@arcgis/core 5.1.0-next.91 → 5.1.0-next.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -6
- package/analysis/ShadowCast/MinDurationOptions.d.ts +17 -9
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +10 -6
- package/analysis/ShadowCastAnalysis.d.ts +23 -17
- package/assets/components/assets/combobox/t9n/messages.fr.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{adfa5c136c72c1e65770.js → 12f41c1c66fb446b6286.js} +22 -16
- package/assets/esri/core/workers/chunks/1523883460874c352e36.js +1 -0
- package/assets/esri/core/workers/chunks/{5409369d0d637cb30257.js → 172228d1a392ca7a5b21.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2c11f54255fd506655e.js → 19a0cb2d335d97ad9488.js} +1 -1
- package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js → 2647c739cda29361a463.js} +2 -2
- package/assets/esri/core/workers/chunks/34f7450769826e8b7069.js +636 -0
- package/assets/esri/core/workers/chunks/{4b9b9e6136c11d5d7901.js → 412745bfacef23e3b702.js} +1 -1
- package/assets/esri/core/workers/chunks/4df19e670b6ed76c1dea.js +2 -0
- package/assets/esri/core/workers/chunks/{ceff78c9e31e3572a082.js → 5eff240a0e41a4f80e61.js} +1 -1
- package/assets/esri/core/workers/chunks/{2dcfc4d7e76c922bcbf9.js → 6aed2e42e65ac80f1fab.js} +1 -1
- package/assets/esri/core/workers/chunks/77c2d8d0ce1c1ab469e9.js +1 -0
- package/assets/esri/core/workers/chunks/8a370cc1a99ddc7ce70b.js +1 -0
- package/assets/esri/core/workers/chunks/8a7a99533d02eb9cb058.js +2 -0
- package/assets/esri/core/workers/chunks/{90a8dfb03a437fe8a6e7.js → be47e42c6c8c0820efd8.js} +1 -1
- package/assets/esri/core/workers/chunks/c7ee05f46b26b17f9414.js +1 -0
- package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js → d1ba118ddd0390c07f35.js} +2 -2
- package/assets/esri/core/workers/chunks/e6f1ed5e56f1d9862821.js +1 -0
- package/assets/esri/core/workers/chunks/{27f67a3828b78d4c1413.js → e81afc8a058a8ecc9b24.js} +1 -1
- package/assets/esri/core/workers/chunks/f49c7bb5d134bcb22155.js +1 -0
- package/assets/esri/core/workers/chunks/{aa6808146c76b2d49b64.js → f68c12e0c1eda7f73a17.js} +1 -1
- package/assets/esri/core/workers/chunks/f706bfea34d22539b46a.js +2 -0
- package/assets/esri/core/workers/chunks/{bb8d596f15fd3a0d783a.js → f8072a4cf1b25d8b93f9.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +24 -18
- package/chunks/GlowBlur.glsl.js +11 -11
- package/chunks/RibbonLine.glsl.js +91 -51
- package/chunks/ShadowCastVisualize.glsl.js +18 -15
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/networks/support/UNTraceConfiguration.d.ts +19 -2
- package/networks/support/UNTraceConfiguration.js +1 -1
- package/networks/support/jsonTypes.d.ts +9 -1
- package/package.json +4 -4
- package/popup/Feature.d.ts +4 -4
- package/popup/Feature.js +1 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.d.ts +13 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.d.ts +9 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/NetworkElement.d.ts +13 -1
- package/rest/networks/support/NetworkElement.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +6 -5
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/assets/esri/core/workers/chunks/0840e7dd62643c56ae9e.js +0 -1
- package/assets/esri/core/workers/chunks/0cc4b3100a7a453bd058.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e7111d43f01c149b3.js +0 -1
- package/assets/esri/core/workers/chunks/73af4c947e8151d411c1.js +0 -2
- package/assets/esri/core/workers/chunks/752f4e0e2961fc315dca.js +0 -1
- package/assets/esri/core/workers/chunks/a508104179e08f0f268c.js +0 -2
- package/assets/esri/core/workers/chunks/bb5f909a2f26fc6a21b0.js +0 -2
- package/assets/esri/core/workers/chunks/bea2fd831d7a864e5995.js +0 -596
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +0 -1
- package/assets/esri/core/workers/chunks/f971dcfd04af1fd652b4.js +0 -1
- /package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js.LICENSE.txt → 2647c739cda29361a463.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bb5f909a2f26fc6a21b0.js.LICENSE.txt → 4df19e670b6ed76c1dea.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{a508104179e08f0f268c.js.LICENSE.txt → 8a7a99533d02eb9cb058.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{73af4c947e8151d411c1.js.LICENSE.txt → d1ba118ddd0390c07f35.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js.LICENSE.txt → f706bfea34d22539b46a.js.LICENSE.txt} +0 -0
|
@@ -8,8 +8,8 @@ import type { ScreenPoint } from "../../../core/types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* The ShadowCastAnalysisView3D is responsible for rendering a [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/)
|
|
10
10
|
* using custom visualizations. The [methods](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ShadowCastAnalysisView3D/#getDurationAtScreen)
|
|
11
|
-
* on the analysis view provide developers with the ability to obtain the specific shadow duration at
|
|
12
|
-
* [point](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenPoint) on the screen or to [disable](#interactive) the
|
|
11
|
+
* on the analysis view provide developers with the ability to obtain the specific shadow or sunlight duration at a
|
|
12
|
+
* certain [point](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenPoint) on the screen or to [disable](#interactive) the tooltip attached to the cursor.
|
|
13
13
|
*
|
|
14
14
|
* The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView)
|
|
15
15
|
* similar to how layer views are retrieved for layers using [SceneView.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenLayerView).
|
|
@@ -66,16 +66,17 @@ export default abstract class ShadowCastAnalysisView3D extends AnalysisView3D {
|
|
|
66
66
|
*/
|
|
67
67
|
accessor visible: boolean;
|
|
68
68
|
/**
|
|
69
|
-
* Returns the time (in milliseconds) spent in shadow for a certain point on the screen.
|
|
69
|
+
* Returns the time (in milliseconds) spent in shadow for a certain point on the screen. When
|
|
70
|
+
* [ShadowCastAnalysis.visualizeSunlight](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/#visualizeSunlight) is `true`, this method returns the time spent in sunlight.
|
|
70
71
|
*
|
|
71
72
|
* @param point - The point on the screen for which shadow cast is calculated.
|
|
72
|
-
* @returns A promise that resolves to the duration (in milliseconds) spent in shadow for the given screen point.
|
|
73
|
+
* @returns A promise that resolves to the duration (in milliseconds) spent in shadow or sunlight for the given screen point.
|
|
73
74
|
* @since 5.0
|
|
74
75
|
* @example
|
|
75
76
|
* // use getDurationAtScreen method from the analysis view once available
|
|
76
77
|
* const analysisView = await view.whenAnalysisView(shadowCastAnalysis);
|
|
77
78
|
*
|
|
78
|
-
* // get shadow duration at the pointer location
|
|
79
|
+
* // get shadow or sunlight duration at the pointer location
|
|
79
80
|
* view.on("pointer-move", async (event) => {
|
|
80
81
|
* // duration in milliseconds
|
|
81
82
|
* const duration = await analysisView.getDurationAtScreen({ x: event.x, y: event.y });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t,equals as i}from"../../../core/arrayUtils.js";import{createTask as s}from"../../../core/asyncUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as n,destroyMaybe as o}from"../../../core/maybe.js";import{after as l,throwIfAborted as u,isPromiseLike as c}from"../../../core/promiseUtils.js";import{watch as p,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{createScreenPointArray as h,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{offsetDateUTC as g,convertTime as _}from"../../../core/timeUtils.js";import{property as y,subclass as v}from"../../../core/accessorSupport/decorators.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as D}from"../../../core/support/UpdatingHandles.js";import{g as C}from"../../../chunks/boundedPlane.js";import{polygonToVolume as b}from"../focusAreaUtils.js";import V from"./AnalysisView3D.js";import{registerAnalysisView as U,hideOtherAnalysisViews as T}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as P}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as O}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as x}from"../support/earthUtils.js";import{computeDirectionsOverTime as S}from"../support/sunUtils.js";import{maxColorRampSize as z}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as j}from"../../../widgets/support/traversalUtils.js";let R=class extends V{constructor(e){super(e),this.type="shadow-cast-view-3d",this.analysis=null,this._updatingHandles=new D,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([U(this.view,this),p(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{n(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=s(async e=>{await l(B,e),u(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),p(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&T(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},d),p(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:i})=>{L(e,i,t)},d),p(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:i,visible:s})=>{L(e,s,{lightDirections:t,lightDirectionsContext:i})},d),p(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:i})=>{L(e,i,{previewing:t})},d),p(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:i})=>{L(e,t,{analysisVolume:i})},d)]),this.interactive=!0,this._tooltip=new P({getDuration:this.getDurationAtScreen.bind(this),getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&L(this._renderer,!0,{enabled:!1}),this._tooltip=o(this._tooltip),this._stopPreviewingTask=n(this._stopPreviewingTask),this._updatingHandles=o(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||null!=this._stopPreviewingTask&&!this._stopPreviewingTask.finished||!0===this._tooltip?.updating||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){return this._updatedRecently||this._sceneUpdating}get _sceneUpdating(){const{view:e}=this;if(null==e?.allLayerViews)return!0;const{stationary:t,graphicsView:i}=e;return!t||this._shadowLayerViews.some(e=>e.updating)||!i?.suspended&&!!i?.updating}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?x(e[0],!1):0}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),"minutes"),e=g(e,-this._effectiveUtcOffset,"hours"),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(M-1)):M}get _interval(){const e=this._totalDurationInterval;switch(this.analysis.mode){case"min-duration":return this._totalDuration>0?e:0;case"total-duration":return e;case"discrete":return this.analysis.discreteOptions.interval||e}}get _intervalContext(){const{mode:e,minDurationOptions:t}=this.analysis;return"min-duration"===e&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){const{startTimeOfDay:e,endTimeOfDay:t}=this.analysis;return t-e}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){const{view:t}=this;if(e<=0)return[];const i="global"===t.viewingMode?I:this._referencePosition;if(null==i)return[];const s=S(this._startDateTimeUTC,this._endDateTimeUTC,e,i,t.state.viewingMode,M),r=s.length;q.length=0;const a=j(0,r,q),n=new Array(r);for(let o=0;o<r;++o)n[o]=s[a[o]];return n}get _analysisVolume(){const{geometry:e}=this.analysis;if(null==e)return this._previousVolume=null,null;try{const t=b(e,this.view,F);return null==t?(this._previousVolume=null,null):c(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new r("shadowcastanalysisview3d:projection-failed","Failed to project analysis area geometry to view spatial reference",{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case"min-duration":return this._minDurationVisualizationParameters;case"total-duration":return this._durationVisualizationParameters;case"discrete":return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){const{color:e,minDuration:t}=this.analysis.minDurationOptions,i=this._totalDuration;return{visualization:2,thresholdColor:e.toUnitRGBA(),threshold:i>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){const{minDurationOptions:e}=this.analysis;return e.contextEnabled?{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e.contextOptions.color,e.contextOptions.colorStops,1/this._lightDirectionsContext.length,this.analysis.visualizeSunlight)}:{}}get _durationVisualizationParameters(){const{color:e,colorStops:t,mode:i}=this.analysis.totalDurationOptions,s=this._totalDuration,r=s>0&&"hourly"===i?G/s:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/s,this.analysis.visualizeSunlight);return 0===r?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{bandedGradientColorRamp:a,visualization:1,bandSize:r}}get _discreteVisualizationParameters(){const{color:e,colorStops:t}=this.analysis.discreteOptions;return{gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,1/this._lightDirections.length,this.analysis.visualizeSunlight),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(k)}get _previewDependencies(){const{view:e}=this,i=e.slice.plane,s=this._shadowLayerViews,r=s.map(e=>e.layer).filter(t),a=s.map(e=>e.suspended),n=r.map(e=>e.visible),o=r.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=r.filter(e=>"definitionExpression"in e).map(e=>e.definitionExpression),c=s.filter(e=>"filter"in e).map(e=>e.filter);return{slicePlane:i,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:l,layerVisibilities:n,layerOpacities:o,filters:c,definitionExpressions:u}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){const{_renderer:t,_totalDurationSampleCount:i}=this;if(null==t||0===i)return 0;const s=this.view.state.camera.screenToRender(h(e.x,e.y),m()),r=t.readAccumulatedShadow(s);return(this.analysis.visualizeSunlight?1-r:r)*this._totalDuration}_getEffectiveShadowCastColorRamp(e,t,i,s){if(null!=t){t.length>z&&a.getLogger(this).warnOnce("ShadowCastAnalysis supports at most 8 color stops");const e=t.map(s?e=>[1-e.value*i,e.color.toUnitRGBA()]:e=>[e.value*i,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return E(e,s)}};e([y({readOnly:!0,type:["shadow-cast-view-3d"]})],R.prototype,"type",void 0),e([y({constructOnly:!0,nonNullable:!0})],R.prototype,"analysis",void 0),e([y({readOnly:!0})],R.prototype,"updating",null),e([y()],R.prototype,"_stopPreviewingTask",void 0),e([y()],R.prototype,"_updatedRecently",void 0),e([y()],R.prototype,"_tooltip",void 0),e([y()],R.prototype,"_sceneUpdating",null),e([y()],R.prototype,"_effectiveUtcOffset",null),e([y()],R.prototype,"_utcOffsetAuto",null),e([y()],R.prototype,"_dateUTCOffset",null),e([y()],R.prototype,"_startDateTimeUTC",null),e([y()],R.prototype,"_endDateTimeUTC",null),e([y()],R.prototype,"_referencePosition",null),e([y()],R.prototype,"_interval",null),e([y()],R.prototype,"_intervalContext",null),e([y()],R.prototype,"_totalDurationSampleCount",null),e([y()],R.prototype,"_totalDuration",null),e([y()],R.prototype,"_lightDirections",null),e([y()],R.prototype,"_lightDirectionsContext",null),e([y()],R.prototype,"_analysisVolume",null),e([y()],R.prototype,"_visualizationParameters",null),e([y()],R.prototype,"_minDurationVisualizationParameters",null),e([y()],R.prototype,"_minDurationContextVisualizationParameters",null),e([y()],R.prototype,"_durationVisualizationParameters",null),e([y()],R.prototype,"_discreteVisualizationParameters",null),e([y()],R.prototype,"_shadowLayerViews",null),e([y()],R.prototype,"_previewDependencies",null),e([y()],R.prototype,"_renderer",null),R=e([v("esri.views.3d.analysis.ShadowCastAnalysisView3D")],R);const A=R;function L(e,t,i){t&&null!=i&&e?.setParameters({shadowCast:i})}function E(e,t){const i=e.toUnitRGBA(),s=w(i[0],i[1],i[2],0),[r,a]=t?[i,s]:[s,i];return[[0,r],[1,a]]}function k(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":case"catalog-footprint-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"gaussian-splat-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":case"group":default:return!1;case"graphics-3d":return e.layer.graphics.some(e=>{const{symbol:t}=e;return null==t||"text"!==t.type&&!("symbolLayers"in t)||"text"!==t.type&&t.symbolLayers.some(e=>"text"!==e.type)})}}function H(e,t){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;const s=C(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,n=i(e.layerVisibilities,t.layerVisibilities),o=i(e.layerOpacities,t.layerOpacities),l=i(e.filters,t.filters),u=i(e.definitionExpressions,t.definitionExpressions);return s&&r&&a&&n&&o&&l&&u}const G=_(1,"hours","milliseconds"),B=500,M=255,I=f(),q=[],F=new O;export{A as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t,equals as i}from"../../../core/arrayUtils.js";import{createTask as s}from"../../../core/asyncUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as n,destroyMaybe as o}from"../../../core/maybe.js";import{after as l,throwIfAborted as u,isPromiseLike as c}from"../../../core/promiseUtils.js";import{watch as p,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{createScreenPointArray as h,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{offsetDateUTC as g,convertTime as _}from"../../../core/timeUtils.js";import{property as y,subclass as v}from"../../../core/accessorSupport/decorators.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as D}from"../../../core/support/UpdatingHandles.js";import{g as C}from"../../../chunks/boundedPlane.js";import{polygonToVolume as b}from"../focusAreaUtils.js";import V from"./AnalysisView3D.js";import{registerAnalysisView as U,hideOtherAnalysisViews as T}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as P}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as O}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as S}from"../support/earthUtils.js";import{computeDirectionsOverTime as x}from"../support/sunUtils.js";import{maxColorRampSize as z}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as j}from"../../../widgets/support/traversalUtils.js";let R=class extends V{constructor(e){super(e),this.type="shadow-cast-view-3d",this.analysis=null,this._updatingHandles=new D,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([U(this.view,this),p(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{n(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=s(async e=>{await l(B,e),u(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),p(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&T(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},d),p(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:i})=>{L(e,i,t)},d),p(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:i,visible:s})=>{L(e,s,{lightDirections:t,lightDirectionsContext:i})},d),p(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:i})=>{L(e,i,{previewing:t})},d),p(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:i})=>{L(e,t,{analysisVolume:i})},d)]),this.interactive=!0,this._tooltip=new P({getDuration:this.getDurationAtScreen.bind(this),getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&L(this._renderer,!0,{enabled:!1}),this._tooltip=o(this._tooltip),this._stopPreviewingTask=n(this._stopPreviewingTask),this._updatingHandles=o(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||null!=this._stopPreviewingTask&&!this._stopPreviewingTask.finished||!0===this._tooltip?.updating||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){return this._updatedRecently||this._sceneUpdating}get _sceneUpdating(){const{view:e}=this;if(null==e?.allLayerViews)return!0;const{stationary:t,graphicsView:i}=e;return!t||this._shadowLayerViews.some(e=>e.updating)||!i?.suspended&&!!i?.updating}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?S(e[0],!1):0}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),"minutes"),e=g(e,-this._effectiveUtcOffset,"hours"),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(M-1)):M}get _interval(){const e=this._totalDurationInterval;switch(this.analysis.mode){case"min-duration":return this._totalDuration>0?e:0;case"total-duration":return e;case"discrete":return this.analysis.discreteOptions.interval||e}}get _intervalContext(){const{mode:e,minDurationOptions:t}=this.analysis;return"min-duration"===e&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){const{startTimeOfDay:e,endTimeOfDay:t}=this.analysis;return t-e}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){const{view:t}=this;if(e<=0)return[];const i="global"===t.viewingMode?I:this._referencePosition;if(null==i)return[];const s=x(this._startDateTimeUTC,this._endDateTimeUTC,e,i,t.state.viewingMode,M),r=s.length;q.length=0;const a=j(0,r,q),n=new Array(r);for(let o=0;o<r;++o)n[o]=s[a[o]];return n}get _analysisVolume(){const{geometry:e}=this.analysis;if(null==e)return this._previousVolume=null,null;try{const t=b(e,this.view,F);return null==t?(this._previousVolume=null,null):c(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new r("shadowcastanalysisview3d:projection-failed","Failed to project analysis area geometry to view spatial reference",{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case"min-duration":return this._minDurationVisualizationParameters;case"total-duration":return this._durationVisualizationParameters;case"discrete":return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){const{color:e,minDuration:t}=this.analysis.minDurationOptions,i=this._totalDuration;return{visualization:2,thresholdColor:e.toUnitRGBA(),threshold:i>0?t/this._totalDuration:0,thresholdRendersSunlight:this.analysis.visualizeSunlight,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){const{minDurationOptions:e}=this.analysis;return e.contextEnabled?{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e.contextOptions.color,e.contextOptions.colorStops,1/this._lightDirectionsContext.length,this.analysis.visualizeSunlight)}:{}}get _durationVisualizationParameters(){const{color:e,colorStops:t,mode:i}=this.analysis.totalDurationOptions,s=this._totalDuration,r=s>0&&"hourly"===i?G/s:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/s,this.analysis.visualizeSunlight);return 0===r?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{bandedGradientColorRamp:a,visualization:1,bandSize:r}}get _discreteVisualizationParameters(){const{color:e,colorStops:t}=this.analysis.discreteOptions;return{gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,1/this._lightDirections.length,this.analysis.visualizeSunlight),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(k)}get _previewDependencies(){const{view:e}=this,i=e.slice.plane,s=this._shadowLayerViews,r=s.map(e=>e.layer).filter(t),a=s.map(e=>e.suspended),n=r.map(e=>e.visible),o=r.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=r.filter(e=>"definitionExpression"in e).map(e=>e.definitionExpression),c=s.filter(e=>"filter"in e).map(e=>e.filter);return{slicePlane:i,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:l,layerVisibilities:n,layerOpacities:o,filters:c,definitionExpressions:u}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){const{_renderer:t,_totalDurationSampleCount:i}=this;if(null==t||0===i)return 0;const s=this.view.state.camera.screenToRender(h(e.x,e.y),m()),r=t.readAccumulatedShadow(s);return(this.analysis.visualizeSunlight?1-r:r)*this._totalDuration}_getEffectiveShadowCastColorRamp(e,t,i,s){if(null!=t){t.length>z&&a.getLogger(this).warnOnce("ShadowCastAnalysis supports at most 8 color stops");const e=t.map(s?e=>[1-e.value*i,e.color.toUnitRGBA()]:e=>[e.value*i,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return E(e,s)}};e([y({readOnly:!0,type:["shadow-cast-view-3d"]})],R.prototype,"type",void 0),e([y({constructOnly:!0,nonNullable:!0})],R.prototype,"analysis",void 0),e([y({readOnly:!0})],R.prototype,"updating",null),e([y()],R.prototype,"_stopPreviewingTask",void 0),e([y()],R.prototype,"_updatedRecently",void 0),e([y()],R.prototype,"_tooltip",void 0),e([y()],R.prototype,"_sceneUpdating",null),e([y()],R.prototype,"_effectiveUtcOffset",null),e([y()],R.prototype,"_utcOffsetAuto",null),e([y()],R.prototype,"_dateUTCOffset",null),e([y()],R.prototype,"_startDateTimeUTC",null),e([y()],R.prototype,"_endDateTimeUTC",null),e([y()],R.prototype,"_referencePosition",null),e([y()],R.prototype,"_interval",null),e([y()],R.prototype,"_intervalContext",null),e([y()],R.prototype,"_totalDurationSampleCount",null),e([y()],R.prototype,"_totalDuration",null),e([y()],R.prototype,"_lightDirections",null),e([y()],R.prototype,"_lightDirectionsContext",null),e([y()],R.prototype,"_analysisVolume",null),e([y()],R.prototype,"_visualizationParameters",null),e([y()],R.prototype,"_minDurationVisualizationParameters",null),e([y()],R.prototype,"_minDurationContextVisualizationParameters",null),e([y()],R.prototype,"_durationVisualizationParameters",null),e([y()],R.prototype,"_discreteVisualizationParameters",null),e([y()],R.prototype,"_shadowLayerViews",null),e([y()],R.prototype,"_previewDependencies",null),e([y()],R.prototype,"_renderer",null),R=e([v("esri.views.3d.analysis.ShadowCastAnalysisView3D")],R);const A=R;function L(e,t,i){t&&null!=i&&e?.setParameters({shadowCast:i})}function E(e,t){const i=e.toUnitRGBA(),s=w(i[0],i[1],i[2],0),[r,a]=t?[i,s]:[s,i];return[[0,r],[1,a]]}function k(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":case"catalog-footprint-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"gaussian-splat-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":case"group":default:return!1;case"graphics-3d":return e.layer.graphics.some(e=>{const{symbol:t}=e;return null==t||"text"!==t.type&&!("symbolLayers"in t)||"text"!==t.type&&t.symbolLayers.some(e=>"text"!==e.type)})}}function H(e,t){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;const s=C(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,n=i(e.layerVisibilities,t.layerVisibilities),o=i(e.layerOpacities,t.layerOpacities),l=i(e.filters,t.filters),u=i(e.definitionExpressions,t.definitionExpressions);return s&&r&&a&&n&&o&&l&&u}const G=_(1,"hours","milliseconds"),B=500,M=255,I=f(),q=[],F=new O;export{A as default};
|
|
@@ -93,7 +93,7 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
93
93
|
// Estimate depth of the marching ray
|
|
94
94
|
rayStartZ = previousEstimatedZ;
|
|
95
95
|
estimatedDepthDifference = -rayStartZ - sampledDepth;
|
|
96
|
-
rayEndZ = (homogeneousStep.z * 0.5 + homogeneousPosition.z)/ (
|
|
96
|
+
rayEndZ = (homogeneousStep.z * 0.5 + homogeneousPosition.z) / (inverseWStep * 0.5 + inverseW);
|
|
97
97
|
rayDepthDelta = rayEndZ - rayStartZ;
|
|
98
98
|
previousEstimatedZ = rayEndZ;
|
|
99
99
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as f,DataType as d}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n){if(t?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;o=e.width*r,n=e.height*r}const i="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,a="highlight coverage"===r,c=e.colorTexture?.descriptor,u=c?.internalFormat,l=[],f=new Array,d=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=v(o);l.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),f[t]=!0)}if(t>0)if(o?.debugName?.endsWith("emissive"))d.push(8);else{const e=o?.descriptor.internalFormat;d.push(F(e))}else d.push(i?0:s?1:a?2:F(u))});const m=this.renderingContext,{depthStencilTexture:g}=e,x=this._ensureProgram(m,null!=g,l,e.level),b=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(x);const $=m.boundFramebuffer;m.bindFramebuffer(b.fbo);const C=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),x.setUniform1i(o,t),t>0&&b.acquireColor(p+t,5,"fbo visualizer"),C.push(r)});const R=g?.descriptor.linearFilterDepth??!1;if(g){const r=e.colorAttachments.length;g.setShadowFiltering(!1),m.bindTexture(g,r),x.setUniform1i("depthTex",r);const t=p+r;t>p&&b.acquireColor(t,5,"fbo visualizer"),C.push(t)}m.gl.drawBuffers(C),h(m.gl);const y=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),x.setUniform1iv("inputTypes",d.length>0?d:[7]),x.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),h(m.gl),m.bindFramebuffer($),m.setViewport(y.x,y.y,y.width,y.height),e.colorAttachments.forEach((o,n)=>{const i=e.getColorTexture(o);f[n]&&i?.clearMipmap(),t===T(r,e,o,!1)&&(this._focusedTexture?.release(),this._focusedTexture=b.getAttachment(o),this._focusedTexture?.retain(),this._focusedFBOType=d[n])}),g&&g.setShadowFiltering(R),b}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[v(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==f.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${g(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv, ${o}.0).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Divide F16 by floatBlendOutputScale to get similar previews as in the OIT8 pipeline\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rgb, 1.0) / ${l.toFixed(1)};\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n fragColor${t}.rgb *= ${l.toFixed(1)};\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n }\n }`,""),f=t.length,d=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(f)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,d,u);return this._programs.set(n,m),m}};function g(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function F(e){switch(e){case f.R16F:case f.R32F:case f.R8:return 3;case f.RG8:return 4;case f.RGBA16F:return 5;case f.RG8UI:return 6;default:return 7}}function T(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${b(r,t)}`}function b(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,T as getAttachmentName};
|
|
2
|
+
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as f,DataType as d}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.setDrawBuffers([p]),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n){if(t?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;o=e.width*r,n=e.height*r}const i="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,a="highlight coverage"===r,c=e.colorTexture?.descriptor,u=c?.internalFormat,l=[],f=new Array,d=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=v(o);l.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),f[t]=!0)}if(t>0)if(o?.debugName?.endsWith("emissive"))d.push(8);else{const e=o?.descriptor.internalFormat;d.push(F(e))}else d.push(i?0:s?1:a?2:F(u))});const m=this.renderingContext,{depthStencilTexture:g}=e,x=this._ensureProgram(m,null!=g,l,e.level),b=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(x);const $=m.boundFramebuffer;m.bindFramebuffer(b.fbo);const C=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),x.setUniform1i(o,t),t>0&&b.acquireColor(p+t,5,"fbo visualizer"),C.push(r)});const R=g?.descriptor.linearFilterDepth??!1;if(g){const r=e.colorAttachments.length;g.setShadowFiltering(!1),m.bindTexture(g,r),x.setUniform1i("depthTex",r);const t=p+r;t>p&&b.acquireColor(t,5,"fbo visualizer"),C.push(t)}m.gl.drawBuffers(C),h(m.gl);const y=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),x.setUniform1iv("inputTypes",d.length>0?d:[7]),x.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),h(m.gl),m.bindFramebuffer($),m.setViewport(y.x,y.y,y.width,y.height),e.colorAttachments.forEach((o,n)=>{const i=e.getColorTexture(o);f[n]&&i?.clearMipmap(),t===T(r,e,o,!1)&&(this._focusedTexture?.release(),this._focusedTexture=b.getAttachment(o),this._focusedTexture?.retain(),this._focusedFBOType=d[n])}),g&&g.setShadowFiltering(R),b}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[v(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==f.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${g(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv, ${o}.0).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Divide F16 by floatBlendOutputScale to get similar previews as in the OIT8 pipeline\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rgb, 1.0) / ${l.toFixed(1)};\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n fragColor${t}.rgb *= ${l.toFixed(1)};\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n }\n }`,""),f=t.length,d=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(f)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,d,u);return this._programs.set(n,m),m}};function g(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function F(e){switch(e){case f.R16F:case f.R32F:case f.R8:return 3;case f.RG8:return 4;case f.RGBA16F:return 5;case f.RG8UI:return 6;default:return 7}}function T(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${b(r,t)}`}function b(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,T as getAttachmentName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{set as u}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as h}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as _}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as b}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as g}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as w}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as P}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as x,ColorAttachment1 as T,SizedPixelFormat as I}from"../../../../webgl/enums.js";import C from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";const j=1,A=.25;let B=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=c.AMBIENT_ILLUMINATION,this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new w,this._maxFrames=255,this._configuration=new g,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;a(e),await this._loadBlueNoiseTexture(t,e),a(e)}catch(r){i(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(o(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this.resetAccumulation(),this.requestRender(1)},n))}precompile(){this._canRender&&(this._configuration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(b,this._configuration),this.techniques.precompile(_),this._needsUpscalePass(this._mode)&&this.techniques.precompile(P))}destroy(){this._abortController=r(this._abortController),this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(x),a=this._mode;if(!r||!s)return this._emptyOutput;if(this.view.stage.renderView.updating&&this.resetAccumulation(),0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=i.hasEmission;const o=this.techniques.getCompiled(b,this._configuration),n=this.techniques.getCompiled(_),l=this._needsUpscalePass(a),m=l?A:1,h=l?this.techniques.getCompiled(P):null;if(!o||!n||l&&!h)return this.requestRender(1),this._emptyOutput;const p=this.renderingContext,{camera:d}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=m;const{fullWidth:f,fullHeight:g}=d,w=Math.max(1,Math.floor(f*m)),I=Math.max(1,Math.floor(g*m)),C=this.fboCache.acquire(w,I,"global illumination input").acquireColor(T,0);p.bindFramebuffer(C.fbo),p.setViewport(0,0,w,I),p.bindTechnique(o,i,this._passParameters,this._drawParameters),p.screen.draw();const q=C.obtainAttachment(T),B=Math.max(1,Math.round(w/j)),M=Math.max(1,Math.round(I/j)),G=this.fboCache.acquire(B,M,"global illumination blur horizontal");p.bindFramebuffer(G.fbo),this._drawParameters.texture=C.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,0,j/I),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,M),p.screen.draw(),C.release();const N=l?"global illumination blur vertical":c.AMBIENT_ILLUMINATION,F=this.fboCache.acquire(B,M,N);p.bindFramebuffer(F.fbo),p.setViewport(0,0,B,M),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParameters.texture=G.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,j/B,0),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,M),p.screen.draw(),G.release(),F.attachColor(q,T),q.release();let U=F;return h&&(U=this.fboCache.acquire(f,g,c.AMBIENT_ILLUMINATION).acquireColor(T,0),p.bindFramebuffer(U.fbo),p.setViewport(0,0,f,g),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParametersUpscale.colorTexture=F.getTexture(),this._drawParametersUpscale.weightTexture=F.getTexture(T),p.bindTechnique(h,i,this._passParameters,this._drawParametersUpscale),p.screen.draw(),F.release()),p.setViewport4fv(d.fullViewport),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this.requestRender(1),U}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,c.AMBIENT_ILLUMINATION).acquireColor(T,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}async _loadBlueNoiseTexture(e,t){a(t);const r=await h(e,{signal:t});if(a(t),!r)return;const s=new q;s.internalFormat=I.RGBA8,s.wrapMode=10497,s.isImmutable=!0,this._passParameters.noiseTexture=new C(this.renderingContext,s,r)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||!e.reprojection.lastFrameColor||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}resetAccumulation(){this._passParameters.accumulatedFrames=0}_needsUpscalePass(e){return 1===e}get test(){return{passParameters:this._passParameters,restartAccumulation:()=>{this.resetAccumulation(),this._passParameters.frameCount=0,this._resetBuffer=!0,this.requestRender(1)}}}};e([l()],B.prototype,"consumes",void 0),e([l()],B.prototype,"produces",void 0),e([l()],B.prototype,"_abortController",void 0),B=e([m("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],B);export{B as GlobalIllumination,j as blurSizePixels};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{set as u}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as h}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as _}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as b}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as g}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as w}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as P}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as x,ColorAttachment1 as T,SizedPixelFormat as I}from"../../../../webgl/enums.js";import C from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";const j=1,A=.25;let B=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=c.AMBIENT_ILLUMINATION,this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new w,this._maxFrames=255,this._configuration=new g,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;a(e),await this._loadBlueNoiseTexture(t,e),a(e)}catch(r){i(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(o(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this.resetAccumulation(),this.requestRender(1)},n))}precompile(){this._canRender&&(this._configuration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(b,this._configuration),this.techniques.precompile(_),this._needsUpscalePass(this._mode)&&this.techniques.precompile(P))}destroy(){this._abortController=r(this._abortController),this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(x),a=this._mode;if(!r||!s)return this._emptyOutput;if(this.view.stage.renderView.updating&&this.resetAccumulation(),0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=i.hasEmission;const o=this.techniques.getCompiled(b,this._configuration),n=this.techniques.getCompiled(_),l=this._needsUpscalePass(a),m=l?A:1,h=l?this.techniques.getCompiled(P):null;if(!o||!n||l&&!h)return this.requestRender(1),this._emptyOutput;const p=this.renderingContext,{camera:d}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=m;const{fullWidth:f,fullHeight:g}=d,w=Math.max(1,Math.floor(f*m)),I=Math.max(1,Math.floor(g*m)),C=this.fboCache.acquire(w,I,"global illumination input").acquireColor(T,0);p.bindFramebuffer(C.fbo),p.setViewport(0,0,w,I),p.bindTechnique(o,i,this._passParameters,this._drawParameters),p.screen.draw();const q=C.obtainAttachment(T),B=Math.max(1,Math.round(w/j)),M=Math.max(1,Math.round(I/j)),G=this.fboCache.acquire(B,M,"global illumination blur horizontal");p.bindFramebuffer(G.fbo),this._drawParameters.texture=C.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,0,j/I),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,M),p.screen.draw(),C.release();const N=l?"global illumination blur vertical":c.AMBIENT_ILLUMINATION,F=this.fboCache.acquire(B,M,N);p.bindFramebuffer(F.fbo),p.setViewport(0,0,B,M),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParameters.texture=G.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,j/B,0),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,M),p.screen.draw(),G.release(),F.attachColor(q,T),q.release();let U=F;return h&&(U=this.fboCache.acquire(f,g,c.AMBIENT_ILLUMINATION).acquireColor(T,0),p.bindFramebuffer(U.fbo),p.setViewport(0,0,f,g),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParametersUpscale.colorTexture=F.getTexture(),this._drawParametersUpscale.weightTexture=F.getTexture(T),p.bindTechnique(h,i,this._passParameters,this._drawParametersUpscale),p.screen.draw(),F.release()),p.setViewport4fv(d.fullViewport),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this.requestRender(1),U}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,c.AMBIENT_ILLUMINATION).acquireColor(T,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}async _loadBlueNoiseTexture(e,t){a(t);const r=await h(e,{signal:t});if(a(t),!r)return;const s=new q;s.internalFormat=I.RGBA8,s.wrapMode=10497,s.isImmutable=!0,this._passParameters.noiseTexture=new C(this.renderingContext,s,r)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||!e.reprojection.lastFrameColor||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}resetAccumulation(){this._passParameters.accumulatedFrames=0}_needsUpscalePass(e){return 1===e}get test(){return{passParameters:this._passParameters,configuration:this._configuration,restartAccumulation:()=>{this.resetAccumulation(),this._passParameters.frameCount=0,this._resetBuffer=!0,this.requestRender(1)}}}};e([l()],B.prototype,"consumes",void 0),e([l()],B.prototype,"produces",void 0),e([l()],B.prototype,"_abortController",void 0),B=e([m("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],B);export{B as GlobalIllumination,j as blurSizePixels};
|
package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as s}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{d as
|
|
2
|
+
import{__decorate as s}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{d as t,b as a}from"../../../../../chunks/GlobalIllumination.glsl.js";class i extends r{constructor(){super(...arguments),this.hasColor=!0,this.hasEmission=!1,this.rayMarchMaxReach=t,this.rayMarchMaxSteps=a,this.useProjectedRayLength=!0,this.clampRayToScreen=!1}}s([o()],i.prototype,"hasColor",void 0),s([o()],i.prototype,"hasEmission",void 0);export{i as GlobalIlluminationTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as d,a as g,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as C}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let F=class extends u{constructor(t){super(t),this.consumes={required:[m.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=m.TRANSPARENT_ENVIRONMENT,this._mode=0,this._intensity=.5,this._scatteringFactors={realistic:new d([32,16,8,4,2,1],1),maximumFog:new d([0,.27,.6,1.05,1.58,2.1],6),cartographicMin:new d([.4,.18,.25,.12,.05,0],1),cartographicDefault:new d([1.17,1.08,.78,.4,.26,.11],4),cartographicMax:new d([3.59,3.9,2.46,1.4,.93,.44],13)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositionConfiguration=new P,this._compositionParameters=new g,this._blurParameters=new c,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=h(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){const t=this.view.environment.lighting.glow;this._mode=null==t?this.view.environment.atmosphereEnabled?0:2:1,t&&(this._intensity=t.intensity),this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateFogParameters(){const{weather:t,weatherAvailable:e}=this.view.environment;this._compositionParameters.distanceModifier=e?t.fogOpacity:0,this._compositionParameters.maxDisperse=this._scatteringFactors.maximumFog,this.requestRender(1)}precompile(){this._compositionConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.blurEnabled=2!==this._mode,this._compositionConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositionConfiguration)}render(t){const i=t.find(({name:t})=>t===m.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(w);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:l,fullHeight:h}=this.bindParameters.camera,u=this.renderingContext;if(this._compositionConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,this._compositionConfiguration.blurEnabled=2!==this._mode,!this._compositionConfiguration.blurEnabled){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),i;const e=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);return this._setupFBO(e,l,h),u.bindTechnique(t,this.bindParameters,this._compositionParameters),u.screen.draw(),e.attachDepth(o),e.attachColor(r,w),e}const c=this.techniques.getCompiled(p,this._blurHorizontalConfiguration),_=this.techniques.getCompiled(p,this._blurVerticalConfiguration),d=this.techniques.getCompiled(f,this._compositionConfiguration);if(!c||!_||!d)return this.requestRender(1),i;const g=this.camera,b=n(g.eye);this._compositionParameters.atmosphereC=b**2-this._atmosphereRadius**2,this._renderGlowMipMap(c,_);const P=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);return P.acquireColor(w,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(P,l,h,!0),u.bindTechnique(d,this.bindParameters,this._compositionParameters),u.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),P.attachDepth(o),P}_renderGlowMipMap(t,e){const i=this.fboCache,{fullWidth:r,fullHeight:s}=this.camera,o=this.renderingContext,n=5;this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=C,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*r,.5*s);let l=Math.floor(this._blurParameters.size[0]),h=Math.floor(this._blurParameters.size[1]);const m=i.acquire(l,h,"glow horizontal",8);for(this._compositionParameters.lodTexture=i.acquire(l,h,"glow mipmap",9);l>1&&h>1&&this._blurParameters.level<n;)this._setupFBO(m,l,h),o.bindTechnique(t,this.bindParameters,this._blurParameters),o.screen.draw(),i.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,m.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=m.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,l,h,!1,this._blurParameters.level),o.bindTechnique(e,this.bindParameters,this._blurParameters),o.screen.draw(),i.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*l,.5*h),l=Math.floor(this._blurParameters.size[0]),h=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;m.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,l)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:t=>{this._compositionParameters.dispersionWeight=t},preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)},toggleTonemapping:t=>{this._compositionConfiguration.tonemappingEnabled=t,this.requestRender(1)}}}};t([s()],F.prototype,"consumes",void 0),t([s()],F.prototype,"produces",void 0),F=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],F);export{F as Glow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
|
|
2
|
+
import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{equals as s}from"../../../../core/arrayUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{property as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{equals as s}from"../../../../core/arrayUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{property as r,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as o,copy as h,equals as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{createQuadVAO as l}from"./glUtil3D.js";import{vvColorNumber as d}from"../materials/VisualVariablePassParameters.js";import{S as _}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as m}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as u}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{ColorAttachment0 as p}from"../../../webgl/enums.js";const c=4e4,b=5e4,f=1/512;let g=class extends t{constructor(e,t,s,i){super({}),this._fbos=e,this._techniques=t,this._data=s,this._requestRender=i,this._configuration=new u,this._enabled=!1,this._passParameters=new _(this._data),this._vao=l(e.rctx)}dispose(){this._stop(),this._vao=i(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(m,this._configuration)}render(e,t){if(!this._showVisualization)return;const[s,i]=this._data.computedSamples;this._passParameters.sampleScale=[s?1/s:0,i?1/i:0];const r=this._techniques.get(m,this._configuration),a=null!=t,o=this._rctx.boundFramebuffer;let h=null;a&&(h=this._fbos.acquire(e.camera.width,e.camera.height,"shadow cast masked draw"),h.attachDepth(t),this._rctx.bindFramebuffer(h.fbo),this._rctx.blitFramebuffer(o,h.fbo,16384)),this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(r,e,this._passParameters),this._rctx.setDrawBuffers([p]),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount("geometry")),null!=h&&(this._rctx.bindFramebuffer(o),this._rctx.blitFramebuffer(h.fbo,o,16384),h.detachDepth(),h.release())}get _rctx(){return this._fbos.rctx}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.thresholdColor&&this._setThresholdColor(e.thresholdColor),void 0!==e.gradientColorRamp&&this._setGradientColorRamp(e.gradientColorRamp),void 0!==e.bandedGradientColorRamp&&this._setBandedGradientColorRamp(e.bandedGradientColorRamp),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.thresholdRendersSunlight&&(this._thresholdRendersSunlight=e.thresholdRendersSunlight),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.analysisVolume&&(this._configuration.useMask=null!==e.analysisVolume)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&(this._data.computedSamples[0]>0||this._data.computedSamples[1]>0)&&this.opacityFromElevation>f}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfEnabled())}get _thresholdRendersSunlight(){return this._configuration.thresholdRendersSunlight}set _thresholdRendersSunlight(e){this._thresholdRendersSunlight!==e&&(this._configuration.thresholdRendersSunlight=e,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(e){e!==this._visualization&&(this._configuration.visualization=e,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfEnabled())}_setThresholdColor(e){const t=this._passParameters.thresholdColor;o(e,t)||(h(this._passParameters.thresholdColor,e),this._requestRenderIfEnabled())}_setGradientColorRamp(e){e.length>d&&(e=e.slice(0,d));v(this._passParameters.gradientColorRamp,e)||(this._passParameters.gradientColorRamp=e,this._requestRenderIfEnabled())}_setBandedGradientColorRamp(e){e.length>d&&(e=e.slice(0,d));v(this._passParameters.bandedGradientColorRamp,e)||(this._passParameters.bandedGradientColorRamp=e,this._requestRenderIfEnabled())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};function v(e,t){return s(e,t,([e,t],[s,i])=>e===s&&n(t,i))}e([r()],g.prototype,"opacityFromElevation",null),g=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],g);export{g as ShadowCastRenderer,b as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,f as shadowCastDisabledElevationThreshold};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as j,closestLineSegmentPoint as z,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=he;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(Pe[0],A[0]-L,A[1]+L,0),n(Pe[1],A[0]+L,A[1]+L,0),n(Pe[2],A[0]+L,A[1]-L,0),n(Pe[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(Pe[e],we[e]))return;x(S.eye,we[0],we[1],ye),x(S.eye,we[1],we[2],je),x(S.eye,we[2],we[3],ze),x(S.eye,we[3],we[0],Ee);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){re[0]=w[e]+r[12],re[1]=w[e+1]+r[13],re[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(se[0]=w[t]+r[12],se[1]=w[t+1]+r[13],se[2]=w[t+2]+r[14],T(ye,re)<0&&T(ye,se)<0||T(je,re)<0&&T(je,se)<0||T(ze,re)<0&&T(ze,se)<0||T(Ee,re)<0&&T(Ee,se)<0)continue;const i=S.projectToRenderScreen(re,ce),s=S.projectToRenderScreen(se,me);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(le,re,se);const e=S.frustum,t=-T(e[4],re)/l(le,C(e[4]));if(p(le,le,t),h(re,re,le),!S.projectToRenderScreen(re,i))continue}else if(i[2]>0&&s[2]<0){o(le,se,re);const e=S.frustum,t=-T(e[4],se)/l(le,C(e[4]));if(p(le,le,t),h(se,se,le),!S.projectToRenderScreen(se,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,de),n=j(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,re,se,A,S,E,M);if(n>=e*e)continue}R=n,c(ue,re),c(fe,se),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(y(ue,fe,de),y(_,v,ge),pe)){o(pe,pe,_);const t=m(pe);p(pe,pe,1/t),e=t/u(_,v)}g(e,pe,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ae,t,i,o),d(ne,ae,s.viewMatrix);const l=m(ne),p=this.computeCameraAbsCosAngle(ae,s,this._configuration.spherical);ie.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ie.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(pe,e):n(pe,0,0,1),o(oe,e,t.eye),g(oe,oe),Math.abs(l(pe,oe))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t;const i=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=J+i}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const{buffer:o,offset:l}=s,p=this.layout,h=i.get("position"),m=h.indices,f=h.data.length/3,g=i.get("distanceToStart")?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const b=p.fields.has("sizeFeatureAttribute");let _=1,v=null;if(b){const e=i.get("sizeFeatureAttribute");1===e.data.length?_=e.data[0]:v=e.data}else _=i.get("size")?.data[0]??1;let w=[1,1,1,1],y=0,j=null;const z=p.fields.has("colorFeatureAttribute");if(z){const e=i.get("colorFeatureAttribute");1===e.data.length?y=e.data[0]:j=e.data}else w=i.get("color")?.data??w;const E=i.get("timeStamps")?.data,A=E&&p.fields.has("timeStamps"),x=p.fields.has("opacityFeatureAttribute");let T=0,C=null;if(x){const e=i.get("opacityFeatureAttribute");1===e.data.length?T=e.data[0]:C=e.data}const O=new Float32Array(o.buffer),M=P(o.buffer),L=new Uint8Array(o.buffer),R=p.stride/4;let V=l*R;const N=V;let U=0;const k=g?(e,t,i)=>U=g[i]:(e,t,i)=>U+=u(e,t),W=O.BYTES_PER_ELEMENT/M.BYTES_PER_ELEMENT,B=4/W,I=F(),J=(e,t,i,s,a,n,o,l)=>{O[V++]=t[0],O[V++]=t[1],O[V++]=t[2],D(e,t,M,V*W),V+=B,D(i,t,M,V*W),V+=B,O[V++]=l;let p=V*W;if(M[p++]=a,M[p++]=n,V=Math.ceil(p/W),z)O[V]=j?.[o]??y;else{const e=Math.min(4*o,w.length-4),t=4*V;L[t]=255*w[e],L[t+1]=255*w[e+1],L[t+2]=255*w[e+2],L[t+3]=255*w[e+3]}if(V++,O[V++]=v?.[o]??_,x&&(O[V++]=C?.[o]??T),I){let e=4*V;r?(L[e++]=r[0],L[e++]=r[1],L[e++]=r[2],L[e++]=r[3]):(L[e++]=0,L[e++]=0,L[e++]=0,L[e++]=0),V=Math.ceil(.25*e)}A&&(p=V*W,M[p++]=s[0],M[p++]=s[1],M[p++]=s[2],M[p++]=s[3],V=Math.ceil(p/W))};V+=R,n(Se,h.data[0],h.data[1],h.data[2]),A&&S(ve,E[0],E[1],E[2],E[3]),e&&d(Se,Se,e);const Y=this._isClosed(i);if(Y){const t=h.data.length-3;n(be,h.data[t],h.data[t+1],h.data[t+2]),e&&d(be,be,e)}else n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),J(Se,Se,_e,ve,1,-4,0,0),J(Se,Se,_e,ve,1,4,0,0),c(be,Se),c(Se,_e),A&&S(ve,E[4],E[5],E[6],E[7]);const q=Y?0:1,X=Y?f:f-1;for(let u=q;u<X;u++){const t=(u+1)%f*3;n(_e,h.data[t],h.data[t+1],h.data[t+2]),e&&d(_e,_e,e),k(be,Se,u),J(be,Se,_e,ve,0,-1,u,U),J(be,Se,_e,ve,0,1,u,U);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);J(be,Se,_e,ve,t,-1,u,U),J(be,Se,_e,ve,t,1,u,U)}if(J(be,Se,_e,ve,1,-2,u,U),J(be,Se,_e,ve,1,2,u,U),c(be,Se),c(Se,_e),A){const e=(u+1)%f*4;S(ve,E[e],E[e+1],E[e+2],E[e+3])}}Y?(n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),U=k(be,Se,X),J(be,Se,_e,ve,0,-1,q,U),J(be,Se,_e,ve,0,1,q,U)):(U=k(be,Se,X),J(be,Se,Se,ve,0,-5,X,U),J(be,Se,Se,ve,0,5,X,U)),$(O,N+R,O,N,R);V=$(O,V-R,O,V,R),this._parameters.wireframe&&this._addWireframeVertices(o,N,V,R)}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ie=new k,re=b(),se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=i(),me=i(),ue=b(),fe=b(),de=w(),ge=w(),be=b(),Se=b(),_e=b(),ve=v(),Pe=[i(),i(),i(),i()],we=[b(),b(),b(),b()],ye=A(),je=A(),ze=A(),Ee=A();export{Q as Parameters,H as RibbonLineMaterial};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as j,closestLineSegmentPoint as z,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ie(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=ce;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(we[0],A[0]-L,A[1]+L,0),n(we[1],A[0]+L,A[1]+L,0),n(we[2],A[0]+L,A[1]-L,0),n(we[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(we[e],ye[e]))return;x(S.eye,ye[0],ye[1],je),x(S.eye,ye[1],ye[2],ze),x(S.eye,ye[2],ye[3],Ee),x(S.eye,ye[3],ye[0],Ae);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){se[0]=w[e]+r[12],se[1]=w[e+1]+r[13],se[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(ae[0]=w[t]+r[12],ae[1]=w[t+1]+r[13],ae[2]=w[t+2]+r[14],T(je,se)<0&&T(je,ae)<0||T(ze,se)<0&&T(ze,ae)<0||T(Ee,se)<0&&T(Ee,ae)<0||T(Ae,se)<0&&T(Ae,ae)<0)continue;const i=S.projectToRenderScreen(se,me),s=S.projectToRenderScreen(ae,ue);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(pe,se,ae);const e=S.frustum,t=-T(e[4],se)/l(pe,C(e[4]));if(p(pe,pe,t),h(se,se,pe),!S.projectToRenderScreen(se,i))continue}else if(i[2]>0&&s[2]<0){o(pe,ae,se);const e=S.frustum,t=-T(e[4],ae)/l(pe,C(e[4]));if(p(pe,pe,t),h(ae,ae,pe),!S.projectToRenderScreen(ae,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,ge),n=j(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,se,ae,A,S,E,M);if(n>=e*e)continue}R=n,c(fe,se),c(de,ae),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(y(fe,de,ge),y(_,v,be),he)){o(he,he,_);const t=m(he);p(he,he,1/t),e=t/u(_,v)}g(e,he,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ne,t,i,o),d(oe,ne,s.viewMatrix);const l=m(oe),p=this.computeCameraAbsCosAngle(ne,s,this._configuration.spherical);re.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return re.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(he,e):n(he,0,0,1),o(le,e,t.eye),g(le,le),Math.abs(l(he,le))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t,this.numJoinSubdivisions=ie(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const{buffer:o,offset:l}=s,p=this.layout,h=i.get("position"),m=h.indices,f=h.data.length/3,g=i.get("distanceToStart")?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const b=p.fields.has("sizeFeatureAttribute");let _=1,v=null;if(b){const e=i.get("sizeFeatureAttribute");1===e.data.length?_=e.data[0]:v=e.data}else _=i.get("size")?.data[0]??1;let w=[1,1,1,1],y=0,j=null;const z=p.fields.has("colorFeatureAttribute");if(z){const e=i.get("colorFeatureAttribute");1===e.data.length?y=e.data[0]:j=e.data}else w=i.get("color")?.data??w;const E=i.get("timeStamps")?.data,A=E&&p.fields.has("timeStamps"),x=p.fields.has("opacityFeatureAttribute");let T=0,C=null;if(x){const e=i.get("opacityFeatureAttribute");1===e.data.length?T=e.data[0]:C=e.data}const O=new Float32Array(o.buffer),M=P(o.buffer),L=new Uint8Array(o.buffer),R=p.stride/4;let V=l*R;const N=V;let U=0;const k=g?(e,t,i)=>U=g[i]:(e,t,i)=>U+=u(e,t),W=O.BYTES_PER_ELEMENT/M.BYTES_PER_ELEMENT,B=4/W,I=F(),J=(e,t,i,s,a,n,o,l)=>{O[V++]=t[0],O[V++]=t[1],O[V++]=t[2],D(e,t,M,V*W),V+=B,D(i,t,M,V*W),V+=B,O[V++]=l;let p=V*W;if(M[p++]=a,M[p++]=n,V=Math.ceil(p/W),z)O[V]=j?.[o]??y;else{const e=Math.min(4*o,w.length-4),t=4*V;L[t]=255*w[e],L[t+1]=255*w[e+1],L[t+2]=255*w[e+2],L[t+3]=255*w[e+3]}if(V++,O[V++]=v?.[o]??_,x&&(O[V++]=C?.[o]??T),I){let e=4*V;r?(L[e++]=r[0],L[e++]=r[1],L[e++]=r[2],L[e++]=r[3]):(L[e++]=0,L[e++]=0,L[e++]=0,L[e++]=0),V=Math.ceil(.25*e)}A&&(p=V*W,M[p++]=s[0],M[p++]=s[1],M[p++]=s[2],M[p++]=s[3],V=Math.ceil(p/W))};V+=R,n(_e,h.data[0],h.data[1],h.data[2]),A&&S(Pe,E[0],E[1],E[2],E[3]),e&&d(_e,_e,e);const Y=this._isClosed(i);if(Y){const t=h.data.length-3;n(Se,h.data[t],h.data[t+1],h.data[t+2]),e&&d(Se,Se,e)}else n(ve,h.data[3],h.data[4],h.data[5]),e&&d(ve,ve,e),J(_e,_e,ve,Pe,1,-4,0,0),J(_e,_e,ve,Pe,1,4,0,0),c(Se,_e),c(_e,ve),A&&S(Pe,E[4],E[5],E[6],E[7]);const q=Y?0:1,X=Y?f:f-1;for(let u=q;u<X;u++){const t=(u+1)%f*3;n(ve,h.data[t],h.data[t+1],h.data[t+2]),e&&d(ve,ve,e),k(Se,_e,u),J(Se,_e,ve,Pe,0,-1,u,U),J(Se,_e,ve,Pe,0,1,u,U);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);J(Se,_e,ve,Pe,t,-1,u,U),J(Se,_e,ve,Pe,t,1,u,U)}if(J(Se,_e,ve,Pe,1,-2,u,U),J(Se,_e,ve,Pe,1,2,u,U),c(Se,_e),c(_e,ve),A){const e=(u+1)%f*4;S(Pe,E[e],E[e+1],E[e+2],E[e+3])}}Y?(n(ve,h.data[3],h.data[4],h.data[5]),e&&d(ve,ve,e),U=k(Se,_e,X),J(Se,_e,ve,Pe,0,-1,q,U),J(Se,_e,ve,Pe,0,1,q,U)):(U=k(Se,_e,X),J(Se,_e,_e,Pe,0,-5,X,U),J(Se,_e,_e,Pe,0,5,X,U)),$(O,N+R,O,N,R);V=$(O,V-R,O,V,R),this._parameters.wireframe&&this._addWireframeVertices(o,N,V,R)}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ie(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return J+i}}const re=new k,se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=b(),me=i(),ue=i(),fe=b(),de=b(),ge=w(),be=w(),Se=b(),_e=b(),ve=b(),Pe=v(),we=[i(),i(),i(),i()],ye=[b(),b(),b(),b()],je=A(),ze=A(),Ee=A(),Ae=A();export{Q as Parameters,H as RibbonLineMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16;class
|
|
2
|
+
import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16,r=8;class s extends e{constructor(o){super(),this.spherical=o,this.capType=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.numJoinSubdivisions=1,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}o([t({count:3})],s.prototype,"capType",void 0),o([t({count:8})],s.prototype,"emissionSource",void 0),o([t({count:4})],s.prototype,"animation",void 0),o([t({count:i})],s.prototype,"polygonOffsetIndex",void 0),o([t()],s.prototype,"writeDepth",void 0),o([t()],s.prototype,"draped",void 0),o([t()],s.prototype,"stippleEnabled",void 0),o([t()],s.prototype,"stippleOffColorEnabled",void 0),o([t()],s.prototype,"stipplePreferContinuous",void 0),o([t({count:r})],s.prototype,"numJoinSubdivisions",void 0),o([t()],s.prototype,"roundJoins",void 0),o([t()],s.prototype,"applyMarkerOffset",void 0),o([t()],s.prototype,"hasVVSize",void 0),o([t()],s.prototype,"hasVVColor",void 0),o([t()],s.prototype,"hasVVOpacity",void 0),o([t()],s.prototype,"falloffEnabled",void 0),o([t()],s.prototype,"innerColorEnabled",void 0),o([t()],s.prototype,"hasOccludees",void 0),o([t()],s.prototype,"occluder",void 0),o([t()],s.prototype,"wireframe",void 0),o([t()],s.prototype,"discardInvisibleFragments",void 0),o([t()],s.prototype,"hasScreenSizePerspective",void 0),o([t()],s.prototype,"worldSizedImagePattern",void 0);export{r as NUM_JOIN_SUBDIVISION_COUNT,i as POLYGON_OFFSET_INDEX_COUNT,s as RibbonLineTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import{parameter as
|
|
2
|
+
import{__decorate as o}from"tslib";import{parameter as t,ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class i extends e{constructor(){super(...arguments),this.visualization=0,this.thresholdRendersSunlight=!1,this.useMask=!1}}o([t({count:4})],i.prototype,"visualization",void 0),o([t()],i.prototype,"thresholdRendersSunlight",void 0),o([t()],i.prototype,"useMask",void 0);export{i as ShadowCastVisualizeTechniqueConfiguration};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[88,926],{69540(e,t,i){i.d(t,{OU:()=>h,Pw:()=>c});var s=i(5482),r=i(69622),n=(i(44208),i(4718)),o=(i(53966),i(97768)),a=i(88620),l=i(64108);const u=Symbol("ClonableMixin"),h=e=>{var t;const i=e;let r=class extends i{constructor(){super(...arguments),this[t]=!0}static{t=u}clone(e){const t=(0,a.oY)(this);(0,o.Lw)(t,"unable to clone instance of non-accessor class");const i=t.metadata,s=t.store,r={},l=new Map;for(const t in i){const o=i[t],a=s?.originOf(t),u=o.clonable;if(o.readOnly||!1===u||7!==a&&0!==a&&5!==a&&4!==a)continue;const h=this[t];let c=null;if("function"==typeof u)c=u(h,e);else if("reference"===u)c=h;else if(c=(0,n.TU)(h,e),null!=h&&null==c)continue;0===a?l.set(t,c):r[t]=c}const u=new(0,Object.getPrototypeOf(this).constructor)(r);if(l.size){const e=(0,a.oY)(u)?.store;if(e)for(const[t,i]of l)e.set(t,i,0)}return u}};return r=(0,s.Cg)([(0,l.$)("esri.core.Clonable")],r),r},c=h(r.A)},66344(e,t,i){i.d(t,{q:()=>a});const s=!!(0,i(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class r{get size(){return this._size}constructor(e=10485760,t=.3){this._maxSize=e,this._maxClientSizeRatio=t,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._clients=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._clients.clear(),this._db.clear()}register(e){this._clients.set(e.id.slice(0,-1),e)}deregister(e){this.clear(e),this._sizeLimits.delete(e),this._clients.delete(e.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,-1),this._checkSize()}get _maxClientSize(){return this._maxSize*this._maxClientSizeRatio}getSize(e,t){const i=this._db.get(e.id+t);return i?.size??0}put(e,t,i,r,o){t=e.id+t;const a=this._db.get(t);if(a&&(this._size-=a.size,e.size-=a.size,this._db.delete(t),a.entry!==i&&this._notifyRemove(t,a.entry,a.size,0)),r>this._maxSize)return void this._notifyRemove(t,i,r,0);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!r||r<0)return s||console.warn(`Refusing to cache entry with size ${r} for key ${t}`),void this._notifyRemove(t,i,0,0);const l=1+Math.max(o,-4)- -3;this._db.set(t,new n(i,r,l)),this._size+=r,e.size+=r,this._checkSize()}updateSize(e,t){t=e.id+t;const i=this._db.get(t);if(!i)return;this._size-=i.size,e.size-=i.size;let s=i.entry.usedMemory;for(;s>this._maxSize;){const e=this._notifyRemove(t,i.entry,s,1);if(!(null!=e&&e>0))return void this._db.delete(t);s=e}i.size=s,this._size+=s,e.size+=s,this._checkSize()}pop(e,t){t=e.id+t;const i=this._db.get(t);if(i)return this._size-=i.size,e.size-=i.size,this._db.delete(t),++this._hit,i.entry;++this._miss}get(e,t){t=e.id+t;const i=this._db.get(t);if(void 0!==i)return this._db.delete(t),i.lives=i.lifetime,this._db.set(t,i),++this._hit,i.entry;++this._miss}peek(e,t){const i=this._db.get(e.id+t);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach((e,s)=>{const r=e.lifetime;i[r]=(i[r]||0)+e.size,this._clients.forEach(i=>{const{id:r,name:n}=i;if(s.startsWith(r)){const i=t[n]||0;t[n]=i+e.size}})});const s={};this._clients.forEach(e=>{const i=e.name;if("hitRate"in e&&"number"==typeof e.hitRate&&!isNaN(e.hitRate)&&e.hitRate>0){const r=t[i]||0;t[i]=r,s[i]=Math.round(100*e.hitRate)+"%"}else s[i]="0%"});const r=Object.keys(t);r.sort((e,i)=>t[i]-t[e]),r.forEach(i=>e[i]=Math.round(t[i]/2**20)+"MB / "+s[i]);for(let t=i.length-1;t>=0;--t){const s=i[t];s&&(e["Priority "+(t+-3-1)]=Math.round(s/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._clients.forEach(e=>e.resetHitRate())}clear(e){const t=e.id;this._db.forEach((e,i)=>{i.startsWith(t)&&(this._size-=e.size,this._db.delete(i),this._notifyRemove(i,e.entry,e.size,0))}),e.size=0}clearAll(){this._db.forEach((e,t)=>this._notifyRemove(t,e.entry,e.size,0)),this._clients.forEach(e=>e.size=0),this._size=0,this._db.clear()}*values(e){for(const[t,i]of this._db)t.startsWith(e.id)&&(yield i.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i,s){const r=this._clients.get(e.split(o)[0])?.removeFunc,n=r?.(t,s,i);return"number"==typeof n?n:null}_checkSize(){this._sizeLimits.forEach((e,t)=>this._checkSizeLimits(e,t)),this._clients.forEach(e=>this._checkSizeLimits(this._maxClientSize,e)),this._checkSizeLimits(this.maxSize)}setMaxClientSize(e,t){null==t||t<=0?this._sizeLimits.delete(e):this._sizeLimits.set(e,t)}_checkSizeLimits(e,t){const i=t??this;if(i.size<=e)return;const s=t?.id;let r=!0;for(;r;){r=!1;for(const[n,a]of this._db)if(0===a.lifetime&&(!s||n.startsWith(s))){const s=t??this._clients.get(n.split(o)[0]);if(this._purgeItem(n,a,s),i.size<=.9*e)return;r||=this._db.has(n)}}for(const[r,n]of this._db)if(!s||r.startsWith(s)){const s=t??this._clients.get(r.split(o)[0]);if(this._purgeItem(r,n,s),i.size<=.9*e)return}}_purgeItem(e,t,i){if(this._db.delete(e),t.lives<=1){this._size-=t.size,i&&(i.size-=t.size);const s=this._notifyRemove(e,t.entry,t.size,1);null!=s&&s>0&&(this._size+=s,i&&(i.size+=s),t.lives=t.lifetime,t.size=s,this._db.set(e,t))}else--t.lives,this._db.set(e,t)}}new r(0);class n{constructor(e,t,i){this.entry=e,this.size=t,this.lifetime=i,this.lives=i}}const o=":";class a{constructor(e,t){this.removeFunc=t,this.id="",this.name="",this.size=0,this._storage=new r(e,1),this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,t,i=1){this._storage.put(this,e,t,i,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}}},60999(e,t,i){i.d(t,{DZ:()=>p,Ke:()=>f,Tj:()=>h,UT:()=>m,aD:()=>y,jJ:()=>u});var s=i(5482),r=i(69622),n=i(97768),o=i(17676),a=i(10107),l=i(64108);function u(e,t,i){return(0,o.Lx)(e.map((e,s)=>t.apply(i,[e,s])))}async function h(e,t,i){return(await(0,o.Lx)(e.map((e,s)=>t.apply(i,[e,s])))).map(e=>e.value)}function c(e){return{ok:!0,value:e}}function d(e){return{ok:!1,error:e}}async function f(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return c(await e)}catch(e){return d(e)}}async function p(e){try{return c(await e)}catch(e){return(0,o.QP)(e),d(e)}}function m(e,t){return new _(e,t)}let _=class extends r.A{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,n.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:i}=this._abortController;this.promise=e(i),this.promise.then(e=>{this._result=c(e),this._cleanup()},e=>{this._result=d(e),this._cleanup()}),this._abortHandle=(0,o.u7)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,n.xt)(this._abortHandle),this._abortController=null}};(0,s.Cg)([(0,a.MZ)()],_.prototype,"value",null),(0,s.Cg)([(0,a.MZ)()],_.prototype,"error",null),(0,s.Cg)([(0,a.MZ)()],_.prototype,"finished",null),(0,s.Cg)([(0,a.MZ)()],_.prototype,"promise",void 0),(0,s.Cg)([(0,a.MZ)()],_.prototype,"_result",void 0),_=(0,s.Cg)([(0,l.$)("esri.core.asyncUtils.ReactiveTask")],_);class y{constructor(){this._sequence=Promise.resolve()}async acquire(){let e;this._sequence=new Promise(t=>{e=this._sequence.then(()=>t,()=>t)});const t=await e;return{[Symbol.dispose]:t}}async run(e){const t={stack:[],error:void 0,hasError:!1};try{return(0,s.mS)(t,await this.acquire(),!1),await e()}catch(e){t.error=e,t.hasError=!0}finally{(0,s.hk)(t)}}}},75503(e,t,i){i.d(t,{wq:()=>a});var s=i(4576),r=i(21818),n=(i(44208),i(15142)),o=i(11006);class a{constructor(e=9,t){this._compareMinX=d,this._compareMinY=f,this._toBBox=e=>e,this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&("function"==typeof t?this._toBBox=t:this._initFormat(t)),this.clear()}destroy(){this.clear(),b.prune(),w.prune(),C.prune(),S.prune()}all(e){l(this._data,e)}search(e,t){let i=this._data;const s=this._toBBox;if(v(e,i))for(b.clear();i;){for(let r=0,n=i.children.length;r<n;r++){const n=i.children[r],o=i.leaf?s(n):n;v(e,o)&&(i.leaf?t(n):g(e,o)?l(n,t):b.push(n))}i=b.pop()}}collides(e){let t=this._data;const i=this._toBBox;if(!v(e,t))return!1;for(b.clear();t;){for(let s=0,r=t.children.length;s<r;s++){const r=t.children[s],n=t.leaf?i(r):r;if(v(e,n)){if(t.leaf||g(e,n))return!0;b.push(r)}}t=b.pop()}return!1}load(e){if(!e.length)return this;if(e.length<this._minEntries){for(let t=0,i=e.length;t<i;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this._data.children.length)if(this._data.height===t.height)this._splitRoot(this._data,t);else{if(this._data.height<t.height){const e=this._data;this._data=t,t=e}this._insert(t,this._data.height-t.height-1,!0)}else this._data=t;return this}insert(e){return e&&this._insert(e,this._data.height-1),this}clear(){return this._data=new F([]),this}remove(e){if(!e)return this;let t,i=this._data,n=null,o=0,a=!1;const l=this._toBBox(e);for(C.clear(),S.clear();i||C.length>0;){if(i||(i=C.pop(),n=C.data[C.length-1],o=S.pop()??0,a=!0),i.leaf&&(t=(0,s.qh)(i.children,(0,r.z)(e),i.children.length,i.indexHint),-1!==t))return i.children.splice(t,1),C.push(i),this._condense(C),this;a||i.leaf||!g(i,l)?n?(o++,i=n.children[o],a=!1):i=null:(C.push(i),S.push(o),o=0,n=i,i=i.children[0])}return this}toJSON(){return this._data}fromJSON(e){return this._data=e,this}_build(e,t,i,s){const r=i-t+1;let n=this._maxEntries;if(r<=n){const s=new F(e.slice(t,i+1));return u(s,this._toBBox),s}s||(s=Math.ceil(Math.log(r)/Math.log(n)),n=Math.ceil(r/n**(s-1)));const o=new T([]);o.height=s;const a=Math.ceil(r/n),l=a*Math.ceil(Math.sqrt(n));x(e,t,i,l,this._compareMinX);for(let r=t;r<=i;r+=l){const t=Math.min(r+l-1,i);x(e,r,t,a,this._compareMinY);for(let i=r;i<=t;i+=a){const r=Math.min(i+a-1,t);o.children.push(this._build(e,i,r,s-1))}}return u(o,this._toBBox),o}_insert(e,t,i){const s=this._toBBox,r=i?e:s(e);C.clear();const n=function(e,t,i,s){for(;s.push(t),!0!==t.leaf&&s.length-1!==i;){let i,s=1/0,r=1/0;for(let n=0,o=t.children.length;n<o;n++){const o=t.children[n],a=p(o),l=_(e,o)-a;l<r?(r=l,s=a<s?a:s,i=o):l===r&&a<s&&(s=a,i=o)}t=i||t.children[0]}return t}(r,this._data,t,C);for(n.children.push(e),c(n,r);t>=0&&C.data[t].children.length>this._maxEntries;)this._split(C,t),t--;!function(e,t,i){for(let s=i;s>=0;s--)c(t.data[s],e)}(r,C,t)}_split(e,t){const i=e.data[t],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const n=this._chooseSplitIndex(i,r,s);if(!n)return;const o=i.children.splice(n,i.children.length-n),a=i.leaf?new F(o):new T(o);a.height=i.height,u(i,this._toBBox),u(a,this._toBBox),t?e.data[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this._data=new T([e,t]),this._data.height=e.height+1,u(this._data,this._toBBox)}_chooseSplitIndex(e,t,i){let s,r,n;s=r=1/0;for(let o=t;o<=i-t;o++){const t=h(e,0,o,this._toBBox),a=h(e,o,i,this._toBBox),l=y(t,a),u=p(t)+p(a);l<s?(s=l,n=o,r=u<r?u:r):l===s&&u<r&&(r=u,n=o)}return n}_chooseSplitAxis(e,t,i){const s=e.leaf?this._compareMinX:d,r=e.leaf?this._compareMinY:f;this._allDistMargin(e,t,i,s)<this._allDistMargin(e,t,i,r)&&e.children.sort(s)}_allDistMargin(e,t,i,s){e.children.sort(s);const r=this._toBBox,n=h(e,0,t,r),o=h(e,i-t,i,r);let a=m(n)+m(o);for(let s=t;s<i-t;s++){const t=e.children[s];c(n,e.leaf?r(t):t),a+=m(n)}for(let s=i-t-1;s>=t;s--){const t=e.children[s];c(o,e.leaf?r(t):t),a+=m(o)}return a}_condense(e){for(let t=e.length-1;t>=0;t--){const i=e.data[t];if(0===i.children.length)if(t>0){const r=e.data[t-1],n=r.children;n.splice((0,s.qh)(n,i,n.length,r.indexHint),1)}else this.clear();else u(i,this._toBBox)}}_initFormat(e){const t=["return a"," - b",";"];this._compareMinX=new Function("a","b",t.join(e[0])),this._compareMinY=new Function("a","b",t.join(e[1])),this._toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}function l(e,t){let i=e;for(w.clear();i;){if(!0===i.leaf)for(const e of i.children)t((0,r.z)(e));else w.pushArray(i.children);i=w.pop()??null}}function u(e,t){h(e,0,e.children.length,t,e)}function h(e,t,i,s,r){r||(r=new F([])),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let n,o=t;o<i;o++)n=e.children[o],c(r,e.leaf?s(n):n);return r}function c(e,t){e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY)}function d(e,t){return e.minX-t.minX}function f(e,t){return e.minY-t.minY}function p(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function m(e){return e.maxX-e.minX+(e.maxY-e.minY)}function _(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function y(e,t){const i=Math.max(e.minX,t.minX),s=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),n=Math.min(e.maxY,t.maxY);return Math.max(0,r-i)*Math.max(0,n-s)}function g(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function v(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function x(e,t,i,s,r){const n=[t,i];for(;n.length;){const t=n.pop(),i=n.pop();if(t-i<=s)continue;const a=i+Math.ceil((t-i)/s/2)*s;(0,o.q)(e,a,i,t,r),n.push(i,a,a,t)}}const b=new n.A,w=new n.A,C=new n.A,S=new n.A({deallocator:void 0});class I{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}class M extends I{constructor(){super(...arguments),this.height=1,this.indexHint=new s.vW}}class F extends M{constructor(e){super(),this.children=e,this.leaf=!0}}class T extends M{constructor(e){super(),this.children=e,this.leaf=!1}}},36708(e,t,i){i.d(t,{C_:()=>d,OH:()=>m,Vh:()=>_,on:()=>c,pc:()=>y,wB:()=>l,z7:()=>u});var s=i(37955),r=i(36563),n=i(97768),o=i(17676),a=i(14012);function l(e,t,i={}){return h(e,t,i,f)}function u(e,t,i={}){return h(e,t,i,p)}function h(e,t,i={},s){let r=null;const o=i.once?(e,i)=>{s(e)&&((0,n.xt)(r),t(e,i))}:(e,i)=>{s(e)&&t(e,i)};if(r=(0,a.Cn)(e,o,i.sync,i.equals),i.initial){const t=e();o(t,t)}return r}function c(e,t,i,o={}){let a=null,u=null,h=null;function c(){a&&u&&(u.remove(),o.onListenerRemove?.(a),a=null,u=null)}function d(e){o.once&&o.once&&(0,n.xt)(h),i(e)}const f=l(e,(e,i)=>{c(),(0,s.wb)(e)&&(a=e,u=(0,s.on)(e,t,d),o.onListenerAdd?.(e))},{sync:o.sync,initial:!0});return h=(0,r.hA)(()=>{f.remove(),c()}),h}function d(e,t){return function(e,t,i){if((0,o.G4)(i))return Promise.reject((0,o.NK)());const s=e();if(t?.(s))return Promise.resolve(s);let a=null;function l(){a=(0,n.xt)(a)}return new Promise((s,n)=>{a=(0,r.vE)([(0,o.u7)(i,()=>{l(),n((0,o.NK)())}),h(e,e=>{l(),s(e)},{sync:!1,once:!0},t??f)])})}(e,p,t)}function f(e){return!0}function p(e){return!!e}i(80559);const m={sync:!0},_={initial:!0},y={sync:!0,initial:!0}},60408(e,t,i){function s(e){return void 0!==e.xmin&&void 0!==e.ymin&&void 0!==e.xmax&&void 0!==e.ymax}function r(e){return void 0!==e.points}function n(e){return void 0!==e.x&&void 0!==e.y}function o(e){return void 0!==e.paths||void 0!==e.curvePaths}function a(e){return void 0!==e.rings||void 0!==e.curveRings}function l(e){return"object"==typeof e&&"vertexAttributes"in e}function u(e){return e?n(e)?"esriGeometryPoint":o(e)?"esriGeometryPolyline":a(e)?"esriGeometryPolygon":s(e)?"esriGeometryEnvelope":r(e)?"esriGeometryMultipoint":null:null}function h(e){return null!=e&&("hasZ"in e&&e.hasZ||"z"in e&&null!=e.z)}function c(e){return null!=e&&("hasM"in e&&e.hasM||"m"in e&&null!=e.m)}i.d(t,{$B:()=>u,Bi:()=>a,Pv:()=>h,Rg:()=>o,U9:()=>r,W0:()=>c,ZC:()=>s,fT:()=>n,uW:()=>l})},65864(e,t,i){i.d(t,{rS:()=>h,xD:()=>d});var s=i(5443),r=i(91075),n=i(48526),o=i(86738),a=i(39829),l=i(82799),u=i(60408);function h(e){return null==e?null:e instanceof r.A?e:(0,u.fT)(e)?o.A.fromJSON(e):(0,u.Rg)(e)?l.A.fromJSON(e):(0,u.Bi)(e)?a.A.fromJSON(e):(0,u.U9)(e)?n.A.fromJSON(e):(0,u.ZC)(e)?s.A.fromJSON(e):null}const c={esriGeometryPoint:o.A,esriGeometryPolyline:l.A,esriGeometryPolygon:a.A,esriGeometryEnvelope:s.A,esriGeometryMultipoint:n.A,esriGeometryMultiPatch:a.A};function d(e){return e&&c[e]||null}},6518(e,t,i){i.d(t,{F:()=>a});var s=i(44208),r=i(75503),n=i(19419);const o={minX:0,minY:0,maxX:0,maxY:0};class a{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new r.wq(9,(0,s.A)("esri-csp-restrictions")?e=>({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const e=new Array(this._idByBounds.size);let t=0;this._idByBounds.forEach((i,s)=>{e[t++]=s}),this._indexInvalid=!1,this._index.clear(),this._index.load(e)}else this._boundsToLoad.length&&(this._index.load(Array.from(new Set(this._boundsToLoad.filter(e=>this._idByBounds.has(e))))),this._boundsToLoad.length=0)}}get fullBounds(){if(!this._boundsById.size)return null;const e=(0,n.Ie)();for(const t of this._boundsById.values())t&&(e[0]=Math.min(t[0],e[0]),e[1]=Math.min(t[1],e[1]),e[2]=Math.max(t[2],e[2]),e[3]=Math.max(t[3],e[3]));return e}get valid(){return!this._indexInvalid}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(e){const t=this._boundsById.get(e);this._boundsById.delete(e),t&&(this._idByBounds.delete(t),this._indexInvalid||this._index.remove(t))}forEachInBounds(e,t){this._loadIndex(),function(e,t,i){(function(e){o.minX=e[0],o.minY=e[1],o.maxX=e[2],o.maxY=e[3]})(t),e.search(o,i)}(this._index,e,e=>t(this._idByBounds.get(e)))}get(e){return this._boundsById.get(e)}has(e){return this._boundsById.has(e)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(e,t){if(!this._indexInvalid){const t=this._boundsById.get(e);t&&(this._index.remove(t),this._idByBounds.delete(t))}this._boundsById.set(e,t),t&&(this._idByBounds.set(t,e),this._indexInvalid||(this._boundsToLoad.push(t),this._boundsToLoad.length>5e4&&this._loadIndex()))}}},39357(e,t,i){i.d(t,{A:()=>a});var s,r=i(5482),n=i(25482),o=i(91429);let a=s=class extends n.o{constructor(e){super(e),this.name=null,this.code=null}clone(){return new s({name:this.name,code:this.code})}};(0,r.Cg)([(0,o.MZ)({type:String,json:{write:{isRequired:!0}}})],a.prototype,"name",void 0),(0,r.Cg)([(0,o.MZ)({type:[String,Number],json:{write:{isRequired:!0}}})],a.prototype,"code",void 0),a=s=(0,r.Cg)([(0,o.$K)("esri.layers.support.CodedValue")],a)},53177(e,t,i){i.d(t,{A:()=>h});var s,r=i(5482),n=i(4718),o=i(91429),a=i(39357),l=i(76357),u=i(93223);let h=class extends l.A{static{s=this}constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let t=null;if(this.codedValues){const i=String(e);this.codedValues.some(e=>(String(e.code)===i&&(t=e.name),!!t))}return t}clone(){return new s({codedValues:(0,n.o8)(this.codedValues),name:this.name})}};(0,r.Cg)([(0,o.MZ)({type:[a.A],json:{write:{isRequired:!0}}})],h.prototype,"codedValues",void 0),(0,r.Cg)([(0,u.e)({codedValue:"coded-value"})],h.prototype,"type",void 0),h=s=(0,r.Cg)([(0,o.$K)("esri.layers.support.CodedValueDomain")],h)},76357(e,t,i){i.d(t,{A:()=>u});var s=i(5482),r=i(66552),n=i(25482),o=i(91429),a=i(93223);const l=new r.J({inherited:"inherited",codedValue:"coded-value",range:"range"});let u=class extends n.o{constructor(e){super(e),this.name=null,this.type=null}};(0,s.Cg)([(0,o.MZ)({type:String,json:{write:!0}})],u.prototype,"name",void 0),(0,s.Cg)([(0,a.e)(l),(0,o.MZ)({json:{write:{isRequired:!0}}})],u.prototype,"type",void 0),u=(0,s.Cg)([(0,o.$K)("esri.layers.support.Domain")],u)},20437(e,t,i){i.d(t,{A:()=>p});var s,r=i(5482),n=i(66552),o=i(25482),a=i(91429),l=i(56507),u=i(8631),h=i(98453),c=i(36005),d=i(93223);const f=new n.J({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",currency:"currency",dateAndTime:"date-and-time",description:"description",emailAddress:"email-address",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",phoneNumber:"phone-number",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let p=class extends o.o{static{s=this}constructor(e){super(e),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(e,{description:t}){let i=null;try{i=t?JSON.parse(t):null}catch(e){}return i?.value??null}readValueType(e,{description:t}){let i=null;try{i=t?JSON.parse(t):null}catch(e){}return i?f.fromJSON(i.fieldValueType):null}clone(){return new s({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain?.clone()??null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],p.prototype,"alias",void 0),(0,r.Cg)([(0,a.MZ)({type:[String,Number],json:{write:{allowNull:!0}}})],p.prototype,"defaultValue",void 0),(0,r.Cg)([(0,a.MZ)()],p.prototype,"description",void 0),(0,r.Cg)([(0,c.w)("description")],p.prototype,"readDescription",null),(0,r.Cg)([(0,a.MZ)({types:u.g,json:{read:{reader:u.r},write:!0}})],p.prototype,"domain",void 0),(0,r.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],p.prototype,"editable",void 0),(0,r.Cg)([(0,a.MZ)({type:l.jz,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],p.prototype,"length",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],p.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],p.prototype,"nullable",void 0),(0,r.Cg)([(0,d.e)(h.m)],p.prototype,"type",void 0),(0,r.Cg)([(0,a.MZ)()],p.prototype,"valueType",void 0),(0,r.Cg)([(0,c.w)("valueType",["description"])],p.prototype,"readValueType",null),(0,r.Cg)([(0,a.MZ)({type:Boolean,json:{read:!1}})],p.prototype,"visible",void 0),p=s=(0,r.Cg)([(0,a.$K)("esri.layers.support.Field")],p)},41628(e,t,i){i.d(t,{A:()=>l});var s,r=i(5482),n=i(91429),o=i(76357),a=i(93223);let l=class extends o.A{static{s=this}constructor(e){super(e),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new s({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};(0,r.Cg)([(0,n.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[1]},write:{enabled:!1,overridePolicy(){return{enabled:null!=this.maxValue&&null==this.minValue}},target:"range",writer(e,t,i){t[i]=[this.minValue||0,e]},isRequired:!0}}})],l.prototype,"maxValue",void 0),(0,r.Cg)([(0,n.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[0]},write:{target:"range",writer(e,t,i){t[i]=[e,this.maxValue||0]},isRequired:!0}}})],l.prototype,"minValue",void 0),(0,r.Cg)([(0,a.e)({range:"range"})],l.prototype,"type",void 0),l=s=(0,r.Cg)([(0,n.$K)("esri.layers.support.RangeDomain")],l)},8631(e,t,i){i.d(t,{r:()=>d,g:()=>c});var s,r=i(53177),n=i(76357),o=i(5482),a=i(91429),l=i(93223);let u=class extends n.A{static{s=this}constructor(e){super(e),this.type="inherited"}clone(){return new s}};(0,o.Cg)([(0,l.e)({inherited:"inherited"})],u.prototype,"type",void 0),u=s=(0,o.Cg)([(0,a.$K)("esri.layers.support.InheritedDomain")],u);var h=i(41628);const c={key:"type",base:n.A,typeMap:{range:h.A,"coded-value":r.A,inherited:u}};function d(e){if(!e?.type)return null;switch(e.type){case"range":return h.A.fromJSON(e);case"codedValue":return r.A.fromJSON(e);case"inherited":return u.fromJSON(e)}return null}},98453(e,t,i){i.d(t,{m:()=>s});const s=new(i(66552).J)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml",esriFieldTypeBigInteger:"big-integer",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"})},31756(e,t,i){i.d(t,{j:()=>n});var s=i(86211),r=i(79258);const n={unknown:1,inches:(0,s.oU)(1,"meters","inches"),feet:(0,s.oU)(1,"meters","feet"),"us-feet":(0,s.oU)(1,"meters","us-feet"),yards:(0,s.oU)(1,"meters","yards"),miles:(0,s.oU)(1,"meters","miles"),"nautical-miles":(0,s.oU)(1,"meters","nautical-miles"),millimeters:(0,s.oU)(1,"meters","millimeters"),centimeters:(0,s.oU)(1,"meters","centimeters"),decimeters:(0,s.oU)(1,"meters","decimeters"),meters:(0,s.oU)(1,"meters","meters"),kilometers:(0,s.oU)(1,"meters","kilometers"),"decimal-degrees":1/(0,s.vl)(1,"meters",r.$O.radius)}},63746(e,t,i){function s(e){return class{constructor(){for(const t of e)this[t]=null}}}function r(e,t=1){const{transform:i,hasZ:s,hasM:r}=e;if(null==i)return s&&1!==t?e=>{e[2]*=t}:null;const[n,o]=function(e,t,i,s){let{scale:r,translate:n,originPosition:o}=e;return"upperLeft"===o&&(r=r.map((e,t)=>1===t?-e:e)),t&&(r=r.map((e,t)=>2===t?e*s:e),n=n.map((e,t)=>2===t?e*s:e)),!t&&i&&(r=r.filter((e,t)=>2!==t),n=n.filter((e,t)=>2!==t)),[r,n]}(i,s,r,t),a=e.hasZ?3:2;return e=>{for(let t=0;t<e.length&&(t!==a||0!==e[t]);++t)e[t]=e[t]*n[t]+o[t]}}i.d(t,{Mv:()=>r,_7:()=>s}),i(53966)},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>c,jV:()=>l,lF:()=>h});var s=i(92602),r=i(70333),n=i(4718),o=i(84952),a=i(926);function l(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,o.An)(e):(0,n.o8)(e)}function h(e,t,i){const s={};for(const r in e){if("declaredClass"===r)continue;const n=e[r];if(null!=n&&"function"!=typeof n)if(Array.isArray(n))s[r]=n.map(e=>h(e));else if("object"==typeof n)if(n.toJSON){const e=n.toJSON(i?.[r]);s[r]=t?e:JSON.stringify(e)}else s[r]=t?n:JSON.stringify(n);else s[r]=n}return s}async function c(e,t,n){const o=function(e,t){return e?t&&(0,a.Qc)(e)?t:(0,a.getApiKey)(e)??r.id?.findCredential(e)?.token:null}(e,t);if(o)return o;!r.id&&s.A.request.useIdentity&&await Promise.all([i.e(7632),i.e(477),i.e(148)]).then(i.bind(i,50148));const l=await r.id.getCredential(e,n);return l?.token}},926(e,t,i){i.d(t,{Dd:()=>d,Jn:()=>f,Qc:()=>p,getApiKey:()=>h,getSessionToken:()=>c});var s=i(92602),r=i(11254),n=i(84952);const o=/^https?:\/\/(i?basemaps|basemapstyles)-api\.arcgis\.com\//i,a=new Set(["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"]),l=new Map;let u=null;function h(e){if(!p(e))return null;const t=t=>t instanceof RegExp?t.test(e):"string"==typeof t&&e.startsWith(t),i=s.A.apiKeys;if(Array.isArray(i.scopes))for(const e of i.scopes)if(Array.isArray(e.urls)){if(e.urls.some(t))return e.token}else if(t(e.urls))return e.token;return i.basemapStyles&&o.test(e)?i.basemapStyles:s.A.apiKey&&/^https?:\/\/.+\.arcgis\.com(\/|$)/i.test(e)?s.A.apiKey:null}async function c(e){if(!s.A.sessions?.basemap?.enabled||!o.test(e))return null;const t=h(e);if(!t)return null;u&&await u;const{styleFamily:i="arcgis",autoRefresh:n,duration:a=43200}=s.A.sessions.basemap,c=`${t}:${i}`,d=l.get(c);if(d&&(!n||d.endTime>Date.now()))return d.sessionToken;let f;u=(0,r.A)("https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/sessions/start",{cacheBust:!0,query:{durationSeconds:a,styleFamily:i,token:t}});try{f=(await u).data,f.endTime-=5e3,l.set(c,f)}finally{u=null}return f.sessionToken}function d(){return null!=s.A.apiKey||null!=s.A.apiKeys.basemapStyles}function f(e,t){return t?p(e):null!=h(e)}function p(e){const t=(0,n.$z)(e,!0);return!!t&&!a.has(t)&&!e.endsWith("/sharing/rest/generateToken")}},88625(e,t,i){i.d(t,{A:()=>g});var s,r=i(5482),n=i(69540),o=i(66552),a=i(25482),l=i(97768),u=i(91429),h=i(30524);let c=s=class extends a.o{constructor(e){super(e),this.expression=void 0,this.title=void 0}async collectRequiredFields(e,t){return(0,h.Dx)(e,t,null,this.expression)}clone(){return new s({expression:this.expression,title:this.title})}equals(e){return this.expression===e.expression&&this.title===e.title}};(0,r.Cg)([(0,u.MZ)({type:String,json:{write:{isRequired:!0}}})],c.prototype,"expression",void 0),(0,r.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],c.prototype,"title",void 0),c=s=(0,r.Cg)([(0,u.$K)("esri.symbols.support.FeatureExpressionInfo")],c);const d=c;var f=i(16271),p=i(36005),m=i(43937);const _=(0,o.O)()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),y=new o.J({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let g=class extends((0,n.OU)(a.o)){constructor(e){super(e),this.featureExpressionInfo=void 0,this.offset=null}readFeatureExpressionInfo(e,t){return null!=e?e.expression?e:void 0:t.featureExpression&&0===t.featureExpression.value?{expression:"0"}:void 0}writeFeatureExpressionInfo(e,t,i,s){t[i]=e.write({},s),"0"===e.expression&&(t.featureExpression={value:0})}get mode(){const{offset:e,featureExpressionInfo:t}=this;return this._isOverridden("mode")?this._get("mode"):null!=e||t?"relative-to-ground":"on-the-ground"}set mode(e){this._override("mode",e)}set unit(e){this._set("unit",e)}write(e,t){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(e,t):null}equals(e){return this.mode===e.mode&&this.offset===e.offset&&this.unit===e.unit&&(0,l.CM)(this.featureExpressionInfo,e.featureExpressionInfo)}};(0,r.Cg)([(0,u.MZ)({type:d,json:{write:!0}})],g.prototype,"featureExpressionInfo",void 0),(0,r.Cg)([(0,p.w)("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],g.prototype,"readFeatureExpressionInfo",null),(0,r.Cg)([(0,m.K)("featureExpressionInfo",{featureExpressionInfo:{type:d},"featureExpression.value":{type:[0]}})],g.prototype,"writeFeatureExpressionInfo",null),(0,r.Cg)([(0,u.MZ)({type:_.apiValues,nonNullable:!0,json:{type:_.jsonValues,read:_.read,write:{writer:_.write,isRequired:!0}}})],g.prototype,"mode",null),(0,r.Cg)([(0,u.MZ)({type:Number,json:{write:!0}})],g.prototype,"offset",void 0),(0,r.Cg)([(0,u.MZ)({type:f.KQ,json:{type:String,read:y.read,write:y.write}})],g.prototype,"unit",null),g=(0,r.Cg)([(0,u.$K)("esri.symbols.support.ElevationInfo")],g)},16271(e,t,i){i.d(t,{Ao:()=>n,KQ:()=>o});var s=i(4576),r=i(31756);function n(e){return 1/(r.j[e]||1)}const o=function(){const e=Object.keys(r.j);return(0,s.TF)(e,"decimal-degrees"),e.sort(),e}()},20401(e,t,i){i.r(t),i.d(t,{default:()=>Pe});var s=i(5482),r=i(65529),n=i(17676),o=i(36708),a=i(91429),l=i(79897),u=i(16930),h=i(65864),c=i(4576),d=i(49186),f=i(53966),p=i(87992),m=i(70328),_=i(6518),y=i(50498),g=i(69397),v=i(27647);class x{constructor(e=null,t={},i,s,r=0,n=null){this.geometry=e,this.attributes=t,this.centroid=i,this.objectId=s,this.displayId=r,this.distance=n}weakClone(){return new x(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId,this.distance)}clone(){return new x(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId,this.distance)}get usedMemory(){return 128+(0,g.lM)(this.attributes)+(this.geometry?.usedMemory??0)}ensureCentroid(e){return this.centroid??=(0,v.Q)(this.geometry&&(0,p.JR)(this.geometry)),this.centroid}}const b={getObjectId:e=>e.objectId,getAttributes:e=>e.attributes,getAttribute:(e,t)=>e.attributes[t],cloneWithGeometry:(e,t,i)=>new x((0,p.Nh)(y.gy.fromJSON(i),t),e.attributes,null,e.objectId,e.displayId,e.distance),getGeometry:e=>e.geometry&&(0,p.JR)(e.geometry),getGeometryWithCurves:e=>e.geometry,getCentroid:(e,t)=>e.ensureCentroid(t)};var w=i(51441);const C=(0,m.vt)();class S{constructor(e,t,i){this.geometryType=e,this.hasZ=t,this.hasM=i,this._boundsStore=new _.F,this._featuresById=new Map,this._usedMemory=0,this.events=new r.bk,this.featureAdapter=b}get usedMemory(){return this._usedMemory}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){const e=this._featuresById.size;let t=0;return this._featuresById.forEach(({geometry:e})=>{t+=e?e.vertexCount:0}),{featureCount:e,vertexCount:t}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,i,s,r]=this.fullBounds;return{xmin:t,ymin:i,xmax:s,ymax:r,spatialReference:(0,w.ag)(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(e){const t=e.map(e=>this._upsert(e));return this._emitChanged(),t.filter(c.Ru)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const i of e){const e=this._boundsStore.get(i.objectId);e&&t((0,m.Jt)(C,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const t=e.objectId;if(null==t)return void f.A.getLogger("esri.layers.graphics.data.FeatureStore").error(new d.A("featurestore:invalid-feature","feature id is missing",{feature:e}));const i=this._featuresById.get(t);let s;if(i?(e.displayId=i.displayId,s=this._boundsStore.get(t)??void 0,this._boundsStore.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0):this.onFeatureAdd?.(e),!e.geometry)return this._boundsStore.set(t,null),void this._featuresById.set(t,e);this._boundsStore.set(t,(0,p.NO)(e.geometry,s)),this._featuresById.set(t,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const t=e?.objectId;if(null==t)return f.A.getLogger("esri.layers.graphics.data.FeatureStore").error(new d.A("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const i=this._featuresById.get(t);if(!i)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0;const{geometry:s,attributes:r}=e;for(const e in r)i.attributes[e]=r[e];return s&&(i.geometry=s,this._boundsStore.set(t,(0,p.NO)(s)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(i)??0,i}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}var I=i(75752),M=i(87045),F=i(72802),T=i(61956),z=i(88625),A=i(66344),B=i(91869),P=i(86211),O=i(52006),R=i(16271);function E(e=!1,t){if(e){const{elevationInfo:e,alignPointsInFeatures:i}=t;return new Z(e,i)}return new j}class j{async alignCandidates(e,t,i){return e}notifyElevationSourceChange(){}}class Z{constructor(e,t){this._elevationInfo=e,this._alignPointsInFeatures=t,this._alignmentsCache=new A.q(1024),this._cacheVersion=0}async alignCandidates(e,t,i){const s=this._elevationInfo;return null==s||"absolute-height"!==s.mode||s.featureExpressionInfo?this._alignComputedElevationCandidates(e,t,i):(function(e,t,i){const{offset:s,unit:r}=i;if(null==s)return;const n=(0,P.G9)(t),o=s*((0,R.Ao)(r??"meters")/n);for(const t of e)switch(t.type){case"edge":t.start.z+=o,t.end.z+=o,t.curve&&((0,O.yP)(t.curve)[2]+=o);continue;case"vertex":t.target.z+=o;continue}}(e,t,s),e)}notifyElevationSourceChange(){this._alignmentsCache.clear(),this._cacheVersion++}async _alignComputedElevationCandidates(e,t,i){const s=new Map;for(const t of e)(0,B.tE)(s,t.objectId,Y).push(t);const[r,o,a]=this._prepareQuery(s,t),l=await this._alignPointsInFeatures(r,i);if((0,n.Te)(i),a!==this._cacheVersion)return this._alignComputedElevationCandidates(e,t,i);this._applyCacheAndResponse(r,l,o);const{drapedObjectIds:u,failedObjectIds:h}=l,c=[];for(const t of e){const{objectId:e}=t;u.has(e)&&"edge"===t.type&&(t.draped=!0),h.has(e)||c.push(t)}return c}_prepareQuery(e,t){const i=[],s=[];for(const[t,r]of e){const e=[];for(const i of r)this._addToQueriesOrCachedResult(t,i.target,e,s),"edge"===i.type&&(this._addToQueriesOrCachedResult(t,i.start,e,s),this._addToQueriesOrCachedResult(t,i.end,e,s));0!==e.length&&i.push({objectId:t,points:e})}return[{spatialReference:t.toJSON(),pointsInFeatures:i},s,this._cacheVersion]}_addToQueriesOrCachedResult(e,t,i,s){const r=q(e,t),n=this._alignmentsCache.get(r);null==n?i.push(t):s.push(new k(t,n))}_applyCacheAndResponse(e,{elevations:t,drapedObjectIds:i,failedObjectIds:s},r){for(const e of r)e.apply();let n=0;const o=this._alignmentsCache;for(const{objectId:r,points:a}of e.pointsInFeatures){if(s.has(r)){n+=a.length;continue}const e=!i.has(r);for(const i of a){const s=q(r,i),a=t[n++];i.z=a,e&&o.put(s,a,1)}}}}class k{constructor(e,t){this.point=e,this.z=t}apply(){this.point.z=this.z}}function q(e,{x:t,y:i,z:s,spatialReference:r}){return`${e}-${t}-${i}-${s??0}}-wkid:${r?.wkid}`}function Y(){return[]}class X{filter(e,t){return t}notifyElevationSourceChange(){}}class N{filter(e,t){const{point:i,distance:s}=e,{z:r}=i;if(null==r)return t;if(0===t.length)return t;const n=function(e){return"number"==typeof e?{x:e,y:e,z:e}:e}(s),o=this._updateCandidatesTo3D(t,i,n).filter(V);return o.sort(G),o}_updateCandidatesTo3D(e,t,i){for(const s of e)switch(s.type){case"edge":H(s,t,i);continue;case"vertex":J(s,t,i);continue}return e}}function V(e){return e.distance<=1}function L(e=!1){return e?new N:new X}function H(e,t,{x:i,y:s,z:r}){const{start:n,end:o,target:a}=e;if(e.curve)throw new Error("Curves are not yet supported.");e.draped||function(e,t,i,s){const r=s.x-i.x,n=s.y-i.y,o=s.z-i.z,a=r*r+n*n+o*o,l=(t.x-i.x)*r+(t.y-i.y)*n+o*(t.z-i.z),u=Math.min(1,Math.max(0,l/a)),h=i.x+r*u,c=i.y+n*u,d=i.z+o*u;e.x=h,e.y=c,e.z=d}(a,t,n,o);const l=(t.x-a.x)/i,u=(t.y-a.y)/s,h=(t.z-a.z)/r;e.distance=Math.sqrt(l*l+u*u+h*h)}function J(e,t,{x:i,y:s,z:r}){const{target:n}=e,o=(t.x-n.x)/i,a=(t.y-n.y)/s,l=(t.z-n.z)/r,u=Math.sqrt(o*o+a*a+l*l);e.distance=u}function G(e,t){return e.distance-t.distance}var $=i(4718),U=i(799);function D(e=!1,t){return e?new W(t):new K}class K{async fetch(){return[]}notifySymbologyChange(){}}class W{constructor(e){this._getSymbologyCandidates=e,this._candidatesCache=new A.q(1024),this._cacheVersion=0}async fetch(e,t){if(0===e.length)return[];const i=[],s=[],r=this._candidatesCache;for(const t of e){const e=Q(t),n=r.get(e);if(n)for(const e of n)s.push((0,$.o8)(e));else i.push(t),r.put(e,[],1)}if(0===i.length)return s;const o=this._cacheVersion,{candidates:a,sourceCandidateIndices:l}=await this._getSymbologyCandidates(i,t);if((0,n.Te)(t),o!==this._cacheVersion)return this.fetch(e,t);const u=[],{length:h}=a;for(let e=0;e<h;++e){const t=a[e],s=Q(i[l[e]]),n=r.get(s);n.push(t),r.put(s,n,n.length),u.push((0,$.o8)(t))}return s.concat(u)}notifySymbologyChange(){this._candidatesCache.clear(),this._cacheVersion++}}function Q(e){switch(e.type){case"vertex":{const{objectId:t,target:i}=e,s=`${t}-vertex-${i.x}-${i.y}-${i.z??0}`;return(0,U.Wm)(s).toString()}case"edge":{const{objectId:t,start:i,end:s}=e,r=`${t}-edge-${i.x}-${i.y}-${i.z??0}-to-${s.x}-${s.y}-${s.z??0}`;return(0,U.Wm)(r).toString()}default:return""}}var ee=i(69622),te=i(60999),ie=i(3483),se=i(13069),re=i(5443),ne=i(19419),oe=i(92722),ae=i(54339);class le{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new le;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}var ue=i(60694),he=i(62815),ce=i(63746);class de{constructor(e){this._options=e,this.featureSet=new le,this.parseOnly=null,this._idInfo=null,this._transformInPlace=null,this._transformInPlaceXY=null,this._push=de._pushXY,this._attributesClass=null,this._previousX=0,this._previousY=0,this._vertex=[],this._i=0,this._geometry=null,this._iVertex=0,this._iPart=0,this._isPolygon=!1,this._ringEndsAt=-1}queryGeometryType(){return this.featureSet.queryGeometryType}queryGeometry(){return this.featureSet.queryGeometry}idField(e){"string"==typeof e?this._idInfo??={type:"object-id",fieldName:e}:this._idInfo={type:"unique-id-simple",fieldName:e.name}}finish(){if(this._idInfo)for(const e of this.featureSet.features)e.objectId=(0,ae.W)(e,this._idInfo);const{spatialReference:e,features:t}=this.featureSet;if(e)for(const{geometry:i}of t)i&&(i.spatialReference=e);this.featureSet.transform=null}feature(){this._attributesClass??=(0,ce._7)(this.featureSet.fields?.map(e=>e.name)??[]),this.featureSet.features.push(new x(null,new this._attributesClass,null,0)),this._setVertexTransformer()}centroid(e){const{hasZ:t,hasM:i}=this.featureSet;this.featureSet.features.at(-1).centroid=new oe.A([],e,t,i)}geometry(e,t,i){this._previousX=this._previousY=0,this._i=this._iVertex=this._iPart=0;let{hasZ:s,hasM:r}=this.featureSet;s??=!1,r??=!1,this._vertex=[0,0],s&&this._vertex.push(0),r&&this._vertex.push(0);const n=y.gy.fromJSON(t);this._isPolygon="polygon"===n;const o=Number(this._isPolygon),a="point"===n?1:i.reduce((e,t)=>e+t-o,0),l="point"===n?0:i.length;if(this._geometry=(0,p.V2)(n,a,l,s,r,!1),this._push=s?r?de._pushXYZM:de._pushXYZ:r?de._pushXYM:de._pushXY,this._geometry.isMultipart()){this._geometry.partOffsets[0]=0;for(let e=0;e<l;++e)this._geometry.partOffsets[e+1]=this._geometry.partOffsets[e]+i[e]-o}this._ringEndsAt=o?this._geometry.partOffsets.at(1)??0:-1,1===e?(this.featureSet.queryGeometry=this._geometry,this.featureSet.queryGeometryType=t):this.featureSet.features.at(-1).geometry=this._geometry}coord(e){const t=this._vertex;t[this._i++]=e,this._i<t.length||(this._i=0,t[0]+=this._previousX,t[1]+=this._previousY,[this._previousX,this._previousY]=t,this._iVertex===this._ringEndsAt&&(++this._iPart,this._ringEndsAt=this._geometry.partOffsets[this._iPart+1],this._previousX=this._previousY=0,this._isPolygon)||(this._transformInPlace?.(t),this._push(this)))}curvedGeometry(e,t,i,s){let{hasZ:r,hasM:n}=this.featureSet;r??=!1,n??=!1,this._i=this._iVertex=this._iPart=0;const o=y.gy.fromJSON(e);this._isPolygon="polygon"===o;const a=Number(!this._isPolygon),l=t.length;let u=0,h=0,c=a*l;for(let e=0;e<i.length;++e)switch(c+=s[e],i[e]){case 1:case 3:u+=s[e];continue;case 2:h+=s[e]}this._geometry=(0,p.V2)(o,c,l,r,n,!0,u,h);const{partOffsets:d}=this._geometry;d[0]=0;for(let e=0,i=0;e<l;++e){d[e+1]=d[e]+a;for(let r=0;r<t[e];++r)d[e+1]+=s[i++]}switch(e){case"esriGeometryPoint":case"esriGeometryMultipoint":throw new Error(`Curved ${e} does not make sense`)}this.featureSet.features.at(-1).geometry=this._geometry}startCurvedPart(e){}finishCurvedPart(e){this._isPolygon||(this._transform(e,this._vertex),this._push(this)),++this._iPart}lineSegment(e,t){this._transform(e,this._vertex),this._push(this)}bezierSegment(e,t,i,s){this._transform(e,this._vertex),this._push(this),this._transformXY(t,me.b[0]),this._transformXY(i,me.b[1]),this._transformXY(s,me.b[2]),this._i=(0,p.tr)(this._vertex,me,this._geometry,this._iVertex-1,this._i)}circularArcSegment(e,t,i){this._transform(e,this._vertex),this._push(this),this._transformXY(t,fe.c[0]),this._transformXY(i,fe.c[1]),this._i=(0,p.e6)(this._vertex,fe,this._geometry,this._iVertex-1,this._i)}ellipticArcSegment(e,t,i,s,r,n,o,a){this._transform(e,this._vertex),this._push(this),this._transformXY(t,pe.a[0]),this._transformXY(i,pe.a[1]),pe.a[2]=s,pe.a[3]=r,pe.a[4]=n,pe.a[5]=o,pe.a[6]=a,this._i=(0,p._s)(this._vertex,pe,this._geometry,this._iVertex-1,this._i)}static _pushXY(e){const t=e._iVertex++,{vertexXY:i}=e._geometry;[i[2*t],i[2*t+1]]=e._vertex}static _pushXYZ(e){const t=e._iVertex++,{vertexXY:i,vertexZ:s}=e._geometry;[i[2*t],i[2*t+1],s[t]]=e._vertex}static _pushXYM(e){const t=e._iVertex++,{vertexXY:i,vertexM:s}=e._geometry;[i[2*t],i[2*t+1],s[t]]=e._vertex}static _pushXYZM(e){const t=e._iVertex++,{vertexXY:i,vertexM:s,vertexZ:r}=e._geometry;[i[2*t],i[2*t+1],r[t],s[t]]=e._vertex}_setVertexTransformer(){const{sourceSpatialReference:e}=this._options,{spatialReference:t,hasZ:i,transform:s}=this.featureSet,r=i?(0,he.d)(e,t):1;this._transformInPlace??=(0,ce.Mv)(this.featureSet,r),this._transformInPlaceXY??=(0,ce.Mv)({transform:s})}_transform(e,t){for(let i=0;i<e.length;++i)t[i]=e[i];this._transformInPlace?.(t)}_transformXY(e,t){t[0]=e[0],t[1]=e[1],this._transformInPlaceXY?.(t)}}const fe={c:[[0,0],[0,0]]},pe={a:[[0,0],[0,0],0,0,0,0,0]},me={b:[[0,0],[0,0],[0,0]]};var _e=i(80893);class ye{constructor(e,t){this.key=e,this.resolution=t,this.state={type:0},this.alive=!0}process(e){switch(this.state.type){case 0:return this.state=this._gotoFetchCount(this.state,e),this.state.task.promise.then(e.resume,e.resume);case 1:case 3:break;case 2:return this.state=this._gotoFetchFeatures(this.state,e),this.state.task.promise.then(e.resume,e.resume);case 4:this.state=this._goToDone(this.state,e)}return null}get debugInfo(){return{key:this.key,featureCount:this._featureCount,state:this._stateToString}}get _featureCount(){switch(this.state.type){case 0:case 1:return 0;case 2:return this.state.featureCount;case 3:return this.state.previous.featureCount;case 4:return this.state.features.length;case 5:return this.state.previous.features.length}}get _stateToString(){switch(this.state.type){case 0:return"created";case 1:return"fetch-count";case 2:return"fetched-count";case 3:return"fetch-features";case 4:return"fetched-features";case 5:return"done"}}_gotoFetchCount(e,t){return{type:1,previous:e,task:(0,te.UT)(async e=>{const i=await(0,te.DZ)(t.fetchCount(this,e));1===this.state.type&&(this.state=function(e,t){return{type:2,featureCount:t,previous:e}}(this.state,i.ok?i.value:1/0))})}}_gotoFetchFeatures(e,t){return{type:3,previous:e,task:(0,te.UT)(async i=>{const s=await(0,te.DZ)(t.fetchFeatures(this,e.featureCount,i));3===this.state.type&&(this.state=function(e,t){return{type:4,previous:e,features:t}}(this.state,s.ok?s.value:[]))})}}_goToDone(e,t){return t.finish(this,e.features),{type:5,previous:e}}reset(){const e=this.state;switch(this.state={type:0},e.type){case 0:case 2:case 4:case 5:break;case 1:case 3:e.task.abort()}}}let ge=class extends ee.A{get _minimumVerticesPerFeature(){switch(this.store?.featureStore.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":return 1;case"esriGeometryPolygon":return 4;case"esriGeometryPolyline":return 2}}get _mandatoryOutFields(){const e=new Set;return this.objectIdField&&e.add(this.objectIdField),this.globalIdField&&e.add(this.globalIdField),e}set outFields(e){const t=this._get("outFields"),i=(0,ie.KC)(e,this._mandatoryOutFields);(0,ie.aI)(i,t)||(this._set("outFields",i),(0,ie.Yy)(i,t)||this.refresh())}get outFields(){return this._get("outFields")??this._mandatoryOutFields}set filter(e){const t=this._get("filter"),i=this._filterProperties(e);JSON.stringify(t)!==JSON.stringify(i)&&this._set("filter",i)}set customParameters(e){const t=this._get("customParameters");JSON.stringify(t)!==JSON.stringify(e)&&this._set("customParameters",e)}get _configuration(){return{filter:this.filter,customParameters:this.customParameters,tileInfo:this.tileInfo,tileSize:this.tileSize}}set tileInfo(e){const t=this._get("tileInfo");t!==e&&(null!=e&&null!=t&&JSON.stringify(e)===JSON.stringify(t)||(this._set("tileInfo",e),this.store.tileInfo=e))}set tileSize(e){this._get("tileSize")!==e&&this._set("tileSize",e)}get updating(){return this._updatingHandles.updating}get hasZ(){return this.store.featureStore.hasZ}constructor(e){super(e),this.suspended=!0,this._historicMoment=null,this.tilesOfInterest=new Array,this.availability=0,this._pendingTiles=new Map,this._updatingHandles=new l.U}initialize(){this._initializeFetchExtent(),this._updatingHandles.add(()=>this._configuration,()=>this.refresh()),this._updatingHandles.add(()=>this.tilesOfInterest,()=>{this._updatePriorities(),this._process()},{sync:!0,initial:!0,equals:(e,t)=>(0,c.aI)(e,t,({id:e},{id:t})=>e===t)}),this.addHandles((0,o.z7)(()=>!this.suspended,()=>this._process()))}_updatePriorities(){this.store.setPriorityOrderByKey(this.tilesOfInterest.map(({id:e})=>e)??[])}destroy(){this._pendingTiles.forEach(e=>this._deletePendingTile(e)),this._pendingTiles.clear(),this.store.destroy(),this.tilesOfInterest.length=0,this._updatingHandles.destroy()}refresh(){this.store.refresh(),this._pendingTiles.forEach(e=>this._deletePendingTile(e)),this._process()}async handleEdits(e){if(e.historicMoment&&(this._historicMoment=e.historicMoment),!e.addedFeatures.length&&!e.updatedFeatures.length&&!e.deletedFeatures.length)return;for(const e of this._pendingTiles.values())e.reset();const t={...e,deletedFeatures:e.deletedFeatures.map(({objectId:e,globalId:t})=>e&&-1!==e?e:this._lookupObjectIdByGlobalId(t))},i=(0,te.UT)(async e=>{try{await this.store.processEdits(t,(e,t)=>this._queryFeaturesById(e,t),e),this._processPendingTiles()}catch(e){(0,n.QP)(e),f.A.getLogger(this).warn("Failed to apply edits",e)}});this.addHandles(i),await this._updatingHandles.addPromise(i.promise)}setHistoricMoment(e){e?.getTime()!==this._historicMoment?.getTime()&&(this._historicMoment=e,this.refresh())}_initializeFetchExtent(){if(!this.capabilities.query.supportsExtent||!(0,ue.Wo)(this.url))return;const e=(0,te.UT)(async e=>{try{const t=await(0,_e.Jf)(this.url,new T.A({where:"1=1",outSpatialReference:this.spatialReference,cacheHint:this.capabilities.query.supportsCacheHint??void 0}),{query:this._configuration.customParameters,signal:e});this.store.extent=re.A.fromJSON(t?.extent)}catch(e){(0,n.QP)(e),f.A.getLogger(this).warn("Failed to fetch data extent",e)}});this._updatingHandles.consumePromise(e.promise.then(()=>this._process())),this.addHandles(e)}get debugInfo(){return{numberOfFeatures:this.store.featureStore.numFeatures,tilesOfInterest:this.tilesOfInterest,pendingTiles:Array.from(this._pendingTiles.values()).map(e=>e.debugInfo),storedTiles:this.store.debugInfo}}_process(){this._markTilesNotAlive(),this._createPendingTiles(),this._deletePendingTiles(),this._processPendingTiles()}_markTilesNotAlive(){for(const e of this._pendingTiles.values())e.alive=!1}_createPendingTiles(){if(this.suspended)return;const e=this._collectMissingTilesInfo();if(this._setAvailability(null==e?1:e.coveredArea/e.fullArea),null!=e)for(const{data:t,resolution:i}of e.missingTiles){const e=this._pendingTiles.get(t.id);e?(e.resolution=i,e.alive=!0):this._createPendingTile(t,i)}}_collectMissingTilesInfo(){let e=null;for(const t of this.tilesOfInterest){const i=this.store.process(t,(e,t)=>this._verifyTileComplexity(e,t),this.outFields);null==e?e=i:e.prepend(i)}return e}_deletePendingTiles(){for(const e of this._pendingTiles.values())e.alive||this._deletePendingTile(e)}_processPendingTiles(){const e={fetchCount:(e,t)=>this._fetchCount(e,t),fetchFeatures:(e,t,i)=>this._fetchFeatures(e,t,i),finish:(e,t)=>this._finishPendingTile(e,t),resume:()=>this._processPendingTiles()};if(this._ensureFetchAllCounts(e))for(const t of this._pendingTiles.values())this._verifyTileComplexity(this.store.getFeatureCount(t.key),t.resolution)&&this._updatingHandles.consumePromise(t.process(e))}_verifyTileComplexity(e,t){return this._verifyVertexComplexity(e)&&this._verifyFeatureDensity(e,t)}_verifyVertexComplexity(e){return e*this._minimumVerticesPerFeature<be}_verifyFeatureDensity(e,t){if(null==this.tileInfo)return!1;const i=this.tileSize*t;return e*(we/(i*i))<Ce}_ensureFetchAllCounts(e){let t=!0;for(const i of this._pendingTiles.values())i.state.type<2&&this._updatingHandles.consumePromise(i.process(e)),i.state.type<=1&&(t=!1);return t}_finishPendingTile(e,t){this.store.add(e.key,t),this._deletePendingTile(e),this._updateAvailability()}_updateAvailability(){const e=this._collectMissingTilesInfo();this._setAvailability(null==e?1:e.coveredArea/e.fullArea)}_setAvailability(e){this._set("availability",e)}_createPendingTile(e,t){const i=new ye(e,t);return this._pendingTiles.set(e.id,i),i}_deletePendingTile(e){e.reset(),this._pendingTiles.delete(e.key.id)}async _fetchCount(e,t){return this.store.fetchCount(e.key,this.url,this._createCountQuery(e),{query:this.customParameters,timeout:xe,signal:t})}async _fetchFeatures(e,t,i){let s=0;const r=[];let n=0,o=t;for(;;){const a=this._createFeaturesQuery(e),l=this._setPagingParameters(a,s,o),{features:u,exceededTransferLimit:h}=await this._queryFeatures(a,i);l&&(s+=a.num),n+=u.length;for(const e of u)r.push(e);if(o=t-n,!l||!h||o<=0)return r}}_filterProperties(e){return null==e?{where:"1=1",gdbVersion:void 0,timeExtent:void 0}:{where:e.where||"1=1",timeExtent:e.timeExtent,gdbVersion:e.gdbVersion}}_lookupObjectIdByGlobalId(e){const t=this.globalIdField,i=this.objectIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let s=null;const r=e?(0,se.AG)(e):e;if(this.store.featureStore.forEach(e=>{r===(0,se.AG)(e.attributes[t])&&(s=e.objectId??e.attributes[i])}),null==s)throw new Error(`Expected to find a feature with globalId ${e}`);return s}_queryFeaturesById(e,t){const i=this._createFeaturesQuery();return i.objectIds=e,this._queryFeatures(i,t)}async _queryFeatures(e,t){return 0===e.num?new le:this.capabilities.query.supportsFormatPBF?this._queryFeaturesPBF(e,t):this._queryFeaturesJSON(e,t)}async _queryFeaturesPBF(e,t){const{sourceSpatialReference:i}=this;return await(0,_e.IJ)(this.url,e,new de({sourceSpatialReference:i}),{query:this._configuration.customParameters,timeout:xe,signal:t})}async _queryFeaturesJSON(e,t){const{sourceSpatialReference:i}=this;return function({exceededTransferLimit:e,features:t,fields:i,geometryType:s,hasM:r,hasZ:n,spatialReference:o,transform:a},l){const u=new le;u.exceededTransferLimit=e??!1;for(const e of t??[]){let t,i;s&&(t=e.geometry&&(0,p.ME)(e.geometry),i=e.centroid&&new oe.A([],[e.centroid.x,e.centroid.y]));const r=(0,ae.W)(e,l),n=void 0;u.features.push(new x(t,e.attributes,i,r,n,e.distance))}return u.fields=i??u.fields,u.geometryType=s??null,u.hasM=r??!1,u.hasZ=n??!1,u.spatialReference=o??null,u.transform=a??null,u}(await(0,_e.eW)(this.url,e,i,{query:this._configuration.customParameters,timeout:xe,signal:t}),{type:"object-id",fieldName:this.objectIdField})}_createCountQuery(e){const t=this._createBaseQuery(e);return this.capabilities.query.supportsCacheHint&&(t.cacheHint=!0),t}_createFeaturesQuery(e=null){const t=this._createBaseQuery(e),i=null!=e?.key?this.store.getAttributesForTile(e?.key?.id):null,s=(0,ie.KC)((0,ie.iv)(this.outFields,i??new Set),this._mandatoryOutFields);return t.outFields=Array.from(s),t.returnGeometry=!0,this.capabilities.data.supportsTrueCurve&&(!this.capabilities.query.supportsFormatPBF||this.capabilities.query.supportsFormatPBFWithCurves)&&(t.returnTrueCurves=!0),null!=e&&(this.capabilities.query.supportsResultType?t.resultType="tile":this.capabilities.query.supportsCacheHint&&(t.cacheHint=!0)),t}_createBaseQuery(e){const t=new T.A({returnZ:this.hasZ,returnM:!1,historicMoment:this._historicMoment,geometry:null!=this.tileInfo&&null!=e?(0,ne.w1)(e.key.extent,this.tileInfo.spatialReference):void 0}),i=this._configuration.filter;return null!=i&&(t.where=i.where,t.gdbVersion=i.gdbVersion,t.timeExtent=i.timeExtent),t.outSpatialReference=this.spatialReference,t}_setPagingParameters(e,t,i){if(!this.capabilities.query.supportsPagination)return!1;const{supportsMaxRecordCountFactor:s,supportsCacheHint:r,tileMaxRecordCount:n,maxRecordCount:o,supportsResultType:a}=this.capabilities.query,l=s?T.A.MAX_MAX_RECORD_COUNT_FACTOR:1,u=l*((a||r)&&n?n:o||ve);return e.start=t,s?(e.maxRecordCountFactor=Math.min(l,Math.ceil(i/u)),e.num=Math.min(i,e.maxRecordCountFactor*u)):e.num=Math.min(i,u),!0}};(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"url",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"currentVersion",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"objectIdField",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"globalIdField",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"capabilities",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"sourceSpatialReference",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"spatialReference",void 0),(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],ge.prototype,"store",void 0),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],ge.prototype,"_minimumVerticesPerFeature",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"_mandatoryOutFields",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"outFields",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"suspended",void 0),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"_historicMoment",void 0),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"filter",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"customParameters",null),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],ge.prototype,"_configuration",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"tileInfo",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"tileSize",null),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"tilesOfInterest",void 0),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],ge.prototype,"updating",null),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],ge.prototype,"availability",void 0),(0,s.Cg)([(0,a.MZ)()],ge.prototype,"hasZ",null),ge=(0,s.Cg)([(0,a.$K)("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")],ge);const ve=2e3,xe=6e5,be=1e6,we=25,Ce=1;i(44208);class Se{constructor(){this._store=new Map,this._priorities=new Map}get size(){return this._store.size}setPriorityOrderByKey(e){this._priorities.clear();for(let t=e.length-1;t>=0;t--)this._priorities.set(e[t],e.length-t)}hasLowerPriority(e){const t=this._priorities.get(e);if(null==t)return!0;for(const[e]of this._store){const i=this._priorities.get(e);if(null==i||i<t)return!0}return!1}someFromLowestToHighestPriority(e){const{_priorities:t}=this;for(const[i,s]of this._store)if(!t.has(i)&&e(s,i))return!0;for(const[i]of t){const t=this._store.get(i);if(t&&e(t,i))return!0}return!1}set(e,t){this._store.set(e,t)}delete(e){return this._store.delete(e)}get(e){return this._store.get(e)}has(e){return this._store.has(e)}clear(){this._store.clear()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}let Ie=class extends ee.A{setPriorityOrderByKey(e){this._tiles.setPriorityOrderByKey(e)}get _memoryLimitExceeded(){return this.featureStore.usedMemory>=this.maximumByteSize}constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10485760,this._tileBounds=new _.F,this._tiles=new Se,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=(0,ne.vt)()}add(e,t){for(const e of t)this._referenceFeature(e.objectId);const i=this.featureStore.upsertMany(t),s=i.map(e=>new Set(Object.keys(e.attributes))).reduce((e,t)=>(0,ie.E$)(e,t),new Set(Object.keys(i[0]?.attributes??[]))),r=this._memoryLimitExceeded;this._addTileStorage(e,new Set(i.map(e=>e.objectId)),s),r&&this._applyCacheMemoryLimits()}_applyCacheMemoryLimits(){if(!this._memoryLimitExceeded)return;const{_tiles:e,featureStore:t,maximumByteSize:i}=this;e.someFromLowestToHighestPriority(e=>!this._memoryLimitExceeded||t.usedMemory-this._estimateRemoveTileMemoryReduction(e)<i||(this._removeTileStorage(e),!1))}_estimateRemoveTileMemoryReduction(e){let t=0;for(const i of e.objectIds)if(1===this._refCounts.get(i)){const e=this.featureStore.getFeature(i);e&&(t+=this.featureStore.estimateFeatureUsedMemory?.(e)??0)}return t}_hasAttributesForTile(e,t){if(e){const i=this._tiles.get(e);if(i)return!i.objectIds.size||(0,ie.Yy)(t,i.attributeKeys)}return!1}getAttributesForTile(e){return e?this._tiles.get(e)?.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,i){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,i)}_addTileStorage(e,t,i){const s=e.id;this._tiles.set(s,new Me(e,t,i)),this._tileBounds.set(s,e.extent),this._tileFeatureCounts.set(s,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)1===this._unreferenceFeature(i)&&t.push(i);this.featureStore.removeManyById(t);const i=e.key.id;this._tiles.delete(i),this._tileBounds.delete(i)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const t of this._tiles.values()){for(const i of e)t.objectIds.delete(i);this._tileFeatureCounts.set(t.key.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,i){if(!e.length)return;const{features:s}=await t(e,i);for(const e of s){if(this._tmpBoundingRect.fill(0),null==e.geometry||0===e.geometry.vertexCount)continue;(0,ne.Ie)(this._tmpBoundingRect);const t=(0,p.NO)(e.geometry,this._tmpBoundingRect);this._tileBounds.forEachInBounds(t,t=>{const i=this._tiles.get(t);this.featureStore.add(e);const s=e.objectId;i.objectIds.has(s)||(i.objectIds.add(s),this._referenceFeature(s),this._tileFeatureCounts.set(i.key.id,i.objectIds.size))})}}process(e,t=()=>!0,i){if(null==this.tileInfo||!e.extent||null!=this.extent&&!(0,ne.HY)((0,ne.VY)(this.extent,this._tmpBoundingRect),e.extent))return new Te(e);if(this._memoryLimitExceeded&&!this._tiles.hasLowerPriority(e.id??""))return new Te(e);if(this._hasAttributesForTile(e.id,i))return new Te(e);const s=this._createTileTree(e,this.tileInfo);return this._simplify(s,t,null,0,1),this._collectMissingTiles(e,s,this.tileInfo,i)}get debugInfo(){return Array.from(this._tiles.values()).map(({key:e})=>({key:e.toJSON(),featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,i,s){let r=this._tileFeatureCounts.get(e.id);return null!=r||(r=await(0,_e.gW)(t,i,s),this._tileFeatureCounts.set(e.id,r)),r}_createTileTree(e,t){const i=new Fe(e.level,e.row,e.col);return t.updateTileInfo(i,1),this._tileBounds.forEachInBounds(e.extent,s=>{const r=this._tiles.get(s)?.key;r&&function(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const i=e.level<t.level,s=i?e:t,r=i?t:e,n=1<<r.level-s.level;return Math.floor(r.row/n)===s.row&&Math.floor(r.col/n)===s.col}(e,r)&&this._populateChildren(i,r,t,this._tileFeatureCounts.get(r.id)||0)}),i}_populateChildren(e,t,i,s){const r=t.level-e.level-1;if(r<0)return void(e.isLeaf=!0);const n=t.row>>r,o=t.col>>r,a=e.row<<1,l=o-(e.col<<1)+(n-a<<1),u=e.children[l];if(null!=u)this._populateChildren(u,t,i,s);else{const r=new Fe(e.level+1,n,o);i.updateTileInfo(r,1),e.children[l]=r,this._populateChildren(r,t,i,s)}}_simplify(e,t,i,s,r){const n=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),null!=i&&(i.children[s]=null),n);const o=r/2,a=o*o;let l=0;for(let i=0;i<e.children.length;i++){const s=e.children[i];l+=null!=s?this._simplify(s,t,e,i,o):a}return 0===l?this._mergeChildren(e):1-l/n<Ae&&(this._purge(e),null!=i&&(i.children[s]=null),l=n),l}_mergeChildren(e){const t=new Set;let i;this._forEachLeaf(e,e=>{const s=this._tiles.get(e.id);if(s){i=i?(0,ie.E$)(i,s.attributeKeys):new Set(s.attributeKeys);for(const e of s.objectIds)t.has(e)||(t.add(e),this._referenceFeature(e));this._remove(e)}}),this._addTileStorage(e,t,i??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const i of e.children)null!=i&&(i.isLeaf?t(i):this._forEachLeaf(i,t))}_purge(e){if(null!=e)if(e.isLeaf)this._remove(e);else for(let t=0;t<e.children.length;t++){const i=e.children[t];this._purge(i),e.children[t]=null}}_collectMissingTiles(e,t,i,s){const r=new ze(i,e,this.extent);return this._collectMissingTilesRecurse(t,r,1,s),r.info}_collectMissingTilesRecurse(e,t,i,s){const r=this._tiles.has(e.id)&&!this._hasAttributesForTile(e.id,s);if(r&&t.addMissing(e.level,e.row,e.col,i),e.isLeaf)return;if(!e.hasChildren)return void(r||t.addMissing(e.level,e.row,e.col,i));const n=i/2;for(let i=0;i<e.children.length;i++){const r=e.children[i];null==r?t.addMissing(e.level+1,(e.row<<1)+((2&i)>>1),(e.col<<1)+(1&i),n):this._collectMissingTilesRecurse(r,t,n,s)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),1===t?0:2}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return 0===t?(this._refCounts.delete(e),1):(t>0&&this._refCounts.set(e,t),2)}get test(){}};(0,s.Cg)([(0,a.MZ)({constructOnly:!0})],Ie.prototype,"featureStore",void 0),(0,s.Cg)([(0,a.MZ)()],Ie.prototype,"tileInfo",void 0),(0,s.Cg)([(0,a.MZ)()],Ie.prototype,"extent",void 0),(0,s.Cg)([(0,a.MZ)()],Ie.prototype,"maximumByteSize",void 0),Ie=(0,s.Cg)([(0,a.$K)("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],Ie);class Me{constructor(e,t,i){this.key=e,this.objectIds=t,this.attributeKeys=i}}class Fe extends F.U{constructor(){super(...arguments),this.isLeaf=!1,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(null!=this.children[0]||null!=this.children[1]||null!=this.children[2]||null!=this.children[3])}}class Te{constructor(e,t=[]){this.missingTiles=t,this.fullArea=0,this.coveredArea=0,this.fullArea=(0,ne.Wc)(e.extent),this.coveredArea=this.fullArea}prepend(e){this.missingTiles=e.missingTiles.concat(this.missingTiles),this.coveredArea+=e.coveredArea,this.fullArea+=e.fullArea}}class ze{constructor(e,t,i){this._tileInfo=e,this._extent=null,this.info=new Te(t),null!=i&&(this._extent=(0,ne.VY)(i))}addMissing(e,t,i,s){const r=new F.U(e,t,i);this._tileInfo.updateTileInfo(r,1)&&(null==this._extent||(0,ne.HY)(this._extent,r.extent))&&(this.info.missingTiles.push({data:r,resolution:s}),this.info.coveredArea-=(0,ne.Wc)(r.extent))}}const Ae=.18751;let Be=class extends r.nJ{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=Promise.withResolvers(),this._elevationAligner=E(),this._elevationFilter=L(),this._symbologyCandidatesFetcher=D(),this._updatingHandles=new l.U,this._alignPointsInFeatures=async(e,t)=>{const i={query:e},s=await this.remoteClient.invoke("alignElevation",i,{signal:t});return(0,n.Te)(t),s},this._getSymbologyCandidates=async(e,t)=>{const i={candidates:e,spatialReference:this._spatialReference.toJSON()},s=await this.remoteClient.invoke("getSymbologyCandidates",i,{signal:t});return(0,n.Te)(t),s}}get updating(){return this._isInitializing||this._updatingHandles.updating||this._featureFetcher.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:i,timeInfo:s,fieldsIndex:r}=e.serviceInfo,{hasZ:n}=e,a=u.A.fromJSON(e.spatialReference);this._spatialReference=a,this._featureStore=new S(t,n,!1),this._featureStore.estimateFeatureUsedMemory=e=>e.usedMemory,this._queryEngine=new I.do({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:r,hasZ:n,hasM:!1,featureIdInfo:{type:"object-id",fieldName:i},timeInfo:s}),this._featureFetcher=new ge({store:new Ie({featureStore:this._featureStore}),url:e.serviceInfo.url,currentVersion:e.serviceInfo.currentVersion,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:a,sourceSpatialReference:u.A.fromJSON(e.serviceInfo.spatialReference),customParameters:e.configuration.customParameters});const l="3d"===e.configuration.viewType;return this._elevationAligner=E(l,{elevationInfo:null!=e.elevationInfo?z.A.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures}),this._elevationFilter=L(l),this.addHandles([(0,o.wB)(()=>this._featureFetcher.availability,e=>this.emit("notify-availability",{availability:e}),o.OH),(0,o.wB)(()=>this.updating,()=>this._notifyUpdating())]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),Oe}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),this._featureFetcher.suspended=e,Oe}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),this._featureFetcher.outFields=new Set(e??[]),Oe}async fetchCandidates(e,t){await this._whenSetup.promise,(0,n.Te)(t);const i=function(e,t){const i=!!t||void 0;if(!e.filter)return{...e,query:{where:"1=1",returnZ:i}};const{distance:s,units:r,spatialRel:n,where:o,timeExtent:a,objectIds:l}=e.filter,u={geometry:e.filter.geometry?(0,h.rS)(e.filter.geometry):void 0,distance:s,units:r,spatialRel:n,timeExtent:a,objectIds:l,returnZ:i,where:o??"1=1"};return{...e,query:u}}(e,this._featureStore.hasZ),s=t?.signal,r=await this._queryEngine.executeQueryForSnapping(i,s);(0,n.Te)(s);const o=await this._elevationAligner.alignCandidates(r.candidates,u.A.fromJSON(e.point.spatialReference)??u.A.WGS84,s);(0,n.Te)(s);const a=await this._symbologyCandidatesFetcher.fetch(o,s);(0,n.Te)(s);const l=0===a.length?o:o.concat(a);return{result:{candidates:this._elevationFilter.filter(i,l)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles.map(e=>F.U.fromJSON(e)),this._featureFetcher.tileInfo=null!=e.tileInfo?M.A.fromJSON(e.tileInfo):null,Oe}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),this._featureFetcher.refresh(),Oe}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),await(0,o.C_)(()=>!this.updating,t),(0,n.Te)(t),Oe}async getDebugInfo(e,t){return(0,n.Te)(t),{result:this._featureFetcher.debugInfo}}async handleEdits(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),(0,n.Te)(t),await this._updatingHandles.addPromise(this._featureFetcher.handleEdits(e)),(0,n.Te)(t),Oe}async setHistoricMoment(e,t){return this._featureFetcher.setHistoricMoment(e.moment),Oe}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),Oe}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),Oe}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=D(e,this._getSymbologyCandidates),Oe}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=null!=e.filter?T.A.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};(0,s.Cg)([(0,a.MZ)({readOnly:!0})],Be.prototype,"updating",null),(0,s.Cg)([(0,a.MZ)()],Be.prototype,"_isInitializing",void 0),Be=(0,s.Cg)([(0,a.$K)("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],Be);const Pe=Be,Oe={result:{}}}}]);
|