@arcgis/core 4.28.0-next.20230720 → 4.28.0-next.20230721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Color.js +1 -1
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/lib/comment-handler.js +1 -1
- package/arcade/lib/parser.js +1 -1
- package/arcade/lib/scanner.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
- package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
- package/assets/esri/core/workers/chunks/{c13b332afdb3f6be1ec9.js → 092fda62b6f62c2e4869.js} +1 -1
- package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
- package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
- package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
- package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
- package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
- package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
- package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
- package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
- package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
- package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
- package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
- package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
- package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
- package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
- package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c026947505a9ff94a53.js → 807742f38885fa90b4fe.js} +1 -1
- package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
- package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
- package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
- package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
- package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
- package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
- package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
- package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
- package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
- package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
- package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
- package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
- package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
- package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
- package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
- package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
- package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
- package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
- package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
- package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
- package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
- package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
- package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
- package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
- package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
- package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
- package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/array.js +1 -1
- package/core/Collection.js +1 -1
- package/core/accessorSupport/decorators/subclass.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/get.js +1 -1
- package/core/accessorSupport/tracking.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/libs/rbush/PooledRBush.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/support/TileClipper.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +7 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/effects/EffectView.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/MultidimensionalSubset.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/TileInfoTilemapCache.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/pamParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/colormaps.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/layers/voxel/VoxelDimension.js +1 -1
- package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/support/generateRendererUtils.js +1 -1
- package/smartMapping/raster/renderers/classBreaks.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectArrow.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/flow/dataUtils.js +1 -1
- package/views/2d/engine/flow/utils.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
- package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
- package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/2d/layers/BaseLayerView2D.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
- package/views/2d/tiling/TileInfoView.js +1 -1
- package/views/2d/tiling/TileInfoViewPOT.js +1 -1
- package/views/2d/tiling/TileQueue.js +1 -1
- package/views/2d/tiling.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TilingScheme.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
- package/views/MapView.js +1 -1
- package/views/animation/pointToPoint/Path.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/webgl/ProgramCache.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
- package/widgets/BuildingExplorer/support/validation.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Histogram/HistogramViewModel.js +1 -1
- package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/colorRampUtils.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Legend/support/utils.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
- package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0210f4c2e1f3ed13041b.js +0 -1
- package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
- package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
- package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
- package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
- package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
- package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
- package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
- package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
- package/assets/esri/core/workers/chunks/4510a17839405146130b.js +0 -1
- package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
- package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
- package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
- package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
- package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
- package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
- package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
- package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
- package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
- package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
- package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
- package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
- package/assets/esri/core/workers/chunks/af4083f2aad5f5d49dde.js +0 -1
- package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
- package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
- package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
- package/assets/esri/core/workers/chunks/d5cce09fbe16cbb8fee4.js +0 -1
- package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
- package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
- package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
- package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
- package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
- package/views/2d/tiling/PagedTileQueue.js +0 -5
package/chunks/array.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{C as o,m as i,a as u,F as a,o as c,g as s,K as l,v as f,A as d,i as h,L as w,j as g}from"./languageUtils.js";import{isPromiseLike as m}from"../core/promiseUtils.js";function F(F){function p(n,o,u){if(n instanceof e)return n.toArray();if(i(n))return n;throw new t(o,r.InvalidParameter,u)}function y(n,t){const r=n.length,e=Math.floor(r/2);return 0===r?[]:1===r?[n[0]]:v(y(n.slice(0,e),t),y(n.slice(e,r),t),t)}function v(n,t,r){const e=[];for(;n.length>0||t.length>0;)if(n.length>0&&t.length>0){let o=r(n[0],t[0]);isNaN(o)&&(o=0),o<=0?(e.push(n[0]),n=n.slice(1)):(e.push(t[0]),t=t.slice(1))}else n.length>0?(e.push(n[0]),n=n.slice(1)):t.length>0&&(e.push(t[0]),t=t.slice(1));return e}async function P(n,t){const r=n.length,e=Math.floor(r/2);if(0===r)return[];if(1===r)return[n[0]];const o=[await P(n.slice(0,e),t),await P(n.slice(e,r),t)];return I(o[0],o[1],t,[])}async function I(n,t,r,e){const o=e;if(!(n.length>0||t.length>0))return e;if(n.length>0&&t.length>0){let i=await r(n[0],t[0]);return isNaN(i)&&(i=1),i<=0?(o.push(n[0]),n=n.slice(1)):(o.push(t[0]),t=t.slice(1)),I(n,t,r,e)}return n.length>0?(o.push(n[0]),I(n=n.slice(1),t,r,e)):t.length>0?(o.push(t[0]),I(n,t=t.slice(1),r,e)):void 0}function O(n,e,u,a){o(u,1,2,n,e);let s=u[0];if(c(s)&&(s=s.toArray()),!1===i(s))throw new t(n,r.InvalidParameter,e);if(u.length>1){if(!1===h(u[1]))throw new t(n,r.InvalidParameter,e);let o=s;const i=u[1].createFunction(n);return a?P(o,i):(o=y(o,((n,t)=>i(n,t))),o)}let l=s;if(0===l.length)return[];const d={};for(let t=0;t<l.length;t++){const n=w(l[t]);""!==n&&(d[n]=!0)}if(!0===d.Array||!0===d.Dictionary||!0===d.Feature||!0===d.Point||!0===d.Polygon||!0===d.Polyline||!0===d.Multipoint||!0===d.Extent||!0===d.Function)return l.slice(0);let m=0,F="";for(const t in d)m++,F=t;return l=m>1||"String"===F?y(l,((n,t)=>{if(null==n||n===f)return null==t||t===f?0:1;if(null==t||t===f)return-1;const r=g(n),e=g(t);return r<e?-1:r===e?0:1})):"Number"===F?y(l,((n,t)=>n-t)):"Boolean"===F?y(l,((n,t)=>n===t?0:t?-1:1)):"Date"===F?y(l,((n,t)=>t-n)):l.slice(0),l}F.functions.array=function(e,f){return F.standardFunction(e,f,((d,h,w)=>{if(o(w,0,2,e,f),0===w.length)return new Array;if(1===w.length&&null===w[0])return new Array;if(i(w[0])){if(2===w.length&&!1===u(w[1]))throw new t(e,r.InvalidParameter,f);return!0===a(w[1],!1)?n(w[0]):w[0].slice(0)}if(c(w[0])){if(2===w.length&&!1===u(w[1]))throw new t(e,r.InvalidParameter,f);return!0===a(w[1],!1)?n(w[0]):w[0].toArray().slice(0)}const g=s(w[0]);if(isNaN(g)||!1===l(g))throw new t(e,r.InvalidParameter,f);const m=a(w[1],null),F=new Array(g);return F.fill(m),F}))},F.functions.front=function(n,e){return F.standardFunction(n,e,((u,a,s)=>{if(o(s,1,1,n,e),c(s[0])){if(s[0].length()<=0)throw new t(n,r.OutOfBounds,e);return s[0].get(0)}if(i(s[0])){if(s[0].length<=0)throw new t(n,r.OutOfBounds,e);return s[0][0]}throw new t(n,r.InvalidParameter,e)}))},F.functions.back=function(n,e){return F.standardFunction(n,e,((u,a,s)=>{if(o(s,1,1,n,e),c(s[0])){if(s[0].length()<=0)throw new t(n,r.OutOfBounds,e);return s[0].get(s[0].length()-1)}if(i(s[0])){if(s[0].length<=0)throw new t(n,r.OutOfBounds,e);return s[0].
|
|
5
|
+
import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{C as o,m as i,a as u,F as a,o as c,g as s,K as l,v as f,A as d,i as h,L as w,j as g}from"./languageUtils.js";import{isPromiseLike as m}from"../core/promiseUtils.js";function F(F){function p(n,o,u){if(n instanceof e)return n.toArray();if(i(n))return n;throw new t(o,r.InvalidParameter,u)}function y(n,t){const r=n.length,e=Math.floor(r/2);return 0===r?[]:1===r?[n[0]]:v(y(n.slice(0,e),t),y(n.slice(e,r),t),t)}function v(n,t,r){const e=[];for(;n.length>0||t.length>0;)if(n.length>0&&t.length>0){let o=r(n[0],t[0]);isNaN(o)&&(o=0),o<=0?(e.push(n[0]),n=n.slice(1)):(e.push(t[0]),t=t.slice(1))}else n.length>0?(e.push(n[0]),n=n.slice(1)):t.length>0&&(e.push(t[0]),t=t.slice(1));return e}async function P(n,t){const r=n.length,e=Math.floor(r/2);if(0===r)return[];if(1===r)return[n[0]];const o=[await P(n.slice(0,e),t),await P(n.slice(e,r),t)];return I(o[0],o[1],t,[])}async function I(n,t,r,e){const o=e;if(!(n.length>0||t.length>0))return e;if(n.length>0&&t.length>0){let i=await r(n[0],t[0]);return isNaN(i)&&(i=1),i<=0?(o.push(n[0]),n=n.slice(1)):(o.push(t[0]),t=t.slice(1)),I(n,t,r,e)}return n.length>0?(o.push(n[0]),I(n=n.slice(1),t,r,e)):t.length>0?(o.push(t[0]),I(n,t=t.slice(1),r,e)):void 0}function O(n,e,u,a){o(u,1,2,n,e);let s=u[0];if(c(s)&&(s=s.toArray()),!1===i(s))throw new t(n,r.InvalidParameter,e);if(u.length>1){if(!1===h(u[1]))throw new t(n,r.InvalidParameter,e);let o=s;const i=u[1].createFunction(n);return a?P(o,i):(o=y(o,((n,t)=>i(n,t))),o)}let l=s;if(0===l.length)return[];const d={};for(let t=0;t<l.length;t++){const n=w(l[t]);""!==n&&(d[n]=!0)}if(!0===d.Array||!0===d.Dictionary||!0===d.Feature||!0===d.Point||!0===d.Polygon||!0===d.Polyline||!0===d.Multipoint||!0===d.Extent||!0===d.Function)return l.slice(0);let m=0,F="";for(const t in d)m++,F=t;return l=m>1||"String"===F?y(l,((n,t)=>{if(null==n||n===f)return null==t||t===f?0:1;if(null==t||t===f)return-1;const r=g(n),e=g(t);return r<e?-1:r===e?0:1})):"Number"===F?y(l,((n,t)=>n-t)):"Boolean"===F?y(l,((n,t)=>n===t?0:t?-1:1)):"Date"===F?y(l,((n,t)=>t-n)):l.slice(0),l}F.functions.array=function(e,f){return F.standardFunction(e,f,((d,h,w)=>{if(o(w,0,2,e,f),0===w.length)return new Array;if(1===w.length&&null===w[0])return new Array;if(i(w[0])){if(2===w.length&&!1===u(w[1]))throw new t(e,r.InvalidParameter,f);return!0===a(w[1],!1)?n(w[0]):w[0].slice(0)}if(c(w[0])){if(2===w.length&&!1===u(w[1]))throw new t(e,r.InvalidParameter,f);return!0===a(w[1],!1)?n(w[0]):w[0].toArray().slice(0)}const g=s(w[0]);if(isNaN(g)||!1===l(g))throw new t(e,r.InvalidParameter,f);const m=a(w[1],null),F=new Array(g);return F.fill(m),F}))},F.functions.front=function(n,e){return F.standardFunction(n,e,((u,a,s)=>{if(o(s,1,1,n,e),c(s[0])){if(s[0].length()<=0)throw new t(n,r.OutOfBounds,e);return s[0].get(0)}if(i(s[0])){if(s[0].length<=0)throw new t(n,r.OutOfBounds,e);return s[0][0]}throw new t(n,r.InvalidParameter,e)}))},F.functions.back=function(n,e){return F.standardFunction(n,e,((u,a,s)=>{if(o(s,1,1,n,e),c(s[0])){if(s[0].length()<=0)throw new t(n,r.OutOfBounds,e);return s[0].get(s[0].length()-1)}if(i(s[0])){if(s[0].length<=0)throw new t(n,r.OutOfBounds,e);return s[0][s[0].length-1]}throw new t(n,r.InvalidParameter,e)}))},F.functions.push=function(n,e){return F.standardFunction(n,e,((u,a,c)=>{if(o(c,1,2,n,e),i(c[0]))return c[0][c[0].length]=c[1],c[0].length;throw new t(n,r.InvalidParameter,e)}))},F.functions.pop=function(n,e){return F.standardFunction(n,e,((u,a,c)=>{if(o(c,1,1,n,e),i(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);const o=c[0][c[0].length-1];return c[0].length=c[0].length-1,o}throw new t(n,r.InvalidParameter,e)}))},F.functions.erase=function(n,e){return F.standardFunction(n,e,((u,a,c)=>{if(o(c,2,2,n,e),i(c[0])){let o=s(c[1]);if(isNaN(o)||!1===l(o))throw new t(n,r.InvalidParameter,e);const i=c[0];if(i.length<=0)throw new t(n,r.OutOfBounds,e);if(o<0&&(o=i.length+o),o<0)throw new t(n,r.OutOfBounds,e);if(o>=i.length)throw new t(n,r.OutOfBounds,e);return i.splice(o,1),f}throw new t(n,r.InvalidParameter,e)}))},F.functions.insert=function(n,e){return F.standardFunction(n,e,((u,a,c)=>{if(o(c,3,3,n,e),i(c[0])){const o=s(c[1]);if(isNaN(o)||!1===l(o))throw new t(n,r.InvalidParameter,e);const i=c[2],u=c[0];if(o>u.length)throw new t(n,r.OutOfBounds,e);if(o<0&&o<-1*u.length)throw new t(n,r.OutOfBounds,e);return o===u.length?(u[o]=i,f):(u.splice(o,0,i),f)}throw new t(n,r.InvalidParameter,e)}))},F.functions.resize=function(n,e){return F.standardFunction(n,e,((u,c,d)=>{if(o(d,2,3,n,e),i(d[0])){const o=s(d[1]);if(isNaN(o)||!1===l(o))throw new t(n,r.InvalidParameter,e);if(o<0)throw new t(n,r.InvalidParameter,e);const i=a(d[2],null),u=d[0];if(u.length>=o)return u.length=o,f;const c=u.length;u.length=o;for(let n=c;n<u.length;n++)u[n]=i;return f}throw new t(n,r.InvalidParameter,e)}))},F.functions.includes=function(n,e){return F.standardFunction(n,e,((u,a,s)=>{if(o(s,2,2,n,e),i(s[0])){const n=s[1];return s[0].findIndex((t=>d(t,n)))>-1}if(c(s[0])){const n=s[1];return s[0].toArray().findIndex((t=>d(t,n)))>-1}throw new t(n,r.InvalidParameter,e)}))},F.functions.slice=function(n,e){return F.standardFunction(n,e,((u,f,d)=>{if(o(d,1,3,n,e),i(d[0])){const o=s(a(d[1],0)),i=s(a(d[2],d[0].length));if(isNaN(o)||!1===l(o))throw new t(n,r.InvalidParameter,e);if(isNaN(i)||!1===l(i))throw new t(n,r.InvalidParameter,e);return d[0].slice(o,i)}if(c(d[0])){const o=d[0],i=s(a(d[1],0)),u=s(a(d[2],o.length()));if(isNaN(i)||!1===l(i))throw new t(n,r.InvalidParameter,e);if(isNaN(u)||!1===l(u))throw new t(n,r.InvalidParameter,e);return o.toArray().slice(i,u)}throw new t(n,r.InvalidParameter,e)}))},F.functions.splice=function(n,t){return F.standardFunction(n,t,((n,t,r)=>{const e=[];for(let o=0;o<r.length;o++)i(r[o])?e.push(...r[o]):c(r[o])?e.push(...r[o].toArray()):e.push(r[o]);return e}))},F.functions.top=function(n,e){return F.standardFunction(n,e,((u,a,l)=>{if(o(l,2,2,n,e),i(l[0]))return s(l[1])>=l[0].length?l[0].slice(0):l[0].slice(0,s(l[1]));if(c(l[0]))return s(l[1])>=l[0].length()?l[0].slice(0):l[0].slice(0,s(l[1]));throw new t(n,r.InvalidParameter,e)}))},F.functions.first=function(n,t){return F.standardFunction(n,t,((r,e,u)=>(o(u,1,1,n,t),i(u[0])?0===u[0].length?null:u[0][0]:c(u[0])?0===u[0].length()?null:u[0].get(0):null)))},"sync"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunction(n,t,((r,e,o)=>O(n,t,o,!1)))},F.functions.any=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,2,n,t);const a=i[1].createFunction(n),c=p(i[0],n,t);for(const n of c){const t=a(n);if(u(t)&&!0===t)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t);for(const n of a){if(!0!==u(n))return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t);for(const n of a){if(!0===u(n))return!1}return!0}))},F.functions.reduce=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,3,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t);return 2===i.length?0===a.length?null:a.reduce(((n,t)=>{const r=u(n,t);return n=void 0!==r&&r!==f?r:null})):a.reduce(((n,t)=>{const r=u(n,t);return n=void 0!==r&&r!==f?r:null}),i[2])}))},F.functions.map=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t),c=[];for(const n of a){const t=u(n);void 0!==t&&t!==f?c.push(t):c.push(null)}return c}))},F.functions.filter=function(n,t){return F.standardFunction(n,t,((r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t),c=[];for(const n of a){!0===u(n)&&c.push(n)}return c}))}),"async"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunctionAsync(n,t,((r,e,o)=>O(n,t,o,!0)))},F.functions.any=function(n,t){return F.standardFunctionAsync(n,t,(async(r,e,i)=>{o(i,2,2,n,t);const a=i[1].createFunction(n),c=p(i[0],n,t);for(const n of c){const t=await a(n);let r=null;if(r=m(r)?await t:t,u(r)&&!0===r)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunctionAsync(n,t,(async(r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t);for(const n of a){const t=await u(n);let r=null;if(r=m(r)?await t:t,!0!==r)return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunctionAsync(n,t,(async(r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t);for(const n of a){const t=await u(n);let r=null;if(r=m(r)?await t:t,!0===r)return!1}return!0}))},F.functions.filter=function(n,t){return F.standardFunctionAsync(n,t,(async(r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t),c=[];for(const n of a){const t=await u(n);let r=null;r=m(r)?await t:t,!0===r&&c.push(n)}return c}))},F.functions.reduce=function(n,t){return F.standardFunctionAsync(n,t,((r,e,i)=>{o(i,2,3,n,t);const u=i[1].createFunction(n),c=p(i[0],n,t);let s=null;if(i.length>2){const n=a(i[2],null);s=c.reduce((async(n,t)=>{let r=await n;return void 0!==r&&r!==f||(r=null),u(r,t)}),Promise.resolve(n))}else{if(0===c.length)return null;s=c.reduce((async(n,t,r)=>{if(r<=1)return u(n,t);let e=await n;return void 0!==e&&e!==f||(e=null),u(e,t)}))}return s.then((n=>void 0!==n&&n!==f?n:null))}))},F.functions.map=function(n,t){return F.standardFunctionAsync(n,t,(async(r,e,i)=>{o(i,2,2,n,t);const u=i[1].createFunction(n),a=p(i[0],n,t),c=[];for(const n of a){const t=await u(n);let r=null;r=m(r)?await t:t,void 0!==r&&r!==f?c.push(r):c.push(null)}return c}))})}const p=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:F},Symbol.toStringTag,{value:"Module"}));export{p as A,F as r};
|
package/core/Collection.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"./ArrayPool.js";import s from"./Evented.js";import{makeHandle as i}from"./handleUtils.js";import{clone as r}from"./lang.js";import n from"./ObjectPool.js";import{ObservableChangesType as h}from"./ObservableChangesType.js";import{schedule as o}from"./scheduling.js";import{ensureType as l,ensureOneOfType as a}from"./accessorSupport/ensureType.js";import{trackAccess as c}from"./accessorSupport/tracking.js";import{property as f}from"./accessorSupport/decorators/property.js";import{shared as _}from"./accessorSupport/decorators/shared.js";import{subclass as m}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as u}from"./accessorSupport/tracking/SimpleObservable.js";var g;class d{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}}class p{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const b=new n(d,void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1}));function v(e){return e?e instanceof R?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function E(e){if(e&&e.length)return e[0]}function C(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function y(e,t,s,i){t&&t.forEach(((t,r,n)=>{e.push(t),y(e,s.call(i,t,r,n),s,i)}))}const A=new Set,O=new Set,M=new Set,D=new Map;let x=0,R=g=class extends s.EventedAccessor{static isCollection(e){return null!=e&&e instanceof g}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new u,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:x++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof g?{items:e}:e:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return c(this._observable),this._items}set items(e){this._emitBeforeChanges(h.ADD)||(this._splice(0,this.length,v(e)),this._emitAfterChanges(h.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),i((()=>{s.removed=!0,e.splice(e.indexOf(s),1)}))}return this._emitter.on(e,t)}once(e,t){return this.on(e,t)}add(e,t){if(c(this._observable),this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(h.ADD),this}addMany(e,t=this._items.length){if(c(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t);return this._splice(s,0,v(e)),this._emitAfterChanges(h.ADD),this}at(e){return c(this._observable),this._items.at(e)}removeAll(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return[];const e=this._removeAllRaw();return this._emitAfterChanges(h.REMOVE),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return c(this._observable),this._createNewInstance({items:this._items.map(r)})}concat(...e){c(this._observable);const t=e.map(v);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(h.REMOVE)}every(e,t){return c(this._observable),this._items.every(e,t)}filter(e,t){let s;return c(this._observable),s=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:s})}find(e,t){return c(this._observable),this._items.find(e,t)}findIndex(e,t){return c(this._observable),this._items.findIndex(e,t)}flatten(e,t){c(this._observable);const s=[];return y(s,this,e,t),new g(s)}forEach(e,t){return c(this._observable),this._items.forEach(e,t)}getItemAt(e){return c(this._observable),this._items[e]}getNextIndex(e){c(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return c(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return c(this._observable),this._items.indexOf(e,t)}join(e=","){return c(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return c(this._observable),this._items.lastIndexOf(e,t)}map(e,t){c(this._observable);const s=this._items.map(e,t);return new g({items:s})}reorder(e,t=this.length-1){c(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(h.MOVE))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(h.MOVE)}return e}}pop(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(this.length-1,1));return this._emitAfterChanges(h.REMOVE),e}push(...e){return c(this._observable),this._emitBeforeChanges(h.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(h.ADD)),this.length}reduce(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return c(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(c(this._observable),e<0||e>=this.length||this._emitBeforeChanges(h.REMOVE))return;const t=E(this._splice(e,1));return this._emitAfterChanges(h.REMOVE),t}removeMany(e){if(c(this._observable),!e||!e.length||this._emitBeforeChanges(h.REMOVE))return[];const t=e instanceof g?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+C(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(h.REMOVE),i}reverse(){if(c(this._observable),this._emitBeforeChanges(h.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(h.MOVE),this}shift(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(0,1));return this._emitAfterChanges(h.REMOVE),e}slice(e=0,t=this.length){return c(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return c(this._observable),this._items.some(e,t)}sort(e){if(c(this._observable),!this.length||this._emitBeforeChanges(h.MOVE))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(h.MOVE),this}splice(e,t,...s){c(this._observable);const i=(t?h.REMOVE:0)|(s.length?h.ADD:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return c(this._observable),this._items.slice()}toJSON(){return c(this._observable),this.toArray()}toLocaleString(){return c(this._observable),this._items.toLocaleString()}toString(){return c(this._observable),this._items.toString()}unshift(...e){return c(this._observable),!e.length||this._emitBeforeChanges(h.ADD)||(this._splice(0,0,e),this._emitAfterChanges(h.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=o((()=>this._dispatchChange()))),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=b.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);b.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=b.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);b.release(e)}}if(s&&s.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=b.acquire();r.target=this,r.cancellable=!0;const o=b.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),o.reset(l),this.emit("after-add",o));b.release(o),b.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._set("length",i.length)}}if((s&&s.length||h&&h.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new p(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=b.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,b.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=b.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),b.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications.at(-1)?.changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;A.clear(),O.clear(),M.clear();for(const{added:t,removed:s}of e){if(t)if(0===M.size&&0===O.size)for(const e of t)A.add(e);else for(const e of t)O.has(e)?(M.add(e),O.delete(e)):M.has(e)||A.add(e);if(s)if(0===M.size&&0===A.size)for(const e of s)O.add(e);else for(const e of s)A.has(e)?A.delete(e):(M.delete(e),O.add(e))}const i=t.acquire();A.forEach((e=>{i.push(e)}));const r=t.acquire();O.forEach((e=>{r.push(e)}));const n=this._items,h=s.items,o=t.acquire();if(M.forEach((e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)})),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}A.clear(),O.clear(),M.clear()}};R.ofType=t=>{if(!t)return g;if(D.has(t))return D.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends g{};return e([_({Type:t,ensureType:"function"==typeof t?l(t):a(t)})],i.prototype,"itemType",void 0),i=e([m(`esri.core.Collection<${s}>`)],i),D.set(t,i),i},e([f()],R.prototype,"length",void 0),e([f()],R.prototype,"items",null),R=g=e([m("esri.core.Collection")],R);const V=R;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"./ArrayPool.js";import s from"./Evented.js";import{makeHandle as i}from"./handleUtils.js";import{clone as r}from"./lang.js";import n from"./ObjectPool.js";import{ObservableChangesType as h}from"./ObservableChangesType.js";import{schedule as o}from"./scheduling.js";import{ensureType as l,ensureOneOfType as a}from"./accessorSupport/ensureType.js";import{trackAccess as c}from"./accessorSupport/tracking.js";import{property as f}from"./accessorSupport/decorators/property.js";import{shared as _}from"./accessorSupport/decorators/shared.js";import{subclass as m}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as u}from"./accessorSupport/tracking/SimpleObservable.js";var g;class d{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}}class p{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const b=new n(d,void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1}));function v(e){return e?e instanceof R?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function E(e){if(e&&e.length)return e[0]}function C(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function y(e,t,s,i){t&&t.forEach(((t,r,n)=>{e.push(t),y(e,s.call(i,t,r,n),s,i)}))}const A=new Set,O=new Set,M=new Set,D=new Map;let x=0,R=g=class extends s.EventedAccessor{static isCollection(e){return null!=e&&e instanceof g}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new u,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:x++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof g?{items:e}:e:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return c(this._observable),this._items}set items(e){this._emitBeforeChanges(h.ADD)||(this._splice(0,this.length,v(e)),this._emitAfterChanges(h.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),i((()=>{s.removed=!0,e.splice(e.indexOf(s),1)}))}return this._emitter.on(e,t)}once(e,t){return this.on(e,t)}add(e,t){if(c(this._observable),this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(h.ADD),this}addMany(e,t=this._items.length){if(c(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t);return this._splice(s,0,v(e)),this._emitAfterChanges(h.ADD),this}at(e){if(c(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return[];const e=this._removeAllRaw();return this._emitAfterChanges(h.REMOVE),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return c(this._observable),this._createNewInstance({items:this._items.map(r)})}concat(...e){c(this._observable);const t=e.map(v);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(h.REMOVE)}every(e,t){return c(this._observable),this._items.every(e,t)}filter(e,t){let s;return c(this._observable),s=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:s})}find(e,t){return c(this._observable),this._items.find(e,t)}findIndex(e,t){return c(this._observable),this._items.findIndex(e,t)}flatten(e,t){c(this._observable);const s=[];return y(s,this,e,t),new g(s)}forEach(e,t){return c(this._observable),this._items.forEach(e,t)}getItemAt(e){return c(this._observable),this._items[e]}getNextIndex(e){c(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return c(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return c(this._observable),this._items.indexOf(e,t)}join(e=","){return c(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return c(this._observable),this._items.lastIndexOf(e,t)}map(e,t){c(this._observable);const s=this._items.map(e,t);return new g({items:s})}reorder(e,t=this.length-1){c(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(h.MOVE))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(h.MOVE)}return e}}pop(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(this.length-1,1));return this._emitAfterChanges(h.REMOVE),e}push(...e){return c(this._observable),this._emitBeforeChanges(h.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(h.ADD)),this.length}reduce(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return c(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(c(this._observable),e<0||e>=this.length||this._emitBeforeChanges(h.REMOVE))return;const t=E(this._splice(e,1));return this._emitAfterChanges(h.REMOVE),t}removeMany(e){if(c(this._observable),!e||!e.length||this._emitBeforeChanges(h.REMOVE))return[];const t=e instanceof g?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+C(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(h.REMOVE),i}reverse(){if(c(this._observable),this._emitBeforeChanges(h.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(h.MOVE),this}shift(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(0,1));return this._emitAfterChanges(h.REMOVE),e}slice(e=0,t=this.length){return c(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return c(this._observable),this._items.some(e,t)}sort(e){if(c(this._observable),!this.length||this._emitBeforeChanges(h.MOVE))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(h.MOVE),this}splice(e,t,...s){c(this._observable);const i=(t?h.REMOVE:0)|(s.length?h.ADD:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return c(this._observable),this._items.slice()}toJSON(){return c(this._observable),this.toArray()}toLocaleString(){return c(this._observable),this._items.toLocaleString()}toString(){return c(this._observable),this._items.toString()}unshift(...e){return c(this._observable),!e.length||this._emitBeforeChanges(h.ADD)||(this._splice(0,0,e),this._emitAfterChanges(h.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=o((()=>this._dispatchChange()))),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=b.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);b.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=b.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);b.release(e)}}if(s&&s.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=b.acquire();r.target=this,r.cancellable=!0;const o=b.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),o.reset(l),this.emit("after-add",o));b.release(o),b.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._set("length",i.length)}}if((s&&s.length||h&&h.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new p(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=b.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,b.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=b.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),b.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;A.clear(),O.clear(),M.clear();for(const{added:t,removed:s}of e){if(t)if(0===M.size&&0===O.size)for(const e of t)A.add(e);else for(const e of t)O.has(e)?(M.add(e),O.delete(e)):M.has(e)||A.add(e);if(s)if(0===M.size&&0===A.size)for(const e of s)O.add(e);else for(const e of s)A.has(e)?A.delete(e):(M.delete(e),O.add(e))}const i=t.acquire();A.forEach((e=>{i.push(e)}));const r=t.acquire();O.forEach((e=>{r.push(e)}));const n=this._items,h=s.items,o=t.acquire();if(M.forEach((e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)})),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}A.clear(),O.clear(),M.clear()}};R.ofType=t=>{if(!t)return g;if(D.has(t))return D.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends g{};return e([_({Type:t,ensureType:"function"==typeof t?l(t):a(t)})],i.prototype,"itemType",void 0),i=e([m(`esri.core.Collection<${s}>`)],i),D.set(t,i),i},e([f()],R.prototype,"length",void 0),e([f()],R.prototype,"items",null),R=g=e([m("esri.core.Collection")],R);const V=R;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../has.js";import{BEFORE_DESTROY_SYMBOL as e}from"../beforeDestroy.js";import{Lifecycle as t}from"../interfaces.js";import{getPropertiesMetadata as r}from"../metadata.js";import{trackAccess as o}from"../tracking.js";import{processPrototypePropertyMetadata as s}from"../extensions/serializableProperty.js";const i=new Set,n=new Set;function c(t){return o=>{t??="esri.core.Accessor",o.prototype.declaredClass=t,l(o);const s=[],c=[];let a=o.prototype;for(;a;)a.hasOwnProperty("initialize")&&!i.has(a.initialize)&&(i.add(a.initialize),s.push(a.initialize)),a.hasOwnProperty("destroy")&&!n.has(a.destroy)&&(n.add(a.destroy),c.push(a.destroy)),a=Object.getPrototypeOf(a);i.clear(),n.clear();const p=class extends o{constructor(...t){if(super(...t),this.constructor===p&&"function"==typeof this.postscript){if(s.length&&Object.defineProperty(this,"initialize",{enumerable:!1,configurable:!0,value(){for(let e=s.length-1;e>=0;e--)s[e].call(this)}}),c.length){let t=!1;const r=this[e];Object.defineProperty(this,"destroy",{enumerable:!1,configurable:!0,value(){if(!t){t=!0,r.call(this);for(let e=0;e<c.length;e++)c[e].call(this)}}})}this.postscript(...t)}}};p.__accessorMetadata__=r(o.prototype),p.prototype.declaredClass=t;const f=(t||"AccessorSubclass").split(".").
|
|
5
|
+
import"../../has.js";import{BEFORE_DESTROY_SYMBOL as e}from"../beforeDestroy.js";import{Lifecycle as t}from"../interfaces.js";import{getPropertiesMetadata as r}from"../metadata.js";import{trackAccess as o}from"../tracking.js";import{processPrototypePropertyMetadata as s}from"../extensions/serializableProperty.js";const i=new Set,n=new Set;function c(t){return o=>{t??="esri.core.Accessor",o.prototype.declaredClass=t,l(o);const s=[],c=[];let a=o.prototype;for(;a;)a.hasOwnProperty("initialize")&&!i.has(a.initialize)&&(i.add(a.initialize),s.push(a.initialize)),a.hasOwnProperty("destroy")&&!n.has(a.destroy)&&(n.add(a.destroy),c.push(a.destroy)),a=Object.getPrototypeOf(a);i.clear(),n.clear();const p=class extends o{constructor(...t){if(super(...t),this.constructor===p&&"function"==typeof this.postscript){if(s.length&&Object.defineProperty(this,"initialize",{enumerable:!1,configurable:!0,value(){for(let e=s.length-1;e>=0;e--)s[e].call(this)}}),c.length){let t=!1;const r=this[e];Object.defineProperty(this,"destroy",{enumerable:!1,configurable:!0,value(){if(!t){t=!0,r.call(this);for(let e=0;e<c.length;e++)c[e].call(this)}}})}this.postscript(...t)}}};p.__accessorMetadata__=r(o.prototype),p.prototype.declaredClass=t;const f=(t||"AccessorSubclass").split(".").slice(-1)[0];return Object.defineProperty(p,"name",{value:f,configurable:!0}),p}}function a(e,t){return null==t.get?function(){const t=this.__accessor__,r=t.propertiesByName.get(e);if(void 0===r)return;o(r.observerObject);const s=t.store;return s.has(e)?s.get(e):r.metadata.value}:function(){const t=this.__accessor__,r=t.propertiesByName.get(e);if(void 0!==r)return r.getComputed(t)}}function l(e){const o=e.prototype,i=r(o),n={};for(const r of Object.getOwnPropertyNames(i)){const e=i[r];s(e),n[r]={enumerable:!0,configurable:!0,get:a(r,e),set(o){const s=this.__accessor__;if(void 0!==s){if(!Object.isFrozen(this)){if(s.initialized&&e.readOnly)throw new TypeError(`[accessor] cannot assign to read-only property '${r}' of ${this.declaredClass}`);if(s.lifecycle===t.CONSTRUCTED&&e.constructOnly)throw new TypeError(`[accessor] cannot assign to construct-only property '${r}' of ${this.declaredClass}`);s.set(r,o)}}else Object.defineProperty(this,r,{enumerable:!0,configurable:!0,writable:!0,value:o})}}}Object.defineProperties(e.prototype,n)}export{l as finalizeClass,c as subclass};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function c(e,n){return null!=n&&e&&!(n instanceof e)}function l(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!l(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:l(e)?p(e,n):c(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const h=new WeakMap;function m(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(h,e,(()=>v.bind(null,e)))}}function d(e,n){const r=m(e);return 1===arguments.length?r:r(n)}function b(e,n,r){return 1===arguments.length?b.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?b((n=>d(e,n))):b((n=>d(e,n)),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return r=>$(e,n,r);if(!r)return r;r=A(e,n,r);let t=n,o=r;for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$((n=>d(e,n)),n):$((n=>d(e,n)),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,l="string"===i||"number"===i;return l&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!c(e,n)))?e:(l&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=d(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,l="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!c(e.base,n))return n;if(null==n)return n;const o=l(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!c(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return d(e.value);case"array":return b(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,-1)} or ${n.
|
|
5
|
+
import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function c(e,n){return null!=n&&e&&!(n instanceof e)}function l(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!l(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:l(e)?p(e,n):c(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const h=new WeakMap;function m(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(h,e,(()=>v.bind(null,e)))}}function d(e,n){const r=m(e);return 1===arguments.length?r:r(n)}function b(e,n,r){return 1===arguments.length?b.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?b((n=>d(e,n))):b((n=>d(e,n)),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return r=>$(e,n,r);if(!r)return r;r=A(e,n,r);let t=n,o=r;for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$((n=>d(e,n)),n):$((n=>d(e,n)),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,l="string"===i||"number"===i;return l&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!c(e,n)))?e:(l&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=d(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,l="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!c(e.base,n))return n;if(null==n)return n;const o=l(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!c(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return d(e.value);case"array":return b(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,-1)} or ${n[n.length-1]}`}}return"unknown"}function F(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case T:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!F(e,n.value)));case"one-of":return n.values.some((n=>F(e,n)))}}export{T as Integer,w as ensureArray,b as ensureArrayTyped,o as ensureBoolean,v as ensureClass,t as ensureDate,s as ensureInteger,B as ensureLongFormType,j as ensureNArray,$ as ensureNArrayTyped,a as ensureNumber,M as ensureOneOf,S as ensureOneOfType,u as ensureString,d as ensureType,i as isClassedType,_ as isLongFormType,k as isOneOf,c as requiresType,N as types};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pathToArray as t,getProperties as n,isPropertyDeclared as r}from"./utils.js";function
|
|
5
|
+
import{pathToArray as t,getProperties as n,isPropertyDeclared as r}from"./utils.js";function e(t,e){const i="?"===t[t.length-1]?t.slice(0,-1):t;if(null!=e.getItemAt||Array.isArray(e)){const t=parseInt(i,10);if(!isNaN(t))return Array.isArray(e)?e[t]:e.at(t)}const u=n(e);return r(u,i)?u.get(i):e[i]}function i(t,n,r){if(null==t)return t;const u=e(n[r],t);return!u&&r<n.length-1?void 0:r===n.length-1?u:i(u,n,r+1)}function u(n,r,u=0){return"string"!=typeof r||r.includes(".")?i(n,t(r),u):e(r,n)}function o(t,n){return u(t,n)}function s(t,n){return void 0!==u(n,t)}export{s as exists,o as get,u as valueOf};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../has.js";import t from"../Logger.js";import{pathToArray as n,getProperties as e}from"./utils.js";import{Flags as r}from"./tracking/Flags.js";const o={onObservableAccessed:()=>{},onTrackingEnd:()=>{}},c=[];let s=o;function i(t){s.onObservableAccessed(t)}let
|
|
5
|
+
import"../has.js";import t from"../Logger.js";import{pathToArray as n,getProperties as e}from"./utils.js";import{Flags as r}from"./tracking/Flags.js";const o={onObservableAccessed:()=>{},onTrackingEnd:()=>{}},c=[];let s=o;function i(t){s.onObservableAccessed(t)}let l=!1,a=!1;function f(t,n,e){if(l)return u(t,n,e);p(t);const r=n.call(e);return d(),r}function g(t,n){return f(o,t,n)}function u(n,e,r){const o=l;l=!0,p(n);let c=null;try{c=e.call(r)}catch(s){a&&t.getLogger("esri.core.accessorSupport.tracking").error(s)}return d(),l=o,c}function p(t){s=t,c.push(t)}function d(){const t=c.length;if(t>1){const n=c.pop();s=c[t-2],n.onTrackingEnd()}else if(1===t){const t=c.pop();s=o,t.onTrackingEnd()}else s=o}function b(t,n){const e=n.observerObject;if(e.flags&r.DepTrackingInitialized)return;const o=a;a=!1,e.flags&r.AutoTracked?u(n,n.metadata.get,t):y(t,n),a=o}const m=[];function y(t,e){const o=e.observerObject;o.flags&r.ExplicitlyTracking||(o.flags|=r.ExplicitlyTracking,u(e,(()=>{const r=e.metadata.dependsOn||m;for(const e of r)if("string"!=typeof e||e.includes(".")){const r=n(e);for(let n=0,e=t;n<r.length&&null!=e&&"object"==typeof e;++n)e=k(e,r[n],n!==r.length-1)}else k(t,e,!1)})),o.flags&=~r.ExplicitlyTracking)}function k(t,n,r){const o="?"===n[n.length-1]?n.slice(0,-1):n;if(null!=t.getItemAt||Array.isArray(t)){const n=parseInt(o,10);if(!isNaN(n))return Array.isArray(t)?t[n]:t.at(n)}const c=e(t);if(c){const n=c.propertiesByName.get(o);n&&(i(n.observerObject),b(t,n))}return r?t[o]:void 0}export{b as initializeDependencyTracking,f as runTracked,u as runTrackedNoThrow,g as runUntracked,i as trackAccess,y as trackExplicitDependencies};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as r}from"../handleUtils.js";import{clone as n}from"../lang.js";function t(r){return r.__accessor__??null}function e(r,n){return null!=r&&r.metadatas&&null!=r.metadatas[n]}function i(r,n){const e=t(r);return e?e.getDependsInfo(r,n,""):""}function u(r,n,t){if(t){return
|
|
5
|
+
import{handlesGroup as r}from"../handleUtils.js";import{clone as n}from"../lang.js";function t(r){return r.__accessor__??null}function e(r,n){return null!=r&&r.metadatas&&null!=r.metadatas[n]}function i(r,n){const e=t(r);return e?e.getDependsInfo(r,n,""):""}function u(r,n,t){if(t){return o(r,n,{policy:t,path:""})}return o(r,n,null)}function o(r,t,e){return t?Object.keys(t).reduce(((r,i)=>{const u=i;let a=null,l="merge";if(e&&(a=e.path?`${e.path}.${i}`:i,l=e.policy(a)),"replace"===l)return r[u]=t[u],r;if("replace-arrays"===l&&Array.isArray(r[u]))return r[u]=t[u],r;if(void 0===r[u])return r[u]=n(t[u]),r;let s=r[u],c=t[u];if(s===c)return r;if(Array.isArray(c)||Array.isArray(r))s=s?Array.isArray(s)?r[u]=s.concat():r[u]=[s]:r[u]=[],c&&(Array.isArray(c)||(c=[c]),c.forEach((r=>{s.includes(r)||s.push(r)})));else if(c&&"object"==typeof c)if(e){const n=e.path;e.path=a,r[u]=o(s,c,e),e.path=n}else r[u]=o(s,c,null);else r.hasOwnProperty(i)&&!t.hasOwnProperty(i)||(r[u]=c);return r}),r||{}):r}function a(r){return r&&("string"!=typeof r||r.includes("."))?l(r):r}function l(r){return Array.isArray(r)?r:r.split(".")}function s(r){return r.includes(",")?r.split(",").map((r=>r.trim())):[r.trim()]}function c(r){if(Array.isArray(r)){const n=[];for(const t of r)n.push(...s(t));return n}return s(r)}function f(r){if(!r.includes("?"))return null;const n=l(r),t=new Array(n.length);for(let e=0;e<n.length;e++){const r=n[e];t[e]="?"===r[r.length-1],t[e]&&(n[e]=r.slice(0,-1))}return{fullPath:n.join("."),conditional:t}}function p(n,t,e,i){const u=c(t);if(1!==u.length){const t=u.map((r=>i(n,r,e)));return r(t)}return i(n,u[0],e)}export{i as getDependsInfo,t as getProperties,e as isPropertyDeclared,u as merge,p as parse,f as parseConditionalPath,l as pathToArray,a as pathToStringOrArray,c as splitPath};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{indexOf as t,PositionHint as i}from"../../arrayUtils.js";import n from"../../PooledArray.js";import{q as e}from"../../../chunks/quickselect.js";class s{constructor(t=9,i){this._compareMinX=o,this._compareMinY=l,this._toBBox=t=>t,this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),i&&("function"==typeof i?this._toBBox=i:this._initFormat(i)),this.clear()}destroy(){this.clear(),p.prune(),g.prune(),M.prune(),X.prune()}all(t){this._all(this._data,t)}search(t,i){let n=this._data;const e=this._toBBox;if(x(t,n))for(p.clear();n;){for(let s=0,h=n.children.length;s<h;s++){const h=n.children[s],a=n.leaf?e(h):h;x(t,a)&&(n.leaf?i(h):_(t,a)?this._all(h,i):p.push(h))}n=p.pop()}}collides(t){let i=this._data;const n=this._toBBox;if(!x(t,i))return!1;for(p.clear();i;){for(let e=0,s=i.children.length;e<s;e++){const s=i.children[e],h=i.leaf?n(s):s;if(x(t,h)){if(i.leaf||_(t,h))return!0;p.push(s)}}i=p.pop()}return!1}load(t){if(!t.length)return this;if(t.length<this._minEntries){for(let i=0,n=t.length;i<n;i++)this.insert(t[i]);return this}let i=this._build(t.slice(0,t.length),0,t.length-1,0);if(this._data.children.length)if(this._data.height===i.height)this._splitRoot(this._data,i);else{if(this._data.height<i.height){const t=this._data;this._data=i,i=t}this._insert(i,this._data.height-i.height-1,!0)}else this._data=i;return this}insert(t){return t&&this._insert(t,this._data.height-1),this}clear(){return this._data=new w([]),this}remove(i){if(!i)return this;let n,e
|
|
5
|
+
import{indexOf as t,PositionHint as i}from"../../arrayUtils.js";import n from"../../PooledArray.js";import{q as e}from"../../../chunks/quickselect.js";class s{constructor(t=9,i){this._compareMinX=o,this._compareMinY=l,this._toBBox=t=>t,this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),i&&("function"==typeof i?this._toBBox=i:this._initFormat(i)),this.clear()}destroy(){this.clear(),p.prune(),g.prune(),M.prune(),X.prune()}all(t){this._all(this._data,t)}search(t,i){let n=this._data;const e=this._toBBox;if(x(t,n))for(p.clear();n;){for(let s=0,h=n.children.length;s<h;s++){const h=n.children[s],a=n.leaf?e(h):h;x(t,a)&&(n.leaf?i(h):_(t,a)?this._all(h,i):p.push(h))}n=p.pop()}}collides(t){let i=this._data;const n=this._toBBox;if(!x(t,i))return!1;for(p.clear();i;){for(let e=0,s=i.children.length;e<s;e++){const s=i.children[e],h=i.leaf?n(s):s;if(x(t,h)){if(i.leaf||_(t,h))return!0;p.push(s)}}i=p.pop()}return!1}load(t){if(!t.length)return this;if(t.length<this._minEntries){for(let i=0,n=t.length;i<n;i++)this.insert(t[i]);return this}let i=this._build(t.slice(0,t.length),0,t.length-1,0);if(this._data.children.length)if(this._data.height===i.height)this._splitRoot(this._data,i);else{if(this._data.height<i.height){const t=this._data;this._data=i,i=t}this._insert(i,this._data.height-i.height-1,!0)}else this._data=i;return this}insert(t){return t&&this._insert(t,this._data.height-1),this}clear(){return this._data=new w([]),this}remove(i){if(!i)return this;let n,e=this._data,s=null,h=0,a=!1;const r=this._toBBox(i);for(M.clear(),X.clear();e||M.length>0;){if(e||(e=M.pop(),s=M.data[M.length-1],h=X.pop()??0,a=!0),e.leaf&&(n=t(e.children,i,e.children.length,e.indexHint),-1!==n))return e.children.splice(n,1),M.push(e),this._condense(M),this;a||e.leaf||!_(e,r)?s?(h++,e=s.children[h],a=!1):e=null:(M.push(e),X.push(h),h=0,s=e,e=e.children[0])}return this}toJSON(){return this._data}fromJSON(t){return this._data=t,this}_all(t,i){let n=t;for(g.clear();n;){if(!0===n.leaf)for(const t of n.children)i(t);else g.pushArray(n.children);n=g.pop()??null}}_build(t,i,n,e){const s=n-i+1;let a=this._maxEntries;if(s<=a){const e=new w(t.slice(i,n+1));return h(e,this._toBBox),e}e||(e=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/a**(e-1)));const r=new b([]);r.height=e;const o=Math.ceil(s/a),l=o*Math.ceil(Math.sqrt(a));f(t,i,n,l,this._compareMinX);for(let h=i;h<=n;h+=l){const i=Math.min(h+l-1,n);f(t,h,i,o,this._compareMinY);for(let n=h;n<=i;n+=o){const s=Math.min(n+o-1,i);r.children.push(this._build(t,n,s,e-1))}}return h(r,this._toBBox),r}_chooseSubtree(t,i,n,e){for(;e.push(i),!0!==i.leaf&&e.length-1!==n;){let n,e=1/0,s=1/0;for(let h=0,a=i.children.length;h<a;h++){const a=i.children[h],r=c(a),o=d(t,a)-r;o<s?(s=o,e=r<e?r:e,n=a):o===s&&r<e&&(e=r,n=a)}i=n||i.children[0]}return i}_insert(t,i,n){const e=this._toBBox,s=n?t:e(t);M.clear();const h=this._chooseSubtree(s,this._data,i,M);for(h.children.push(t),r(h,s);i>=0&&M.data[i].children.length>this._maxEntries;)this._split(M,i),i--;this._adjustParentBBoxes(s,M,i)}_split(t,i){const n=t.data[i],e=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,e);const a=this._chooseSplitIndex(n,s,e);if(!a)return void console.log(" Error: assertion failed at PooledRBush._split: no valid split index");const r=n.children.splice(a,n.children.length-a),o=n.leaf?new w(r):new b(r);o.height=n.height,h(n,this._toBBox),h(o,this._toBBox),i?t.data[i-1].children.push(o):this._splitRoot(n,o)}_splitRoot(t,i){this._data=new b([t,i]),this._data.height=t.height+1,h(this._data,this._toBBox)}_chooseSplitIndex(t,i,n){let e,s,h;e=s=1/0;for(let r=i;r<=n-i;r++){const i=a(t,0,r,this._toBBox),o=a(t,r,n,this._toBBox),l=u(i,o),m=c(i)+c(o);l<e?(e=l,h=r,s=m<s?m:s):l===e&&m<s&&(s=m,h=r)}return h}_chooseSplitAxis(t,i,n){const e=t.leaf?this._compareMinX:o,s=t.leaf?this._compareMinY:l;this._allDistMargin(t,i,n,e)<this._allDistMargin(t,i,n,s)&&t.children.sort(e)}_allDistMargin(t,i,n,e){t.children.sort(e);const s=this._toBBox,h=a(t,0,i,s),o=a(t,n-i,n,s);let l=m(h)+m(o);for(let a=i;a<n-i;a++){const i=t.children[a];r(h,t.leaf?s(i):i),l+=m(h)}for(let a=n-i-1;a>=i;a--){const i=t.children[a];r(o,t.leaf?s(i):i),l+=m(o)}return l}_adjustParentBBoxes(t,i,n){for(let e=n;e>=0;e--)r(i.data[e],t)}_condense(i){for(let n=i.length-1;n>=0;n--){const e=i.data[n];if(0===e.children.length)if(n>0){const s=i.data[n-1],h=s.children;h.splice(t(h,e,h.length,s.indexHint),1)}else this.clear();else h(e,this._toBBox)}}_initFormat(t){const i=["return a"," - b",";"];this._compareMinX=new Function("a","b",i.join(t[0])),this._compareMinY=new Function("a","b",i.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 h(t,i){a(t,0,t.children.length,i,t)}function a(t,i,n,e,s){s||(s=new w([])),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let h,a=i;a<n;a++)h=t.children[a],r(s,t.leaf?e(h):h);return s}function r(t,i){t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY)}function o(t,i){return t.minX-i.minX}function l(t,i){return t.minY-i.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function m(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(t,i){return(Math.max(i.maxX,t.maxX)-Math.min(i.minX,t.minX))*(Math.max(i.maxY,t.maxY)-Math.min(i.minY,t.minY))}function u(t,i){const n=Math.max(t.minX,i.minX),e=Math.max(t.minY,i.minY),s=Math.min(t.maxX,i.maxX),h=Math.min(t.maxY,i.maxY);return Math.max(0,s-n)*Math.max(0,h-e)}function _(t,i){return t.minX<=i.minX&&t.minY<=i.minY&&i.maxX<=t.maxX&&i.maxY<=t.maxY}function x(t,i){return i.minX<=t.maxX&&i.minY<=t.maxY&&i.maxX>=t.minX&&i.maxY>=t.minY}function f(t,i,n,s,h){const a=[i,n];for(;a.length;){const i=a.pop(),n=a.pop();if(i-n<=s)continue;const r=n+Math.ceil((i-n)/s/2)*s;e(t,r,n,i,h),a.push(n,r,r,i)}}const p=new n,g=new n,M=new n,X=new n({deallocator:void 0});class Y{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}class B extends Y{constructor(){super(...arguments),this.height=1,this.indexHint=new i}}class w extends B{constructor(t){super(),this.children=t,this.leaf=!0}}class b extends B{constructor(t){super(),this.children=t,this.leaf=!1}}export{Y as BBox,s as PooledRBush};
|
package/core/urlUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../config.js";import{isSome as n}from"./arrayUtils.js";import e from"./Error.js";import{isSerializable as r}from"./JSONSupport.js";import o from"./Logger.js";import{parseKnownArcGISOnlineDomain as s}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as i,arrayBufferToBase64 as u}from"../support/base64Utils.js";const l=o.getLogger("esri.core.urlUtils"),c=t.request,f="esri/config: esriConfig.request.proxyUrl is not set.",a=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,p=/^\s*http:/i,h=/^\s*https:/i,d=/^\s*file:/i,m=/:\d+$/,y=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,g=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),$=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class x{constructor(t=""){this.uri=t,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let n=this.uri.match(g);this.scheme=n[2]||(n[1]?"":null),this.authority=n[4]||(n[3]?"":null),this.path=n[5],this.query=n[7]||(n[6]?"":null),this.fragment=n[9]||(n[8]?"":null),null!=this.authority&&(n=this.authority.match($),this.user=n[3]||null,this.password=n[4]||null,this.host=n[6]||n[7],this.port=n[9]||null)}toString(){return this.uri}}const w={},O=new x(t.applicationUrl);let U=O;const R=j();let b=R;const C=()=>U,q=()=>b;function j(){const t=U.path,n=t.substring(0,t.lastIndexOf(t.split("/").at(-1)));return`${`${U.scheme}://${U.host}${null!=U.port?`:${U.port}`:""}`}${n}`}const L={setAppUrl:t=>U=t,setAppBaseUrl:t=>b=t,restoreUrls:()=>{U=O,b=R}};function I(t){if(!t)return null;const n={path:null,query:null},e=new x(t),r=t.indexOf("?");return null===e.query?n.path=t:(n.path=t.substring(0,r),n.query=A(e.query)),e.fragment&&(n.hash=e.fragment,null===e.query&&(n.path=n.path.substring(0,n.path.length-(e.fragment.length+1)))),n}function A(t){const n=t.split("&"),e={};for(const r of n){if(!r)continue;const t=r.indexOf("=");let n,o;t<0?(n=decodeURIComponent(r),o=""):(n=decodeURIComponent(r.slice(0,t)),o=decodeURIComponent(r.slice(t+1)));let s=e[n];"string"==typeof s&&(s=e[n]=[s]),Array.isArray(s)?s.push(o):e[n]=o}return e}function v(t,n){return t?n&&"function"==typeof n?Object.keys(t).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(n(e,t[e])))).join("&"):Object.keys(t).map((e=>{const o=t[e];if(null==o)return"";const s=encodeURIComponent(e)+"=",i=n&&n[e];return i?s+encodeURIComponent(i(o)):Array.isArray(o)?o.map((t=>r(t)?s+encodeURIComponent(JSON.stringify(t)):s+encodeURIComponent(t))).join("&"):r(o)?s+encodeURIComponent(JSON.stringify(o)):s+encodeURIComponent(o)})).filter((t=>t)).join("&"):""}function P(t=!1){let n,r=c.proxyUrl;if("string"==typeof t){n=dt(t);const e=T(t);e&&(r=e.proxyUrl)}else n=!!t;if(!r)throw l.warn(f),new e("urlutils:proxy-not-set",f);n&&wt()&&(r=$t(r));return I(r)}function S(t){const n=T(t);let e,r;if(n){const t=E(n.proxyUrl);e=t.path,r=t.query?A(t.query):null}if(e){const n=I(t);t=e+"?"+n.path;const o=v({...r,...n.query});o&&(t=`${t}?${o}`)}return t}const k={path:"",query:""};function E(t){const n=t.indexOf("?");return-1!==n?(k.path=t.slice(0,n),k.query=t.slice(n+1)):(k.path=t,k.query=null),k}function B(t){return t=(t=Ot(t=Ct(t=E(t).path),!0)).toLowerCase()}function H(t){const n={proxyUrl:t.proxyUrl,urlPrefix:B(t.urlPrefix)},e=c.proxyRules,r=n.urlPrefix;let o=e.length;for(let s=0;s<e.length;s++){const t=e[s].urlPrefix;if(0===r.indexOf(t)){if(r.length===t.length)return-1;o=s;break}0===t.indexOf(r)&&(o=s+1)}return e.splice(o,0,n),o}function T(t){const n=c.proxyRules,e=B(t);for(let r=0;r<n.length;r++)if(0===e.indexOf(n[r].urlPrefix))return n[r]}function W(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r?e.portalHostname===r.portalHostname:null==e&&null==r&&F(t,n,!0)}function J(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r&&e.portalHostname===r.portalHostname}function N(t,n){return t=z(t),n=z(n),Ot(t)===Ot(n)}function z(t){const n=(t=K(t)).indexOf("/sharing");return n>0?t.substring(0,n):t.replace(/\/+$/,"")}function D(t){const n=n=>null==n||n instanceof RegExp&&n.test(t)||"string"==typeof n&&t.startsWith(n),e=c.interceptors;if(e)for(const r of e)if(Array.isArray(r.urls)){if(r.urls.some(n))return r}else if(n(r.urls))return r;return null}function F(t,n,e=!1){if(!t||!n)return!1;const r=vt(t),o=vt(n);return!(!e&&r.scheme!==o.scheme)&&(null!=r.host&&null!=o.host&&(r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port))}function M(t){if("string"==typeof t){if(!Y(t))return!0;t=vt(t)}if(F(t,U))return!0;const n=c.trustedServers||[];for(let e=0;e<n.length;e++){const r=Q(n[e]);for(let n=0;n<r.length;n++)if(F(t,r[n]))return!0}return!1}function Q(t){return w[t]||(ht(t)||pt(t)?w[t]=[new x(_(t))]:w[t]=[new x(`http://${t}`),new x(`https://${t}`)]),w[t]}function _(t,n=b,e){return pt(t)?e&&e.preserveProtocolRelative?t:"http"===U.scheme&&U.authority===X(t).slice(2)?`http:${t}`:`https:${t}`:ht(t)?t:V("/"===t[0]?Ut(n):n,t)}function G(t,n=b,e){if(null==t||!Y(t))return t;const r=K(t),o=r.toLowerCase(),s=K(n).toLowerCase().replace(/\/+$/,""),i=e?K(e).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return t;const u=(t,n,e)=>-1===(e=t.indexOf(n,e))?t.length:e;let l=u(o,"/",o.indexOf("//")+2),c=-1;for(;o.slice(0,l+1)===s.slice(0,l)+"/"&&(c=l+1,l!==o.length);)l=u(o,"/",l+1);if(-1===c)return t;if(i&&c<i.length)return t;t=r.slice(c);const f=s.slice(c-1).replaceAll(/[^/]+/g,"").length;if(f>0)for(let a=0;a<f;a++)t=`../${t}`;else t=`./${t}`;return t}function K(t){return t=It(t=Lt(t=jt(t=_(t=t.trim()))))}function V(...t){const e=t.filter(n);if(!e||!e.length)return;const r=[];if(Y(e[0])){const t=e[0],n=t.indexOf("//");-1!==n&&(r.push(t.slice(0,n+1)),yt(e[0])&&(r[0]+="/"),e[0]=t.slice(n+2))}else"/"===e[0][0]&&r.push("");const o=e.reduce(((t,n)=>n?t.concat(n.split("/")):t),[]);for(let n=0;n<o.length;n++){const t=o[n];".."===t&&r.length>0&&".."!==r.at(-1)?r.pop():(!t&&n===o.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function X(t,n=!1){if(null==t||Z(t)||tt(t))return null;let e=t.indexOf("://");if(-1===e&&pt(t))e=2;else{if(-1===e)return null;e+=3}const r=t.indexOf("/",e);return-1!==r&&(t=t.slice(0,r)),n&&(t=Ot(t,!0)),t}function Y(t){return pt(t)||ht(t)}function Z(t){return null!=t&&"blob:"===t.slice(0,5)}function tt(t){return null!=t&&"data:"===t.slice(0,5)}function nt(t){const n=ot(t);return n&&n.isBase64?i(n.data):null}function et(t){return u(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const rt=/^data:(.*?)(;base64)?,(.*)$/;function ot(t){const n=t.match(rt);if(!n)return null;const[,e,r,o]=n;return{mediaType:e,isBase64:!!r,data:o}}function st(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}async function it(t){return(await fetch(t)).blob()}function ut(t){const n=nt(t);if(!n)return null;const e=ot(t);return new Blob([n],{type:e.mediaType})}function lt(t,n){ft(t,n)}function ct(t,n){at(t,n)}function ft(t,n){const e=ut(t);return!!e&&at(e,n)}function at(t,n){if(!t)return!1;const e=document.createElement("a");if(!("download"in e))return!1;const r=URL.createObjectURL(t);return e.download=n,e.href=r,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(r),!0}function pt(t){return null!=t&&"/"===t[0]&&"/"===t[1]}function ht(t){return null!=t&&a.test(t)}function dt(t){return null!=t&&h.test(t)||"https"===U.scheme&&pt(t)}function mt(t){return null!=t&&p.test(t)||"http"===U.scheme&&pt(t)}function yt(t){return null!=t&&d.test(t)}function gt(t){return pt(t)?`http:${t}`:t.replace(h,"http:")}function $t(t){return pt(t)?`https:${t}`:t.replace(p,"https:")}function xt(){return"http"===U.scheme}function wt(){return"https"===U.scheme}function Ot(t,n=!1){return pt(t)?t.slice(2):(t=t.replace(a,""),n&&t.length>1&&"/"===t[0]&&"/"===t[1]&&(t=t.slice(2)),t)}function Ut(t){const n=t.indexOf("//"),e=t.indexOf("/",n+2);return-1===e?t:t.slice(0,e)}function Rt(t){let n=0;if(Y(t)){const e=t.indexOf("//");-1!==e&&(n=e+2)}const e=t.lastIndexOf("/");return e<n?t:t.slice(0,e+1)}function bt(t,n){if(!t)return"";const e=I(t).path.replace(/\/+$/,""),r=e.substring(e.lastIndexOf("/")+1);if(!n?.length)return r;const o=new RegExp(`.(${n.join("|")})$`,"ig");return r.replace(o,"")}function Ct(t){return t.endsWith("/")?t:`${t}/`}function qt(t){return t.replace(/\/+$/,"")}function jt(t){if(/^https?:\/\//i.test(t)){const n=E(t);t=(t=n.path.replaceAll(/\/{2,}/g,"/")).replace("/","//"),n.query&&(t+=`?${n.query}`)}return t}function Lt(t){return t.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}function It(t){const n=c.httpsDomains;if(!mt(t))return t;const e=t.indexOf("/",7);let r;if(r=-1===e?t:t.slice(0,e),r=r.toLowerCase().slice(7),m.test(r)){if(!r.endsWith(":80"))return t;r=r.slice(0,-3),t=t.replace(":80","")}return xt()&&r===U.authority&&!y.test(t)||(wt()&&r===U.authority||n&&n.some((t=>r===t||r.endsWith(`.${t}`)))||wt()&&!T(t))&&(t=$t(t)),t}function At(t,n,e){if(!(n&&e&&t&&Y(t)))return t;const r=t.indexOf("//"),o=t.indexOf("/",r+2),s=t.indexOf(":",r+2),i=Math.min(o<0?t.length:o,s<0?t.length:s);if(t.slice(r+2,i).toLowerCase()!==n.toLowerCase())return t;return`${t.slice(0,r+2)}${e}${t.slice(i)}`}function vt(t){return"string"==typeof t?new x(_(t)):(t.scheme||(t.scheme=U.scheme),t)}function Pt(t){return Nt.test(t)}function St(t,n){const e=I(t),r=Object.keys(e.query||{});return r.length>0&&n&&n.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),e.path}function kt(t,n,e){const r=I(t),o=r.query||{};return o[n]=String(e),`${r.path}?${v(o)}`}function Et(t,n){if(!n)return t;const e=I(t),r=e.query||{};for(const[s,i]of Object.entries(n))null!=i&&(r[s]=i);const o=v(r);return o?`${e.path}?${o}`:e.path}function Bt(t,n){const{path:e,query:r}=I(t);if(!r)return t;delete r[n];const o=v(r);return o?`${e}?${o}`:e}function Ht(t){if(null==t)return null;const n=t.match(Jt);return n?n[2]:null}function Tt(t){if(null==t)return null;const n=t.match(Jt);return n?{path:n[1],extension:n[2]}:{path:t,extension:null}}async function Wt(t){if("string"==typeof t){return ot(t)??{data:t}}return new Promise(((n,e)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>n(ot(r.result)),r.onerror=t=>e(t)}))}const Jt=/([^.]*)\.([^\/]*)$/,Nt=/(^data:image\/svg|\.svg$)/i;export{x as Url,S as addProxy,H as addProxyRule,kt as addQueryParameter,Et as addQueryParameters,et as base64UrlEncode,it as blobUrlToBlob,At as changeDomain,ot as dataComponents,nt as dataToArrayBuffer,ut as dataToBlob,ct as downloadBlobAsFile,lt as downloadDataAsFile,Ct as ensureTrailingSlash,q as getAppBaseUrl,C as getAppUrl,bt as getFilename,D as getInterceptor,X as getOrigin,Ht as getPathExtension,T as getProxyRule,P as getProxyUrl,ht as hasProtocol,J as hasSameCanonicalArcGISOnlinePortal,W as hasSameCanonicalPortal,F as hasSameOrigin,N as hasSamePortal,Y as isAbsolute,wt as isAppHTTPS,Z as isBlobProtocol,tt as isDataProtocol,dt as isHTTPSProtocol,pt as isProtocolRelative,Pt as isSVG,M as isTrustedServer,V as join,_ as makeAbsolute,st as makeData,G as makeRelative,K as normalize,v as objectToQuery,Wt as parseData,A as queryToObject,Rt as removeFile,Bt as removeQueryParameter,St as removeQueryParameters,qt as removeTrailingSlash,Tt as splitPathExtension,L as test,gt as toHTTP,$t as toHTTPS,w as trustedServersUrlCache,I as urlToObject};
|
|
5
|
+
import t from"../config.js";import{isSome as n}from"./arrayUtils.js";import e from"./Error.js";import{isSerializable as r}from"./JSONSupport.js";import o from"./Logger.js";import{parseKnownArcGISOnlineDomain as s}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as i,arrayBufferToBase64 as u}from"../support/base64Utils.js";const l=o.getLogger("esri.core.urlUtils"),c=t.request,f="esri/config: esriConfig.request.proxyUrl is not set.",a=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,p=/^\s*http:/i,h=/^\s*https:/i,d=/^\s*file:/i,m=/:\d+$/,g=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,y=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),$=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class x{constructor(t=""){this.uri=t,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let n=this.uri.match(y);this.scheme=n[2]||(n[1]?"":null),this.authority=n[4]||(n[3]?"":null),this.path=n[5],this.query=n[7]||(n[6]?"":null),this.fragment=n[9]||(n[8]?"":null),null!=this.authority&&(n=this.authority.match($),this.user=n[3]||null,this.password=n[4]||null,this.host=n[6]||n[7],this.port=n[9]||null)}toString(){return this.uri}}const w={},O=new x(t.applicationUrl);let U=O;const R=j();let b=R;const C=()=>U,q=()=>b;function j(){const t=U.path,n=t.substring(0,t.lastIndexOf(t.split("/")[t.split("/").length-1]));return`${`${U.scheme}://${U.host}${null!=U.port?`:${U.port}`:""}`}${n}`}const L={setAppUrl:t=>U=t,setAppBaseUrl:t=>b=t,restoreUrls:()=>{U=O,b=R}};function I(t){if(!t)return null;const n={path:null,query:null},e=new x(t),r=t.indexOf("?");return null===e.query?n.path=t:(n.path=t.substring(0,r),n.query=A(e.query)),e.fragment&&(n.hash=e.fragment,null===e.query&&(n.path=n.path.substring(0,n.path.length-(e.fragment.length+1)))),n}function A(t){const n=t.split("&"),e={};for(const r of n){if(!r)continue;const t=r.indexOf("=");let n,o;t<0?(n=decodeURIComponent(r),o=""):(n=decodeURIComponent(r.slice(0,t)),o=decodeURIComponent(r.slice(t+1)));let s=e[n];"string"==typeof s&&(s=e[n]=[s]),Array.isArray(s)?s.push(o):e[n]=o}return e}function v(t,n){return t?n&&"function"==typeof n?Object.keys(t).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(n(e,t[e])))).join("&"):Object.keys(t).map((e=>{const o=t[e];if(null==o)return"";const s=encodeURIComponent(e)+"=",i=n&&n[e];return i?s+encodeURIComponent(i(o)):Array.isArray(o)?o.map((t=>r(t)?s+encodeURIComponent(JSON.stringify(t)):s+encodeURIComponent(t))).join("&"):r(o)?s+encodeURIComponent(JSON.stringify(o)):s+encodeURIComponent(o)})).filter((t=>t)).join("&"):""}function P(t=!1){let n,r=c.proxyUrl;if("string"==typeof t){n=dt(t);const e=T(t);e&&(r=e.proxyUrl)}else n=!!t;if(!r)throw l.warn(f),new e("urlutils:proxy-not-set",f);n&&wt()&&(r=$t(r));return I(r)}function S(t){const n=T(t);let e,r;if(n){const t=E(n.proxyUrl);e=t.path,r=t.query?A(t.query):null}if(e){const n=I(t);t=e+"?"+n.path;const o=v({...r,...n.query});o&&(t=`${t}?${o}`)}return t}const k={path:"",query:""};function E(t){const n=t.indexOf("?");return-1!==n?(k.path=t.slice(0,n),k.query=t.slice(n+1)):(k.path=t,k.query=null),k}function B(t){return t=(t=Ot(t=Ct(t=E(t).path),!0)).toLowerCase()}function H(t){const n={proxyUrl:t.proxyUrl,urlPrefix:B(t.urlPrefix)},e=c.proxyRules,r=n.urlPrefix;let o=e.length;for(let s=0;s<e.length;s++){const t=e[s].urlPrefix;if(0===r.indexOf(t)){if(r.length===t.length)return-1;o=s;break}0===t.indexOf(r)&&(o=s+1)}return e.splice(o,0,n),o}function T(t){const n=c.proxyRules,e=B(t);for(let r=0;r<n.length;r++)if(0===e.indexOf(n[r].urlPrefix))return n[r]}function W(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r?e.portalHostname===r.portalHostname:null==e&&null==r&&F(t,n,!0)}function J(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r&&e.portalHostname===r.portalHostname}function N(t,n){return t=z(t),n=z(n),Ot(t)===Ot(n)}function z(t){const n=(t=K(t)).indexOf("/sharing");return n>0?t.substring(0,n):t.replace(/\/+$/,"")}function D(t){const n=n=>null==n||n instanceof RegExp&&n.test(t)||"string"==typeof n&&t.startsWith(n),e=c.interceptors;if(e)for(const r of e)if(Array.isArray(r.urls)){if(r.urls.some(n))return r}else if(n(r.urls))return r;return null}function F(t,n,e=!1){if(!t||!n)return!1;const r=vt(t),o=vt(n);return!(!e&&r.scheme!==o.scheme)&&(null!=r.host&&null!=o.host&&(r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port))}function M(t){if("string"==typeof t){if(!Y(t))return!0;t=vt(t)}if(F(t,U))return!0;const n=c.trustedServers||[];for(let e=0;e<n.length;e++){const r=Q(n[e]);for(let n=0;n<r.length;n++)if(F(t,r[n]))return!0}return!1}function Q(t){return w[t]||(ht(t)||pt(t)?w[t]=[new x(_(t))]:w[t]=[new x(`http://${t}`),new x(`https://${t}`)]),w[t]}function _(t,n=b,e){return pt(t)?e&&e.preserveProtocolRelative?t:"http"===U.scheme&&U.authority===X(t).slice(2)?`http:${t}`:`https:${t}`:ht(t)?t:V("/"===t[0]?Ut(n):n,t)}function G(t,n=b,e){if(null==t||!Y(t))return t;const r=K(t),o=r.toLowerCase(),s=K(n).toLowerCase().replace(/\/+$/,""),i=e?K(e).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return t;const u=(t,n,e)=>-1===(e=t.indexOf(n,e))?t.length:e;let l=u(o,"/",o.indexOf("//")+2),c=-1;for(;o.slice(0,l+1)===s.slice(0,l)+"/"&&(c=l+1,l!==o.length);)l=u(o,"/",l+1);if(-1===c)return t;if(i&&c<i.length)return t;t=r.slice(c);const f=s.slice(c-1).replaceAll(/[^/]+/g,"").length;if(f>0)for(let a=0;a<f;a++)t=`../${t}`;else t=`./${t}`;return t}function K(t){return t=It(t=Lt(t=jt(t=_(t=t.trim()))))}function V(...t){const e=t.filter(n);if(!e||!e.length)return;const r=[];if(Y(e[0])){const t=e[0],n=t.indexOf("//");-1!==n&&(r.push(t.slice(0,n+1)),gt(e[0])&&(r[0]+="/"),e[0]=t.slice(n+2))}else"/"===e[0][0]&&r.push("");const o=e.reduce(((t,n)=>n?t.concat(n.split("/")):t),[]);for(let n=0;n<o.length;n++){const t=o[n];".."===t&&r.length>0&&".."!==r[r.length-1]?r.pop():(!t&&n===o.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function X(t,n=!1){if(null==t||Z(t)||tt(t))return null;let e=t.indexOf("://");if(-1===e&&pt(t))e=2;else{if(-1===e)return null;e+=3}const r=t.indexOf("/",e);return-1!==r&&(t=t.slice(0,r)),n&&(t=Ot(t,!0)),t}function Y(t){return pt(t)||ht(t)}function Z(t){return null!=t&&"blob:"===t.slice(0,5)}function tt(t){return null!=t&&"data:"===t.slice(0,5)}function nt(t){const n=ot(t);return n&&n.isBase64?i(n.data):null}function et(t){return u(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const rt=/^data:(.*?)(;base64)?,(.*)$/;function ot(t){const n=t.match(rt);if(!n)return null;const[,e,r,o]=n;return{mediaType:e,isBase64:!!r,data:o}}function st(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}async function it(t){return(await fetch(t)).blob()}function ut(t){const n=nt(t);if(!n)return null;const e=ot(t);return new Blob([n],{type:e.mediaType})}function lt(t,n){ft(t,n)}function ct(t,n){at(t,n)}function ft(t,n){const e=ut(t);return!!e&&at(e,n)}function at(t,n){if(!t)return!1;const e=document.createElement("a");if(!("download"in e))return!1;const r=URL.createObjectURL(t);return e.download=n,e.href=r,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(r),!0}function pt(t){return null!=t&&"/"===t[0]&&"/"===t[1]}function ht(t){return null!=t&&a.test(t)}function dt(t){return null!=t&&h.test(t)||"https"===U.scheme&&pt(t)}function mt(t){return null!=t&&p.test(t)||"http"===U.scheme&&pt(t)}function gt(t){return null!=t&&d.test(t)}function yt(t){return pt(t)?`http:${t}`:t.replace(h,"http:")}function $t(t){return pt(t)?`https:${t}`:t.replace(p,"https:")}function xt(){return"http"===U.scheme}function wt(){return"https"===U.scheme}function Ot(t,n=!1){return pt(t)?t.slice(2):(t=t.replace(a,""),n&&t.length>1&&"/"===t[0]&&"/"===t[1]&&(t=t.slice(2)),t)}function Ut(t){const n=t.indexOf("//"),e=t.indexOf("/",n+2);return-1===e?t:t.slice(0,e)}function Rt(t){let n=0;if(Y(t)){const e=t.indexOf("//");-1!==e&&(n=e+2)}const e=t.lastIndexOf("/");return e<n?t:t.slice(0,e+1)}function bt(t,n){if(!t)return"";const e=I(t).path.replace(/\/+$/,""),r=e.substring(e.lastIndexOf("/")+1);if(!n?.length)return r;const o=new RegExp(`.(${n.join("|")})$`,"ig");return r.replace(o,"")}function Ct(t){return t.endsWith("/")?t:`${t}/`}function qt(t){return t.replace(/\/+$/,"")}function jt(t){if(/^https?:\/\//i.test(t)){const n=E(t);t=(t=n.path.replaceAll(/\/{2,}/g,"/")).replace("/","//"),n.query&&(t+=`?${n.query}`)}return t}function Lt(t){return t.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}function It(t){const n=c.httpsDomains;if(!mt(t))return t;const e=t.indexOf("/",7);let r;if(r=-1===e?t:t.slice(0,e),r=r.toLowerCase().slice(7),m.test(r)){if(!r.endsWith(":80"))return t;r=r.slice(0,-3),t=t.replace(":80","")}return xt()&&r===U.authority&&!g.test(t)||(wt()&&r===U.authority||n&&n.some((t=>r===t||r.endsWith(`.${t}`)))||wt()&&!T(t))&&(t=$t(t)),t}function At(t,n,e){if(!(n&&e&&t&&Y(t)))return t;const r=t.indexOf("//"),o=t.indexOf("/",r+2),s=t.indexOf(":",r+2),i=Math.min(o<0?t.length:o,s<0?t.length:s);if(t.slice(r+2,i).toLowerCase()!==n.toLowerCase())return t;return`${t.slice(0,r+2)}${e}${t.slice(i)}`}function vt(t){return"string"==typeof t?new x(_(t)):(t.scheme||(t.scheme=U.scheme),t)}function Pt(t){return Nt.test(t)}function St(t,n){const e=I(t),r=Object.keys(e.query||{});return r.length>0&&n&&n.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),e.path}function kt(t,n,e){const r=I(t),o=r.query||{};return o[n]=String(e),`${r.path}?${v(o)}`}function Et(t,n){if(!n)return t;const e=I(t),r=e.query||{};for(const[s,i]of Object.entries(n))null!=i&&(r[s]=i);const o=v(r);return o?`${e.path}?${o}`:e.path}function Bt(t,n){const{path:e,query:r}=I(t);if(!r)return t;delete r[n];const o=v(r);return o?`${e}?${o}`:e}function Ht(t){if(null==t)return null;const n=t.match(Jt);return n?n[2]:null}function Tt(t){if(null==t)return null;const n=t.match(Jt);return n?{path:n[1],extension:n[2]}:{path:t,extension:null}}async function Wt(t){if("string"==typeof t){return ot(t)??{data:t}}return new Promise(((n,e)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>n(ot(r.result)),r.onerror=t=>e(t)}))}const Jt=/([^.]*)\.([^\/]*)$/,Nt=/(^data:image\/svg|\.svg$)/i;export{x as Url,S as addProxy,H as addProxyRule,kt as addQueryParameter,Et as addQueryParameters,et as base64UrlEncode,it as blobUrlToBlob,At as changeDomain,ot as dataComponents,nt as dataToArrayBuffer,ut as dataToBlob,ct as downloadBlobAsFile,lt as downloadDataAsFile,Ct as ensureTrailingSlash,q as getAppBaseUrl,C as getAppUrl,bt as getFilename,D as getInterceptor,X as getOrigin,Ht as getPathExtension,T as getProxyRule,P as getProxyUrl,ht as hasProtocol,J as hasSameCanonicalArcGISOnlinePortal,W as hasSameCanonicalPortal,F as hasSameOrigin,N as hasSamePortal,Y as isAbsolute,wt as isAppHTTPS,Z as isBlobProtocol,tt as isDataProtocol,dt as isHTTPSProtocol,pt as isProtocolRelative,Pt as isSVG,M as isTrustedServer,V as join,_ as makeAbsolute,st as makeData,G as makeRelative,K as normalize,v as objectToQuery,Wt as parseData,A as queryToObject,Rt as removeFile,Bt as removeQueryParameter,St as removeQueryParameters,qt as removeTrailingSlash,Tt as splitPathExtension,L as test,yt as toHTTP,$t as toHTTPS,w as trustedServersUrlCache,I as urlToObject};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as t}from"../core/lang.js";import{collectMultipath as e}from"./geometryCursorCollectUtils.js";import{isPolygon as s,isPolyline as i,isMultipoint as h,isExtent as n,isPoint as r}from"./support/jsonUtils.js";import o from"../layers/graphics/OptimizedGeometry.js";class a{static fromOptimized(t,e,s=!1,i=!1){return(new p).initialize(t,e,s,i,1)}static fromJSON(t,e=!1,s=!1){const[i,h]=u(t);return(new m).initialize(i,h,e,s,1)}static fromOptimizedCIM(t,e,s=!1,i=!1){return(new
|
|
5
|
+
import{clone as t}from"../core/lang.js";import{collectMultipath as e}from"./geometryCursorCollectUtils.js";import{isPolygon as s,isPolyline as i,isMultipoint as h,isExtent as n,isPoint as r}from"./support/jsonUtils.js";import o from"../layers/graphics/OptimizedGeometry.js";class a{static fromOptimized(t,e,s=!1,i=!1){return(new p).initialize(t,e,s,i,1)}static fromJSON(t,e=!1,s=!1){const[i,h]=u(t);return(new m).initialize(i,h,e,s,1)}static fromOptimizedCIM(t,e,s=!1,i=!1){return(new y).initialize(t,e,s,i,1)}static fromJSONCIM(t,e=!1,s=!1){const[i,h]=u(t);return(new l).initialize(i,h,e,s,1)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimized(e,s):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimizedCIM(e,s):null}static createEmptyOptimized(t,e=!1,s=!1){return(new p).initialize(new o,t,e,s,1)}static createEmptyJSON(t,e=!1,s=!1){return(new m).initialize([],t,e,s,1)}static createEmptyOptimizedCIM(t,e=!1,s=!1){return(new y).initialize(new o,t,e,s,1)}static createEmptyJSONCIM(t,e=!1,s=!1){return(new l).initialize([],t,e,s,1)}asJSON(){const t=e(this);return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat()}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1]}:"esriGeometryPolygon"===this.geometryType?{rings:t}:{paths:t}}invertY(){this.yFactor*=-1}}class p extends a{constructor(){super(...arguments),this._end=-1}initialize(t,e,s,i,h){return this.hasZ=s,this.hasM=i,this.geometryType=e,this._stride=2+Number(s)+Number(i),this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=h,this}reset(){this.initialize(this._geometry,this.geometryType,this.hasZ,this.hasM,this.yFactor)}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._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){if(this._pathIndex>=0){const t=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex];this._pathOffset+=this._stride*t}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<this.numPaths}pathLength(){const t=this._end,e=this._stride,s=this._geometry.coords;let i=0;for(let h=this._pathOffset+e;h<t;h+=e){const t=s[h-e],n=s[h-e+1],r=s[h]-t,o=s[h+1]-n;i+=Math.sqrt(r*r+o*o)}return i}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.numPaths-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.numPaths-1]++}pushPoints(t){for(const e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.numPaths-1]+=t.length}asOptimized(){const t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){const t=this._geometry.coords,e=this._pathOffset,s=this._end-this._stride;for(let i=0;i<this._stride;i++)if(t[e+i]!==t[s+i])return!1;return!0}clone(){return(new p).initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get numPoints(){const{lengths:t}=this._geometry;return this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get numPaths(){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 pointIndex(){return this._pointOffset/this._stride}}function _(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function u(t){return s(t)?[t.rings,"esriGeometryPolygon"]:i(t)?[t.paths,"esriGeometryPolyline"]:h(t)?[[t.points],"esriGeometryMultipoint"]:n(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:r(t)?[[[_(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class m extends a{initialize(t,e,s,i,h){return this._paths=t,this.geometryType=e,this.hasZ=s,this.hasM=i,this._pathIndex=this._pointIndex=-1,this.yFactor=h,this._mIdx=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.numPaths}pathLength(){const t=this._currentPath.length,e=this._currentPath;let s=0;for(let i=1;i<t;i++){const t=e[i-1],h=e[i],n=t[0],r=t[1],o=h[0]-n,a=h[1]-r;s+=Math.sqrt(o*o+a*a)}return s}startPath(){this._paths.push([])}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.pathIndex].push(t)}pushXY(t,e){this._paths[this.pathIndex].push([t,e])}pushPoints(t){this._paths[this.pathIndex].push(...t)}asOptimized(){const t=new o;if("esriGeometryPoint"===this.geometryType)t.coords.push(...this._paths[0][0]),t.lengths.length=0;else for(const e of this._paths){for(const s of e)t.coords.push(s[0]),t.coords.push(s[1]*this.yFactor),this.hasZ&&t.coords.push(s[2]),this.hasM&&t.coords.push(s[this._mIdx]);t.lengths.push(e.length)}return t}isClosed(){const t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}clone(){return(new m).initialize(t(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get numPoints(){return this._pathIndex<0||this._pathIndex>this.numPaths-1?-1:this._paths[this._pathIndex].length}get numPaths(){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._mIdx]}set m(t){this._currentPoint[this._mIdx]=t}get pathIndex(){return this._pathIndex}get pointIndex(){return this._pointIndex}}const c=4,d=1;class y extends p{initialize(t,e,s,i,h){return super.initialize(t,e,s,i,h),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.numPaths).fill(void 0).map((t=>new Set))),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=(new y).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.pointIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this.pointIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class l extends m{initialize(t,e,s,i,h){return super.initialize(t,e,s,i,h)}clone(){return(new l).initialize(t(this._paths),this.geometryType,this.hasZ,this.hasM,1)}setControlPoint(){this._paths[this.pathIndex][this.pointIndex][c]=d}getControlPoint(){return this._paths[this.pathIndex][this.pointIndex][c]===d}setControlPointAt(t){this._paths[this.pathIndex][t][c]=d}getControlPointAt(t){return this._paths[this.pathIndex][t][c]===d}}export{a as GeometryCursor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const i=512;var t,s;!function(i){i[i.Unknown=0]="Unknown",i[i.Point=1]="Point",i[i.LineString=2]="LineString",i[i.Polygon=3]="Polygon"}(t||(t={}));class h{constructor(i,t){this.x=i,this.y=t}clone(){return new h(this.x,this.y)}equals(i,t){return i===this.x&&t===this.y}isEqual(i){return i.x===this.x&&i.y===this.y}setCoords(i,t){this.x=i,this.y=t}normalize(){const i=this.x,t=this.y,s=Math.sqrt(i*i+t*t);this.x/=s,this.y/=s}rightPerpendicular(){const i=this.x;this.x=this.y,this.y=-i}move(i,t){this.x+=i,this.y+=t}assign(i){this.x=i.x,this.y=i.y}assignAdd(i,t){this.x=i.x+t.x,this.y=i.y+t.y}assignSub(i,t){this.x=i.x-t.x,this.y=i.y-t.y}rotate(i,t){const s=this.x,h=this.y;this.x=s*i-h*t,this.y=s*t+h*i}scale(i){this.x*=i,this.y*=i}length(){const i=this.x,t=this.y;return Math.sqrt(i*i+t*t)}static distance(i,t){const s=t.x-i.x,h=t.y-i.y;return Math.sqrt(s*s+h*h)}static add(i,t){return new h(i.x+t.x,i.y+t.y)}static sub(i,t){return new h(i.x-t.x,i.y-t.y)}}class n{constructor(i,t,s){this.ratio=i,this.x=t,this.y=s}}class e{constructor(t,s,h,n=8,e=8){this._lines=[],this._starts=[],this.validateTessellation=!0,this._pixelRatio=n,this._pixelMargin=e,this._tileSize=i*n,this._dz=t,this._yPos=s,this._xPos=h}setPixelMargin(i){i!==this._pixelMargin&&(this._pixelMargin=i,this.setExtent(this._extent))}setExtent(i){this._extent=i,this._finalRatio=this._tileSize/i*(1<<this._dz);let t=this._pixelRatio*this._pixelMargin;t/=this._finalRatio;const s=i>>this._dz;t>s&&(t=s),this._margin=t,this._xmin=s*this._xPos-t,this._ymin=s*this._yPos-t,this._xmax=this._xmin+s+2*t,this._ymax=this._ymin+s+2*t}reset(i){this._type=i,this._lines=[],this._starts=[],this._line=null,this._start=0}moveTo(i,t){this._pushLine(),this._prevIsIn=this._isIn(i,t),this._moveTo(i,t,this._prevIsIn),this._prevPt=new h(i,t),this._firstPt=new h(i,t),this._dist=0}lineTo(i,t){const s=this._isIn(i,t),e=new h(i,t),_=h.distance(this._prevPt,e);let l,x,a,y,o,r,m,u;if(s)this._prevIsIn?this._lineTo(i,t,!0):(l=this._prevPt,x=e,a=this._intersect(x,l),this._start=this._dist+_*(1-this._r),this._lineTo(a.x,a.y,!0),this._lineTo(x.x,x.y,!0));else if(this._prevIsIn)x=this._prevPt,l=e,a=this._intersect(x,l),this._lineTo(a.x,a.y,!0),this._lineTo(l.x,l.y,!1);else{const i=this._prevPt,t=e;if(i.x<=this._xmin&&t.x<=this._xmin||i.x>=this._xmax&&t.x>=this._xmax||i.y<=this._ymin&&t.y<=this._ymin||i.y>=this._ymax&&t.y>=this._ymax)this._lineTo(t.x,t.y,!1);else{const s=[];if((i.x<this._xmin&&t.x>this._xmin||i.x>this._xmin&&t.x<this._xmin)&&(y=(this._xmin-i.x)/(t.x-i.x),u=i.y+y*(t.y-i.y),u<=this._ymin?r=!1:u>=this._ymax?r=!0:s.push(new n(y,this._xmin,u))),(i.x<this._xmax&&t.x>this._xmax||i.x>this._xmax&&t.x<this._xmax)&&(y=(this._xmax-i.x)/(t.x-i.x),u=i.y+y*(t.y-i.y),u<=this._ymin?r=!1:u>=this._ymax?r=!0:s.push(new n(y,this._xmax,u))),(i.y<this._ymin&&t.y>this._ymin||i.y>this._ymin&&t.y<this._ymin)&&(y=(this._ymin-i.y)/(t.y-i.y),m=i.x+y*(t.x-i.x),m<=this._xmin?o=!1:m>=this._xmax?o=!0:s.push(new n(y,m,this._ymin))),(i.y<this._ymax&&t.y>this._ymax||i.y>this._ymax&&t.y<this._ymax)&&(y=(this._ymax-i.y)/(t.y-i.y),m=i.x+y*(t.x-i.x),m<=this._xmin?o=!1:m>=this._xmax?o=!0:s.push(new n(y,m,this._ymax))),0===s.length)o?r?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):r?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin,this._ymin,!0);else if(s.length>1&&s[0].ratio>s[1].ratio)this._start=this._dist+_*s[1].ratio,this._lineTo(s[1].x,s[1].y,!0),this._lineTo(s[0].x,s[0].y,!0);else{this._start=this._dist+_*s[0].ratio;for(let i=0;i<s.length;i++)this._lineTo(s[i].x,s[i].y,!0)}this._lineTo(t.x,t.y,!1)}}this._dist+=_,this._prevIsIn=s,this._prevPt=e}close(){if(this._line.length>2){const i=this._firstPt,t=this._prevPt;i.x===t.x&&i.y===t.y||this.lineTo(i.x,i.y);const s=this._line;let h=s.length;for(;h>=4&&(s[0].x===s[1].x&&s[0].x===s[h-2].x||s[0].y===s[1].y&&s[0].y===s[h-2].y);)s.pop(),s[0].x=s[h-2].x,s[0].y=s[h-2].y,--h}}result(i=!0){return this._pushLine(),0===this._lines.length?null:(this._type===t.Polygon&&i&&l.simplify(this._tileSize,this._margin*this._finalRatio,this._lines),this._lines)}resultWithStarts(){if(this._type!==t.LineString)throw new Error("Only valid for lines");this._pushLine();const i=this._lines,s=i.length;if(0===s)return null;const h=[];for(let t=0;t<s;t++)h.push({line:i[t],start:this._starts[t]||0});return h}_isIn(i,t){return i>=this._xmin&&i<=this._xmax&&t>=this._ymin&&t<=this._ymax}_intersect(i,t){let s,n,e;if(t.x>=this._xmin&&t.x<=this._xmax)n=t.y<=this._ymin?this._ymin:this._ymax,e=(n-i.y)/(t.y-i.y),s=i.x+e*(t.x-i.x);else if(t.y>=this._ymin&&t.y<=this._ymax)s=t.x<=this._xmin?this._xmin:this._xmax,e=(s-i.x)/(t.x-i.x),n=i.y+e*(t.y-i.y);else{n=t.y<=this._ymin?this._ymin:this._ymax,s=t.x<=this._xmin?this._xmin:this._xmax;const h=(s-i.x)/(t.x-i.x),_=(n-i.y)/(t.y-i.y);h<_?(e=h,n=i.y+h*(t.y-i.y)):(e=_,s=i.x+_*(t.x-i.x))}return this._r=e,new h(s,n)}_pushLine(){this._line&&(this._type===t.Point?this._line.length>0&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===t.LineString?this._line.length>1&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===t.Polygon&&this._line.length>3&&(this._lines.push(this._line),this._starts.push(this._start))),this._line=[],this._start=0}_moveTo(i,s,n){this._type!==t.Polygon?n&&(i=Math.round((i-(this._xmin+this._margin))*this._finalRatio),s=Math.round((s-(this._ymin+this._margin))*this._finalRatio),this._line.push(new h(i,s))):(n||(i<this._xmin&&(i=this._xmin),i>this._xmax&&(i=this._xmax),s<this._ymin&&(s=this._ymin),s>this._ymax&&(s=this._ymax)),i=Math.round((i-(this._xmin+this._margin))*this._finalRatio),s=Math.round((s-(this._ymin+this._margin))*this._finalRatio),this._line.push(new h(i,s)),this._isH=!1,this._isV=!1)}_lineTo(i,s,n){let e,_;if(this._type!==t.Polygon)if(n){if(i=Math.round((i-(this._xmin+this._margin))*this._finalRatio),s=Math.round((s-(this._ymin+this._margin))*this._finalRatio),this._line.length>0&&(e=this._line[this._line.length-1],e.equals(i,s)))return;this._line.push(new h(i,s))}else this._line&&this._line.length>0&&this._pushLine();else if(n||(i<this._xmin&&(i=this._xmin),i>this._xmax&&(i=this._xmax),s<this._ymin&&(s=this._ymin),s>this._ymax&&(s=this._ymax)),i=Math.round((i-(this._xmin+this._margin))*this._finalRatio),s=Math.round((s-(this._ymin+this._margin))*this._finalRatio),this._line&&this._line.length>0){e=this._line[this._line.length-1];const t=e.x===i,n=e.y===s;if(t&&n)return;this._isH&&t||this._isV&&n?(e.x=i,e.y=s,_=this._line[this._line.length-2],_.x===i&&_.y===s?(this._line.pop(),this._line.length<=1?(this._isH=!1,this._isV=!1):(_=this._line[this._line.length-2],this._isH=_.x===i,this._isV=_.y===s)):(this._isH=_.x===i,this._isV=_.y===s)):(this._line.push(new h(i,s)),this._isH=t,this._isV=n)}else this._line.push(new h(i,s))}}class _{setExtent(i){this._ratio=4096===i?1:4096/i}get validateTessellation(){return this._ratio<1}reset(i){this._lines=[],this._line=null}moveTo(i,t){this._line&&this._lines.push(this._line),this._line=[];const s=this._ratio;this._line.push(new h(i*s,t*s))}lineTo(i,t){const s=this._ratio;this._line.push(new h(i*s,t*s))}close(){const i=this._line;i&&!i[0].isEqual(i[i.length-1])&&i.push(i[0])}result(){return this._line&&this._lines.push(this._line),0===this._lines.length?null:this._lines}}!function(i){i[i.sideLeft=0]="sideLeft",i[i.sideRight=1]="sideRight",i[i.sideTop=2]="sideTop",i[i.sideBottom=3]="sideBottom"}(s||(s={}));class l{static simplify(i,t,h){if(!h)return;const n=-t,e=i+t,_=-t,x=i+t,a=[],y=[],o=h.length;for(let l=0;l<o;++l){const i=h[l];if(!i||i.length<2)continue;let t,o=i[0];const r=i.length;for(let h=1;h<r;++h)t=i[h],o.x===t.x&&(o.x<=n&&(o.y>t.y?(a.push(l),a.push(h),a.push(s.sideLeft),a.push(-1)):(y.push(l),y.push(h),y.push(s.sideLeft),y.push(-1))),o.x>=e&&(o.y<t.y?(a.push(l),a.push(h),a.push(s.sideRight),a.push(-1)):(y.push(l),y.push(h),y.push(s.sideRight),y.push(-1)))),o.y===t.y&&(o.y<=_&&(o.x<t.x?(a.push(l),a.push(h),a.push(s.sideTop),a.push(-1)):(y.push(l),y.push(h),y.push(s.sideTop),y.push(-1))),o.y>=x&&(o.x>t.x?(a.push(l),a.push(h),a.push(s.sideBottom),a.push(-1)):(y.push(l),y.push(h),y.push(s.sideBottom),y.push(-1)))),o=t}if(0===a.length||0===y.length)return;l.fillParent(h,y,a),l.fillParent(h,a,y);const r=[];l.calcDeltas(r,y,a),l.calcDeltas(r,a,y),l.addDeltas(r,h)}static fillParent(i,t,h){const n=h.length,e=t.length;for(let _=0;_<e;_+=4){const e=t[_],l=t[_+1],a=t[_+2],y=i[e][l-1],o=i[e][l];let r=8092,m=-1;for(let t=0;t<n;t+=4){if(h[t+2]!==a)continue;const n=h[t],e=h[t+1],_=i[n][e-1],l=i[n][e];switch(a){case s.sideLeft:case s.sideRight:if(x(y.y,_.y,l.y)&&x(o.y,_.y,l.y)){const i=Math.abs(l.y-_.y);i<r&&(r=i,m=t)}break;case s.sideTop:case s.sideBottom:if(x(y.x,_.x,l.x)&&x(o.x,_.x,l.x)){const i=Math.abs(l.x-_.x);i<r&&(r=i,m=t)}}}t[_+3]=m}}static calcDeltas(i,t,s){const h=t.length;for(let n=0;n<h;n+=4){const h=[],e=l.calcDelta(n,t,s,h);i.push(t[n]),i.push(t[n+1]),i.push(t[n+2]),i.push(e)}}static calcDelta(i,t,s,h){const n=t[i+3];if(-1===n)return 0;const e=h.length;return e>1&&h[e-2]===n?0:(h.push(n),l.calcDelta(n,s,t,h)+1)}static addDeltas(i,t){const h=i.length;let n=0;for(let s=0;s<h;s+=4){const t=i[s+3];t>n&&(n=t)}for(let e=0;e<h;e+=4){const h=t[i[e]],_=i[e+1],l=n-i[e+3];switch(i[e+2]){case s.sideLeft:h[_-1].x-=l,h[_].x-=l,1===_&&(h[h.length-1].x-=l),_===h.length-1&&(h[0].x-=l);break;case s.sideRight:h[_-1].x+=l,h[_].x+=l,1===_&&(h[h.length-1].x+=l),_===h.length-1&&(h[0].x+=l);break;case s.sideTop:h[_-1].y-=l,h[_].y-=l,1===_&&(h[h.length-1].y-=l),_===h.length-1&&(h[0].y-=l);break;case s.sideBottom:h[_-1].y+=l,h[_].y+=l,1===_&&(h[h.length-1].y+=l),_===h.length-1&&(h[0].y+=l)}}}}const x=(i,t,s)=>i>=t&&i<=s||i>=s&&i<=t;export{t as GeometryType,h as Point,_ as SimpleBuilder,e as TileClipper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../geometry.js";import e from"../../core/Error.js";import{convertUnit as t}from"../../core/unitUtils.js";import{toRadians as n,spheroids as i,WKT_SPHEROID_REGEX as s}from"./geodesicConstants.js";import{equals as
|
|
5
|
+
import"../../geometry.js";import e from"../../core/Error.js";import{convertUnit as t}from"../../core/unitUtils.js";import{toRadians as n,spheroids as i,WKT_SPHEROID_REGEX as s}from"./geodesicConstants.js";import{equals as r,isGeographic as a}from"./spatialReferenceUtils.js";import o from"../Polyline.js";import c from"../Polygon.js";import h from"../Point.js";import l from"../SpatialReference.js";function f(e){if(!e)return null;if(a(e)&&e.wkid){const t=i[e.wkid];if(t)return t}if(e.wkt){const t=p(e.wkt);if(t)return t}return null}function p(e){const t=s.exec(e);if(!t||2!==t.length)return null;const n=t[1].split(",");if(!n||n.length<3)return null;const i=parseFloat(n[1]),r=parseFloat(n[2]);if(isNaN(i)||isNaN(r))return null;return{a:i,f:0===r?0:1/r}}function u(e){const t=f(e??l.WGS84);if(d(t))return t;const n=t.a*(1-t.f);return Object.assign(t,{b:n,eSq:1-(n/t.a)**2,radius:(2*t.a+n)/3,densificationRatio:1e4/((2*t.a+n)/3)})}function d(e){return null!=e&&"b"in e&&"eSq"in e&&"radius"in e}function m(e){return null!=e&&e<0?e+360:e}function g(e,t,i){const{a:s,eSq:r}=u(i),a=Math.sqrt(r),o=Math.sin(t[1]*n),c=s*t[0]*n;let h;if(r>0){h=s*((1-r)*(o/(1-r*(o*o))-1/(2*a)*Math.log((1-a*o)/(1+a*o))))*.5}else h=s*o;return e[0]=c,e[1]=h,e}function M(e){return null!==f(e)}function w(n,i="square-meters"){if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const t=n[e],i=t.spatialReference,{radius:r,densificationRatio:a}=u(i),o=r*a;s.push(v(t,o))}const r=[],a=[0,0],o=[0,0];for(let e=0;e<s.length;e++){const{rings:n,spatialReference:c}=s[e];let h=0;for(let e=0;e<n.length;e++){const t=n[e];g(a,t[0],c),g(o,t[t.length-1],c);let i=o[0]*a[1]-a[0]*o[1];for(let e=0;e<t.length-1;e++)g(a,t[e+1],c),g(o,t[e],c),i+=o[0]*a[1]-a[0]*o[1];h+=i}h=t(h,"square-meters",i),r.push(h/-2)}return r}function y(n,i="meters"){if(!n)throw new e("geodesic-lengths:invalid-geometries","the input geometries type is not supported");if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-lengths:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const r=n[e],{spatialReference:a}=r,o="polyline"===r.type?r.paths:r.rings;let c=0;for(let e=0;e<o.length;e++){const t=o[e];let n=0;for(let e=1;e<t.length;e++){const i=t[e-1][0],s=t[e][0],r=t[e-1][1],o=t[e][1];if(r!==o||i!==s){const e=new R;b(e,[i,r],[s,o],a),n+=e.distance}}c+=n}c=t(c,"meters",i),s.push(c)}return s}function v(t,n){if("polyline"!==t.type&&"polygon"!==t.type)throw new e("geodesic-densify:invalid-geometry","the input geometry is neither polyline nor polygon");const{spatialReference:i}=t;if(!M(i))throw new e("geodesic-densify:invalid-spatial-reference","the input geometry spatial reference is not supported");const s="polyline"===t.type?t.paths:t.rings,r=[],a=[0,0],h=new R;for(const e of s){const t=[];r.push(t),t.push([e[0][0],e[0][1]]);let s,o,c=e[0][0],l=e[0][1];for(let r=0;r<e.length-1;r++){if(s=e[r+1][0],o=e[r+1][1],c===s&&l===o)continue;const f=[c,l];b(h,[c,l],[s,o],i);const{azimuth:p,distance:u}=h,d=u/n;if(d>1){for(let e=1;e<=d-1;e++){z(a,f,p,e*n,i),t.push(a.slice(0))}z(a,f,p,(u+Math.floor(d-1)*n)/2,i),t.push(a.slice(0))}z(a,f,p,u,i),t.push(a.slice(0)),c=a[0],l=a[1]}}return"polyline"===t.type?new o({paths:r,spatialReference:i}):new c({rings:r,spatialReference:i})}class R{constructor(e=0,t=void 0,n=void 0){this.distance=e,this.azimuth=t,this.reverseAzimuth=n}}function z(e,t,i,s,r){const a=t[0],o=t[1],c=a*n,h=o*n,l=(i??0)*n,{a:f,b:p,f:d}=u(r),m=Math.sin(l),g=Math.cos(l),M=(1-d)*Math.tan(h),w=1/Math.sqrt(1+M*M),y=M*w,v=Math.atan2(M,g),R=w*m,z=R*R,b=1-z,j=b*(f*f-p*p)/(p*p),q=1+j/16384*(4096+j*(j*(320-175*j)-768)),x=j/1024*(256+j*(j*(74-47*j)-128));let A,N,S,k,P=s/(p*q),F=2*Math.PI;for(;Math.abs(P-F)>1e-12;)S=Math.cos(2*v+P),A=Math.sin(P),N=Math.cos(P),k=x*A*(S+x/4*(N*(2*S*S-1)-x/6*S*(4*A*A-3)*(4*S*S-3))),F=P,P=s/(p*q)+k;const U=y*A-w*N*g,C=Math.atan2(y*N+w*A*g,(1-d)*Math.sqrt(z+U*U)),E=Math.atan2(A*m,w*N-y*A*g),G=d/16*b*(4+d*(4-3*b)),I=C/n,O=(c+(E-(1-G)*d*R*(P+G*A*(S+G*N*(2*S*S-1)))))/n;return e[0]=O,e[1]=I,e}function b(e,t,i,s){const r=t[0]*n,a=t[1]*n,o=i[0]*n,c=i[1]*n,{a:h,b:l,f,radius:p}=u(s),d=o-r,m=Math.atan((1-f)*Math.tan(a)),g=Math.atan((1-f)*Math.tan(c)),M=Math.sin(m),w=Math.cos(m),y=Math.sin(g),v=Math.cos(g);let R,z,b,j,q,x,A,N,S,k,P=1e3,F=d;do{if(A=Math.sin(F),N=Math.cos(F),b=Math.sqrt(v*A*(v*A)+(w*y-M*v*N)*(w*y-M*v*N)),0===b)return e.distance=0,e.azimuth=void 0,e.reverseAzimuth=void 0,e;q=M*y+w*v*N,x=Math.atan2(b,q),S=w*v*A/b,z=1-S*S,j=q-2*M*y/z,isNaN(j)&&(j=0),k=f/16*z*(4+f*(4-3*z)),R=F,F=d+(1-k)*f*S*(x+k*b*(j+k*q*(2*j*j-1)))}while(Math.abs(F-R)>1e-12&&--P>0);if(0===P){const t=p,i=Math.acos(Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos(o-r))*t,s=o-r,h=Math.sin(s)*Math.cos(c),l=Math.cos(a)*Math.sin(c)-Math.sin(a)*Math.cos(c)*Math.cos(s),f=Math.atan2(h,l);return e.azimuth=f/n,e.distance=i,e.reverseAzimuth=void 0,e}const U=z*(h*h-l*l)/(l*l),C=U/1024*(256+U*(U*(74-47*U)-128)),E=l*(1+U/16384*(4096+U*(U*(320-175*U)-768)))*(x-C*b*(j+C/4*(q*(2*j*j-1)-C/6*j*(4*b*b-3)*(4*j*j-3)))),G=Math.atan2(v*Math.sin(F),w*y-M*v*Math.cos(F)),I=Math.atan2(w*Math.sin(F),w*y*Math.cos(F)-M*v);return e.azimuth=G/n,e.distance=E,e.reverseAzimuth=I/n,e}function j(n,i,s="meters"){if(!n||!i)throw new e("geodesic-distance:missing-parameters","one or both input parameters are missing");if(!n.spatialReference||!i.spatialReference)throw new e("geodesic-distance:invalid-parameters","one or both input points do not have a spatial reference");if(!r(n.spatialReference,i.spatialReference))throw new e("geodesic-distance:invalid-parameters","spatial references of input parameters do not match");const{spatialReference:a}=n;if(!M(a))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");if(n.x===i.x&&n.y===i.y)return new R(0,0,0);const o=new R;return b(o,[n.x,n.y],[i.x,i.y],a),o.distance=t(o.distance,"meters",s),o.azimuth=m(o.azimuth),o.reverseAzimuth=m(o.reverseAzimuth),o}function q(t,n,i){if(!t||null==n||null==i)throw new e("point-from-distance:missing-parameters","one or more input parameters are missing or undefined");if(i<0||i>360)throw new e("point-from-distance:-of-bounds","azimuth is restricted to angles between, and including, 0° to 360° degrees");if(!t.spatialReference)throw new e("point-from-distance:missing-spatial-reference","the input point must have a spatial reference");const{spatialReference:s}=t;if(!M(s))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");const r=[0,0];return z(r,[t.x,t.y],i,n,s),new h({x:r[0],y:r[1],spatialReference:s})}export{R as InverseGeodeticSolverResult,z as directGeodeticSolver,w as geodesicAreas,v as geodesicDensify,j as geodesicDistance,y as geodesicLengths,b as inverseGeodeticSolver,M as isSupported,q as pointFromDistance};
|
package/interfaces.d.ts
CHANGED
|
@@ -4141,7 +4141,7 @@ declare namespace __esri {
|
|
|
4141
4141
|
*
|
|
4142
4142
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-RelationshipElement.html#type)
|
|
4143
4143
|
*/
|
|
4144
|
-
|
|
4144
|
+
type: "relationship";
|
|
4145
4145
|
/**
|
|
4146
4146
|
* A `RelationshipElement` form element defines how a relationship between [feature layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [tables](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#tables) participates in the [FeatureForm](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html).
|
|
4147
4147
|
*
|
|
@@ -4186,6 +4186,12 @@ declare namespace __esri {
|
|
|
4186
4186
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-RelationshipElement.html#orderByFields)
|
|
4187
4187
|
*/
|
|
4188
4188
|
orderByFields?: RelatedRecordsInfoFieldOrderProperties[];
|
|
4189
|
+
/**
|
|
4190
|
+
* Indicates the type of form [element](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-Element.html).
|
|
4191
|
+
*
|
|
4192
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-RelationshipElement.html#type)
|
|
4193
|
+
*/
|
|
4194
|
+
type?: "relationship";
|
|
4189
4195
|
}
|
|
4190
4196
|
|
|
4191
4197
|
/**
|