@arcgis/core 4.33.0-next.20250423 → 4.33.0-next.20250424
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/Graphic.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/Analysis.d.ts +4 -0
- package/analysis/Analysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/analysis/SlicePlane.js +1 -1
- package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
- package/analysis/support/AnalysisOriginWebScene.js +5 -0
- package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
- package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
- package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa8a3c75f9b41d31559b.js → 265f69d153b7b6f07e42.js} +1 -1
- package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
- package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
- package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
- package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
- package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
- package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
- package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
- package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
- package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
- package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
- package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
- package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
- package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
- package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
- package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
- package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
- package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
- package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
- package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
- package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c42281188b874ffcdad.js → db5913824d5e5a2a8365.js} +1 -1
- package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
- package/assets/esri/core/workers/chunks/{9408a72968cbd985dd24.js → f2cef954b58c6604642c.js} +34 -34
- package/chunks/BloomBlur.glsl.js +7 -7
- package/chunks/BloomComposition.glsl.js +24 -25
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/sphere.js +1 -1
- package/core/Collection.js +1 -1
- package/core/JSONSupport.js +1 -1
- package/core/SetUtils.js +1 -1
- package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +344 -111
- package/layers/DimensionLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/videoUtils.js +5 -0
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/atmosphereUtils.js +1 -1
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
- package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/cameraUtilsSpherical.js +1 -1
- package/views/3d/support/geometryUtils/sphere.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/webgl/ManagedDepthTexture.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/webgl/FBOAttachmentType.js +5 -0
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/RenderbufferDescriptor.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/webscene/InitialViewProperties.js +1 -1
- package/webscene/Presentation.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/SlideLegendInfo.js +1 -1
- package/webscene/background/ColorBackground.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/webscene/spec-certification/compare.js +1 -1
- package/webscene/spec-certification/index.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/webscene/support/Description.js +1 -1
- package/webscene/support/SlideElements.js +1 -1
- package/webscene/support/SlideEnvironment.js +1 -1
- package/webscene/support/SlideGround.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/webscene/support/Title.js +1 -1
- package/webscene/support/analysisUtils.js +5 -0
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
- package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
- package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
- package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
- package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
- package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
- package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
- package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
- package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
- package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
- package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
- package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
- package/views/webgl/formats.js +0 -5
package/webscene/Slide.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import o from"../core/Collection.js";import{referenceSetter as s}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{cast as b}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as w}from"../core/accessorSupport/ensureType.js";import{s as T}from"../chunks/vec32.js";import{create as j}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as L,clonePreservingTiledLayers as C}from"../support/basemapEnsureType.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{SlideThumbnail as S}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as k}from"../webdoc/support/timeProperties.js";import A from"./SunLighting.js";import V from"./VirtualLighting.js";import U from"./support/Description.js";import x from"./support/SlideElements.js";import{SlideEnvironment as I}from"./support/SlideEnvironment.js";import D from"./support/SlideGround.js";import{SlideVisibleLayer as F}from"./support/SlideVisibleLayer.js";import R from"./support/Title.js";let M=0;const P=o.ofType(F),q=["caption","cover","none"];let B=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+M++,this.title=new R,this.description=new U,this.hidden=!1,this.thumbnail=new S,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new I,this.timeExtent=null,this.elements=null,this.visibleLayers=new P}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new R({text:e}):w(R,e)}castDescription(e){return"string"==typeof e?new U({text:e}):w(U,e)}castThumbnail(e){return"string"==typeof e?new S({url:e}):w(S,e)}castBasemap(e){return L(e)}set visibleLayers(e){this._set("visibleLayers",s(e,this._get("visibleLayers"),P))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=N(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayersFrom(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=N(i);t.push(new F({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}_updateFocusAreaIDs(e){if(e){this.enabledFocusAreas=[];for(const t of e)t.enabled&&this.enabledFocusAreas.push(t.id)}}updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};return e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?V.prototype.clone.apply(e.environment.lighting):A.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this._updateFocusAreaIDs(e.focusAreas?.areas),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?D.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(i))).then((e=>(this.thumbnail=new S({url:e.dataUrl}),this)))}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),o=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw o(),c}if(i.signal.aborted)throw o(),d();const s=e.resourceController.scheduler.registerTask(E.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([s.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),s.schedule((()=>this._applyBasemap(e,l)),l.signal),s.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([s.schedule((()=>this._applyLayerVisibility(e)),l.signal),s.schedule((()=>this._applyGround(e)),l.signal),s.schedule((()=>this._applyViewpoint(e,l)),l.signal),s.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),s.schedule((()=>e.environment.weather=this.environment.weather.clone())),s.schedule((()=>this._applyFocusAreaIDs(e.focusAreas?.areas)))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),s.remove(),o(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaIDs(e){if(e)for(const t of e)t.enabled=this.enabledFocusAreas?.includes(t.id)??!1}_getLayers(e){const t=new o;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=G(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),l=J(o,a),p=e.renderCoordsHelper,m=j();p.toRenderCoords(e.camera.position,m);const c=j(),h=j();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=T(m,h),n=T(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(s-r)*a,y=z(o,l*a);t.date=this._setTime(d,u,y)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([v({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([v({type:R,json:{default:()=>new R({text:""}),write:{isRequired:!0}}})],B.prototype,"title",void 0),e([b("title")],B.prototype,"castTitle",null),e([v({type:U,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",void 0),e([b("description")],B.prototype,"castDescription",null),e([v({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],B.prototype,"hidden",void 0),e([v({type:S,json:{default:()=>new S({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",void 0),e([b("thumbnail")],B.prototype,"castThumbnail",null),e([v({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([v({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",void 0),e([b("basemap")],B.prototype,"castBasemap",null),e([v({type:D,json:{write:!0}})],B.prototype,"ground",void 0),e([v({type:q,json:{write:!0,default:"caption"},nonNullable:!0})],B.prototype,"layout",void 0),e([v({type:P,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([b("visibleLayers")],B.prototype,"castVisibleLayers",null),e([v({type:I,json:{write:!0}})],B.prototype,"environment",void 0),e([v({type:[String],json:{write:!1}})],B.prototype,"enabledFocusAreas",void 0),e([v(k)],B.prototype,"timeExtent",void 0),e([v({type:x,json:{write:!0}})],B.prototype,"elements",void 0),B=e([f("esri.webscene.Slide")],B);const O=B;function G(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function N(e){const t=G(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const W=86400,H=43200;function J(e,t){let i=t-e;return i>H&&(i-=W),i<-43200&&(i+=W),i}function z(e,t){return p(e+t,W)}export{O as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as v}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as f}from"../core/accessorSupport/ensureType.js";import{s as T}from"../chunks/vec32.js";import{create as j}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as L,clonePreservingTiledLayers as C}from"../support/basemapEnsureType.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{SlideThumbnail as S}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as k}from"../webdoc/support/timeProperties.js";import A from"./SunLighting.js";import V from"./VirtualLighting.js";import U from"./support/Description.js";import x from"./support/SlideElements.js";import{SlideEnvironment as I}from"./support/SlideEnvironment.js";import F from"./support/SlideGround.js";import{SlideVisibleLayer as D}from"./support/SlideVisibleLayer.js";import R from"./support/Title.js";let M=0;const O=s.ofType(D),P=["caption","cover","none"];let q=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+M++,this.title=new R,this.description=new U,this.hidden=!1,this.thumbnail=new S,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new I,this.timeExtent=null,this.elements=new x,this.visibleLayers=new O}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new R({text:e}):f(R,e)}castDescription(e){return"string"==typeof e?new U({text:e}):f(U,e)}castThumbnail(e){return"string"==typeof e?new S({url:e}):f(S,e)}castBasemap(e){return L(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),O))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=N(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayersFrom(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=N(i);t.push(new D({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}_updateFocusAreaIDs(e){if(e){this.enabledFocusAreas=[];for(const t of e)t.enabled&&this.enabledFocusAreas.push(t.id)}}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?V.prototype.clone.apply(e.environment.lighting):A.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this._updateFocusAreaIDs(e.focusAreas?.areas),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?F.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayersFrom(e);const n=await e.takeScreenshot(i);return this.thumbnail=new S({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(E.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),o.schedule((()=>this._applyBasemap(e,l)),l.signal),o.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),l.signal),o.schedule((()=>this._applyGround(e)),l.signal),o.schedule((()=>this.elements.analyses.applyTo(e)),l.signal),o.schedule((()=>this._applyViewpoint(e,l)),l.signal),o.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),o.schedule((()=>e.environment.weather=this.environment.weather.clone())),o.schedule((()=>this._applyFocusAreaIDs(e.focusAreas?.areas)))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaIDs(e){if(e)for(const t of e)t.enabled=this.enabledFocusAreas?.includes(t.id)??!1}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=G(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=J(s,a),p=e.renderCoordsHelper,m=j();p.toRenderCoords(e.camera.position,m);const c=j(),h=j();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=T(m,h),n=T(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=z(s,l*a);t.date=this._setTime(d,u,y)}))}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([b({type:String,json:{write:{isRequired:!0}}})],q.prototype,"id",void 0),e([b({type:R,json:{default:()=>new R({text:""}),write:{isRequired:!0}}})],q.prototype,"title",void 0),e([v("title")],q.prototype,"castTitle",null),e([b({type:U,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],q.prototype,"description",void 0),e([v("description")],q.prototype,"castDescription",null),e([b({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],q.prototype,"hidden",void 0),e([b({type:S,json:{default:()=>new S({url:""}),write:{isRequired:!0}}})],q.prototype,"thumbnail",void 0),e([v("thumbnail")],q.prototype,"castThumbnail",null),e([b({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],q.prototype,"viewpoint",void 0),e([b({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],q.prototype,"basemap",void 0),e([v("basemap")],q.prototype,"castBasemap",null),e([b({type:F,json:{write:!0}})],q.prototype,"ground",void 0),e([b({type:P,json:{write:!0,default:"caption"},nonNullable:!0})],q.prototype,"layout",void 0),e([b({type:O,json:{write:{isRequired:!0}}})],q.prototype,"visibleLayers",null),e([v("visibleLayers")],q.prototype,"castVisibleLayers",null),e([b({type:I,json:{write:!0}})],q.prototype,"environment",void 0),e([b({type:[String],json:{write:!1}})],q.prototype,"enabledFocusAreas",void 0),e([b(k)],q.prototype,"timeExtent",void 0),e([b({type:x,nonNullable:!0,json:{write:!0}})],q.prototype,"elements",void 0),q=e([w("esri.webscene.Slide")],q);const B=q;function G(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function N(e){const t=G(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const W=86400,H=43200;function J(e,t){let i=t-e;return i>H&&(i-=W),i<-43200&&(i+=W),i}function z(e,t){return p(e+t,W)}export{B 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../chunks/tslib.es6.js";import e from"../core/Clonable.js";import r from"../core/JSONSupport.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";let p=class extends(e.ClonableMixin(r)){constructor(o){super(o),this.visible=!1}};o([s({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"visible",void 0),p=o([t("esri.webscene.SlideLegendInfo")],p);const c=p;export{c 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as s}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import{colorAndTransparencyProperty as c}from"../../symbols/support/materialUtils.js";import p from"./Background.js";var
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as s}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import{colorAndTransparencyProperty as c}from"../../symbols/support/materialUtils.js";import p from"./Background.js";var i;let l=i=class extends p{constructor(o){super(o),this.type="color",this.color=new r([0,0,0,1])}clone(){return new i(this.cloneProperties())}cloneProperties(){return{color:this.color.clone()}}};o([s({color:"color"},{readOnly:!0}),e({json:{write:{isRequired:!0}}})],l.prototype,"type",void 0),o([e(c({nonNullable:!0,colorRequiredOnWrite:!0}))],l.prototype,"color",void 0),l=i=o([t("esri.webscene.background.ColorBackground")],l);const n=l;export{n 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Basemap.js";import
|
|
5
|
+
import{b as e,c as t}from"../../chunks/tslib.es6.js";import r from"../../Basemap.js";import n from"../../Ground.js";import a from"../../WebScene.js";import"../../core/has.js";import{isLongFormType as s,Integer as y,Null as o}from"../../core/accessorSupport/ensureType.js";import{isCollection as i}from"../../core/accessorSupport/extensions/serializableProperty/type.js";import p from"../../layers/GroupLayer.js";import u from"../../layers/KMLLayer.js";import{typeModuleMap as l}from"../../layers/mixins/operationalLayerModuleMap.js";import{supportedTypes as c}from"../../layers/mixins/operationalLayers.js";import m from"../../layers/support/Sublayer.js";import{JoinTableDataSource as f,DataLayerSource as d}from"../../layers/support/source/DataLayerSource.js";import{MapLayerSource as b}from"../../layers/support/source/MapLayerSource.js";import w from"../InitialViewProperties.js";import{ScanContext as j}from"./utils.js";import{webSceneAnalysisRegistry as N}from"../support/analysisUtils.js";import v from"../support/SlideElements.js";async function g(r){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new j,!1);return await L(null,{typeName:"json",type:r},t)}catch(a){n.error=a,n.hasError=!0}finally{t(n)}}async function T(e,t,r){switch(t.typeName){case"array":await R(e,t,r);break;case"union":await M(e,t,r);break;case"json":await L(e,t,r);break;case"native":await h(e,t,r);break;case"enum":await q(e,t,r)}}async function h(e,t,r){r.addProperty({name:e,type:O(r,t),default:t.default,required:t.isRequired})}function k(e){const t=e.slice();return t.sort(),t}async function q(e,t,r){const n=t.values.slice();t.nullable&&n.push(null),r.currentClass?.typeValue&&"type"===e?r.addProperty({name:e,type:"string",enum:`"${r.currentClass.typeValue}"`,required:t.isRequired}):r.addProperty({name:e,type:O(r,t),enum:k(n).map((e=>"string"==typeof e?`"${e}"`:`${e}`)).join("|"),default:t.default,required:t.isRequired})}async function R(e,t,r){t.elementType.isRequired=t.isRequired,await T(`${e}[]`,t.elementType,r)}function S(e,t){if("json"===e.typeName){const t=e.type.__accessorMetadata__,r=t?.type,n=r&&F(r),a=n?.type,s=a||r?.type;if(s&&Array.isArray(s)&&1===s.length&&"string"==typeof s[0])return a?s[0]:G(r,s[0])}return t}async function M(e,t,r){const n=[];for(const a of t.types)if("native"!==a.type.typeName&&t.key){const t=`${e}<${S(a.type,a.value)}>`;await T(t,a.type,r)}else n.push(a.type);if(n.length){const a=n.map((e=>O(r,e)));t.nullable&&a.push("null"),a.sort(),r.addProperty({type:a.join("|"),name:e,default:t.default,required:t.isRequired})}}async function C(e,t){return e.type===a&&"layers"===t?_("web-scene/operational-layers","operational-layers"):e.type===a&&"tables"===t?_("web-scene/tables","tables"):e.type!==r||"baseLayers"!==t&&"baseMapLayers"!==t?e.type===r&&"elevationLayers"===t||e.type===n&&"layers"===t?_("web-scene/ground","ground"):e.type===p&&"layers"===t?_("web-scene/operational-layers","operational-layers",(e=>e!==p)):e.type!==v&&e.type!==w||"analyses"!==t?e.type!==f||"leftTableSource"!==t&&"rightTableSource"!==t?null:B({key:"type",base:null,typeMap:{"data-layer":d,"map-layer":b}}):{typeName:"array",elementType:{typeName:"union",key:"type",types:await Promise.all(Object.entries(N).map((async([e,t])=>({type:{typeName:"json",type:await t()},value:e}))))}}:_("web-scene/basemap","basemap")}async function P(e,t,r){const n=I(r),a=await C(e,t);return a?(a.isRequired=n.isRequired,a):n}async function L(e,t,r){const n=t.type.__accessorMetadata__,a=r.getDeclaredClass(t.type);if(!n)return e&&r.addProperty({name:e,type:"unknown"}),null;let s=a,y=null;t.layerContainerType&&(s+=`--${t.layerContainerType}`);const o=e?.match(/<([^>]+)>$/);o&&(s+=`--${o[1]}`,y=o[1]),t.type===m&&(s+=`--${r.currentClass?.name}`,y=r.currentClass?.name);const i=r.seen.get(s);if(i&&e)return r.addProperty({name:e,type:i,required:t.isRequired}),i;const p={type:t.type,name:a,id:s,properties:[]};e&&(r.addProperty({name:e,type:p,required:t.isRequired}),p.typeValue=y),r.push(e,p);for(const u in n){const e=n[u],a=H(e);if(!a?.enabled)continue;if(a.layerContainerTypes&&t.layerContainerType&&!a.layerContainerTypes.includes(t.layerContainerType))continue;if(t.type===m){const e="esri/layers/TileLayer"===r.stack[r.stack.length-2].klass.name;if(e&&m.test.isMapImageLayerOverridePolicy(a.overridePolicy)||!e&&m.test.isTileImageLayerOverridePolicy(a.overridePolicy))continue}const s=a.target;if("string"==typeof s||null==s){const n=await P(t,u,e);if(!n)continue;await T("string"==typeof s?s:u,n,r)}else await $(t,s,r)}return r.pop()}async function $(e,t,r){for(const n in t){let a=await C(e,n);if(!a){const e=t[n];a=e.types?B(e.types):W(e.type),a.default=e.default,a.isRequired=e.isRequired,a=E(a)}await T(n,a,r)}}async function _(e,t,r){const n={typeName:"union",key:"layerType",types:[]};for(const a in c[e]){if("web-scene/operational-layers"===e&&"ArcGISTiledElevationServiceLayer"===a)continue;const s=await l[a]();s&&(r&&!r(s)||s!==u&&n.types.push({type:{typeName:"json",layerContainerType:t,type:s},value:a}))}if(0===n.types.length)return null;return{typeName:"array",elementType:1===n.types.length?n.types[0].type:n}}function O(e,t){switch(t.typeName){case"array":return`${O(e,t.elementType)}[]`;case"union":{const r=t.types.map((t=>O(e,t.type)));return t.nullable&&r.push("null"),r.sort(),`${r.join(" | ")}`}case"native":switch(t.type){case Number:return"number";case y:return"integer";case String:return"string";case Boolean:return"boolean";case Object:return"object";case o:return"null";default:return"unknown"}case"json":return e.getDeclaredClass(t.type);case"enum":return"string"}}function A(e){const t=e.prototype.itemType?.Type;if(!t)return{typeName:"array",elementType:{typeName:"native",type:null}};if("function"==typeof t)return{typeName:"array",elementType:W(t)};if(t.typeMap){const e=[];for(const r in t.typeMap){const n=t.typeMap[r];e.push({type:W(n),value:U(n)?null:r})}return{typeName:"array",elementType:{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:e}}}}function x(e){if("json"!==e.typeName)return null;const t=e.type.__accessorMetadata__,r=t?.type,n=r&&F(r),a=n?.type,s=a||r?.type;return s&&Array.isArray(s)&&"string"==typeof s[0]?a||r.type.map((e=>G(r,e))):null}function E(e){if("array"===e.typeName)return e.elementType=E(e.elementType),e;const t=x(e);return t?{typeName:"union",key:"type",nullable:e.nullable,isRequired:e.isRequired,types:t.map((t=>({value:t,type:e})))}:e}function I(e){const t=F(e);return t?.types?B(t.types):!t?.type&&e.types?B(e.types):V(E(J(e)))}function V(e){return e.nullable&&"native"===e.typeName?{typeName:"union",key:null,isRequired:e.isRequired,types:[{value:null,type:e}],nullable:!0}:e}function B(e){if(Array.isArray(e))return{typeName:"array",elementType:B(e[0])};const t=[];for(const r in e.typeMap){const n=e.typeMap[r];t.push({type:W(n),value:U(n)?null:r})}return{typeName:"union",key:"string"==typeof e.key?e.key:"type",types:t}}function D(e){return null!=e&&e.isJSONMapWriter}function G(e,t){const r=H(e);if(r&&D(r.writer)){const e={value:""};return r.writer?.(t,e,"value"),e.value}return t}function J(e){const t=F(e),r=H(e),n=t?.type,a=W(n||e.type);return t&&void 0!==t.default&&"function"!=typeof t.default&&(a.default=G(e,t.default)),r?.allowNull&&(a.nullable=!0),r?.isRequired&&(a.isRequired=!0),a}function W(e){return e?s(e)?z(e):Array.isArray(e)?"string"==typeof e[0]||"number"==typeof e[0]?{typeName:"enum",values:e}:e.length>1?{typeName:"union",key:null,types:e.map((e=>({type:W(e),value:null})))}:{typeName:"array",elementType:W(e[0])}:i(e)?A(e):U(e)?{typeName:"native",type:e}:K(e)?{typeName:"json",type:e}:{typeName:"native",type:null}:{typeName:"native",type:null}}function z(e){switch(e.type){case"native":return{typeName:"native",type:e.value};case"array":return{typeName:"array",elementType:W(e.value)};case"one-of":return{typeName:"union",key:null,types:e.values.map((e=>({type:z(e),value:null})))}}}function K(e){let t=e;for(;t;){if(t.prototype&&("esri.core.JSONSupport"===t.prototype.declaredClass||"esri.core.MultiOriginJSONSupport"===t.prototype.declaredClass))return!0;t=Object.getPrototypeOf(t)}return!1}function U(e){return e===String||e===Boolean||e===Number||e===y||e===Object||e===o}function F(e){if(!e.json)return null;const t=e.json.origins,r=e.json,n=t?.["web-scene"],a=t?.["web-document"];return n||a||r||null}function H(e){if(!e.json)return null;const t=e.json.origins,r=e.json.write,n=t?.["web-scene"]?.write,a=t?.["web-document"]?.write;return n||a||r||null}export{g as scan};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{collectClassPaths as e}from"./utils.js";function
|
|
5
|
+
import{collectClassPaths as e}from"./utils.js";function t(e){const t=s(e),n=[],r=a(t),i=new Map;p("api","",e.api,t,r.api,i);const c=new Map;p("spec","",e.spec,t,r.spec,c);const u=o(t);for(const[p,a]of i){const e=c.get(p),t=u.get(a.container.id),o=`${a.container.name} (${e.container.name})${a.container.typeValue?` <${a.container.typeValue}>`:""}`;n.push({name:o,api:a,spec:e,indent:t})}return n}function n(e,t,a,o,s,i,c,u,f){if(c.has(o))return f;for(const d of o.properties){const l=t?`${t}.${d.name}`:d.name,m=a?`${a}.${d.name}`:d.name,y=s.get(m);if(y){const t=i.get(y[e].id);f.push({name:l,type:"ref",ref:y,refName:t,required:d.required}),p(e,m,y[e],s,i,u)}else"string"==typeof d.type?f.push(r(l,d)):(c.add(o),n(e,l,m,d.type,s,i,c,u,f))}return c.delete(o),f}function p(e,t,p,a,o,s){if(s.has(p.id))return s;const r={container:p,text:null,props:[]};return o.get(p.id).forEach((e=>s.set(e,r))),n(e,"",t,p,a,o,new Set,s,r.props),r.props.sort(i),s}function a(e){const t={api:new Map,spec:new Map};for(const n of e.values()){const e=`${n.api.name} (${n.spec.name})${n.api.typeValue?` <${n.api.typeValue}>`:""}`;let p=t.api.get(n.api.id);p||(p=new Set,t.api.set(n.api.id,p)),p.add(e);let a=t.spec.get(n.spec.id);a||(a=new Set,t.spec.set(n.spec.id,a)),a.add(e)}return t}function o(e){const t=new Map;for(const n of e.keys()){const p=n?n.split(".").length:0,a=e.get(n).api.id;t.has("id")?t.set(a,Math.min(p,t.get(a))):t.set(a,p)}return t}function s(t){const n=e(t.api),p=e(t.spec),a=new Map;a.set("",{api:t.api,spec:t.spec});for(const[e,o]of n){const t=p.get(e);t&&a.set(e,{api:o,spec:t})}return a}function r(e,t){return{name:e,type:t.enum||("string"==typeof t.type?t.type:""),default:JSON.stringify(t.default),required:t.required}}function i(e,t){const n=e.name.localeCompare(t.name);if(0!==n)return n;const p=(e.type||"").localeCompare(t.type||"");return 0!==p?p:(e.default||"").localeCompare(t.default||"")}export{t as collect};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
export{scan as scanSpec}from"./spec.js";export{scan as scanAPI}from"./api.js";export{collectClassPaths,flatten}from"./utils.js";const e={applicationProperties:"esri/webscene/ApplicationProperties",authoringInfo:"esri/renderers/support/AuthoringInfo",authoringInfo_visualVariable:"esri/renderers/support/AuthoringInfoVisualVariable",baseMap:"esri/Basemap",border:"esri/symbols/callouts/LineCallout3DBorder",buildingSceneLayer:"esri/layers/BuildingSceneLayer",buildingSceneLayer_filter:"esri/layers/support/BuildingFilter",buildingSceneLayer_filterAuthoringInfo_filterBlock:"esri/layers/support/BuildingFilterAuthoringInfoBlock",buildingSceneLayer_filterAuthoringInfo_filterType:"esri/layers/support/BuildingFilterAuthoringInfoType",buildingSceneLayer_filterAuthoringInfoCheckbox:"esri/layers/support/BuildingFilterAuthoringInfoCheckbox",buildingSceneLayer_filterBlock:"esri/layers/support/BuildingFilterBlock",buildingSceneLayer_filterModeSolid:"esri/layers/support/BuildingFilterModeSolid",buildingSceneLayer_filterModeWireFrame:"esri/layers/support/BuildingFilterModeWireFrame",buildingSceneLayer_filterModeXray:"esri/layers/support/BuildingFilterModeXRay",buildingSceneLayer_sublayer:"esri/layers/buildingSublayers/BuildingComponentSublayer",callout:"esri/symbols/callouts/LineCallout3D",camera:"esri/Camera",cimSymbolReference:"esri/symbols/CIMSymbol",classBreakInfo:"esri/renderers/support/ClassBreakInfo",classBreakInfo_authoringInfo:"esri/renderer/support/AuthoringInfoClassBreakInfo",classBreaksRenderer:"esri/renderers/ClassBreaksRenderer",codedValue:"esri/layers/support/CodedValue",codedValue_domain:"esri/layers/support/CodedValueDomain",colorClassBreakInfo:"esri/renderers/support/pointCloud/ColorClassBreakInfo",colorInfo_visualVariable:"esri/renderers/visualVariables/ColorVariable",colormapInfo:"esri/renderers/support/ColormapInfo",colorModulationInfo:"esri/renderers/support/pointCloud/ColorModulation",colorRamp_algorithmic:"esri/rest/support/AlgorithmicColorRamp",colorRamp_multipart:"esri/rest/support/MultipartColorRamp",colorStop:"esri/renderers/visualVariables/support/ColorStop",colorUniqueValueInfo:"esri/renderers/support/pointCloud/ColorUniqueValueInfo",csvLayer:"esri/layers/CSVLayer",description:"esri/webscene/support/Description",dynamicDataLayer_source:"esri/layers/support/source/DataLayerSource",dynamicMapLayer_source:"esri/layers/support/source/MapLayerSource",elevationInfo:"esri/symbols/support/ElevationInfo",environment_background_color:"esri/webscene/background/ColorBackground",environment:"esri/webscene/Environment",extent:"esri/geometry/Extent",extrudeSymbol3DLayer:"esri/symbols/ExtrudeSymbol3DLayer",facilityLayerInfo:"esri/layers/support/FacilityLayerInfo",featureExpressionInfo:"esri/layers/support/FeatureExpressionInfo",featureLayer:"esri/layers/FeatureLayer",featureReduction_select:"esri/layers/support/FeatureReductionSelection",field:"esri/layers/support/Field",field_authoringInfo:"esri/renderers/support/AuthoringInfoFieldInfo",fieldInfo:"esri/popup/FieldInfo",fillSymbol3DLayer:"esri/symbols/FillSymbol3DLayer",font:"esri/symbols/Font",format:"esri/popup/support/FieldInfoFormat",ground:"esri/Ground",groupLayer:"esri/layers/GroupLayer",halo:"esri/symbols/support/Symbol3DHalo",heightModelInfo:"esri/geometry/HeightModelInfo",iconSymbol3DLayer:"esri/symbols/IconSymbol3DLayer",iconSymbol3DLayer_resource:"esri/symbols/support/IconSymbol3DLayerResource",imageServiceLayer:"esri/layers/ImageryLayer",inherited_domain:"esri/layers/support/InheritedDomain",initialState:"esri/webscene/InitialViewProperties",integratedMeshLayer:"esri/layers/IntegratedMeshLayer",joinTableDataSource:"esri/layers/support/source/JoinTableDataSource",labelExpressionInfo:"esri/layers/support/LabelExpressionInfo",labelingInfo:"esri/layers/support/LabelClass",labelSymbol3D:"esri/symbols/LabelSymbol3D",layer:"esri/layers/support/Sublayer",layerFloorInfo:"esri/layers/support/LayerFloorInfo",levelLayerInfo:"esri/layers/support/LevelLayerInfo",lighting:"esri/webscene/Lighting",lineSymbol3D:"esri/symbols/LineSymbol3D",lineSymbol3DLayer:"esri/symbols/LineSymbol3DLayer",lineOfSightLayer:"esri/layers/LineOfSightLayer",lineOfSightObserver:"esri/analysis/LineOfSightAnalysisObserver",lineOfSightTarget:"esri/analysis/LineOfSightAnalysisTarget",lod:"esri/layers/support/LOD",mapFloorInfo:"esri/support/MapFloorInfo",mapServiceLayer:"esri/layers/MapImageLayer",material:"esri/symbols/support/Symbol3DMaterial",materialColorMixMode:"esri/symbols/support/Symbol3DFillMaterial",mediaInfo_chart:"esri/popup/content/BarChartMediaInfo",mediaInfo_chart_value:"esri/popup/content/support/ChartMediaInfoValue",mediaInfo_image:"esri/popup/content/ImageMediaInfo",mediaInfo_image_value:"esri/popup/content/support/ImageMediaInfoValue",meshSymbol3D:"esri/symbols/MeshSymbol3D",mosaicRule:"esri/layers/support/MosaicRule",multidimensionalDefinition:"esri/layers/support/DimensionalDefinition",multipoint_geometry:"esri/geometry/Multipoint",navigationConstraint:"esri/ground/NavigationConstraint",objectSymbol3DLayer:"esri/symbols/ObjectSymbol3DLayer",objectSymbol3DLayer_resource:"esri/symbols/support/ObjectSymbol3DLayerResource",ogcFeatureLayer:"esri/layers/OGCFeatureLayer",openStreetMapLayer:"esri/layers/OpenStreetMapLayer",relatedRecordsInfoFieldOrder:"esri/popup/support/RelatedRecordsInfoFieldOrder",attachmentsOrderByInfo:"esri/popup/support/AttachmentsOrderByInfo",outline:"esri/symbols/support/Symbol3DOutline",pathSymbol3DLayer:"esri/symbols/PathSymbol3DLayer",point_geometry:"esri/geometry/Point",pointCloudBitfieldFilter:"esri/layers/pointCloudFilters/PointCloudBitfieldFilter",pointCloudClassBreaksRenderer:"esri/renderers/PointCloudClassBreaksRenderer",pointCloudFixedSizeAlgorithm:"esri/renderers/support/pointCloud/PointSizeFixedSizeAlgorithm",pointCloudLayer:"esri/layers/PointCloudLayer",pointCloudReturnFilter:"esri/layers/pointCloudFilters/PointCloudReturnFilter",pointCloudRGBRenderer:"esri/renderers/PointCloudRGBRenderer",pointCloudSplatAlgorithm:"esri/renderers/support/pointCloud/PointSizeSplatAlgorithm",pointCloudStretchRenderer:"esri/renderers/PointCloudStretchRenderer",pointCloudUniqueValueRenderer:"esri/renderers/PointCloudUniqueValueRenderer",pointCloudValueFilter:"esri/layers/pointCloudFilters/PointCloudValueFilter",pointSymbol3D:"esri/symbols/PointSymbol3D",polygon_geometry:"esri/geometry/Polygon",polygonPattern:"esri/symbols/patterns/StylePattern3D",polygonSymbol3D:"esri/symbols/PolygonSymbol3D",polyline_geometry:"esri/geometry/Polyline",popupElement_attachments:"esri/popup/content/AttachmentsContent",popupElement_fields:"esri/popup/content/FieldsContent",popupElement_media:"esri/popup/content/MediaContent",popupElement_text:"esri/popup/content/TextContent",popupExpressionInfo:"esri/popup/ExpressionInfo",popupInfo:"esri/PopupTemplate",popupLayerOptions:"esri/popup/LayerOptions",presentation:"esri/webscene/Presentation",queryTableDataSource:"esri/layers/support/source/QueryTableDataSource",range_domain:"esri/layers/support/RangeDomain",rangeInfo:"esri/layers/support/RangeInfo",rasterColormapRenderer:"esri/renderers/RasterColormapRenderer",rasterDataSource:"esri/layers/support/source/RasterDataSource",rasterShadedReliefRenderer:"esri/renderers/RasterShadedReliefRenderer",rasterStretchRenderer:"esri/renderers/RasterStretchRenderer",relatedRecordsInfo:"esri/popup/RelatedRecordsInfo",rendererLegendOptions:"esri/renderers/support/RendererLegendOptions",renderingRule:"esri/layers/support/RasterFunction",rotationInfo_visualVariable:"esri/renderers/visualVariables/RotationVariable",sceneLayer:"esri/layers/SceneLayer",search:"esri/webdoc/applicationProperties/Search",search_layer:"esri/webdoc/applicationProperties/SearchLayer",search_layer_field:"esri/webdoc/applicationProperties/SearchLayerField",simpleRenderer:"esri/renderers/SimpleRenderer",siteLayerInfo:"esri/layers/support/SiteLayerInfo",sizeInfo_visualVariable:"esri/renderers/visualVariables/SizeVariable",sizeStop:"esri/renderers/visualVariables/support/SizeStop",sketchEdges:"esri/symbols/edges/SketchEdges3D",slide:"esri/webscene/Slide",slide_ground:"esri/webscene/support/SlideGround",solidEdges:"esri/symbols/support/SolidEdges3D",spatialReference:"esri/geometry/SpatialReference",styleSymbolReference:"esri/symbols/WebStyleSymbol",tableDataSource:"esri/layers/support/source/TableDataSource",textSymbol3DLayer:"esri/symbols/TextSymbol3DLayer",thumbnail:"esri/webdoc/support/Thumbnail",tiledElevationLayer:"esri/layers/ElevationLayer",tiledImageServiceLayer:"esri/layers/ImageryTileLayer",tiledMapServiceLayer:"esri/layers/TileLayer",tileInfo:"esri/layers/support/TileInfo",title:"esri/webscene/support/Title",transparencyInfo_visualVariable:"esri/renderers/visualVariables/OpacityVariable",transparencyStop:"esri/renderers/visualVariables/support/OpacityStop",transportationNetwork:"esri/webscene/TransportationNetwork",uniqueValueInfo:"esri/renderers/support/UniqueValueInfo",uniqueValueRenderer:"esri/renderers/UniqueValueRenderer",vectorTileLayer:"esri/layers/VectorTileLayer",verticalOffset:"esri/symbols/support/Symbol3DVerticalOffset",viewing:"esri/webdoc/applicationProperties/Viewing",viewpoint:"esri/Viewpoint",visibleLayer:"esri/webscene/support/SlideVisibleLayer",visualVariableLegendOptions:"esri/renderers/visualVariables/support/VisualVariableLegendOptions",voxelOpacityStop:"esri/layers/voxel/VoxelOpacityStop",voxelColorStop:"esri/layers/voxel/VoxelColorStop",voxelDynamicSection:"esri/layers/voxel/VoxelDynamicSection",voxelIsosurfaceStyle:"esri/layers/voxel/VoxelIsosurface",voxelLayer:"esri/layers/VoxelLayer",voxelRangeFilter:"esri/layers/voxel/VoxelRangeFilter",voxelSection:"esri/layers/voxel/VoxelSection",voxelShading:"esri/layers/voxel/VoxelSimpleShading",voxelSlice:"esri/layers/voxel/VoxelSlice",voxelStyle:"esri/layers/voxel/VoxelStyle",voxelTransferFunctionStyle:"esri/layers/voxel/VoxelTransferFunctionStyle",voxelUniqueValue:"esri/layers/voxel/VoxelUniqueValue",voxelVariableStyle:"esri/layers/voxel/VoxelVariableStyle",voxelVolumeStyle:"esri/layers/voxel/VoxelVolumeStyle",waterSymbol3DLayer:"esri/symbols/WaterSymbol3DLayer",webTiledLayer:"esri/layers/WebTileLayer",wfsLayer:"esri/layers/WFSLayer",wmsLayer:"esri/layers/WMSLayer",wmsLayer_layer:"esri/layers/support/WMSSublayer",wmtsInfo:"esri/layers/support/WMTSLayerInfo"},r=["baseMapLayer","buildingSceneLayer_filterMode","buildingSceneLayer_sublayer","classBreakInfo_authoringInfo","clippingArea","codedValue_domain","codedValue","color","colorRamp","customParameters","dataSource","definitionEditor","domain","drawingInfo","edges","elevationLayers","environment_background_color","feature","featureSet","field_authoringInfo","fieldInfo","floorFilter","format","geometry","inherited_domain","initialState","input","joinTableDataSource","kmlLayer","layerDefinition","locationInfo","mapRangeInfo","mediaInfo_chart_value","mediaInfo_chart","mediaInfo_image_value","mediaInfo","multidimensionalDefinition","navigationConstraint","operationalLayers","orderByFields","parameter","pointCloudFilter","pointCloudRenderers","pointSizeAlgorithm","popupElement","popupExpressionInfo","queryTableDataSource","range_domain","range","rasterClassBreaksRenderer","rasterDataElevationLayer","rasterDataLayer","rasterDataSource","rasterRenderers","rasterStretchRenderer","rasterUniqueValueRenderer","relatedRecordsInfo","renderer","source","styleOrigin","symbol3D","table","tableDataSource","template","transportationNetwork","type","uniqueValueFromStyleRenderer","value","version","visibleLayer","visualVariable","visualVariableLegendOptions","voxelLayerDefinition","wfsInfo","widgets"];export{r as ignoredSchemaDefinitions,e as schemaToClassModule};
|
|
5
|
+
export{scan as scanSpec}from"./spec.js";export{scan as scanAPI}from"./api.js";export{collectClassPaths,flatten}from"./utils.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{json as t}from"../../portal/schemas/webScene.js";import{ScanContext as r,sorted as n}from"./utils.js";function s(e,t){if(t.properties){if("layerType"in t.properties)return t.properties.layerType.enum[0];if("type"in t.properties&&t.properties.type.enum)return t.properties.type.enum[0]}switch(e){case"multipoint_geometry_schema.json":return"multipoint";case"point_geometry_schema.json":return"point";case"polyline_geometry_schema.json":return"polyline";case"polygon_geometry_schema.json":return"polygon";case"extent_schema.json":return"extent"}}function i(e){return"array"===e.type?`${i(e.items)}[]`:e.type}function a(e){const t={count:e.length,refsCount:0,typesCount:0,distinctTypes:[],type:null},r=new Set;for(const n in e){const s=e[n];s.$ref?t.refsCount++:s.type&&(t.typesCount++,r.add(i(s)))}return r.forEach((e=>t.distinctTypes.push(e))),t.distinctTypes.sort(),t.refsCount===t.count?t.type="refs":2===t.count&&t.refsCount>0&&1===t.distinctTypes.length&&"null"===t.distinctTypes[0]?t.type="refsAndNull":t.typesCount===t.count?(t.type="types",t.distinctTypes=t.distinctTypes):t.type="mix",t}function o(e,t){const r=t.stack[t.stack.length-1],n=t.definitions[r.klass.name];return n?.required&&n.required.includes(e.replace("[]",""))}function c(e){return"array"===e.type||!("properties"in e)}function l(e,t,r){if(!r.hasFilteredProperties)return`${e}--${t}`;return`${e}--${t}--${r.filteredPropertiesArray.join("/")}`}async function u(e,t,r,n,i){i.schemaStack.push(e);const a=s(e,r),u=n?n.replace("<?TYPE?>",a?`<${a}>`:""):"";if(c(r)){const n=i.currentClass?null:{type:e,name:e,id:`${e}--${t}`,typeValue:t,properties:[]};return n&&i.push(null,n),await T(r,u,i),i.schemaStack.pop(),n}const p=l(e,t,i),f="drawingInfo_schema.json"!==e&&"layer_schema.json"!==e&&i.seen.get(p);if(f&&u)return i.addProperty({name:u,type:f,required:o(u,i)}),i.schemaStack.pop(),f;const h={type:e,name:e,id:p,typeValue:t,properties:[]};return u&&i.addProperty({name:u,type:h,required:o(u,i)}),i.push(u,h),await T(r,"",i),i.schemaStack.pop(),i.pop()}async function p(e,t,r){const n=await r.requestSchema(e.$ref),s=L(n.schema);if(s){for(const e of s){const s={...n.schema};s.properties={...s.properties,type:{type:"string",enum:[e]}};const i=t&&!t.includes("<?TYPE?>")?`${t}<?TYPE?>`:t;await u(n.schemaId,e,s,i,r)}return}const i="layer_schema.json"===n.schemaId&&r.schemaStack.length?r.schemaStack[r.schemaStack.length-1].replace(/_schema\.json/,""):null;await u(n.schemaId,i,n.schema,t,r)}function f(e,t){if(!m(e))return!1;const r=e.stack.map((e=>e.klass.type)).join("/");return/.*pointCloudLayer_schema\.json\/layerDefinition_schema\.json\/drawingInfo_schema\.json$/.test(r)&&"renderer"===t}function h(e,t){if(!y(e)&&!d(e))return!1;const r=e.stack.map((e=>e.klass.type)).join("/");return(/.*(imageServiceLayer|tiledImageServiceLayer|wcsLayer)_schema\.json\/(layerDefinition|rasterLayerDefinition)_schema\.json\/rasterDrawingInfo_schema\.json$/.test(r)||/.*rasterPresetRenderer_schema\.json$/.test(r))&&"renderer"===t}function m(e){return!!e.currentClass&&"drawingInfo_schema.json"===e.currentClass.name}function y(e){return!!e.currentClass&&"rasterDrawingInfo_schema.json"===e.currentClass.name}function d(e){return!!e.currentClass&&"rasterPresetRenderer_schema.json"===e.currentClass.name}function _(e){switch(e.schemaStack[e.schemaStack.length-1]){case"operationalLayers_schema.json":case"elevationLayers_schema.json":case"baseMapLayer_schema.json":return!0}return!1}const w=/raster.*Renderer|vectorFieldRenderer/,j=/(uniqueValueRenderer|classBreaksRenderer|raster.*Renderer|vectorFieldRenderer)/,$=/(rasterUniqueValueRenderer|rasterClassBreaksRenderer)/;function g(e,t,r){if(m(r)||y(r)||d(r)){const n=f(r,t),s=h(r,t);return e.filter((e=>{if(/uniqueValueFromStyleRenderer_schema\.json$/.test(e.$ref))return!1;if(s)return j.test(e.$ref)&&!$.test(e.$ref);if(w.test(e.$ref))return!1;const t=/pointCloud.*Renderer/.test(e.$ref);return n===t}))}if(_(r)){const t=["kmlLayer","rasterDataElevationLayer","rasterDataLayer","object3DTilesLayer"];return e.filter((e=>!t.some((t=>e.$ref.replace(/.*\//,"")===`${t}_schema.json`))))}return e}async function P(e,t,r){await T(e.items,`${t}[]`,r)}async function S(e,t,r){for(const n in e.properties)if(!("webscene_schema.json"===r.currentClass?.name&&"mapRangeInfo"===n||"baseMap_schema.json"===r.currentClass?.name&&"elevationLayers"===n)){if(m(r)){const e=r.stack.map((e=>e.klass.type)).join("/");if(/imageServiceLayer|tiledImageServiceLayer/.test(e)&&"transparency"===n)continue}await r.withFilter(n,(async()=>{const s=t?`${t}.${n}`:n;await T(e.properties[n],s,r)}))}}function k(e,t="",r=new Set){for(const n of e)if("properties"in n)for(const e in n.properties){const s=n.properties[e],i=t?`${t}.${e}`:e,a=Object.keys(s);if(0===a.length||1===a.length&&"$ref"===a[0])r.add(i);else{if(1!==a.length||"allOf"!==a[0])throw new Error(`unexpected allOf filter construct: ${JSON.stringify(s)}`);r.add(i),k(s.allOf,i,r)}}return r}async function R(e,t,r){let n=null;for(const i of e.allOf)if("$ref"in i){if(n)throw new Error("Cannot process more than 1 ref in an allOf construct");n=i}else if(!("properties"in i))throw new Error("allOf construct only allows simple top-level property filters");const s=k(e.allOf);await r.addFilter(s,(()=>p(n,t,r)))}async function C(e,t,r){const s=a(e.oneOf);if("refs"!==s.type&&"refsAndNull"!==s.type)if("types"!==s.type)for(const n in e.oneOf){const s=`.oneOf[${n}]`;await T(e.oneOf[n],`${t}${s}`,r)}else r.addProperty({name:t,type:n(s.distinctTypes).join("|"),required:o(t,r)});else{const n=g(e.oneOf,t,r);for(const e of n)if("null"===e.type);else{const s=`${t||""}`+(1!==n.length?"<?TYPE?>":"");await T(e,s,r)}}}function L(e){if("layerDefinition"===e.title)return null;const t=e.properties?.type;return t?.enum?t.enum:null}async function q(e,t,r){await p(e,t,r)}async function O(e,t,r){let s="unknown";e.type&&(s=Array.isArray(e.type)?n(e.type).join("|"):e.type.replaceAll(" ","").split(",").join("|"));const i={name:t,type:s,default:e.default,required:o(t,r)};e.enum&&(i.enum=n(e.enum).map((e=>"string"==typeof e?`"${e}"`:`${e}`)).join("|")),r.addProperty(i)}async function T(e,t,r){return"array"===e.type?P(e,t,r):"properties"in e?S(e,t,r):"allOf"in e?R(e,t,r):"oneOf"in e?C(e,t,r):"$ref"in e?q(e,t,r):O(e,t,r)}const b="#/definitions/";function E(e){return 0===e.indexOf(b)?e.slice(b.length):e}async function I(e,t){const r=await v.create(e,t);return u(`${e||"webscene"}_schema.json`,null,r.schemaRoot,null,r)}class v extends r{constructor(e,t,r){super(),this.definitions=e,this.schemaRoot=t,this.requestSchema=r,this._filteredProperties=null,this.schemaStack=[],this.requestSchema.bind(this)}get hasFilteredProperties(){return
|
|
5
|
+
import e from"../../core/Error.js";import{json as t}from"../../portal/schemas/webScene.js";import{ScanContext as r,sorted as n}from"./utils.js";function s(e,t){if(t.properties){if("layerType"in t.properties)return t.properties.layerType.enum[0];if("type"in t.properties&&t.properties.type.enum)return t.properties.type.enum[0]}switch(e){case"multipoint_geometry_schema.json":return"multipoint";case"point_geometry_schema.json":return"point";case"polyline_geometry_schema.json":return"polyline";case"polygon_geometry_schema.json":return"polygon";case"extent_schema.json":return"extent"}}function i(e){return"array"===e.type?`${i(e.items)}[]`:e.type}function a(e){const t={count:e.length,refsCount:0,typesCount:0,distinctTypes:[],type:null},r=new Set;for(const n in e){const s=e[n];s.$ref?t.refsCount++:s.type&&(t.typesCount++,r.add(i(s)))}return r.forEach((e=>t.distinctTypes.push(e))),t.distinctTypes.sort(),t.refsCount===t.count?t.type="refs":2===t.count&&t.refsCount>0&&1===t.distinctTypes.length&&"null"===t.distinctTypes[0]?t.type="refsAndNull":t.typesCount===t.count?(t.type="types",t.distinctTypes=t.distinctTypes):t.type="mix",t}function o(e,t){const r=t.stack[t.stack.length-1],n=t.definitions[r.klass.name];return n?.required&&n.required.includes(e.replace("[]",""))}function c(e){return"array"===e.type||!("properties"in e)}function l(e,t,r){if(!r.hasFilteredProperties)return`${e}--${t}`;return`${e}--${t}--${r.filteredPropertiesArray.join("/")}`}async function u(e,t,r,n,i){i.schemaStack.push(e);const a=s(e,r),u=n?n.replace("<?TYPE?>",a?`<${a}>`:""):"";if(c(r)){const n=i.currentClass?null:{type:e,name:e,id:`${e}--${t}`,typeValue:t,properties:[]};return n&&i.push(null,n),await T(r,u,i),i.schemaStack.pop(),n}const p=l(e,t,i),f="drawingInfo_schema.json"!==e&&"layer_schema.json"!==e&&i.seen.get(p);if(f&&u)return i.addProperty({name:u,type:f,required:o(u,i)}),i.schemaStack.pop(),f;const h={type:e,name:e,id:p,typeValue:t,properties:[]};return u&&i.addProperty({name:u,type:h,required:o(u,i)}),i.push(u,h),await T(r,"",i),i.schemaStack.pop(),i.pop()}async function p(e,t,r){const n=await r.requestSchema(e.$ref),s=L(n.schema);if(s){for(const e of s){const s={...n.schema};s.properties={...s.properties,type:{type:"string",enum:[e]}};const i=t&&!t.includes("<?TYPE?>")?`${t}<?TYPE?>`:t;await u(n.schemaId,e,s,i,r)}return}const i="layer_schema.json"===n.schemaId&&r.schemaStack.length?r.schemaStack[r.schemaStack.length-1].replace(/_schema\.json/,""):null;await u(n.schemaId,i,n.schema,t,r)}function f(e,t){if(!m(e))return!1;const r=e.stack.map((e=>e.klass.type)).join("/");return/.*pointCloudLayer_schema\.json\/layerDefinition_schema\.json\/drawingInfo_schema\.json$/.test(r)&&"renderer"===t}function h(e,t){if(!y(e)&&!d(e))return!1;const r=e.stack.map((e=>e.klass.type)).join("/");return(/.*(imageServiceLayer|tiledImageServiceLayer|wcsLayer)_schema\.json\/(layerDefinition|rasterLayerDefinition)_schema\.json\/rasterDrawingInfo_schema\.json$/.test(r)||/.*rasterPresetRenderer_schema\.json$/.test(r))&&"renderer"===t}function m(e){return!!e.currentClass&&"drawingInfo_schema.json"===e.currentClass.name}function y(e){return!!e.currentClass&&"rasterDrawingInfo_schema.json"===e.currentClass.name}function d(e){return!!e.currentClass&&"rasterPresetRenderer_schema.json"===e.currentClass.name}function _(e){switch(e.schemaStack[e.schemaStack.length-1]){case"operationalLayers_schema.json":case"elevationLayers_schema.json":case"baseMapLayer_schema.json":return!0}return!1}const w=/raster.*Renderer|vectorFieldRenderer/,j=/(uniqueValueRenderer|classBreaksRenderer|raster.*Renderer|vectorFieldRenderer)/,$=/(rasterUniqueValueRenderer|rasterClassBreaksRenderer)/;function g(e,t,r){if(m(r)||y(r)||d(r)){const n=f(r,t),s=h(r,t);return e.filter((e=>{if(/uniqueValueFromStyleRenderer_schema\.json$/.test(e.$ref))return!1;if(s)return j.test(e.$ref)&&!$.test(e.$ref);if(w.test(e.$ref))return!1;const t=/pointCloud.*Renderer/.test(e.$ref);return n===t}))}if(_(r)){const t=["kmlLayer","rasterDataElevationLayer","rasterDataLayer","object3DTilesLayer"];return e.filter((e=>!t.some((t=>e.$ref.replace(/.*\//,"")===`${t}_schema.json`))))}return e}async function P(e,t,r){await T(e.items,`${t}[]`,r)}async function S(e,t,r){for(const n in e.properties)if(!("webscene_schema.json"===r.currentClass?.name&&"mapRangeInfo"===n||"baseMap_schema.json"===r.currentClass?.name&&"elevationLayers"===n)){if(m(r)){const e=r.stack.map((e=>e.klass.type)).join("/");if(/imageServiceLayer|tiledImageServiceLayer/.test(e)&&"transparency"===n)continue}await r.withFilter(n,(async()=>{const s=t?`${t}.${n}`:n;await T(e.properties[n],s,r)}))}}function k(e,t="",r=new Set){for(const n of e)if("properties"in n)for(const e in n.properties){const s=n.properties[e],i=t?`${t}.${e}`:e,a=Object.keys(s);if(0===a.length||1===a.length&&"$ref"===a[0])r.add(i);else{if(1!==a.length||"allOf"!==a[0])throw new Error(`unexpected allOf filter construct: ${JSON.stringify(s)}`);r.add(i),k(s.allOf,i,r)}}return r}async function R(e,t,r){let n=null;for(const i of e.allOf)if("$ref"in i){if(n)throw new Error("Cannot process more than 1 ref in an allOf construct");n=i}else if(!("properties"in i))throw new Error("allOf construct only allows simple top-level property filters");const s=k(e.allOf);await r.addFilter(s,(()=>p(n,t,r)))}async function C(e,t,r){const s=a(e.oneOf);if("refs"!==s.type&&"refsAndNull"!==s.type)if("types"!==s.type)for(const n in e.oneOf){const s=`.oneOf[${n}]`;await T(e.oneOf[n],`${t}${s}`,r)}else r.addProperty({name:t,type:n(s.distinctTypes).join("|"),required:o(t,r)});else{const n=g(e.oneOf,t,r);for(const e of n)if("null"===e.type);else{const s=`${t||""}`+(1!==n.length?"<?TYPE?>":"");await T(e,s,r)}}}function L(e){if("layerDefinition"===e.title)return null;const t=e.properties?.type;return t?.enum?t.enum:null}async function q(e,t,r){await p(e,t,r)}async function O(e,t,r){let s="unknown";e.type&&(s=Array.isArray(e.type)?n(e.type).join("|"):e.type.replaceAll(" ","").split(",").join("|"));const i={name:t,type:s,default:e.default,required:o(t,r)};e.enum&&(i.enum=n(e.enum).map((e=>"string"==typeof e?`"${e}"`:`${e}`)).join("|")),r.addProperty(i)}async function T(e,t,r){return"array"===e.type?P(e,t,r):"properties"in e?S(e,t,r):"allOf"in e?R(e,t,r):"oneOf"in e?C(e,t,r):"$ref"in e?q(e,t,r):O(e,t,r)}const b="#/definitions/";function E(e){return 0===e.indexOf(b)?e.slice(b.length):e}async function I(e,t){const r=await v.create(e,t);return u(`${e||"webscene"}_schema.json`,null,r.schemaRoot,null,r)}class v extends r{constructor(e,t,r){super(),this.definitions=e,this.schemaRoot=t,this.requestSchema=r,this._filteredProperties=null,this.schemaStack=[],this.requestSchema.bind(this)}get hasFilteredProperties(){return(this._filteredProperties?.size??0)>0}get filteredPropertiesArray(){const e=[];return this._filteredProperties?.forEach((t=>e.push(t))),e}async withFilter(e,t){if(!this.hasFilteredProperties)return t();if(!this._filteredProperties?.has(e))return;const r=this._filteredProperties;this._filteredProperties=null;const n=e=>{this._filteredProperties||(this._filteredProperties=new Set),this._filteredProperties.add(e)};r.forEach((t=>{const r=t.split(".",2);r.length>1&&r[0]===e&&n(r[1])})),await t(),this._filteredProperties=r}async addFilter(e,t){const r=this._filteredProperties;this._filteredProperties=null;const n=e=>{this._filteredProperties||(this._filteredProperties=new Set),this._filteredProperties.add(e)};r&&r.forEach(n),e&&e.forEach(n);const s=await t();return this._filteredProperties=r,s}static async create(e,t){return t?.useRemoteSchema?v.createRemote(e,t?.baseUrl):v.createLocal(e)}static createLocal(e){const r=e&&"webscene"!==e?t.definitions[`${e}_schema.json`]:t;return new v(t.definitions,r,v._getLocalSchemaRequest())}static async createRemote(e,t){const r=await v._getRemoteSchemaRequest(t),n=new v({},null,r),s=(await n.requestSchema(`${e||"webscene"}_schema.json`)).schema;return new v(n.definitions,s,r)}static _getLocalSchemaRequest(){return function(t){const r=E(t),n=this.definitions[r];return n?Promise.resolve({schemaId:r,schema:n}):Promise.reject(new e("spec-certification:spec-invalid-local-schema","Schema reference is not a local reference"))}}static async _getRemoteSchemaRequest(t){if(!t)return Promise.reject(new e("spec-certification:spec-missing-base-url","The base url of the remote schema directory must be specified when using a remote schema"));const r=v._getLocalSchemaRequest(),n=(await import("../../request.js")).default;return function(e){return r.call(this,e).catch((()=>n(`${t}/${e}`,{responseType:"json"}).then((t=>(this.definitions[E(e)]=t.data,{schemaId:e,schema:t.data})))))}}}const F=Object.keys(t.definitions).map((e=>e.replace(/_schema\.json$/,"")));export{I as scan,F as schemaDefinitions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function
|
|
5
|
+
function e(e){return t(e,"",new Set,new Map)}function t(e,s,n,r){if(n.has(e))return r;n.add(e),s&&e.id&&r.set(s,e);for(const a of e.properties)if("string"!=typeof a.type){const e=s?`${s}.${a.name}`:a.name;t(a.type,e,n,r)}return n.delete(e),r}function s(e){const t=n(e,"",[]);return t.sort(((e,t)=>(e.name??"").localeCompare(t.name??""))),t}function n(e,t,s){for(const r of e.properties){const e=t?`${t}.${r.name}`:r.name;"string"==typeof r.type?s.push({name:e,type:r.type,default:r.default,enum:r.enum}):0===r.type.properties.length?s.push({name:e,type:"unknown",default:r.default,enum:r.enum}):n(r.type,e,s)}return s}class r{constructor(){this.stack=[],this.seen=new Map,this._uniqueDeclaredClasses=new Map}[Symbol.dispose](){this.seen.clear(),this.stack.length=0,this._uniqueDeclaredClasses.clear()}getDeclaredClass(e){const{_uniqueDeclaredClasses:t}=this,s=e.prototype.declaredClass.replaceAll(".","/");let n=0;for(;;){const r=n?`${s}/${n}`:s;n++;const a=t.get(r);if(!a)return t.set(r,e),r;if(a===e)return r}}addProperty(e){this.currentClass?.properties.push(e)}push(e,t){this.seen.set(t.id,t),this.stack.push({klass:t,propertyName:e})}pop(){return this.stack.pop()?.klass??null}get currentClass(){return this.stack.length?this.stack[this.stack.length-1].klass:null}get pathString(){return this.stack.map((e=>e.propertyName)).filter((e=>!!e)).join(".")}}function a(e){const t=e.slice();return t.sort(),t}export{r as ScanContext,e as collectClassPaths,s as flatten,a as sorted};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import s from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(r.ClonableMixin(s)){constructor(){super(...arguments),this.text=""}};o([e({type:String,json:{write:{isRequired:!0}}})],p.prototype,"text",void 0),p=o([t("esri.webscene.support.Description")],p);const c=p;export{c 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Clonable.js";import r from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import p from"../SlideLegendInfo.js";import{WebSceneAnalysesCollection as i,webSceneAnalysisCollectionProperty as n}from"./analysisUtils.js";let a=class extends(s.ClonableMixin(r)){constructor(o){super(o),this.analyses=new i,this.legendInfo=null}};o([e(n("analyses"))],a.prototype,"analyses",void 0),o([e({type:p,json:{write:!0}})],a.prototype,"legendInfo",void 0),a=o([t("esri.webscene.support.SlideElements")],a);const l=a;export{l 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../views/3d/environment/SunnyWeather.js";import{weatherTypes as p}from"../../views/3d/environment/weather.js";import{lightingTypes as n}from"../lightingTypes.js";import m from"../SunLighting.js";let c=class extends(r.ClonableMixin(e)){constructor(){super(...arguments),this.lighting=new m,this.weather=new i}};o([t({types:n,json:{write:!0}})],c.prototype,"lighting",void 0),o([t({types:p,json:{write:!0}})],c.prototype,"weather",void 0),c=o([s("esri.webscene.support.SlideEnvironment")],c);export{c as SlideEnvironment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Ground.js";import t from"../../core/Clonable.js";import s from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as p}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{transparencyToOpacity as i,opacityToTransparency as a}from"../../webdoc/support/opacityUtils.js";var n;const m={type:Number,json:{type:p,name:"transparency",read:i,write:(o,r,t)=>{r[t]=a(o)}}};let u=n=class extends(t.ClonableMixin(s)){constructor(){super(...arguments),this.opacity=null}cloneAndApplyTo(o){return null==this.opacity||((o=o?.clone()??new r).opacity=this.opacity),o}static fromGround(o){return new n({opacity:o.opacity})}};o([e(m)],u.prototype,"opacity",void 0),u=n=o([c("esri.webscene.support.SlideGround")],u);const l=u;export{l 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../core/Clonable.js";import s from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as t}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";let i=class extends(o.ClonableMixin(s)){constructor(r){super(r),this.id="",this.sublayerIds=null}};r([e({type:String,json:{write:!0}})],i.prototype,"id",void 0),r([e({type:[t],json:{name:"subLayerIds",write:!0}})],i.prototype,"sublayerIds",void 0),i=r([p("esri.webscene.support.SlideVisibleLayer")],i);export{i as SlideVisibleLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import s from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(r.ClonableMixin(s)){constructor(){super(...arguments),this.text=""}};o([e({type:String,json:{write:{isRequired:!0}}})],p.prototype,"text",void 0),p=o([t("esri.webscene.support.Title")],p);const c=p;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{AnalysisOriginWebScene as s}from"../../analysis/support/AnalysisOriginWebScene.js";import t from"../../core/Collection.js";import{castForReferenceSetter as i,referenceSetter as o}from"../../core/collectionUtils.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const r=["slice"];let a=class extends t{constructor(e){super(e),this.addHandles([this.on("after-add",(e=>{this._setOrigin(e.item)})),this.on("before-remove",(e=>{const{origin:s}=e.item;"web-scene"===s?.type&&this._setOrigin(e.item,null)}))])}initialize(){for(const e of this.items)this._setOrigin(e)}_setOrigin(e,t=new s){e.origin=t}updateFrom(e){const t=e.analyses.filter((e=>c(e)));this.removeAll(),t.length&&this.addMany(t.map((e=>(e.origin=new s,e.clone()))))}applyTo(e){e.analyses.destroyMany(e.analyses.filter((({origin:e})=>"web-scene"===e?.type))),e.analyses.addMany(this.map((e=>e.clone())))}toJSON(e){return this.items.filter(c).map((s=>s.toJSON(e)))}};function l(e){return{type:a,cast:i,set(s){this._set(e,o(s,this._get(e),a))},json:{read(s,t,i){i?.hooks?.onAfterLoad((()=>p(this[e],s,i)))},write:{overridePolicy:e=>({enabled:e.length>0})}}}}function c(e){return r.includes(e.type)&&e.valid}async function p(e,s,t){if(!s)return;const i=await Promise.allSettled(s.map((e=>m(e,t))));for(const o of i)"fulfilled"===o.status&&e.add(o.value)}async function m(e,s){const t=new(await d[e.type]());return t.read(e,s),t}a=e([n("esri.webscene.support.analysisUtils.WebSceneAnalysesCollection")],a);const d={slice:async()=>{const{default:e}=await import("../../analysis/SliceAnalysis.js");return e}};export{a as WebSceneAnalysesCollection,l as webSceneAnalysisCollectionProperty,d as webSceneAnalysisRegistry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{whenOrAbort as a}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{DateOnly as u}from"../../../core/sql/DateOnly.js";import{TimeOnly as c}from"../../../core/sql/TimeOnly.js";import{makeUseId as p}from"../inputs/support/inputUtils.js";import{isGroupElementTemplate as d,isFieldElementTemplate as f}from"../templates/support/templateUtils.js";let m=null
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{whenOrAbort as a}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{DateOnly as u}from"../../../core/sql/DateOnly.js";import{TimeOnly as c}from"../../../core/sql/TimeOnly.js";import{makeUseId as p}from"../inputs/support/inputUtils.js";import{isGroupElementTemplate as d,isFieldElementTemplate as f}from"../templates/support/templateUtils.js";let m=null,h=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new i,this.expressionEvaluationFailed=!1}abort(){this._abortController.abort()}async runAllExpressions(e,t=!1){this.calculating=!0;try{const r=[];for(const s of e){const e=this.layerExpressionsModelMap.get(s.layer);if(!e||0===e.components.length)continue;const o=new Set;r.push(this.evaluateAffectedComponents(e.components,s,e,t,o))}await a(Promise.all(r),this._abortController)}catch(r){s.getLogger(this).error(r),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async valueChanged(e,t,r=!0){try{this.calculating=!0;const s=t.map((t=>this.evaluateValueChangedForFeature(e,t,r)));await Promise.all(s)}catch(o){s.getLogger(this).error(o),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async evaluateValueChangedForFeature(e,t,r){if(this._abortController.signal.aborted)return;const s=this.layerExpressionsModelMap.get(t.layer);if(!s||0===s.components.length)return;const o=new Set,a=new Set([e]),i=new Set;for(;a.size>0;){const[e]=a;if(a.delete(e),o.has(e))continue;o.add(e);const n=s.fieldReferencesMap.get(e.toLowerCase());if(!n)continue;for(const t of n)i.has(t)&&n.delete(t);if(0===n.size)continue;const l=new Set;await this.evaluateAffectedComponents([...n],t,s,r,l);for(const t of n)i.add(t);for(const t of l)o.has(t)||a.add(t)}}async evaluateAffectedComponents(e,t,r,s,o){const a=new Map;for(const n of e)a.has(n)||a.set(n,this.createSccEvaluator(n,t,a,r));if(0===a.size)return;const i=[...a.values()].map((e=>e.evaluate(s,o)));await Promise.all(i)}createSccEvaluator(e,t,r,s){const a=new g(e,t,this.arcadeContext,s,this.evaluatedExpressions,this._abortController);for(const i of e.adjacencyList)a.dependentEvaluators.push(o(r,i,(()=>this.createSccEvaluator(i,t,r,s))));return a}};e([n()],h.prototype,"calculating",void 0),e([n({constructOnly:!0})],h.prototype,"arcadeContext",void 0),e([n()],h.prototype,"_abortController",void 0),e([n()],h.prototype,"layerExpressionsModelMap",void 0),e([n()],h.prototype,"evaluatedExpressions",void 0),e([n()],h.prototype,"expressionEvaluationFailed",void 0),h=e([l("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],h);class g{constructor(e,t,r,s,o,a){this.scc=e,this.feature=t,this.arcadeContextInfo=r,this.expressionsModel=s,this.evaluatedExpressions=o,this._abortController=a,this.dependentEvaluators=[],this._evaluatorPromise=null}get baseContext(){const{editType:e,map:t,spatialReference:r,timeZone:s}=this.arcadeContextInfo,o=this.feature.layer,a="scene"===o?.type&&null!=o.associatedLayer?o.associatedLayer:o;return{variables:{$originalfeature:this.feature.original.clone(),$editcontext:{editType:e},$layer:a,$featureset:a,$datastore:a?.url,$feature:this.feature.plainGraphic.clone(),$map:t},executeContext:{rawOutput:!0,spatialReference:r??void 0,timeZone:s,abortSignal:this._abortController.signal}}}evaluate(e,t){return null==this._evaluatorPromise&&(this._evaluatorPromise=this._evaluate(e,t)),this._evaluatorPromise}async _evaluate(e,t){null===m&&(m=await import("../../../arcade/languageUtils.js"));const s=this.dependentEvaluators.map((r=>r.evaluate(e,t)));await a(Promise.all(s),this._abortController);for(const a of this.scc.executors){const s=this.baseContext;if(this._abortController.signal.aborted)break;const l=this.expressionsModel.arcadeExecutorUses.get(a)??[],u=o(this.evaluatedExpressions,this.feature,(()=>new i));let c=null,m=null;try{c=a.isAsync?await a.executeAsync(s.variables,s.executeContext):a.execute(s.variables,s.executeContext),m={result:c,status:"success"}}catch(n){m={error:n,status:"error"}}for(const r of l){const s=this.expressionsModel.elementTemplateMap.get(r.elementId);switch(r.executorPurpose){case"editable":case"required":u.set(p(r.elementId,r.executorPurpose),m);break;case"value":{if("error"===m?.status)continue;const e=s.getExpressionExecutorsForLayer(this.feature.layer);let r=!0;if(e?.editableExpression&&(r=!1===u.get(p(s.elementId,"editable"))?.result),r){const e=this.feature.getAttribute(s.fieldName)??null,r=y(m.result,this.feature,s.fieldName,this.arcadeContextInfo.timeZone);r!==e&&(this.feature.setAttribute(s.fieldName,r),t.add(s.fieldName))}}break;case"visibility":if(u.set(p(r.elementId,r.executorPurpose),m),!this.expressionsModel.preserveFieldValuesWhenHidden&&!1===m.result&&e)if(d(s)){for(const e of s.elements)if(f(e)){null!==this.feature.getAttribute(e.fieldName)&&t.add(e.fieldName),this.feature.setAttribute(e.fieldName,null)}}else if(f(s)){null!==this.feature.getAttribute(s.fieldName)&&t.add(s.fieldName),this.feature.setAttribute(s.fieldName,null)}}}if("error"===m?.status){const e=new Set;for(const t of l){const r=this.expressionsModel.elementTemplateMap.get(t.elementId);if(r)switch(t.executorPurpose){case"editable":e.add(r.label+" - Editable expression");break;case"required":e.add(r.label+" - Required expression");break;case"value":e.add(r.label+" - Value expression");break;case"visibility":e.add(r.label+" - Visibility expression")}}if(e.size>0)throw new r("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")");throw new r("expression-evaluation-failed","Arcade evaluation failed ")}}}}function y(e,t,s,o){if(null===e)return null;const a=t.layer.fieldsIndex.get(s);if(!a)throw new r("field-not-found","Unable set field value as the field cannot be found. ("+s+")");switch(a.type){case"big-integer":case"integer":case"long":case"oid":case"small-integer":case"single":case"double":return m.toNumber(e);case"global-id":case"guid":case"string":return m.toString(e);case"date":{if(m.isDate(e))return e.getTime();const t=m.toDate(e,o);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+s+")");return t.getTime()}case"date-only":{if(m.isDateOnly(e))return e.toStorageFormat();if(m.isDate(e))return u.fromDateTime(e.toDateTime()).toStorageFormat();const t=u.fromString(m.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageFormat()}case"time-only":{if(m.isTime(e))return e.toStorageString();if(m.isDate(e)){return c.fromDateTime(e.toDateTime()).toStorageString()}const t=c.fromString(m.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageString()}case"timestamp-offset":{if(m.isDate(e))return e.toISOString(!1);const t=m.toDate(e,o);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+s+")");return t.toISOString(!1)}}throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+s+")")}export{h as ExpressionsManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{getDisplayedSymbol as I}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as V}from"../../views/draw/support/helpMessageUtils.js";import k from"../../views/draw/support/HighlightHelper.js";import S from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as A}from"../../views/support/HighlightDefaults.js";import E from"./CreateFeaturesWorkflowData.js";import{isModelUpload as P,handleModelUpload as T}from"./modelUploadUtils.js";import H from"./Workflow.js";import{createToolFromGeometryType as j,getServiceEditsFromWorkflowData as U,getServiceInfoForLayer as L,orderEditsByRelationshipDependencies as x,getFullTemplateForCreationInfo as O,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as z,isTerminalUpdateEventType as G,getVisualVariableAttributes as N,startUpdatingFeatureGeometry as K,createWorkflowSteps as Z,avoidFeatureTemplateSelectionWithOnlyOneItem as q,getCreationAttributes as B,setRelationshipFields as J,prepareAttachmentsForCreateFeaturesWorkflow as Q,showProgressCursor as X,setUpSketchCreateWatchers as Y,setVisualVariablesAndElevationInfoForUpdate as $,visualVariableInteractiveUpdate as ee}from"./workflowUtils.js";import te from"../FeatureForm/FeatureFormViewModel.js";import ae from"../Sketch/SketchViewModel.js";var ie;const re=Symbol(),se=Symbol(),oe=Symbol(),ne=Symbol(),le={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let de=ie=class extends H{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new te,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!P(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}const r=this._sketchViewModel.activeCreateToolDrawMode,s=this._sketchViewModel.activeTool;return V("rectangle"===s?"rectangle":"circle"===s?"circle":a,i?.geometry,r)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter((e=>this.data.isDisplayable(e))).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=j(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...le[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([oe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find((e=>this._hasValidationErrors(e)));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.layer.graphics.remove(e))}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,applyEditsFeatureServiceCallback:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new S,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new ie({data:new E({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=U(p.data),h=F(c)&&u;if(n){if(pe(s),h){let t=fe(u,l);const a=await L(o,d.view);a&&(t=x({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=me(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map((e=>{if(e?.addFeatureResults)return t(o,he(s,e.addFeatureResults,o,l))})))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,i((()=>e.opacity=t))}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await O(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(se);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({arcadeEditType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||c.activeWorkflow?.previous(),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>h.addFile(e,t))),await z(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",(async()=>{v?.updateAttributes(o.getValues()),await z(e,s,"2d"===m.type?m.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&G(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()})),u((()=>o.feature?.sourceLayer),(t=>e.sourceLayer=t)),u((()=>[o.feature,o.submittable]),(()=>this._stashValidationState()))]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchViewModel:a,data:i}=this,{creationInfo:r,viewModel:s}=i,{view:o}=s;if(!o||!r)return;const n=e.sourceLayer??r.layer;return M(n)?void 0:(this._visualVariableAttributes=N(e),K({graphic:e,sketchViewModel:a,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=Z(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(P(t)?e.addHandles(await T({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([oe,re,se,ne]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return q(a,i)}static _configureSketchViewModel(e){const{data:t}=e,a=e._webStyleCache,{creationInfo:s,viewModel:o}=t,{view:n}=o,l=e._sketchViewModel,d=[];if(!n)return i();if("2d"===n.type){s&&d.push(e._fadeExistingFeatures(s.layer));const t=c(((e,t)=>Promise.all(e.map((e=>z(e,a,t))))));d.push(u((()=>n.scale),(e=>t(l.layer.graphics,e))))}const p=B(t.fullTemplate,s?.attributeOverrides),m=u((()=>l.createGraphic),(i=>{i&&!e.hasHandles(se)&&e._updatingHandles.addPromise(Y({creationAttributes:p,data:t,sketchViewModel:l,view:n,webStyleCache:a}).then((t=>e.addHandles(t,se))))})),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(se),"cancel"===t.state&&null!==n.activeTool&&n.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===n.type?n.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e;if(a.graphics.length>1)return void await e._clearSelectedFeature();const d=a.graphics[0];if("complete"===a.state){const{submittable:t}=r;if(e.numPendingFeatures!==s?.maxFeatures&&t||r.submit(),await e._clearSelectedFeature(),"add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),!a.aborted&&n.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===a.state)return d.sourceLayer??=t.creationInfo?.layer,await $({sketchViewModel:l,graphic:d,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===a.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;await ee(n,d,a,t,e._webStyleCache);const i=d.attributes,{rotation:s,size:o}=t;if(null!=s){const{field:e}=s;r.setValue(e,i[e])}if(null!=o){const{field:e}=o;r.setValue(e,i[e])}}}},g=async a=>{if(a.graphics.forEach((e=>{t.removePendingFeature(e)})),!P(t.creationInfo))return e._startCreating()},y=async()=>{if(P(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(m,l.on("create",(t=>e._updatingHandles.addPromise(f(t)))),l.on("update",(t=>e._updatingHandles.addPromise(w(t)))),l.on("delete",(t=>e._updatingHandles.addPromise(g(t)))),h((()=>!e.numPendingFeatures),(()=>e._updatingHandles.addPromise(y()))),i((()=>{l.cancel()})),ce(l,t),...ue(t));const v=r(d);return l.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ae({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchViewModel=r,t?.map.add(a),this.addHandles([i((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})),u((()=>this.numPendingFeatures>0),(e=>this._sketchViewModel.updateOnGraphicClick=e),p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i}=this,{layerInfos:r,view:s}=a.viewModel;i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}const n=this.sketchViewModel.layer;n.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),J(u.relationships),i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await I(a,t),n.add(a)),a.sourceLayer!==e?.layer&&(e=R(r,a.sourceLayer));const s=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,s)}}i.feature=null,await m((()=>!i.updating));return u.edits.reduce(((e,t)=>e+(t.addFeatures?.length??0)),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m((()=>!s.updating)),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(oe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i((()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])})))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Q(d),f.push(u((()=>d.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const g=X(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:B(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ie._configureSketchViewModel(this)),h?(P(o)&&o.geometryToPlace&&(h.attributes=B(e.fullTemplate,o.attributeOverrides)),s.layer.add(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i((()=>{for(const t of e.pendingFeatures)s.layer.remove(t),e.removePendingFeature(t)})),k=u((()=>c?.timeZone),(e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e}),p),S=i((()=>{P(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i((()=>d.fileInfos.removeAll())),r(f),r(w),S,V,k],oe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),ne),await m((()=>null==e?.activeTool),t.signal),t.abort()}};function ce(e,t){let a=null;const s=()=>e.snappingOptions.featureSources,o=()=>(a=new C({layer:e.layer}),s().add(a),a),n=()=>{null!=a&&(s().remove(a),a=l(a))};return r([u((()=>{const e=t.creationInfo?.layer,a=s().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return n();a??=o(),a.enabled=t}),f),i(n)])}function ue(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new k({view:t});a.push(u((()=>e.selectedPendingFeature),((e,t)=>{r.remove(e),r.add(t)})),i((()=>r.destroy())))}const r=new k({view:t,highlightName:A});return a.push(u((()=>e.temporaryHighlightFeature),(e=>{r.removeAll(),r.add(e)})),i((()=>r.destroy()))),a}function he(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach((({form:e})=>r.push({feature:o,attachment:e})))}})),r}function pe(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function me(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function fe(e,t){return e.map((e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e}))}e([g()],de.prototype,"createFeatureState",void 0),e([g()],de.prototype,"data",void 0),e([g({constructOnly:!0})],de.prototype,"isNested",void 0),e([g()],de.prototype,"featureFormViewModel",null),e([g()],de.prototype,"hasPendingEdits",null),e([g()],de.prototype,"hasPreviousStep",null),e([g()],de.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],de.prototype,"helpMessage",null),e([g()],de.prototype,"layer",null),e([g()],de.prototype,"parent",null),e([g()],de.prototype,"parentLayer",null),e([g()],de.prototype,"keyboardCancellationEnabled",null),e([g()],de.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],de.prototype,"shouldShowAttachments",null),e([g()],de.prototype,"shouldAllowAttachmentEditing",null),e([g()],de.prototype,"sketchViewModel",null),e([g()],de.prototype,"availableCreateTools",null),e([g()],de.prototype,"_attachmentsActive",null),de=ie=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],de);const we=de;export{we as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{getDisplayedSymbol as I}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as V}from"../../views/draw/support/helpMessageUtils.js";import k from"../../views/draw/support/HighlightHelper.js";import S from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as A}from"../../views/support/HighlightDefaults.js";import E from"./CreateFeaturesWorkflowData.js";import{isModelUpload as P,handleModelUpload as T}from"./modelUploadUtils.js";import H from"./Workflow.js";import{createToolFromGeometryType as j,getServiceEditsFromWorkflowData as U,getServiceInfoForLayer as L,orderEditsByRelationshipDependencies as x,getFullTemplateForCreationInfo as O,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as z,isTerminalUpdateEventType as G,getVisualVariableAttributes as N,startUpdatingFeatureGeometry as K,createWorkflowSteps as Z,avoidFeatureTemplateSelectionWithOnlyOneItem as q,getCreationAttributes as B,setRelationshipFields as J,prepareAttachmentsForCreateFeaturesWorkflow as Q,showProgressCursor as X,setUpSketchCreateWatchers as Y,setVisualVariablesAndElevationInfoForUpdate as $,visualVariableInteractiveUpdate as ee}from"./workflowUtils.js";import te from"../FeatureForm/FeatureFormViewModel.js";import ae from"../Sketch/SketchViewModel.js";var ie;const re=Symbol(),se=Symbol(),oe=Symbol(),ne=Symbol(),le={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let de=ie=class extends H{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new te,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!P(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}const r=this._sketchViewModel.activeCreateToolDrawMode,s=this._sketchViewModel.activeTool;return V("rectangle"===s?"rectangle":"circle"===s?"circle":a,i?.geometry,r)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter((e=>this.data.isDisplayable(e))).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=j(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...le[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([oe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find((e=>this._hasValidationErrors(e)));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.layer.graphics.remove(e))}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,applyEditsFeatureServiceCallback:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new S,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new ie({data:new E({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=U(p.data),h=F(c)&&u;if(n){if(pe(s),h){let t=fe(u,l);const a=await L(o,d.view);a&&(t=x({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=me(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map((e=>{if(e?.addFeatureResults)return t(o,he(s,e.addFeatureResults,o,l))})))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,i((()=>e.opacity=t))}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await O(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(se);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({arcadeEditType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||c.activeWorkflow?.previous(),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>h.addFile(e,t))),await z(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",(async()=>{v?.updateAttributes(o.getValues()),await z(e,s,"2d"===m.type?m.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&G(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()})),u((()=>o.feature?.sourceLayer),(t=>e.sourceLayer=t)),u((()=>[o.feature,o.submittable]),(()=>this._stashValidationState()))]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchViewModel:a,data:i}=this,{creationInfo:r,viewModel:s}=i,{view:o}=s;if(!o||!r)return;const n=e.sourceLayer??r.layer;return M(n)?void 0:(this._visualVariableAttributes=N(e),K({graphic:e,sketchViewModel:a,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=Z(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(P(t)?e.addHandles(await T({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([oe,re,se,ne]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return q(a,i)}static _configureSketchViewModel(e){const{data:t}=e,a=e._webStyleCache,{creationInfo:s,viewModel:o}=t,{view:n}=o,l=e._sketchViewModel,d=[];if(!n)return i();if("2d"===n.type){s&&d.push(e._fadeExistingFeatures(s.layer));const t=c(((e,t)=>Promise.all(e.map((e=>z(e,a,t))))));d.push(u((()=>n.scale),(e=>t(l.layer.graphics,e))))}const p=B(t.fullTemplate,s?.attributeOverrides),m=u((()=>l.createGraphic),(i=>{i&&!e.hasHandles(se)&&e._updatingHandles.addPromise(Y({creationAttributes:p,data:t,sketchViewModel:l,view:n,webStyleCache:a}).then((t=>e.addHandles(t,se))))})),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(se),"cancel"===t.state&&null!==n.activeTool&&n.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===n.type?n.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e;if(a.graphics.length>1)return void await e._clearSelectedFeature();const d=a.graphics[0];if("complete"===a.state){const{submittable:t}=r;if(e.numPendingFeatures!==s?.maxFeatures&&t||r.submit(),await e._clearSelectedFeature(),"add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),!a.aborted&&n.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===a.state)return d.sourceLayer??=t.creationInfo?.layer,await $({sketchViewModel:l,graphic:d,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===a.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;ee(n,d,a,t)&&await z(d,e._webStyleCache,"2d"===n.type?n.scale:null);const i=d.attributes,{rotation:s,size:o}=t;if(null!=s){const{field:e}=s;r.setValue(e,i[e])}if(null!=o){const{field:e}=o;r.setValue(e,i[e])}}}},g=async a=>{if(a.graphics.forEach((e=>{t.removePendingFeature(e)})),!P(t.creationInfo))return e._startCreating()},y=async()=>{if(P(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(m,l.on("create",(t=>e._updatingHandles.addPromise(f(t)))),l.on("update",(t=>e._updatingHandles.addPromise(w(t)))),l.on("delete",(t=>e._updatingHandles.addPromise(g(t)))),h((()=>!e.numPendingFeatures),(()=>e._updatingHandles.addPromise(y()))),i((()=>{l.cancel()})),ce(l,t),...ue(t));const v=r(d);return l.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ae({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchViewModel=r,t?.map.add(a),this.addHandles([i((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})),u((()=>this.numPendingFeatures>0),(e=>this._sketchViewModel.updateOnGraphicClick=e),p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i}=this,{layerInfos:r,view:s}=a.viewModel;i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}const n=this.sketchViewModel.layer;n.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),J(u.relationships),i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await I(a,t),n.add(a)),a.sourceLayer!==e?.layer&&(e=R(r,a.sourceLayer));const s=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,s)}}i.feature=null,await m((()=>!i.updating));return u.edits.reduce(((e,t)=>e+(t.addFeatures?.length??0)),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m((()=>!s.updating)),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(oe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i((()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])})))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Q(d),f.push(u((()=>d.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const g=X(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:B(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ie._configureSketchViewModel(this)),h?(P(o)&&o.geometryToPlace&&(h.attributes=B(e.fullTemplate,o.attributeOverrides)),s.layer.add(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i((()=>{for(const t of e.pendingFeatures)s.layer.remove(t),e.removePendingFeature(t)})),k=u((()=>c?.timeZone),(e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e}),p),S=i((()=>{P(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i((()=>d.fileInfos.removeAll())),r(f),r(w),S,V,k],oe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),ne),await m((()=>null==e?.activeTool),t.signal),t.abort()}};function ce(e,t){let a=null;const s=()=>e.snappingOptions.featureSources,o=()=>(a=new C({layer:e.layer}),s().add(a),a),n=()=>{null!=a&&(s().remove(a),a=l(a))};return r([u((()=>{const e=t.creationInfo?.layer,a=s().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return n();a??=o(),a.enabled=t}),f),i(n)])}function ue(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new k({view:t});a.push(u((()=>e.selectedPendingFeature),((e,t)=>{r.remove(e),r.add(t)})),i((()=>r.destroy())))}const r=new k({view:t,highlightName:A});return a.push(u((()=>e.temporaryHighlightFeature),(e=>{r.removeAll(),r.add(e)})),i((()=>r.destroy()))),a}function he(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach((({form:e})=>r.push({feature:o,attachment:e})))}})),r}function pe(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function me(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function fe(e,t){return e.map((e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e}))}e([g()],de.prototype,"createFeatureState",void 0),e([g()],de.prototype,"data",void 0),e([g({constructOnly:!0})],de.prototype,"isNested",void 0),e([g()],de.prototype,"featureFormViewModel",null),e([g()],de.prototype,"hasPendingEdits",null),e([g()],de.prototype,"hasPreviousStep",null),e([g()],de.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],de.prototype,"helpMessage",null),e([g()],de.prototype,"layer",null),e([g()],de.prototype,"parent",null),e([g()],de.prototype,"parentLayer",null),e([g()],de.prototype,"keyboardCancellationEnabled",null),e([g()],de.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],de.prototype,"shouldShowAttachments",null),e([g()],de.prototype,"shouldAllowAttachmentEditing",null),e([g()],de.prototype,"sketchViewModel",null),e([g()],de.prototype,"availableCreateTools",null),e([g()],de.prototype,"_attachmentsActive",null),de=ie=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],de);const we=de;export{we as default};
|