@arcgis/core 4.28.0-next.20230819 → 4.28.0-next.20230821

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.
Files changed (169) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
  3. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a67e5b22adc91e850b4e.js → 05ab09713d599687afa3.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
  6. package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
  7. package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
  10. package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
  12. package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
  13. package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
  14. package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
  15. package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{8ed83426ef88a3eccecd.js → 4e496b03ce24b1206f86.js} +1 -1
  17. package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
  18. package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
  20. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
  21. package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
  22. package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
  23. package/assets/esri/core/workers/chunks/{ed499c328ae3a704791c.js → 6db4a6f9d25691830829.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
  25. package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
  26. package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
  27. package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
  28. package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
  29. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
  30. package/assets/esri/core/workers/chunks/{88f0b5c0fe751bf35af2.js → b2752e038c5fa3c21e49.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
  33. package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
  34. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
  35. package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
  36. package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
  40. package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
  41. package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
  42. package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
  43. package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
  44. package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
  45. package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
  46. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
  47. package/assets/esri/themes/dark/main.css +1 -1
  48. package/assets/esri/themes/light/main.css +1 -1
  49. package/assets/esri/themes/light/view.css +1 -1
  50. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  51. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  52. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
  53. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
  54. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
  55. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
  56. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
  57. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
  58. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
  59. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
  60. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
  61. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
  62. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
  63. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
  64. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
  65. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
  66. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
  67. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
  68. package/chunks/HighlightBlur.glsl.js +3 -3
  69. package/chunks/HighlightDownsample.glsl.js +24 -6
  70. package/chunks/SSAO.glsl.js +2 -2
  71. package/core/timeUtils.js +1 -1
  72. package/intl/date.js +1 -1
  73. package/layers/FeatureLayer.js +1 -1
  74. package/layers/ImageryLayer.js +1 -1
  75. package/layers/ImageryTileLayer.js +1 -1
  76. package/layers/StreamLayer.js +1 -1
  77. package/layers/SubtypeGroupLayer.js +1 -1
  78. package/layers/VoxelWasmPerSceneView.js +1 -1
  79. package/layers/graphics/sources/support/uploads.js +1 -1
  80. package/layers/save/featureLayerUtils.js +1 -1
  81. package/layers/save/imageryUtils.js +1 -1
  82. package/layers/save/streamLayerUtils.js +1 -1
  83. package/package.json +1 -1
  84. package/popup/support/FieldInfoFormat.js +1 -1
  85. package/support/revision.js +1 -1
  86. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  87. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  88. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  89. package/views/3d/support/LaserLineRenderer.js +1 -1
  90. package/views/3d/terrain/OverlayRenderer.js +1 -1
  91. package/views/3d/terrain/TerrainRenderer.js +1 -1
  92. package/views/3d/terrain/TerrainSurface.js +1 -1
  93. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  94. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  95. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  96. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  97. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  98. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  99. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  100. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  101. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  102. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  103. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  104. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  106. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  107. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  108. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  109. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  110. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  111. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  112. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  113. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  114. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  115. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  116. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  121. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  122. package/views/draw/DrawGraphicTool.js +1 -1
  123. package/views/draw/DrawOperation.js +1 -1
  124. package/views/interactive/sketch/constraints.js +1 -1
  125. package/views/interactive/sketch/normalizedPoint.js +1 -1
  126. package/views/interactive/snapping/SnappingManager.js +1 -1
  127. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  128. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  129. package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
  130. package/views/interactive/tooltip/constraintUtils.js +5 -0
  131. package/views/support/angularMeasurementUtils.js +1 -1
  132. package/widgets/Editor/EditorViewModel.js +1 -1
  133. package/widgets/Editor/Upload.js +1 -1
  134. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  135. package/widgets/Editor/components/UploadDetails.js +1 -1
  136. package/widgets/Editor/modelUploadUtils.js +1 -1
  137. package/widgets/Editor.js +1 -1
  138. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  139. package/widgets/ElevationProfile.js +1 -1
  140. package/widgets/Feature/FeatureViewModel.js +1 -1
  141. package/widgets/Feature/support/featureUtils.js +1 -1
  142. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
  143. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  144. package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
  145. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
  146. package/widgets/UtilityNetworkAssociations.js +1 -1
  147. package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
  148. package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
  149. package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
  150. package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
  151. package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
  152. package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
  153. package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
  154. package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
  155. package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
  156. package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
  157. package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
  158. package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
  159. package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
  160. package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
  161. package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
  162. package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
  163. package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
  164. package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
  165. package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
  166. package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
  167. package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
  168. package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
  169. package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{ClonableMixin as r}from"../core/Clonable.js";import t from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a,whenOrAbort as n}from"../core/promiseUtils.js";import{watch as l,sync as u}from"../core/reactiveUtils.js";import{sqlAnd as p}from"../core/sql.js";import{urlToObject as y,join as d}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f,nameToId as b}from"../core/accessorSupport/PropertyOrigin.js";import g from"./Layer.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as F}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as C}from"./mixins/PortalLayer.js";import{RefreshableLayer as _}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as P}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as E}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as T,computeEffectiveEditingEnabled as U,addAttachment as G,updateAttachment as A,applyEdits as q,createQuery as $,deleteAttachments as M,fetchRecomputedExtents as R,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as D,queryRelatedFeatures as H,queryRelatedFeaturesCount as V,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as J}from"./support/fieldProperties.js";import{fixTimeInfoFields as z}from"./support/fieldUtils.js";import K from"./support/Subtype.js";import Z from"./support/SubtypeSublayer.js";import W from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as X}from"./support/versionUtils.js";import Y from"../rest/support/Query.js";const ee="SubtypeGroupLayer",re="esri.layers.SubtypeGroupLayer";function te(e,r){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}const se=J();let ie=class extends(F(L(w(P(I(_(v(x(C(o(S(j(r(g)))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.subtypes=null,this.sublayers=new(t.ofType(Z)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this.addHandles(l((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),u))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(r))})).then((()=>T(this,"load",e)));return this.addResolvingPromise(t),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return U(this)}get parsedUrl(){const e=y(this.url);return null!=e&&null!=this.layerId&&(e.path=d(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:r}){return this.url?E(this.url,r):r}async addAttachment(e,r){return G(this,e,r,ee)}async updateAttachment(e,r,t){return A(this,e,r,t,ee)}async applyEdits(e,r){return q(this,e,r)}on(e,r){return super.on(e,r)}async createGraphicsSource(e){const{default:r}=await n(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=$(this),r=this.sublayers.map((e=>e.subtypeCode));return e.where=p(`${this.subtypeField} IN (${r.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,r){return M(this,e,r,ee)}async fetchRecomputedExtents(e){return R(this,e,ee)}findSublayerForFeature(e){const r=this.fieldsIndex.get(this.subtypeField),t=e.attributes[r.name];return this.findSublayerForSubtypeCode(t)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,r){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,r){return k(this,e,r,ee)}async queryFeatures(e,r){const t=await this.load(),s=Y.from(e)??t.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await t.source.queryFeatures(s,r);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,r){return N(this,e,r,ee)}async queryFeatureCount(e,r){return Q(this,e,r,ee)}async queryExtent(e,r){return D(this,e,r,ee)}async queryRelatedFeatures(e,r){return H(this,e,r,ee)}async queryRelatedFeaturesCount(e,r){return V(this,e,r,ee)}async save(e){const{save:r}=await import("./save/featureLayerUtils.js");return r(this,e)}async saveAs(e,r){const{saveAs:t}=await import("./save/featureLayerUtils.js");return t(this,e,r)}write(e,r){const{origin:t,layerContainerType:i,messages:o}=r;if(this.isTable){if("web-scene"===t||"web-map"===t&&"tables"!==i)return o?.push(te(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===t&&"tables"===i)return o?.push(te(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,r):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&X(this,e)}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:r}=e;if(r&&(this.sourceJSON=r,this.read(r,{origin:"service",url:this.parsedUrl})),this.isTable)throw new s("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),z(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return B(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)})),e.on("after-changes",(()=>{this._sublayersCollectionChanged=!0}))],"sublayers-owner"))}};e([c({readOnly:!0})],ie.prototype,"createQueryVersion",null),e([c({readOnly:!0})],ie.prototype,"editingEnabled",null),e([c({readOnly:!0})],ie.prototype,"effectiveEditingEnabled",null),e([c({...se.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ie.prototype,"fields",void 0),e([c(se.fieldsIndex)],ie.prototype,"fieldsIndex",void 0),e([c(O)],ie.prototype,"id",void 0),e([c({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ie.prototype,"listMode",void 0),e([c({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],ie.prototype,"operationalLayerType",void 0),e([c(se.outFields)],ie.prototype,"outFields",void 0),e([c({readOnly:!0})],ie.prototype,"parsedUrl",null),e([c({clonable:!1})],ie.prototype,"source",null),e([c({type:[K],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"subtypes",void 0),e([c({type:t.ofType(Z),json:{origins:{service:{read:{source:"subtypes",reader:(e,r,s)=>{const i=e.map((({code:e})=>{const t=new Z({subtypeCode:e});return t.read(r,s),t}));return new(t.ofType(Z))(i)}}}},name:"layers",write:{overridePolicy(e,r,t){const s=this.originOf("sublayers"),i=f.PORTAL_ITEM;let o=!0;if(b(s)===i&&b(t.origin)>i){const r=e.some((e=>e.hasUserOverrides()));o=this._sublayersCollectionChanged||r}return{enabled:o,ignoreOrigin:!0}}}}})],ie.prototype,"sublayers",void 0),e([c({type:W})],ie.prototype,"timeInfo",void 0),e([c({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ie.prototype,"title",void 0),e([h("service","title",["name"])],ie.prototype,"readTitleFromService",null),e([c({json:{read:!1}})],ie.prototype,"type",void 0),ie=e([m(re)],ie);const oe=ie;export{oe as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{ClonableMixin as r}from"../core/Clonable.js";import t from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n,whenOrAbort as u}from"../core/promiseUtils.js";import{watch as l,sync as p}from"../core/reactiveUtils.js";import{sqlAnd as y}from"../core/sql.js";import{urlToObject as d,join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as b,nameToId as g}from"../core/accessorSupport/PropertyOrigin.js";import j from"./Layer.js";import{APIKeyMixin as S}from"./mixins/APIKeyMixin.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as L}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as F}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as _}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as C}from"./mixins/PortalLayer.js";import{RefreshableLayer as E}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as O}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as P}from"./support/arcgisLayerUrl.js";import{id as A}from"./support/commonProperties.js";import{ensureLayerCredential as T,computeEffectiveEditingEnabled as U,addAttachment as G,updateAttachment as q,applyEdits as $,createQuery as M,deleteAttachments as R,fetchRecomputedExtents as V,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as D,queryRelatedFeatures as H,queryRelatedFeaturesCount as B,hasDataChanged as J}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import Z from"./support/Subtype.js";import W from"./support/SubtypeSublayer.js";import X from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as Y}from"./support/versionUtils.js";import ee from"../rest/support/Query.js";import{SaveOperationType as re}from"../webdoc/interfaces.js";const te="SubtypeGroupLayer",se="esri.layers.SubtypeGroupLayer";function ie(e,r){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}const oe=z();let ae=class extends(_(F(w(O(I(E(v(x(C(o(L(S(r(j)))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.subtypes=null,this.sublayers=new(t.ofType(W)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=a((async(e,r,t)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case re.SAVE:return s(this,r);case re.SAVE_AS:return i(this,t,r)}})),this.addHandles(l((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),p))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(n).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(r))})).then((()=>T(this,"load",e)));return this.addResolvingPromise(t),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return U(this)}get parsedUrl(){const e=d(this.url);return null!=e&&null!=this.layerId&&(e.path=c(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:r}){return this.url?P(this.url,r):r}async addAttachment(e,r){return G(this,e,r,te)}async updateAttachment(e,r,t){return q(this,e,r,t,te)}async applyEdits(e,r){return $(this,e,r)}on(e,r){return super.on(e,r)}async createGraphicsSource(e){const{default:r}=await u(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=M(this),r=this.sublayers.map((e=>e.subtypeCode));return e.where=y(`${this.subtypeField} IN (${r.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,r){return R(this,e,r,te)}async fetchRecomputedExtents(e){return V(this,e,te)}findSublayerForFeature(e){const r=this.fieldsIndex.get(this.subtypeField),t=e.attributes[r.name];return this.findSublayerForSubtypeCode(t)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,r){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,r){return k(this,e,r,te)}async queryFeatures(e,r){const t=await this.load(),s=ee.from(e)??t.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await t.source.queryFeatures(s,r);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,r){return N(this,e,r,te)}async queryFeatureCount(e,r){return Q(this,e,r,te)}async queryExtent(e,r){return D(this,e,r,te)}async queryRelatedFeatures(e,r){return H(this,e,r,te)}async queryRelatedFeaturesCount(e,r){return B(this,e,r,te)}async save(e){return this._debouncedSaveOperations(re.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(re.SAVE_AS,r,e)}write(e,r){const{origin:t,layerContainerType:i,messages:o}=r;if(this.isTable){if("web-scene"===t||"web-map"===t&&"tables"!==i)return o?.push(ie(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===t&&"tables"===i)return o?.push(ie(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,r):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&Y(this,e)}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:r}=e;if(r&&(this.sourceJSON=r,this.read(r,{origin:"service",url:this.parsedUrl})),this.isTable)throw new s("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return J(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)})),e.on("after-changes",(()=>{this._sublayersCollectionChanged=!0}))],"sublayers-owner"))}};e([h({readOnly:!0})],ae.prototype,"createQueryVersion",null),e([h({readOnly:!0})],ae.prototype,"editingEnabled",null),e([h({readOnly:!0})],ae.prototype,"effectiveEditingEnabled",null),e([h({...oe.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ae.prototype,"fields",void 0),e([h(oe.fieldsIndex)],ae.prototype,"fieldsIndex",void 0),e([h(A)],ae.prototype,"id",void 0),e([h({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ae.prototype,"listMode",void 0),e([h({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],ae.prototype,"operationalLayerType",void 0),e([h(oe.outFields)],ae.prototype,"outFields",void 0),e([h({readOnly:!0})],ae.prototype,"parsedUrl",null),e([h({clonable:!1})],ae.prototype,"source",null),e([h({type:[Z],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ae.prototype,"subtypes",void 0),e([h({type:t.ofType(W),json:{origins:{service:{read:{source:"subtypes",reader:(e,r,s)=>{const i=e.map((({code:e})=>{const t=new W({subtypeCode:e});return t.read(r,s),t}));return new(t.ofType(W))(i)}}}},name:"layers",write:{overridePolicy(e,r,t){const s=this.originOf("sublayers"),i=b.PORTAL_ITEM;let o=!0;if(g(s)===i&&g(t.origin)>i){const r=e.some((e=>e.hasUserOverrides()));o=this._sublayersCollectionChanged||r}return{enabled:o,ignoreOrigin:!0}}}}})],ae.prototype,"sublayers",void 0),e([h({type:X})],ae.prototype,"timeInfo",void 0),e([h({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ae.prototype,"title",void 0),e([m("service","title",["name"])],ae.prototype,"readTitleFromService",null),e([h({json:{read:!1}})],ae.prototype,"type",void 0),ae=e([f(se)],ae);const ne=ae;export{ne as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{h}from"../chunks/vec3.js";import{c as d}from"../chunks/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as p,UpdateFlags as g,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as T}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as R}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as L}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as E,StoreResults as V}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as C}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as F}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{ContextType as S}from"../views/webgl/contextUtils.js";import{CompareFunction as P,Face as U,StencilOperation as k}from"../views/webgl/enums.js";const I=s.getLogger("esri.layers.VoxelWasmPerSceneView");var B;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(B||(B={}));let A=class extends R{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this.renderSlots=[F.VOXEL],this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=E.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}canRender(){return!!this._vxl&&"local"===this.view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===B.Error?I.error(t):I.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(B.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(B.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(B.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(B.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(B.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(B.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(B.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===S.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(B.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(B.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(B.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const r=!!this._rctx,s=!!this._renderTargetToRestore;if(!r||!s)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(B.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,r){if(!this._rctx)return void this._dbg(B.Error,"modifyAllocation callback has no rendering context!");const s=e;1===r?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,r,s){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,r),this._rctx.setBlendEquation(s)):this._dbg(B.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(B.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,r){this._rctx?(this._rctx.setDepthFunction(r),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(P.ALWAYS,0,255),this._rctx.setStencilOpSeparate(U.FRONT,k.KEEP,k.INCR,k.KEEP),this._rctx.setStencilOpSeparate(U.BACK,k.KEEP,k.DECR,k.KEEP)):this._dbg(B.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(U.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(U.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(B.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,r,s){this._rctx?this._rctx.setViewport(e,t,r,s):this._dbg(B.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const r=this._vxl.estimate_memory_usage(t);r>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(r))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const s=[];e.responses.forEach(((r,i)=>{s.push(i),this._dbg(B.RequestResponse,"responding for requestID:"+i+" size:"+r.size),this._vxl.respond(t,i,r),r.requestType!==p.TreeIndex&&r.requestType!==p.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const r of s)a.delete(r);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],s={responseType:"array-buffer",signal:o};this._dbg(B.RequestResponse,"making requestID:"+l+" url:"+t.url),r(t.url,s).then((r=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(B.RequestResponse,"have response for requestID:"+l);let s=0;if(r.data.byteLength>0){s=this._vxl._malloc(r.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,s,r.data.byteLength),t=new Uint8Array(r.data);for(let s=0;s<r.data.byteLength;++s)e[s]=t[s]}a.set(+l,{responseType:t.responseType,ptr:s,size:r.data.byteLength,success:!0,requestType:t.requestType})})).catch((r=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(r)||(this._dbg(B.Error,`requestID:${l} failed, error=${r.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const r=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let e=0;e<r.length;++e)t.push(r[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))})),t}setEnabled(e,t){this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),r.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const r={mask:g.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,r,!0)}setCurrentVariable(e,t){const r={mask:g.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,r,!0)}setRenderMode(e,t){const r={mask:g.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,r,!0)}setVerticalExaggerationAndOffset(e,t,r,s){const i={mask:g.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:r,verticalOffset:s}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const r={mask:g.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setVolumeStyles(e,t){const r={mask:g.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setEnableDynamicSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,r,!0)}setEnableIsosurfaces(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,r,!0)}setEnableSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,r,!0)}setAnalysisSlice(e,t,r,s){const i={mask:g.AnalysisSlice,analysisSlice:{point:r,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,r){if(!this._vxl)return!1;let s=!1;return this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(s=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),s&&r&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,r,s,i){return e[3*t]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,r){return e[3*t]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,r=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,r,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],p=this._frustum.points[_.FAR_TOP_LEFT];let g=0,f=0;const x=this._frustum.planes[c.NEAR];g=this._addTriangleToWasmBuffer(s,g,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),g=this._addTriangleToWasmBuffer(s,g,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];g=this._addTriangleToWasmBuffer(s,g,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),g=this._addTriangleToWasmBuffer(s,g,m,p,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];g=this._addTriangleToWasmBuffer(s,g,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),g=this._addTriangleToWasmBuffer(s,g,h,p,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];g=this._addTriangleToWasmBuffer(s,g,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),g=this._addTriangleToWasmBuffer(s,g,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];g=this._addTriangleToWasmBuffer(s,g,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),g=this._addTriangleToWasmBuffer(s,g,d,p,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];g=this._addTriangleToWasmBuffer(s,g,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),g=this._addTriangleToWasmBuffer(s,g,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(r,3*e,i,e,255,0,0,64),this._vxl._free(r),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,r)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(r),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},r=new Promise(((e,r)=>{t.resolveCallback=e,t.rejectCallback=r}));return this._newLayers.push(t),r}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const r=this._newLayers.length;return 0===r&&(this._dbg(B.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}let t=-1;this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){t=s,r.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const r=this._layers.size;return 0===r&&(this._dbg(B.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=!1;return null!=e&&(e.isAllTime?s=!0:(null!=e.start&&(s=!0,t=e.start.getTime()/1e3),null!=e.end&&(s=!0,r=e.end.getTime()/1e3))),{startTime:t,endTime:r,useTime:s}}_addVoxelLayer(e){const t=e.layer;let r=-1;const s=t.getConfiguration();if(s.length<1)return-1;const i={str:s,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(i))return-1;const a=this._getTimeArgs(this.view?.timeExtent),n=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(r=this._vxl.add_layer(t.serviceRoot,i.ptr,i.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this.view.qualityProfile)),i.isReusable||this._vxl._free(i.ptr),r>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const s=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:s,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&I.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&I.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&I.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&I.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&I.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),r}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,r=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(r[0],r[1],r[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(B.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==T.Color)return;for(const r of this._newLayers){const e=this._addVoxelLayer(r.layerView);-1===e?r.rejectCallback(-1):r.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(B.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(C.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(B.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(B.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(B.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),s=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,s,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(B.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=r.viewport[3]-t;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(B.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const i=r.viewForward,a=r.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(r),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,s);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,r,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>r.viewport[2]||a<0||a>r.viewport[3])return this._dbg(B.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${r.viewport.toString()}]`),null;this._beforeDraw();const n=r.viewForward,o=r.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(r),this._vxl.begin_frame();let l=null;if(0===s.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,r,s,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(B.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(r,s),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const r=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,r,i,u)},c=e.results,m=e.options.store===V.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=L(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,r){return new t({layer:e,sourceLayer:e,attributes:r})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,r){this._vxl&&this._vxl.set_upscaling_limits(e,t,r)}};e([o({constructOnly:!0})],A.prototype,"view",void 0),A=e([l("esri.layers.VoxelWasmPerSceneView")],A);const M=A;export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{h}from"../chunks/vec3.js";import{c as d}from"../chunks/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as p,UpdateFlags as g,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as T}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as R}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as L}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as E,StoreResults as V}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as C}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as F}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{ContextType as S}from"../views/webgl/contextUtils.js";import{CompareFunction as P,Face as U,StencilOperation as k}from"../views/webgl/enums.js";const I=s.getLogger("esri.layers.VoxelWasmPerSceneView");var B;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(B||(B={}));let A=class extends R{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this.renderSlots=[F.VOXEL],this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=E.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}produces(){return!!this._vxl&&"local"===this.view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===B.Error?I.error(t):I.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(B.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(B.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(B.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(B.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(B.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(B.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(B.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===S.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(B.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(B.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(B.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const r=!!this._rctx,s=!!this._renderTargetToRestore;if(!r||!s)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(B.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,r){if(!this._rctx)return void this._dbg(B.Error,"modifyAllocation callback has no rendering context!");const s=e;1===r?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,r,s){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,r),this._rctx.setBlendEquation(s)):this._dbg(B.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(B.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,r){this._rctx?(this._rctx.setDepthFunction(r),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(P.ALWAYS,0,255),this._rctx.setStencilOpSeparate(U.FRONT,k.KEEP,k.INCR,k.KEEP),this._rctx.setStencilOpSeparate(U.BACK,k.KEEP,k.DECR,k.KEEP)):this._dbg(B.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(U.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(U.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(B.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,r,s){this._rctx?this._rctx.setViewport(e,t,r,s):this._dbg(B.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const r=this._vxl.estimate_memory_usage(t);r>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(r))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const s=[];e.responses.forEach(((r,i)=>{s.push(i),this._dbg(B.RequestResponse,"responding for requestID:"+i+" size:"+r.size),this._vxl.respond(t,i,r),r.requestType!==p.TreeIndex&&r.requestType!==p.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const r of s)a.delete(r);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],s={responseType:"array-buffer",signal:o};this._dbg(B.RequestResponse,"making requestID:"+l+" url:"+t.url),r(t.url,s).then((r=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(B.RequestResponse,"have response for requestID:"+l);let s=0;if(r.data.byteLength>0){s=this._vxl._malloc(r.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,s,r.data.byteLength),t=new Uint8Array(r.data);for(let s=0;s<r.data.byteLength;++s)e[s]=t[s]}a.set(+l,{responseType:t.responseType,ptr:s,size:r.data.byteLength,success:!0,requestType:t.requestType})})).catch((r=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(r)||(this._dbg(B.Error,`requestID:${l} failed, error=${r.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const r=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let e=0;e<r.length;++e)t.push(r[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))})),t}setEnabled(e,t){this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),r.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const r={mask:g.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,r,!0)}setCurrentVariable(e,t){const r={mask:g.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,r,!0)}setRenderMode(e,t){const r={mask:g.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,r,!0)}setVerticalExaggerationAndOffset(e,t,r,s){const i={mask:g.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:r,verticalOffset:s}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const r={mask:g.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setVolumeStyles(e,t){const r={mask:g.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setEnableDynamicSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,r,!0)}setEnableIsosurfaces(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,r,!0)}setEnableSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,r,!0)}setAnalysisSlice(e,t,r,s){const i={mask:g.AnalysisSlice,analysisSlice:{point:r,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,r){if(!this._vxl)return!1;let s=!1;return this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(s=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),s&&r&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,r,s,i){return e[3*t]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,r){return e[3*t]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,r=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,r,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],p=this._frustum.points[_.FAR_TOP_LEFT];let g=0,f=0;const x=this._frustum.planes[c.NEAR];g=this._addTriangleToWasmBuffer(s,g,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),g=this._addTriangleToWasmBuffer(s,g,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];g=this._addTriangleToWasmBuffer(s,g,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),g=this._addTriangleToWasmBuffer(s,g,m,p,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];g=this._addTriangleToWasmBuffer(s,g,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),g=this._addTriangleToWasmBuffer(s,g,h,p,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];g=this._addTriangleToWasmBuffer(s,g,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),g=this._addTriangleToWasmBuffer(s,g,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];g=this._addTriangleToWasmBuffer(s,g,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),g=this._addTriangleToWasmBuffer(s,g,d,p,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];g=this._addTriangleToWasmBuffer(s,g,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),g=this._addTriangleToWasmBuffer(s,g,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(r,3*e,i,e,255,0,0,64),this._vxl._free(r),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,r)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(r),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},r=new Promise(((e,r)=>{t.resolveCallback=e,t.rejectCallback=r}));return this._newLayers.push(t),r}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const r=this._newLayers.length;return 0===r&&(this._dbg(B.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}let t=-1;this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){t=s,r.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const r=this._layers.size;return 0===r&&(this._dbg(B.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=!1;return null!=e&&(e.isAllTime?s=!0:(null!=e.start&&(s=!0,t=e.start.getTime()/1e3),null!=e.end&&(s=!0,r=e.end.getTime()/1e3))),{startTime:t,endTime:r,useTime:s}}_addVoxelLayer(e){const t=e.layer;let r=-1;const s=t.getConfiguration();if(s.length<1)return-1;const i={str:s,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(i))return-1;const a=this._getTimeArgs(this.view?.timeExtent),n=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(r=this._vxl.add_layer(t.serviceRoot,i.ptr,i.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this.view.qualityProfile)),i.isReusable||this._vxl._free(i.ptr),r>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const s=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:s,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&I.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&I.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&I.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&I.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&I.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),r}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,r=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(r[0],r[1],r[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(B.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==T.Color)return;for(const r of this._newLayers){const e=this._addVoxelLayer(r.layerView);-1===e?r.rejectCallback(-1):r.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(B.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(C.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(B.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(B.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(B.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),s=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,s,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(B.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=r.viewport[3]-t;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(B.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const i=r.viewForward,a=r.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(r),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,s);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,r,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>r.viewport[2]||a<0||a>r.viewport[3])return this._dbg(B.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${r.viewport.toString()}]`),null;this._beforeDraw();const n=r.viewForward,o=r.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(r),this._vxl.begin_frame();let l=null;if(0===s.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,r,s,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(B.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(r,s),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const r=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,r,i,u)},c=e.results,m=e.options.store===V.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=L(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,r){return new t({layer:e,sourceLayer:e,attributes:r})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,r){this._vxl&&this._vxl.set_upscaling_limits(e,t,r)}};e([o({constructOnly:!0})],A.prototype,"view",void 0),A=e([l("esri.layers.VoxelWasmPerSceneView")],A);const M=A;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import"../../../../core/has.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{join as t}from"../../../../core/urlUtils.js";import{isHostedAgolService as s}from"../../../support/arcgisLayerUrl.js";import{arrayBufferToBase64 as r}from"../../../../support/base64Utils.js";const a=1e6,n=20*a,i=2e9,p=3;async function m({data:r,name:m,description:c},l,d){let f=null;try{const u=t(l,"uploads"),h=t(u,"info"),{data:w}=await e(h,{query:{f:"json"},responseType:"json"});o(d);const j=s(l),y=w.maxUploadFileSize*a,g=j?i:y,q=j?Math.min(n,y):n;if(r.size>g)throw new Error("Data too large");const T=t(u,"register"),{data:U}=await e(T,{query:{f:"json",itemName:m,description:c},responseType:"json",method:"post"});if(o(d),!U.success)throw new Error("Registration failed");const{itemID:z}=U.item;f=t(u,z);const E=t(f,"uploadPart"),D=Math.ceil(r.size/q),M=new Array;for(let e=0;e<D;++e)M.push(r.slice(e*q,Math.min((e+1)*q,r.size)));const P=M.slice().reverse(),b=new Array,x=async()=>{for(;0!==P.length;){const t=M.length-P.length,s=P.pop(),r=new FormData,a=s;r.append("f","json"),r.append("file",a),r.append("partId",`${t}`);const{data:n}=await e(E,{timeout:0,body:r,responseType:"json",method:"post"});if(o(d),!n.success)throw new Error("Part upload failed")}};for(let e=0;e<p&&0!==P.length;++e)b.push(x());await Promise.all(b);const A=t(f,"commit"),{data:F}=await e(A,{query:{f:"json",parts:M.map(((e,o)=>o)).join(",")},responseType:"json",method:"post"});if(o(d),!F.success)throw new Error("Commit failed");return F.item}catch(u){if(null!=f){const o=t(f,"delete");await e(o,{query:{f:"json"},responseType:"json",method:"post"})}throw u}}export{m as uploadItem};
5
+ import e from"../../../../request.js";import"../../../../core/has.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{join as o}from"../../../../core/urlUtils.js";import{isHostedAgolService as r}from"../../../support/arcgisLayerUrl.js";import{arrayBufferToBase64 as s}from"../../../../support/base64Utils.js";const a=1e6,n=20*a,i=2e9,p=3;async function l({data:s,name:l,description:m},f,d){let u=null;try{const h=o(f,"uploads"),w=o(h,"info"),{data:j}=await e(w,{query:{f:"json"},responseType:"json"});t(d);const y=r(f),g=j.maxUploadFileSize*a,q=y?i:g,T=y?Math.min(n,g):n;if(s.size>q)throw new Error("Data too large");const U=o(h,"register"),{data:z}=await e(U,{query:{f:"json",itemName:c(l),description:m},responseType:"json",method:"post"});if(t(d),!z.success)throw new Error("Registration failed");const{itemID:A}=z.item;u=o(h,A);const E=o(u,"uploadPart"),D=Math.ceil(s.size/T),M=new Array;for(let e=0;e<D;++e)M.push(s.slice(e*T,Math.min((e+1)*T,s.size)));const P=M.slice().reverse(),b=new Array,x=async()=>{for(;0!==P.length;){const o=M.length-P.length,r=P.pop(),s=new FormData,a=r;s.append("f","json"),s.append("file",a),s.append("partId",`${o}`);const{data:n}=await e(E,{timeout:0,body:s,responseType:"json",method:"post"});if(t(d),!n.success)throw new Error("Part upload failed")}};for(let e=0;e<p&&0!==P.length;++e)b.push(x());await Promise.all(b);const F=o(u,"commit"),{data:I}=await e(F,{query:{f:"json",parts:M.map(((e,t)=>t)).join(",")},responseType:"json",method:"post"});if(t(d),!I.success)throw new Error("Commit failed");return I.item}catch(h){if(null!=u){const t=o(u,"delete");await e(t,{query:{f:"json"},responseType:"json",method:"post"})}throw h}}function c(e){return e.replaceAll("/","_").replaceAll("\\","_")}export{l as uploadItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{difference as e,isSome as a}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{debounce as t}from"../../core/promiseUtils.js";import{updateOrigins as s}from"../../core/accessorSupport/originUtils.js";import o from"../FeatureLayer.js";import{save as l,saveAs as n,getLayerJSON as i,setCommonItemProperties as c,getPortalItem as u,addItem as p,ensureLayerConfig as m,ensureItemConfig as f,createErrorMessage as y}from"./utils.js";import{parse as d}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as h}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as w}from"../support/layerUtils.js";import{createForItemWrite as v}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as S,removeTypeKeyword as b,TypeKeyword as I,addTypeKeyword as T,toggleTypeKeword as $}from"../../portal/support/portalItemUtils.js";const E="Feature Service",P="feature-layer-utils",A=`${P}-save`,L=`${P}-save-as`,j=`${P}-saveall`,N=`${P}-saveall-as`;function U(e){return{isValid:w(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function x(e){const a=[],r=[];for(const{layer:t,layerJSON:s}of e)t.isTable?r.push(s):a.push(s);return{layers:a,tables:r}}function g(e){return x([e])}async function O(e,a){return/\/\d+\/?$/.test(e.url)?g(a[0]):J(a,e)}async function J(e,a){if(!a)return x(e);const{layer:{url:r,customParameters:t,apiKey:s}}=e[0];let o=await a.fetchData("json");o&&null!=o.layers&&null!=o.tables||(o=await M(o,{url:r??"",customParameters:t,apiKey:s},e.map((e=>e.layer.layerId))));for(const l of e)F(l.layer,l.layerJSON,o);return o}async function M(e,a,r){e||={},e.layers||=[],e.tables||=[];const{url:t,customParameters:s,apiKey:o}=a,{serviceJSON:l,layersJSON:n}=await h(t,{customParameters:s,apiKey:o}),i=R(e.layers,l.layers,r),c=R(e.tables,l.tables,r);e.layers=i.itemResources,e.tables=c.itemResources;const u=[...i.added,...c.added],p=n?[...n.layers,...n.tables]:[];return await D(e,u,t,p),e}function R(a,r,t){const s=e(a,r,((e,a)=>e.id===a.id));a=a.filter((e=>!s.removed.some((a=>a.id===e.id))));const o=s.added.map((({id:e})=>({id:e})));return o.forEach((({id:e})=>{a.push({id:e})})),{itemResources:a,added:o.filter((({id:e})=>!t.includes(e)))}}async function D(e,a,r,t){const s=a.map((({id:e})=>new o({url:r,layerId:e,sourceJSON:t.find((({id:a})=>a===e))})));await Promise.allSettled(s.map((e=>e.load()))),s.forEach((a=>{const{layerId:r,loaded:t,defaultPopupTemplate:s}=a;if(!t||null==s)return;F(a,{id:r,popupInfo:s.toJSON()},e)}))}function F(e,a,r){e.isTable?K(r.tables,a):K(r.layers,a)}function K(e,a){const r=e.findIndex((({id:e})=>e===a.id));-1===r?e.push(a):e[r]=a}function Y(e,a){if(!e.length)throw new r(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function _(e,a){const t=e.map((e=>e.portalItem.id));if(new Set(t).size>1)throw new r(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function z(e,a){const t=e.map((e=>e.layerId));if(new Set(t).size!==t.length)throw new r(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function B(e){Y(e,j),await Promise.all(e.map((e=>e.load())));for(const a of e)m(a,j,U),f(a,j,E);_(e,j),z(e,j)}async function G(e,a){const{url:r,layerId:t,title:s,fullExtent:o,isTable:l}=e,n=d(r);a.url="FeatureServer"===n?.serverType?r:`${r}/${t}`,a.title||=s,a.extent=null,l||null==o||(a.extent=await S(o)),b(a,I.METADATA),b(a,I.MULTI_LAYER),T(a,I.SINGLE_LAYER),l&&T(a,I.TABLE)}function C(e,a){for(const l of e){const t=l.parsedUrl.path,s=d(t),o=s?.url.path;if(!o)throw new r(`${a}:invalid-parameters`,y(l,`has unsupported url pattern: ${t}`),{layer:l});const n=s?.serverType;if("FeatureServer"!==n&&"MapServer"!==n)throw new r(`${a}:invalid-parameters`,y(l,`has unsupported server type: ${n}`),{layer:l});if("MapServer"===n&&e.length>1)throw new r(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=d(e[0].parsedUrl.path),s=t?.url.path,o=e.every((e=>{const a=d(e.parsedUrl.path);return a?.url.path===s}));if(!o)throw new r(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function V(e){Y(e,N),await Promise.all(e.map((e=>e.load())));for(const a of e)m(a,N,U);C(e,N),z(e,N)}async function k(e,r){let t=0,s=0;for(const{isTable:a}of r)a?s++:t++;const o=r[0].parsedUrl.path,l=d(o);if(e.url="FeatureServer"===l?.serverType?l.url.path:o,e.title||=l.title,e.extent=null,t>0){const t=r.map((e=>e.fullExtent)).filter(a).reduce(((e,a)=>e.clone().union(a)));t&&(e.extent=await S(t))}b(e,I.METADATA),$(e,I.MULTI_LAYER,r.length>1),$(e,I.SINGLE_LAYER,1===r.length),$(e,I.TABLE,s>0&&0===t),c(e)}const q=t(H);async function H(e,a){return l({layer:e,itemType:E,validateLayer:U,createItemData:(e,a)=>O(a,[e]),errorNamePrefix:A},a)}const Q=t((async(e,a)=>{await B(e);const r=e[0].portalItem,t=v(r),o=await Promise.all(e.map((e=>i(e,t,a)))),l=await O(r,e.map(((e,a)=>({layer:e,layerJSON:o[a]}))));return c(r),await r.update({data:l}),await Promise.all(e.slice(1).map((e=>e.portalItem.reload()))),s(t),r.clone()})),W=t(X);async function X(e,a,r){return n({layer:e,itemType:E,validateLayer:U,createItemData:(e,a)=>Promise.resolve(g(e)),errorNamePrefix:L,newItem:a,setItemProperties:G},r)}const Z=t((async(e,a,r)=>{await V(e);const t=u(a,N,E),o=v(t),l=await Promise.all(e.map((e=>i(e,o,r)))),n=await J(e.map(((e,a)=>({layer:e,layerJSON:l[a]}))));await k(t,e),await p(t,n,r);for(const s of e)s.portalItem=t.clone();return s(o),t}));export{q as save,Q as saveAll,Z as saveAllAs,W as saveAs};
5
+ import{difference as e,isSome as a}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{updateOrigins as t}from"../../core/accessorSupport/originUtils.js";import s from"../FeatureLayer.js";import{save as o,getLayerJSON as l,setCommonItemProperties as n,saveAs as i,getPortalItem as u,addItem as c,ensureLayerConfig as p,ensureItemConfig as m,createErrorMessage as f}from"./utils.js";import{parse as y}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as d}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as h}from"../support/layerUtils.js";import{createForItemWrite as w}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as v,removeTypeKeyword as S,TypeKeyword as b,toggleTypeKeword as I,addTypeKeyword as T}from"../../portal/support/portalItemUtils.js";const $="Feature Service",E="feature-layer-utils",P=`${E}-save`,A=`${E}-save-as`,L=`${E}-saveall`,j=`${E}-saveall-as`;function N(e){return{isValid:h(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function x(e){const a=[],r=[];for(const{layer:t,layerJSON:s}of e)t.isTable?r.push(s):a.push(s);return{layers:a,tables:r}}function U(e){return x([e])}async function g(e,a){return/\/\d+\/?$/.test(e.url)?U(a[0]):O(a,e)}async function O(e,a){if(!a)return x(e);const{layer:{url:r,customParameters:t,apiKey:s}}=e[0];let o=await a.fetchData("json");o&&null!=o.layers&&null!=o.tables||(o=await J(o,{url:r??"",customParameters:t,apiKey:s},e.map((e=>e.layer.layerId))));for(const l of e)D(l.layer,l.layerJSON,o);return o}async function J(e,a,r){e||={},e.layers||=[],e.tables||=[];const{url:t,customParameters:s,apiKey:o}=a,{serviceJSON:l,layersJSON:n}=await d(t,{customParameters:s,apiKey:o}),i=M(e.layers,l.layers,r),u=M(e.tables,l.tables,r);e.layers=i.itemResources,e.tables=u.itemResources;const c=[...i.added,...u.added],p=n?[...n.layers,...n.tables]:[];return await R(e,c,t,p),e}function M(a,r,t){const s=e(a,r,((e,a)=>e.id===a.id));a=a.filter((e=>!s.removed.some((a=>a.id===e.id))));const o=s.added.map((({id:e})=>({id:e})));return o.forEach((({id:e})=>{a.push({id:e})})),{itemResources:a,added:o.filter((({id:e})=>!t.includes(e)))}}async function R(e,a,r,t){const o=a.map((({id:e})=>new s({url:r,layerId:e,sourceJSON:t.find((({id:a})=>a===e))})));await Promise.allSettled(o.map((e=>e.load()))),o.forEach((a=>{const{layerId:r,loaded:t,defaultPopupTemplate:s}=a;if(!t||null==s)return;D(a,{id:r,popupInfo:s.toJSON()},e)}))}function D(e,a,r){e.isTable?F(r.tables,a):F(r.layers,a)}function F(e,a){const r=e.findIndex((({id:e})=>e===a.id));-1===r?e.push(a):e[r]=a}function K(e,a){if(!e.length)throw new r(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function Y(e,a){const t=e.map((e=>e.portalItem.id));if(new Set(t).size>1)throw new r(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function _(e,a){const t=e.map((e=>e.layerId));if(new Set(t).size!==t.length)throw new r(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function z(e){K(e,L),await Promise.all(e.map((e=>e.load())));for(const a of e)p(a,L,N),m(a,L,$);Y(e,L),_(e,L)}async function B(e,a){const{url:r,layerId:t,title:s,fullExtent:o,isTable:l}=e,n=y(r);a.url="FeatureServer"===n?.serverType?r:`${r}/${t}`,a.title||=s,a.extent=null,l||null==o||(a.extent=await v(o)),S(a,b.METADATA),S(a,b.MULTI_LAYER),T(a,b.SINGLE_LAYER),l&&T(a,b.TABLE)}function G(e,a){for(const l of e){const t=l.parsedUrl.path,s=y(t),o=s?.url.path;if(!o)throw new r(`${a}:invalid-parameters`,f(l,`has unsupported url pattern: ${t}`),{layer:l});const n=s?.serverType;if("FeatureServer"!==n&&"MapServer"!==n)throw new r(`${a}:invalid-parameters`,f(l,`has unsupported server type: ${n}`),{layer:l});if("MapServer"===n&&e.length>1)throw new r(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=y(e[0].parsedUrl.path),s=t?.url.path,o=e.every((e=>{const a=y(e.parsedUrl.path);return a?.url.path===s}));if(!o)throw new r(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function C(e){K(e,j),await Promise.all(e.map((e=>e.load())));for(const a of e)p(a,j,N);G(e,j),_(e,j)}async function V(e,r){let t=0,s=0;for(const{isTable:a}of r)a?s++:t++;const o=r[0].parsedUrl.path,l=y(o);if(e.url="FeatureServer"===l?.serverType?l.url.path:o,e.title||=l.title,e.extent=null,t>0){const t=r.map((e=>e.fullExtent)).filter(a).reduce(((e,a)=>e.clone().union(a)));t&&(e.extent=await v(t))}S(e,b.METADATA),I(e,b.MULTI_LAYER,r.length>1),I(e,b.SINGLE_LAYER,1===r.length),I(e,b.TABLE,s>0&&0===t),n(e)}async function k(e,a){return o({layer:e,itemType:$,validateLayer:N,createItemData:(e,a)=>g(a,[e]),errorNamePrefix:P},a)}async function q(e,a){await z(e);const r=e[0].portalItem,s=w(r),o=await Promise.all(e.map((e=>l(e,s,a)))),i=await g(r,e.map(((e,a)=>({layer:e,layerJSON:o[a]}))));return n(r),await r.update({data:i}),await Promise.all(e.slice(1).map((e=>e.portalItem.reload()))),t(s),r.clone()}async function H(e,a,r){return i({layer:e,itemType:$,validateLayer:N,createItemData:(e,a)=>Promise.resolve(U(e)),errorNamePrefix:A,newItem:a,setItemProperties:B},r)}async function Q(e,a,r){await C(e);const s=u(a,j,$),o=w(s),n=await Promise.all(e.map((e=>l(e,o,r)))),i=await O(e.map(((e,a)=>({layer:e,layerJSON:n[a]}))));await V(s,e),await c(s,i,r);for(const t of e)t.portalItem=s.clone();return t(o),s}export{k as save,q as saveAll,Q as saveAllAs,H as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{debounce as e}from"../../core/promiseUtils.js";import{save as t,saveAs as r}from"./utils.js";import{getWGS84ExtentForItem as a,addTypeKeyword as i,TypeKeyword as s}from"../../portal/support/portalItemUtils.js";const l="Image Service",o="imagery-layer-save",n="imagery-layer-save-as",y="imagery-tile-layer-save",m="imagery-tile-layer-save-as";function c(e){if("imagery"===e.type)return{isValid:!0};const{raster:t}=e;return{isValid:"RasterTileServer"===t?.datasetFormat&&("Raster"===t.tileType||"Map"===t.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function p(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:r,title:l,fullExtent:o}=e;t.url=r.path,t.title||=l,t.extent=await a(o),"imagery-tile"===e.type&&i(t,s.TILED_IMAGERY)}const f=e(g);async function g(e,r){const a="imagery"===e.type?o:y;return t({layer:e,itemType:l,validateLayer:c,createItemData:p,errorNamePrefix:a},r)}const v=e(d);async function d(e,t,a){const i="imagery"===e.type?n:m;return r({layer:e,itemType:l,validateLayer:c,createItemData:p,errorNamePrefix:i,newItem:t,setItemProperties:u},a)}export{f as save,v as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,addTypeKeyword as a,TypeKeyword as i}from"../../portal/support/portalItemUtils.js";const s="Image Service",l="imagery-layer-save",y="imagery-layer-save-as",n="imagery-tile-layer-save",o="imagery-tile-layer-save-as";function m(e){if("imagery"===e.type)return{isValid:!0};const{raster:t}=e;return{isValid:"RasterTileServer"===t?.datasetFormat&&("Raster"===t.tileType||"Map"===t.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function p(e,t){const{parsedUrl:s,title:l,fullExtent:y}=e;t.url=s.path,t.title||=l,t.extent=await r(y),"imagery-tile"===e.type&&a(t,i.TILED_IMAGERY)}async function u(t,r){const a="imagery"===t.type?l:n;return e({layer:t,itemType:s,validateLayer:m,createItemData:c,errorNamePrefix:a},r)}async function g(e,r,a){const i="imagery"===e.type?y:o;return t({layer:e,itemType:s,validateLayer:m,createItemData:c,errorNamePrefix:i,newItem:r,setItemProperties:p},a)}export{u as save,g as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{debounce as e}from"../../core/promiseUtils.js";import{save as t,saveAs as r}from"./utils.js";import{getWGS84ExtentForItem as a,addTypeKeyword as s,TypeKeyword as l}from"../../portal/support/portalItemUtils.js";const n="Stream Service",o="stream-layer-save",i="stream-layer-save-as";function m(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:r,title:n,fullExtent:o}=e;t.url=r.path,t.title||=n,t.extent=null,null!=o&&(t.extent=await a(o)),s(t,l.SINGLE_LAYER)}const p=e(y);async function y(e,r){return t({layer:e,itemType:n,validateLayer:m,createItemData:c,errorNamePrefix:o},r)}const f=e(v);async function v(e,t,a){return r({layer:e,itemType:n,validateLayer:m,createItemData:c,errorNamePrefix:i,newItem:t,setItemProperties:u},a)}export{p as save,f as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,addTypeKeyword as a,TypeKeyword as s}from"../../portal/support/portalItemUtils.js";const l="Stream Service",n="stream-layer-save",i="stream-layer-save-as";function o(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function m(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:l,title:n,fullExtent:i}=e;t.url=l.path,t.title||=n,t.extent=null,null!=i&&(t.extent=await r(i)),a(t,s.SINGLE_LAYER)}async function c(t,r){return e({layer:t,itemType:l,validateLayer:o,createItemData:m,errorNamePrefix:n},r)}async function y(e,r,a){return t({layer:e,itemType:l,validateLayer:o,createItemData:m,errorNamePrefix:i,newItem:r,setItemProperties:u},a)}export{c as save,y as saveAs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.28.0-next.20230819",
3
+ "version": "4.28.0-next.20230821",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as s}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as p,utcTimeZone as n,formatDateOnly as d,formatTimeOnly as u,formatTimestamp as c,dateFormatJSONMap as l}from"../../intl/date.js";import{formatNumber as f,convertNumberFormatToIntlOptions as h}from"../../intl/number.js";let j=class extends(r(o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}formatNumber(t){return f(t,h(this))}formatDate(t,r=!1){return this.dateFormat?m(t,{...p(this.dateFormat),...r&&n}):this.formatNumber(t)}formatDateOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return d(t,r)}formatTimeOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return u(t,r)}formatTimestamp(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return c(t,r)}formatRasterPixelValue(t){return t=t.trim(),/\d{2}-\d{2}/.test(t)?t:t.includes(",")?this._formatDelimitedString(t,",",", "):t.includes(";")?this._formatDelimitedString(t,";","; "):t.includes(" ")?this._formatDelimitedString(t," "," "):this.formatNumber(Number(t))}_formatDelimitedString(t,r,o){return t&&r&&o?t.trim().split(r).map((t=>this.formatNumber(Number(t)))).join(o):t}};t([i(l)],j.prototype,"dateFormat",void 0),t([e({type:Boolean,json:{write:!0}})],j.prototype,"digitSeparator",void 0),t([e({type:s,json:{write:!0}})],j.prototype,"places",void 0),j=t([a("esri.popup.support.FieldInfoFormat")],j);const F=j;export{F as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as s}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as a,convertDateFormatToIntlOptions as p,formatDateOnly as n,formatTimeOnly as u,formatTimestamp as d,dateFormatJSONMap as c}from"../../intl/date.js";import{formatNumber as l,convertNumberFormatToIntlOptions as f}from"../../intl/number.js";let h=class extends(r(o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}formatNumber(t){return l(t,f(this))}formatDate(t,r){return this.dateFormat?a(t,{...p(this.dateFormat??"short-date-short-time"),timeZone:r}):this.formatNumber(t)}formatDateOnly(t){return n(t,p(this.dateFormat??"short-date"))}formatTimeOnly(t){return u(t,p(this.dateFormat??"short-time"))}formatTimestamp(t,r){return d(t,{...p(this.dateFormat??"short-date-short-time"),timeZone:r})}formatRasterPixelValue(t){return t=t.trim(),/\d{2}-\d{2}/.test(t)?t:t.includes(",")?this._formatDelimitedString(t,",",", "):t.includes(";")?this._formatDelimitedString(t,";","; "):t.includes(" ")?this._formatDelimitedString(t," "," "):this.formatNumber(Number(t))}_formatDelimitedString(t,r,o){return t&&r&&o?t.trim().split(r).map((t=>this.formatNumber(Number(t)))).join(o):t}};t([i(c)],h.prototype,"dateFormat",void 0),t([e({type:Boolean,json:{write:!0}})],h.prototype,"digitSeparator",void 0),t([e({type:s,json:{write:!0}})],h.prototype,"places",void 0),h=t([m("esri.popup.support.FieldInfoFormat")],h);const j=h;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const a="20230819",e="a51936ee16564eadb2a80e940a0243acfa36be81";export{a as buildDate,e as commitHash};
5
+ const c="20230821",a="accf51d40adc5636cda9c9f5d37a532b14bc0934";export{c as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,i as d,f as p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as c,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{isReadyCloudsData as v,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as C}from"./LocalAtmosphere.js";import E from"./MarsAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import{Stars as W}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as M}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends M{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}canRender(){return!(null===this._atmosphere&&null===this._stars)}requires(e){return e===O.Depth&&this._atmosphereType===f.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new W({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new j({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new P({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=v(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===O.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return C;case f.Mars:return E;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&c(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{V=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=V}}}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const q=u(.5,.5,.5),D=u(1.5,1.5,1.5);let V;export{U as EnvironmentRenderer,I as WeatherParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,i as d,f as p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as c,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{isReadyCloudsData as v,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as C}from"./LocalAtmosphere.js";import E from"./MarsAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import{Stars as W}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as M}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends M{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}produces(){return!(null===this._atmosphere&&null===this._stars)}consumes(e){return e===O.Depth&&this._atmosphereType===f.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new W({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new j({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new P({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=v(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===O.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return C;case f.Mars:return E;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&c(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{k=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=k}}}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const D=u(.5,.5,.5),V=u(1.5,1.5,1.5);let k;export{U as EnvironmentRenderer,I as WeatherParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";class l{constructor(){this._renderers=new r}add(e,r){let t=this._findStageRenderer(e);t||(t=new p({view:e}),this._renderers.add(t)),t.add(r)}remove(e,r){const t=this._findStageRenderer(e);t&&(t.remove(r),0===t.renderers.length&&(t.destroy(),this._renderers.remove(t)))}_findStageRenderer(e){return this._renderers.find((r=>r.view===e))}}let p=class extends c{canRender(e){return e!==h.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}constructor(e){super(e),this.renderSlots=[h.OPAQUE_MATERIAL,h.TRANSPARENT_MATERIAL],this.renderers=new r,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>m(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&m(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),m(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const r=this.renderers.indexOf(e);-1!==r&&(this.renderers.removeAt(r),this.context&&(m(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>m(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==a.Color||e.bindParameters.slot!==h.OPAQUE_MATERIAL&&e.bindParameters.slot!==h.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((r=>{switch(e.bindParameters.slot){case h.OPAQUE_MATERIAL:m(r,"render",this.context);break;case h.TRANSPARENT_MATERIAL:m(r,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function m(e,r,t){"function"==typeof e[r]&&null!=t&&e[r]?.(t)}e([i({constructOnly:!0})],p.prototype,"view",void 0),p=e([o("esri.views.3d.externalRenderers.ExternalRendererStore")],p);export{l as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";class l{constructor(){this._renderers=new r}add(e,r){let t=this._findStageRenderer(e);t||(t=new p({view:e}),this._renderers.add(t)),t.add(r)}remove(e,r){const t=this._findStageRenderer(e);t&&(t.remove(r),0===t.renderers.length&&(t.destroy(),this._renderers.remove(t)))}_findStageRenderer(e){return this._renderers.find((r=>r.view===e))}}let p=class extends c{produces(e){return e!==h.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}constructor(e){super(e),this.renderSlots=[h.OPAQUE_MATERIAL,h.TRANSPARENT_MATERIAL],this.renderers=new r,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>m(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&m(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),m(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const r=this.renderers.indexOf(e);-1!==r&&(this.renderers.removeAt(r),this.context&&(m(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>m(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==a.Color||e.bindParameters.slot!==h.OPAQUE_MATERIAL&&e.bindParameters.slot!==h.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((r=>{switch(e.bindParameters.slot){case h.OPAQUE_MATERIAL:m(r,"render",this.context);break;case h.TRANSPARENT_MATERIAL:m(r,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function m(e,r,t){"function"==typeof e[r]&&null!=t&&e[r]?.(t)}e([i({constructOnly:!0})],p.prototype,"view",void 0),p=e([o("esri.views.3d.externalRenderers.ExternalRendererStore")],p);export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as n,l as o,b as a,o as l,d as h,p as c}from"../../../../chunks/vec3.js";import{c as u}from"../../../../chunks/vec3f64.js";import{s as d}from"../../../../chunks/vec4.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,POSITIVE_INFINITY as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as R}from"./PointHighlights.js";import{minimumDistancePlane as w,maximumDistancePlane as j,intersectLine as y,toAaBoundingBox as q}from"../../support/orientedBoundingBox.js";import{ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as I}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as v}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as E}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as F,StoreResults as C}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as T}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as N,a as H,g as B}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as D}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as U}from"../../../webgl/BufferObject.js";import{DataType as V,PrimitiveType as W,Usage as k}from"../../../webgl/enums.js";import{VertexElementDescriptor as G}from"../../../webgl/VertexElementDescriptor.js";const Q={positions:[new G(L.POSITION,3,V.FLOAT,0,12)],colors:[new G(L.COLOR,3,V.UNSIGNED_BYTE,0,3,!0)]};let Y=class extends I{constructor(e){super(e),this.type=F.PCL,this.isGround=!1,this.renderSlots=[O.OPAQUE_MATERIAL],this._passParameters=new N,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new D,this._nodes=new s}canRender(e,t){return t!==A.Highlight||!this._highlights.empty}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=u(),f=u(),P=u(),b=u(),R=S(),A=e.camera.perScreenPixelRatio/2,I=e.camera.near;n(f,i,s);const v=1/o(f);a(f,f,v),l(P,f),d(R,f[0],f[1],f[2],-h(f,s));const F=new ie,O=new ie,T=new Array,L=p(),N=p(this._passParameters.clipBox);m(N,-s[0],-s[1],-s[2],N),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=w(o.obb,R),u=j(o.obb,R);l-=Z(a,l+I,this._passParameters,A,o.isLeaf),u-=Z(a,u+I,this._passParameters,A,o.isLeaf);const d=u<0,p=null!=F.dist&&null!=O.dist&&F.dist<l*v&&O.dist>u*v;if(d||p)return;const S=X(a,u+I,this._passParameters,A,o.isLeaf);if(!y(o.obb,s,f,S))return;const x=S*S;q(o.obb,L),m(L,-s[0],-s[1],-s[2],L);const z=!g(N,L);n(b,o.origin,s);const E=o.coordinates.length/3;for(let n=0;n<E;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(N,r))continue;const l=h(r,f),u=c(r)-l*l;if(u>x)continue;let d=l+I;const p=Z(a,d,this._passParameters,A,o.isLeaf);if(l-p<0)continue;d-=p;const m=X(a,d,this._passParameters,A,o.isLeaf);if(u>m*m)continue;const g=(l-p)*v,S=e=>(e.point=$(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==F.dist||g<F.dist)&&(null==t||t(s,i,g))&&S(F),e.options.store!==C.MIN&&(null==O.dist||g>O.dist)&&(null==t||t(s,i,g))&&S(O),e.options.store===C.ALL&&(null==t||t(s,i,g))){const e=new ie;T.push(S(e))}}}));const H=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},B=(e,t)=>{const s=H(t);e.set(this.type,s,t.dist,t.normal)};if(re(F)){const t=e.results.min;(null==t.dist||F.dist<t.dist)&&B(t,F)}if(re(O)&&e.options.store!==C.MIN){const t=e.results.max;(null==t.dist||O.dist>t.dist)&&B(t,O)}if(e.options.store===C.ALL){const t=x(s,i);for(const s of T){const i=E(t);B(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==A.Color&&e.output!==A.Depth&&e.output!==A.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output===A.Depth?A.Depth:e.output===A.Highlight?A.Highlight:A.Color,this._context.techniqueRepository.releaseAndAcquire(M,this._techniqueConfig,this._technique))}render(e,t){const s=e.rctx,i=s.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===A.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(W.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(W.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(W.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=te(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=se(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new T(s,v,Q,{positions:U.createVertex(s,k.STATIC_DRAW,t.coordinates),colors:U.createVertex(s,k.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],Y.prototype,"createGraphic",void 0),Y=e([r("esri.views.3d.layers.i3s.PointRenderer")],Y);class J extends H{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function K(e){return e.hasOwnProperty("splatSize")}function X(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=B(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Z(e,t,s,i,r){return s.drawScreenSpace?0:X(e,t,s,i,r)}function $(e,t,s){return null==s&&(s=u()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function ee(e){return null!=e.component?e.component:-1}function te(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=ee(i);let n=e.length-1;for(;n>0&&r<ee(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function se(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ie{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function re(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{Y as PointRenderer,J as PointRendererNode,K as isInstanceOfNode};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as n,l as o,b as a,o as l,d as h,p as c}from"../../../../chunks/vec3.js";import{c as u}from"../../../../chunks/vec3f64.js";import{s as d}from"../../../../chunks/vec4.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,POSITIVE_INFINITY as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as w}from"./PointHighlights.js";import{minimumDistancePlane as R,maximumDistancePlane as j,intersectLine as y,toAaBoundingBox as q}from"../../support/orientedBoundingBox.js";import{ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as I}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as v}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as E}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as F,StoreResults as C}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as T}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as N,a as H,g as B}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as D}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as U}from"../../../webgl/BufferObject.js";import{DataType as V,PrimitiveType as W,Usage as k}from"../../../webgl/enums.js";import{VertexElementDescriptor as G}from"../../../webgl/VertexElementDescriptor.js";const Q={positions:[new G(L.POSITION,3,V.FLOAT,0,12)],colors:[new G(L.COLOR,3,V.UNSIGNED_BYTE,0,3,!0)]};let Y=class extends I{constructor(e){super(e),this.type=F.PCL,this.isGround=!1,this.renderSlots=[O.OPAQUE_MATERIAL],this._passParameters=new N,this._highlights=new w({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new D,this._nodes=new s}produces(e,t){return t!==A.Highlight||!this._highlights.empty}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=u(),f=u(),P=u(),b=u(),w=S(),A=e.camera.perScreenPixelRatio/2,I=e.camera.near;n(f,i,s);const v=1/o(f);a(f,f,v),l(P,f),d(w,f[0],f[1],f[2],-h(f,s));const F=new ie,O=new ie,T=new Array,L=p(),N=p(this._passParameters.clipBox);m(N,-s[0],-s[1],-s[2],N),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=R(o.obb,w),u=j(o.obb,w);l-=Z(a,l+I,this._passParameters,A,o.isLeaf),u-=Z(a,u+I,this._passParameters,A,o.isLeaf);const d=u<0,p=null!=F.dist&&null!=O.dist&&F.dist<l*v&&O.dist>u*v;if(d||p)return;const S=X(a,u+I,this._passParameters,A,o.isLeaf);if(!y(o.obb,s,f,S))return;const x=S*S;q(o.obb,L),m(L,-s[0],-s[1],-s[2],L);const z=!g(N,L);n(b,o.origin,s);const E=o.coordinates.length/3;for(let n=0;n<E;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(N,r))continue;const l=h(r,f),u=c(r)-l*l;if(u>x)continue;let d=l+I;const p=Z(a,d,this._passParameters,A,o.isLeaf);if(l-p<0)continue;d-=p;const m=X(a,d,this._passParameters,A,o.isLeaf);if(u>m*m)continue;const g=(l-p)*v,S=e=>(e.point=$(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==F.dist||g<F.dist)&&(null==t||t(s,i,g))&&S(F),e.options.store!==C.MIN&&(null==O.dist||g>O.dist)&&(null==t||t(s,i,g))&&S(O),e.options.store===C.ALL&&(null==t||t(s,i,g))){const e=new ie;T.push(S(e))}}}));const H=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},B=(e,t)=>{const s=H(t);e.set(this.type,s,t.dist,t.normal)};if(re(F)){const t=e.results.min;(null==t.dist||F.dist<t.dist)&&B(t,F)}if(re(O)&&e.options.store!==C.MIN){const t=e.results.max;(null==t.dist||O.dist>t.dist)&&B(t,O)}if(e.options.store===C.ALL){const t=x(s,i);for(const s of T){const i=E(t);B(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==A.Color&&e.output!==A.Depth&&e.output!==A.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output===A.Depth?A.Depth:e.output===A.Highlight?A.Highlight:A.Color,this._context.techniqueRepository.releaseAndAcquire(M,this._techniqueConfig,this._technique))}render(e,t){const s=e.rctx,i=s.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===A.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(W.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(W.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(W.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=te(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=se(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new T(s,v,Q,{positions:U.createVertex(s,k.STATIC_DRAW,t.coordinates),colors:U.createVertex(s,k.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],Y.prototype,"createGraphic",void 0),Y=e([r("esri.views.3d.layers.i3s.PointRenderer")],Y);class J extends H{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function K(e){return e.hasOwnProperty("splatSize")}function X(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=B(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Z(e,t,s,i,r){return s.drawScreenSpace?0:X(e,t,s,i,r)}function $(e,t,s){return null==s&&(s=u()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function ee(e){return null!=e.component?e.component:-1}function te(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=ee(i);let n=e.length-1;for(;n>0&&r<ee(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function se(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ie{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function re(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{Y as PointRenderer,J as PointRendererNode,K as isInstanceOfNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{i as r,e as a}from"../../../chunks/vec3.js";import{create as h,fromRay as l,getStart as o,getEnd as c}from"../../../geometry/support/clipRay.js";import{intersectClipRay as d}from"../../../geometry/support/frustum.js";import{copy as p}from"../../../geometry/support/lineSegment.js";import{wrap as _}from"../../../geometry/support/ray.js";import{ViewingMode as u}from"../../ViewingMode.js";import{LaserlinePathData as m}from"./LaserlinePathData.js";import{ShaderOutput as g}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as P}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as b}from"../webgl-engine/lib/RenderSlot.js";import{updateParameters as E}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechnique as f}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as q}from"../webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as L,LaserlineTechnique as R}from"../webgl-engine/shaders/LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as V}from"../webgl-engine/shaders/LaserlineTechniqueConfiguration.js";let D=class extends P{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=u.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new L}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}get renderSlots(){return[this.contrastControlEnabled?b.LASERLINES_CONTRAST_CONTROL:b.LASERLINES]}canRender(e){return e===b.LASERLINES||this.contrastControlEnabled&&e===b.LASERLINES_CONTRAST_CONTROL}requires(e){return e===g.Depth}get isDecoration(){return this._isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){r(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){r(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){r(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){p(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){p(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this._requestRender())}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){E(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e,this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new V;const t=new q;t.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(f,t)}uninitializeRenderContext(){this._technique=t(this._technique),this._pathVerticalPlaneData=i(this._pathVerticalPlaneData),this._pathTechnique=t(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===u.Global,this._technique=this._techniqueRepository.releaseAndAcquire(R,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx;this._updatePassParameters(e),i.bindTechnique(t,this._passParameters,e.bindParameters),i.screen.draw()}_renderPath(e){if(null==this._pathVerticalPlaneData||null==this._pathTechnique)return;const t=e.rctx,i=this._pathTechnique;t.bindTechnique(i,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(l(_(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),S),S.c0=-Number.MAX_VALUE,!d(t.frustum,S))return;o(S,this._passParameters.lineStartWorld),c(S,this._passParameters.lineEndWorld)}else r(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),a(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}get test(){return{passParameters:this._passParameters}}};e([s({constructOnly:!0})],D.prototype,"contrastControlEnabled",void 0),e([s({constructOnly:!0})],D.prototype,"_isDecoration",void 0),e([s({constructOnly:!0})],D.prototype,"renderCoordsHelper",void 0),D=e([n("esri.views.3d.support.LaserLineRenderer")],D);const S=h();export{D as LaserLineRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{i as r,e as a}from"../../../chunks/vec3.js";import{create as h,fromRay as l,getStart as o,getEnd as c}from"../../../geometry/support/clipRay.js";import{intersectClipRay as d}from"../../../geometry/support/frustum.js";import{copy as p}from"../../../geometry/support/lineSegment.js";import{wrap as _}from"../../../geometry/support/ray.js";import{ViewingMode as u}from"../../ViewingMode.js";import{LaserlinePathData as m}from"./LaserlinePathData.js";import{ShaderOutput as g}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as P}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as b}from"../webgl-engine/lib/RenderSlot.js";import{updateParameters as E}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechnique as f}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as q}from"../webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as L,LaserlineTechnique as R}from"../webgl-engine/shaders/LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as V}from"../webgl-engine/shaders/LaserlineTechniqueConfiguration.js";let D=class extends P{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=u.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new L}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}get renderSlots(){return[this.contrastControlEnabled?b.LASERLINES_CONTRAST_CONTROL:b.LASERLINES]}produces(e){return e===b.LASERLINES||this.contrastControlEnabled&&e===b.LASERLINES_CONTRAST_CONTROL}consumes(e){return e===g.Depth}get isDecoration(){return this._isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){r(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){r(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){r(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){p(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){p(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this._requestRender())}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){E(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e,this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new V;const t=new q;t.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(f,t)}uninitializeRenderContext(){this._technique=t(this._technique),this._pathVerticalPlaneData=i(this._pathVerticalPlaneData),this._pathTechnique=t(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===u.Global,this._technique=this._techniqueRepository.releaseAndAcquire(R,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx;this._updatePassParameters(e),i.bindTechnique(t,this._passParameters,e.bindParameters),i.screen.draw()}_renderPath(e){if(null==this._pathVerticalPlaneData||null==this._pathTechnique)return;const t=e.rctx,i=this._pathTechnique;t.bindTechnique(i,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(l(_(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),S),S.c0=-Number.MAX_VALUE,!d(t.frustum,S))return;o(S,this._passParameters.lineStartWorld),c(S,this._passParameters.lineEndWorld)}else r(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),a(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}get test(){return{passParameters:this._passParameters}}};e([s({constructOnly:!0})],D.prototype,"contrastControlEnabled",void 0),e([s({constructOnly:!0})],D.prototype,"_isDecoration",void 0),e([s({constructOnly:!0})],D.prototype,"renderCoordsHelper",void 0),D=e([n("esri.views.3d.support.LaserLineRenderer")],D);const S=h();export{D as LaserLineRenderer};