@arcgis/core 4.34.0-next.15 → 4.34.0-next.16

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 (180) hide show
  1. package/applications/Components/sanitizerUtils.d.ts +3 -0
  2. package/applications/Components/sanitizerUtils.js +5 -0
  3. package/applications/MapViewer/layerUtils.d.ts +3 -0
  4. package/applications/MapViewer/layerUtils.js +5 -0
  5. package/applications/SceneViewer/layerUtils.d.ts +2 -2
  6. package/arcade.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{a08ce98672ab94d19613.js → 04e558a970c6a77f243e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0d99579d8cdeddc0fc9c.js +1 -0
  10. package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +1 -0
  11. package/assets/esri/core/workers/chunks/1a7570bd2b79194ff94b.js +42 -0
  12. package/assets/esri/core/workers/chunks/{0ed4ec00ef16aa58a33d.js → 254c4f7e277ae9915dce.js} +1 -1
  13. package/assets/esri/core/workers/chunks/2990145d7ac3af0d68be.js +1 -0
  14. package/assets/esri/core/workers/chunks/2d51d0a24cdc89bafa1c.js +1 -0
  15. package/assets/esri/core/workers/chunks/2d89e354eeadadca4f7f.js +1 -0
  16. package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +1 -0
  17. package/assets/esri/core/workers/chunks/{2254989ca3ff3960f2fe.js → 400a4c9fa62964f8fa1d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/445ddf57d2f503a0b98b.js +1 -0
  19. package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +1 -0
  20. package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +1 -0
  21. package/assets/esri/core/workers/chunks/{e980a81c4d1e05f07141.js → 53e43798d08ad2075c1f.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{8b93cd4132934b0d7d39.js → 54814a269d44855f0673.js} +1 -1
  23. package/assets/esri/core/workers/chunks/55ce214a10fb6fc2e901.js +1 -0
  24. package/assets/esri/core/workers/chunks/66c8816e91e3f9e214d4.js +346 -0
  25. package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +1 -0
  26. package/assets/esri/core/workers/chunks/{7f14d6cb754c7e94748c.js → 827919fe23e06e40a330.js} +139 -115
  27. package/assets/esri/core/workers/chunks/87986f31061c426e761b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{7ae88c141a5d85e5bb88.js → 87a743df7d8556d5e253.js} +1 -1
  29. package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +1 -0
  30. package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +1 -0
  31. package/assets/esri/core/workers/chunks/93e66d9c49eaeb503bff.js +1 -0
  32. package/assets/esri/core/workers/chunks/9959a91c8de6fef499c2.js +1 -0
  33. package/assets/esri/core/workers/chunks/c1a72e1dbd1ba7b41965.js +1 -0
  34. package/assets/esri/core/workers/chunks/c4065934637b820cad5b.js +1 -0
  35. package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +1 -0
  36. package/assets/esri/core/workers/chunks/{05f2133f05f86266d8c7.js → d2139307f62ea8bf999a.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{3f58da371633967a61ca.js → ddb66fe6fcd0764daa7a.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{70e5848aa372475fc8fa.js → eac7af86166c09c6a9be.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{7317346ed8d7c5bb859d.js → f537a02dc2fc9e6435a2.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{7e1906d35a764f7f10b0.js → fe1129f03476825a7344.js} +1 -1
  41. package/chunks/DefaultMaterial.glsl.js +30 -28
  42. package/chunks/RealisticTree.glsl.js +25 -22
  43. package/chunks/aiServices.js +1 -1
  44. package/config.js +1 -1
  45. package/core/LRUCache.js +1 -1
  46. package/core/MemCache.js +1 -1
  47. package/core/urlUtils.js +1 -1
  48. package/core/workers/RemoteClient.js +1 -1
  49. package/core/workers/WorkerHandle.js +1 -1
  50. package/interfaces.d.ts +51 -19
  51. package/kernel.js +1 -1
  52. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  53. package/layers/mixins/FeatureLayerBase.js +1 -1
  54. package/layers/support/arcgisLayers.js +1 -1
  55. package/layers/support/fetchService.js +1 -1
  56. package/layers/support/layerUtils.js +1 -1
  57. package/package.json +1 -1
  58. package/portal/support/layersLoader.js +1 -1
  59. package/portal/support/loadUtils.js +1 -1
  60. package/portal/support/portalLayers.js +1 -1
  61. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  62. package/rest/support/TranslateParameters.js +1 -1
  63. package/support/revision.js +1 -1
  64. package/symbols/WaterSymbol3DLayer.js +1 -1
  65. package/symbols/support/symbolUtils.js +1 -1
  66. package/symbols/support/utils.js +1 -1
  67. package/views/3d/layers/I3SMeshView3D.js +1 -1
  68. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  69. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  70. package/views/3d/layers/RouteLayerView3D.js +1 -1
  71. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  72. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  73. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  74. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  76. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  80. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  81. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  82. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  83. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  84. package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
  85. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  86. package/views/3d/layers/support/makeScheduleFunction.js +1 -1
  87. package/views/3d/layers/support/symbolColorUtils.js +1 -1
  88. package/views/3d/state/controllers/FovController.js +1 -1
  89. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  90. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  91. package/views/3d/state/controllers/RotateController.js +1 -1
  92. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  93. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  94. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  95. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  96. package/views/3d/state/utils/navigationUtils.js +1 -1
  97. package/views/3d/support/StreamDataLoader.js +1 -1
  98. package/views/3d/terrain/OverlayRenderer.js +1 -1
  99. package/views/3d/terrain/TerrainRenderer.js +1 -1
  100. package/views/3d/terrain/TerrainSurface.js +1 -1
  101. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  102. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  103. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  104. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstanceColor.glsl.js +11 -0
  105. package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +18 -0
  106. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +40 -26
  107. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +35 -24
  108. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +12 -8
  109. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +3 -1
  110. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +26 -8
  111. package/views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js +1 -1
  112. package/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js +1 -1
  113. package/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js +1 -1
  114. package/views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js +1 -1
  115. package/views/3d/webgl-engine/core/shaderModules/Float3DrawUniform.js +1 -1
  116. package/views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js +1 -1
  117. package/views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js +1 -1
  118. package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +1 -1
  119. package/views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js +1 -1
  122. package/views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js +1 -1
  123. package/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js +1 -1
  124. package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +1 -1
  126. package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +1 -1
  127. package/views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js +1 -1
  128. package/views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js +1 -1
  129. package/views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js +1 -1
  130. package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
  131. package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
  132. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  133. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  134. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  135. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  136. package/views/3d/webgl-engine/lib/Program.js +1 -1
  137. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  139. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  140. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  141. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  142. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  143. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  144. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  145. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  146. package/views/webgl/Program.js +1 -1
  147. package/views/webgl/ShaderBuilder.js +1 -1
  148. package/webscene/Slide.js +1 -1
  149. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  150. package/widgets/BatchAttributeForm.js +1 -1
  151. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  152. package/widgets/FeatureTemplates.js +1 -1
  153. package/widgets/Search/SearchViewModel.js +1 -1
  154. package/widgets/Search/support/layerSearchUtils.js +1 -1
  155. package/widgets/support/ItemList.js +1 -1
  156. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  157. package/widgets/support/SelectionList.js +1 -1
  158. package/widgets/support/dateUtils.js +1 -1
  159. package/widgets/support/symbolPreviewUtils.js +1 -1
  160. package/assets/esri/core/workers/chunks/0dbb350ce651bc236ec8.js +0 -1
  161. package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +0 -1
  162. package/assets/esri/core/workers/chunks/1f559f1e7f0bc0f4bf20.js +0 -346
  163. package/assets/esri/core/workers/chunks/462cc6966d060be59c7c.js +0 -1
  164. package/assets/esri/core/workers/chunks/4a805e7a57d25c4b595f.js +0 -66
  165. package/assets/esri/core/workers/chunks/58f92100b1b2343111c6.js +0 -1
  166. package/assets/esri/core/workers/chunks/5dcc8fa321f0a7c49f36.js +0 -1
  167. package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +0 -1
  168. package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +0 -1
  169. package/assets/esri/core/workers/chunks/622c0552ca3cd674d46c.js +0 -1
  170. package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +0 -1
  171. package/assets/esri/core/workers/chunks/658e82c9b722852e02d0.js +0 -1
  172. package/assets/esri/core/workers/chunks/679d7baea233faf3fdbc.js +0 -1
  173. package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +0 -1
  174. package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +0 -1
  175. package/assets/esri/core/workers/chunks/a250a5c6e055e33bd25c.js +0 -1
  176. package/assets/esri/core/workers/chunks/b4273381dc069f4e1fa2.js +0 -1
  177. package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +0 -1
  178. package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +0 -1
  179. package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +0 -1
  180. package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.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.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{watch as t,initial as o}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{isTable as s}from"../layers/support/layerUtils.js";import n from"./Widget.js";import{nullGroupBy as l,isTemplateItemGroup as a}from"./FeatureTemplates/featureTemplatesUtils.js";import d from"./FeatureTemplates/FeatureTemplatesViewModel.js";import c from"./FeatureTemplates/VisibleElements.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{ItemList as u}from"./support/ItemList.js";import{fetchThumbnail as h}from"./support/symbolPreviewUtils.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";const y={base:"esri-feature-templates"};function I(e){return e.length>0&&a(e[0])}function g(e){return e.id}let C=class extends n{constructor(e,t){super(e,t),this.enableListScroll=!0,this.filterText="",this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.selectionMode="none",this.viewModel=new d,this.visibleElements=new c,this.renderCustomItem=e=>null,this.renderCustomGroupContent=e=>null,this.renderItemLabel=()=>null,this.renderItemDescription=()=>null,this.renderItemContent=e=>null,this.renderItemContentEnd=e=>null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const o=e.target;if(M(o))return void t.unobserve(o);const r=w(o),{layer:i,template:s}=r;j(o,!0);const n=await h(s,i).catch((()=>(j(o,!1),null)));if(null==n)return;o.appendChild(n)}}))})),this._renderItemIcon=e=>s(e.layer)?b("span",{"data-has-icon":!0,"data-item":e,key:"icon"},b("calcite-icon",{icon:"table"})):b("span",{afterCreate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":e,key:"icon"}),this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)}}initialize(){const e=({label:e})=>!this.filterText||!!e?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(t((()=>this.viewModel),((t,o)=>{t&&!t.filterFunction&&(this.filterFunction=e),o&&o!==t&&o.filterFunction===e&&(o.filterFunction=null)}),o))}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return m({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(e){this.viewModel.filterFunction=e}get groupBy(){return this.viewModel.groupBy}set groupBy(e){this.viewModel.groupBy=e}get icon(){return"list-rectangle"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get selectedItem(){return this.viewModel.selectedItem}select(e,t){return this.viewModel.select(e,t)}render(){const{disabled:e,enableListScroll:t,filterText:o,headingLevel:r,messages:i,viewModel:{items:s,numberOfFeatureTemplates:n,selectedItem:d,state:c}}=this,m=this.visibleElements.filter&&n>1;if(I(s)){const e=s.find((e=>e.label===l.label));e&&(e.label=i.other)}return b("div",{"aria-label":i.widgetLabel,class:this.classes(y.base,p.widget)},"loading"===c?b("calcite-loader",{key:"loader",label:this.messagesCommon.loading,type:"indeterminate"}):"ready"===c?b(u,{disabled:e,enableListScroll:t,filterEnabled:m,filterText:o,headingLevel:r,id:this.id,identify:g,items:s,messages:{filterPlaceholder:i.filterPlaceholder,noItems:i.noItems,noMatches:i.noMatches},renderCustomGroupContent:this.renderCustomGroupContent,renderCustomItem:this.renderCustomItem,renderIcon:this._renderItemIcon,renderItemContent:this.renderItemContent,renderItemContentEnd:this.renderItemContentEnd,renderItemDescription:this.renderItemDescription,renderItemLabel:this.renderItemLabel,selectedItem:d??void 0,selectionMode:this.selectionMode??void 0,onFilterChange:e=>{this.filterText=e},onItemSelect:e=>!a(e)&&this.viewModel.select(e)}):null)}};function w(e){return e?.["data-item"]}function M(e){return!!e?.["data-has-icon"]}function j(e,t){e&&(e["data-has-icon"]=t)}e([r()],C.prototype,"disabled",null),e([r()],C.prototype,"enableListScroll",void 0),e([r()],C.prototype,"filterFunction",null),e([r()],C.prototype,"filterText",void 0),e([r()],C.prototype,"groupBy",null),e([r()],C.prototype,"headingLevel",void 0),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layers",null),e([r(),f("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],C.prototype,"messages",void 0),e([r(),f("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([r({readOnly:!0})],C.prototype,"selectedItem",null),e([r()],C.prototype,"selectionMode",void 0),e([r(),v("select")],C.prototype,"viewModel",void 0),e([r({type:c,nonNullable:!0})],C.prototype,"visibleElements",void 0),e([r()],C.prototype,"renderCustomItem",void 0),e([r()],C.prototype,"renderCustomGroupContent",void 0),e([r()],C.prototype,"renderItemLabel",void 0),e([r()],C.prototype,"renderItemDescription",void 0),e([r()],C.prototype,"renderItemContent",void 0),e([r()],C.prototype,"renderItemContentEnd",void 0),C=e([i("esri.widgets.FeatureTemplates")],C);const F=C;export{F as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{watch as t,initial as o}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{isTable as i}from"../layers/support/layerUtils.js";import n from"./Widget.js";import{nullGroupBy as l,isTemplateItemGroup as a}from"./FeatureTemplates/featureTemplatesUtils.js";import d from"./FeatureTemplates/FeatureTemplatesViewModel.js";import m from"./FeatureTemplates/VisibleElements.js";import{loadCalciteComponents as c}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{ItemList as u}from"./support/ItemList.js";import{fetchThumbnail as h}from"./support/symbolPreviewUtils.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";import{substitute as g}from"../intl/substitute.js";const y={base:"esri-feature-templates"};function I(e){return e.length>0&&a(e[0])}function C(e){return e.id}let w=class extends n{constructor(e,t){super(e,t),this.enableListScroll=!0,this.filterText="",this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesLegend=null,this.selectionMode="none",this.viewModel=new d,this.visibleElements=new m,this.renderCustomItem=e=>null,this.renderCustomGroupContent=e=>null,this.renderItemLabel=()=>null,this.renderItemDescription=()=>null,this.renderItemContent=e=>null,this.renderItemContentEnd=e=>null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const o=e.target;if(j(o))return void t.unobserve(o);const r=L(o),{layer:s,template:i}=r;M(o,!0);const n=r.label?g(this.messagesLegend.previewTemplateAriaLabel,{label:r.label}):this.messagesCommon.preview,l=await h(i,s,{ariaLabel:n}).catch((()=>(M(o,!1),null)));if(null==l)return;o.appendChild(l)}}))})),this._renderItemIcon=e=>i(e.layer)?b("span",{"data-has-icon":!0,"data-item":e,key:"icon"},b("calcite-icon",{icon:"table"})):b("span",{afterCreate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":e,key:"icon"}),this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)}}initialize(){const e=({label:e})=>!this.filterText||!!e?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(t((()=>this.viewModel),((t,o)=>{t&&!t.filterFunction&&(this.filterFunction=e),o&&o!==t&&o.filterFunction===e&&(o.filterFunction=null)}),o))}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return c({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(e){this.viewModel.filterFunction=e}get groupBy(){return this.viewModel.groupBy}set groupBy(e){this.viewModel.groupBy=e}get icon(){return"list-rectangle"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get selectedItem(){return this.viewModel.selectedItem}select(e,t){return this.viewModel.select(e,t)}render(){const{disabled:e,enableListScroll:t,filterText:o,headingLevel:r,messages:s,viewModel:{items:i,numberOfFeatureTemplates:n,selectedItem:d,state:m}}=this,c=this.visibleElements.filter&&n>1;if(I(i)){const e=i.find((e=>e.label===l.label));e&&(e.label=s.other)}return b("div",{"aria-label":s.widgetLabel,class:this.classes(y.base,p.widget)},"loading"===m?b("calcite-loader",{key:"loader",label:this.messagesCommon.loading,type:"indeterminate"}):"ready"===m?b(u,{disabled:e,enableListScroll:t,filterEnabled:c,filterText:o,headingLevel:r,id:this.id,identify:C,items:i,messages:{filterPlaceholder:s.filterPlaceholder,noItems:s.noItems,noMatches:s.noMatches},renderCustomGroupContent:this.renderCustomGroupContent,renderCustomItem:this.renderCustomItem,renderIcon:this._renderItemIcon,renderItemContent:this.renderItemContent,renderItemContentEnd:this.renderItemContentEnd,renderItemDescription:this.renderItemDescription,renderItemLabel:this.renderItemLabel,selectedItem:d??void 0,selectionMode:this.selectionMode??void 0,onFilterChange:e=>{this.filterText=e},onItemSelect:e=>!a(e)&&this.viewModel.select(e)}):null)}};function L(e){return e?.["data-item"]}function j(e){return!!e?.["data-has-icon"]}function M(e,t){e&&(e["data-has-icon"]=t)}e([r()],w.prototype,"disabled",null),e([r()],w.prototype,"enableListScroll",void 0),e([r()],w.prototype,"filterFunction",null),e([r()],w.prototype,"filterText",void 0),e([r()],w.prototype,"groupBy",null),e([r()],w.prototype,"headingLevel",void 0),e([r()],w.prototype,"icon",null),e([r()],w.prototype,"label",null),e([r()],w.prototype,"layers",null),e([r(),f("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],w.prototype,"messages",void 0),e([r(),f("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([r(),f("esri/widgets/Legend/t9n/Legend")],w.prototype,"messagesLegend",void 0),e([r({readOnly:!0})],w.prototype,"selectedItem",null),e([r()],w.prototype,"selectionMode",void 0),e([r(),v("select")],w.prototype,"viewModel",void 0),e([r({type:m,nonNullable:!0})],w.prototype,"visibleElements",void 0),e([r()],w.prototype,"renderCustomItem",void 0),e([r()],w.prototype,"renderCustomGroupContent",void 0),e([r()],w.prototype,"renderItemLabel",void 0),e([r()],w.prototype,"renderItemDescription",void 0),e([r()],w.prototype,"renderItemContent",void 0),e([r()],w.prototype,"renderItemContentEnd",void 0),w=e([s("esri.widgets.FeatureTemplates")],w);const F=w;export{F 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import o from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import a from"../../core/Error.js";import n from"../../core/Evented.js";import u from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as h,after as p}from"../../core/promiseUtils.js";import{watch as g,initial as d,whenOnce as m}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import S from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointFromGeometry as v,getPointWithElevation as w}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";import L from"../../portal/Portal.js";import{isApiKeyApplicable as I}from"../../support/apiKeyUtils.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const H=()=>x("esri/widgets/Search/t9n/Search"),B="highlight",Q=l.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=_.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(n.EventedMixin(o))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=L.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await H();this.messages=e,this.defaultPopupTemplate=new s({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([g((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),d),b(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new a("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});u.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new a("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw u.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new a("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw u.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new a("select:missing-source","Cannot select without a source.",{source:o});throw u.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),n=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,c=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new a("select:missing-feature","Cannot select without a feature.",{feature:d});throw u.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?v(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?w(_,t):Promise.resolve(_)},x=await h(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&c?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new r({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&n&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await m((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=h([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await m((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=O(e.url)&&I(e.url)?{url:A}:null,r=C.fromJSON({...e,...t}),s=r.url;if(O(s)||N(s)||D(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0})).filter(i)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new a("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return u.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return p(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?v(e.geometry):e instanceof S?e:Array.isArray(e)&&2===e.length?new S({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),u.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new a("search:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),h(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new a("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),h(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??Z,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer?.type||"subtype-sublayer"===e.layer?.type)return null;const{layer:r}=e;return r?(await t.when(),t.whenLayerView(r)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:i}=o,l=(i&&s?.[i])??null,a=r.highlight(l??t);this.addHandles(a,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([y()],W.prototype,"_searching",void 0),e([y()],W.prototype,"_updatingPromise",void 0),e([y({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([y()],W.prototype,"activeSourceIndex",null),e([y()],W.prototype,"allPlaceholder",null),e([y({readOnly:!0})],W.prototype,"allSources",null),e([y()],W.prototype,"autoNavigate",void 0),e([y()],W.prototype,"autoSelect",void 0),e([y({type:s})],W.prototype,"defaultPopupTemplate",void 0),e([y({readOnly:!0})],W.prototype,"defaultSources",void 0),e([y()],W.prototype,"defaultSymbols",void 0),e([y()],W.prototype,"includeDefaultSources",void 0),e([y()],W.prototype,"locationEnabled",null),e([y()],W.prototype,"maxInputLength",void 0),e([y()],W.prototype,"maxResults",void 0),e([y()],W.prototype,"maxSuggestions",void 0),e([y()],W.prototype,"messages",void 0),e([y()],W.prototype,"minSuggestCharacters",void 0),e([y({readOnly:!0})],W.prototype,"placeholder",null),e([y()],W.prototype,"popupEnabled",void 0),e([y({type:s})],W.prototype,"popupTemplate",void 0),e([y({type:L})],W.prototype,"portal",void 0),e([y()],W.prototype,"resultCount",void 0),e([y()],W.prototype,"resultGraphicEnabled",void 0),e([y({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([y({readOnly:!0})],W.prototype,"results",void 0),e([y({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([y()],W.prototype,"searchAllEnabled",void 0),e([y({readOnly:!0})],W.prototype,"selectedResult",void 0),e([y()],W.prototype,"searchTerm",null),e([y({type:Q})],W.prototype,"sources",void 0),e([y({readOnly:!0})],W.prototype,"state",null),e([y()],W.prototype,"suggestionDelay",void 0),e([y()],W.prototype,"suggestionCount",void 0),e([y({readOnly:!0})],W.prototype,"suggestions",void 0),e([y()],W.prototype,"suggestionsEnabled",void 0),e([y({readOnly:!0})],W.prototype,"updating",null),e([y()],W.prototype,"view",void 0),e([y()],W.prototype,"clear",null),W=e([f("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import o from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import a from"../../core/Error.js";import n from"../../core/Evented.js";import u from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as h,after as p}from"../../core/promiseUtils.js";import{watch as g,initial as d,whenOnce as m}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import S from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointFromGeometry as v,getPointWithElevation as w}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";import L from"../../portal/Portal.js";import{isApiKeyApplicable as I}from"../../support/apiKeyUtils.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const H=()=>x("esri/widgets/Search/t9n/Search"),B="highlight",Q=l.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=_.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(n.EventedMixin(o))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=L.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await H();this.messages=e,this.defaultPopupTemplate=new s({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([g((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),d),b(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new a("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});u.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new a("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw u.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new a("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw u.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new a("select:missing-source","Cannot select without a source.",{source:o});throw u.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),n=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,c=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new a("select:missing-feature","Cannot select without a feature.",{feature:d});throw u.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?v(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?w(_,t):Promise.resolve(_)},x=await h(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&c?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new r({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&n&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await m((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=h([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await m((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=O(e.url)&&I(e.url)?{url:A}:null,r=C.fromJSON({...e,...t}),s=r.url;if(O(s)||N(s)||D(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0})).filter(i)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new a("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return u.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return p(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?v(e.geometry):e instanceof S?e:Array.isArray(e)&&2===e.length?new S({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),u.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new a("search:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),h(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new a("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),h(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??Z,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([y()],W.prototype,"_searching",void 0),e([y()],W.prototype,"_updatingPromise",void 0),e([y({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([y()],W.prototype,"activeSourceIndex",null),e([y()],W.prototype,"allPlaceholder",null),e([y({readOnly:!0})],W.prototype,"allSources",null),e([y()],W.prototype,"autoNavigate",void 0),e([y()],W.prototype,"autoSelect",void 0),e([y({type:s})],W.prototype,"defaultPopupTemplate",void 0),e([y({readOnly:!0})],W.prototype,"defaultSources",void 0),e([y()],W.prototype,"defaultSymbols",void 0),e([y()],W.prototype,"includeDefaultSources",void 0),e([y()],W.prototype,"locationEnabled",null),e([y()],W.prototype,"maxInputLength",void 0),e([y()],W.prototype,"maxResults",void 0),e([y()],W.prototype,"maxSuggestions",void 0),e([y()],W.prototype,"messages",void 0),e([y()],W.prototype,"minSuggestCharacters",void 0),e([y({readOnly:!0})],W.prototype,"placeholder",null),e([y()],W.prototype,"popupEnabled",void 0),e([y({type:s})],W.prototype,"popupTemplate",void 0),e([y({type:L})],W.prototype,"portal",void 0),e([y()],W.prototype,"resultCount",void 0),e([y()],W.prototype,"resultGraphicEnabled",void 0),e([y({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([y({readOnly:!0})],W.prototype,"results",void 0),e([y({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([y()],W.prototype,"searchAllEnabled",void 0),e([y({readOnly:!0})],W.prototype,"selectedResult",void 0),e([y()],W.prototype,"searchTerm",null),e([y({type:Q})],W.prototype,"sources",void 0),e([y({readOnly:!0})],W.prototype,"state",null),e([y()],W.prototype,"suggestionDelay",void 0),e([y()],W.prototype,"suggestionCount",void 0),e([y({readOnly:!0})],W.prototype,"suggestions",void 0),e([y()],W.prototype,"suggestionsEnabled",void 0),e([y({readOnly:!0})],W.prototype,"updating",null),e([y()],W.prototype,"view",void 0),e([y()],W.prototype,"clear",null),W=e([f("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X 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.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../intl.js";import e from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{mappedFind as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import u from"../../../rest/support/FullTextSearch.js";import{substitute as a}from"../../../intl/substitute.js";import{formatDate as c}from"../../../intl/date.js";const d=/https?:\/\/services.*\.arcgis\.com/i,f=/(?:\{([^}]+)\})/g,m=()=>r.getLogger("esri.widgets.Search.support.layerSearchUtils");function p(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:f,filter:p,zoomScale:g}=u,b=d?.scale,L=y(u,d),R=r?.signal;return x(f).then((()=>{const e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null})).then((t=>{const{objectIdField:r,returnZ:y}=f,x=S(u);if(!I(f,x))throw m().error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const C=t?.length?t:[x],E=u.outFields||C,D=h(E);E.includes(r)||D||E.push(r),f.floorInfo?.floorField&&E.push(f.floorInfo.floorField);if(!(D||j(f,E)))throw m().error("invalid-field: outField is invalid."),new e("getResults():invalid-field","outField is invalid.");const A=f.createQuery(),{orderByFields:N}=u;if(N&&(A.orderByFields=N),s){A.outSpatialReference=s;const e=1/n(s);e&&(A.maxAllowableOffset=e)}const k="mesh"===f.geometryType||"multipatch"===f.geometryType,O=f.capabilities?.data?.supportsZ&&!k;if(A.returnZ=O&&!1!==y,A.returnGeometry=!0,A.multipatchOption=k?"xyFootprint":null,E&&(A.outFields=E),l)A.geometry=l;else if(c.key)A.objectIds=[c.key];else{const t=u.searchFields||[x];if(!j(f,t))throw m().error("invalid-field: search field is invalid."),new e("getResults():invalid-field","search field is invalid.");T(f)&&(A.num=o),L&&(A.geometry=L);const r=c.text?.trim();if(!r)return[];const n=c.text,{prefix:l="",suffix:s=""}=u,a=q(`${l}${n}${s}`);$(f)&&v(f,t)&&!i&&n&&(A.fullText=w({text:n,searchFields:t}));const d=M({searchTerm:a,layer:f,searchFields:t,filter:p,exactMatch:i,query:A,type:"search"});if(A.where=d,!F(A))return[]}return f.queryFeatures(A,{signal:R}).then((e=>Z(e,d,u,a,x,b,g)))}))}function g(t,r){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=t,{layer:c,filter:d}=i,p=r?.signal,g=y(i,l);return x(c).then((()=>{if(!T(c))return[];const t=S(i),r=i.searchFields||[t],l=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(f,((e,t)=>(l.push(t),e))):l.push(t);const y=h(l);l.includes(c.objectIdField)||y||l.push(c.objectIdField);const x=I(c,t),b=y||j(c,l),L=j(c,r);if(!x)throw m().error("invalid-field: displayField is invalid."),new e("getSuggestions():invalid-field","displayField is invalid.");if(!b)throw m().error("invalid-field: outField is invalid."),new e("getSuggestions():invalid-field","outField is invalid.");if(!L)throw m().error("invalid-field: search field is invalid."),new e("getSuggestions():invalid-field","search field is invalid.");const R=c.createQuery(),{orderByFields:C}=i;C&&(R.orderByFields=C),R.outSpatialReference=n,R.returnGeometry=!1,R.num=s,R.outFields=l,g&&(R.geometry=g);if(!o.trim())return[];const{prefix:E="",suffix:D=""}=i,A=q(`${E}${o}${D}`);$(c)&&v(c,r)&&!a&&o&&(R.fullText=w({text:o,searchFields:r}));const N=M({searchTerm:A,layer:c,searchFields:r,filter:d,exactMatch:a,query:R,type:"suggest"});return R.where=N,F(R)?c.queryFeatures(R,{signal:p}).then((e=>B(e,i,u,t))):[]}))}function y(e,t){const{filter:r,withinViewEnabled:i}=e,n=t?.extent,l=r?.geometry;return l??(i&&n?n:void 0)}function h(e){return e&&e.includes("*")}async function x(e){e&&await e.load()}function F(e){return!(!e.fullText&&!e.where)}function v(e,t){const r=e?.indexes;if(!r||!t?.length)return!1;return r.filter((e=>"FullText"===e.indexType)).some((e=>{const r=e.fields?.split(",").map((e=>e.trim().toLowerCase()))||[];return t.every((e=>r.includes(e.toLowerCase())))}))}function w({text:e,searchFields:t}){return e.trim().split(" ").filter((e=>!!e.trim())).map((e=>new u({onFields:t,searchTerm:e,searchType:"prefix"})))}function $(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function T(e){return e?.capabilities?.query?.supportsPagination??!1}function b(e){return e?.fieldsIndex?.fields?.find((e=>"string"===e.type))?.name??""}function S(e){return e.displayField||e.layer.displayField||b(e.layer)}function j(e,t){return!(!e||!t?.length)&&t.every((t=>I(e,t)))}function I(e,t){return!!e.getField(t)}function L(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function R({codedValues:e},t,r){return i(e??[],(e=>{const i=e.name,n=r?i:i.toLowerCase();return(r?t:t.toLowerCase())===n?e.code.toString():null}))??null}function q(e){return e.replaceAll("'","''")}function C(e,t){const r=t?.where;return r?`(${e}) AND (${r})`:e}function E({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t?.type,s=t?.name;if("string"===o||"date"===o||"global-id"===o){const t=d.test(n??""),o=t&&L(e)?"N":"";if(i&&"search"===l)return C(`${s} = ${o}'${e}'`,r);if(t){return C(`${s} LIKE ${o}${`'${e}%'`}`,r)}return C(`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:C(`${s} = ${t}`,r)}return C(`${s} = ${e}`,r)}function D(e,t){return e?` OR (${t})`:`(${t})`}function M({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,query:l,type:o}){const{definitionExpression:s,url:u}=t;let a="";return!l.fullText&&e&&r&&r.forEach((r=>{const l=t.getField(r),s=t.getFieldDomain?.(r,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}),c=(s&&"coded-value"===s.type?R(s,e,n):null)||e||null;if(null!==c){const e=E({currentTerm:c,field:l,filter:i,exactMatch:n,url:u,type:o});e&&(a+=D(a,e))}})),s&&a?`(${s}) AND (${a})`:s||a}function A(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some((e=>e.code===t&&(r=e.name,!0))),r}function N(e,t){return e[t]??e[Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase()))]}function k(e,t,r){const i=e.sourceLayer,{attributes:n}=e,l=i.getFieldDomain?.(r,{feature:e,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});if(t)return a(t,n);if(r&&n){const e=i.getField(r),t=N(n,r);return null==t?"":l&&"coded-value"===l.type?A(l,t)??"":"date"===e?.type?c(new Date(t)):"number"==typeof t?t.toString():"string"!=typeof t?"":t.trim()}return""}function O(e,t,r,i){const n=e.sourceLayer,{attributes:l}=e,{objectIdField:o}=n,s=o?l[o]:null;return{text:k(e,t.suggestionTemplate,i),key:s,sourceIndex:r}}function B(e,t,r,i){return e.features.map((e=>O(e,t,r,i)))}function U(e){return null!=e&&null!=e.minScale&&null!=e.maxScale}function V(e,r,i,n,u,a,c){const d=e.clone(),f=e.sourceLayer,m=f?.objectIdField,p=m?e.attributes[m]:null,g=k(e,i.searchTemplate,u);null!=a&&U(f)&&(f.minScale&&f.minScale<a?a=f.minScale:f.maxScale&&f.maxScale>a&&(a=f.maxScale));const y=d.geometry?o(d.geometry,r??void 0,a??void 0):void 0,h="number"==typeof c&&y?s(t(y),r??void 0,c):y,x=e.clone();return null!=h&&(x.geometry=l.fromExtent(h)),{extent:h,target:x,feature:d,key:p,name:g,sourceIndex:n}}function Z(e,t,r,i,n,l,o){return e.features.map((e=>V(e,t,r,i,n,l,o)))}export{w as createFullTextSearchInfos,p as getResults,g as getSuggestions};
5
+ import"../../../intl.js";import e from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{mappedFind as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import u from"../../../rest/support/FullTextSearch.js";import{substitute as a}from"../../../intl/substitute.js";import{formatDate as c}from"../../../intl/date.js";const d=/https?:\/\/services.*\.arcgis\.com/i,f=/(?:\{([^}]+)\})/g,m=()=>r.getLogger("esri.widgets.Search.support.layerSearchUtils");function p(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:f,filter:p,zoomScale:g}=u,b=d?.scale,L=y(u,d),R=r?.signal;return x(f).then((()=>{const e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null})).then((t=>{const{objectIdField:r,returnZ:y}=f,x=S(u);if(!I(f,x))throw m().error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const C=t?.length?t:[x],E=u.outFields||C,D=h(E);E.includes(r)||D||E.push(r),f.floorInfo?.floorField&&E.push(f.floorInfo.floorField);if(!(D||j(f,E)))throw m().error("invalid-field: outField is invalid."),new e("getResults():invalid-field","outField is invalid.");const A=f.createQuery(),{orderByFields:N}=u;if(N&&(A.orderByFields=N),s){A.outSpatialReference=s;const e=1/n(s);e&&(A.maxAllowableOffset=e)}const k="mesh"===f.geometryType||"multipatch"===f.geometryType,O=f.capabilities?.data?.supportsZ&&!k;if(A.returnZ=O&&!1!==y,A.returnGeometry=!0,A.multipatchOption=k?"xyFootprint":null,E&&(A.outFields=E),l)A.geometry=l;else if(c.key)A.objectIds=[c.key];else{const t=u.searchFields||[x];if(!j(f,t))throw m().error("invalid-field: search field is invalid."),new e("getResults():invalid-field","search field is invalid.");T(f)&&(A.num=o),L&&(A.geometry=L);const r=c.text?.trim();if(!r)return[];const n=c.text,{prefix:l="",suffix:s=""}=u,a=q(`${l}${n}${s}`);$(f)&&v(f,t)&&!i&&n&&(A.fullText=w({text:n,searchFields:t}));const d=M({searchTerm:a,layer:f,searchFields:t,filter:p,exactMatch:i,query:A,type:"search"});if(A.where=d,!F(A))return[]}return f.queryFeatures(A,{signal:R}).then((e=>Z(e,d,u,a,x,b,g)))}))}function g(t,r){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=t,{layer:c,filter:d}=i,p=r?.signal,g=y(i,l);return x(c).then((()=>{if(!T(c))return[];const t=S(i),r=i.searchFields||[t],l=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(f,((e,t)=>(l.push(t),e))):l.push(t);const y=h(l);l.includes(c.objectIdField)||y||l.push(c.objectIdField);const x=I(c,t),b=y||j(c,l),L=j(c,r);if(!x)throw m().error("invalid-field: displayField is invalid."),new e("getSuggestions():invalid-field","displayField is invalid.");if(!b)throw m().error("invalid-field: outField is invalid."),new e("getSuggestions():invalid-field","outField is invalid.");if(!L)throw m().error("invalid-field: search field is invalid."),new e("getSuggestions():invalid-field","search field is invalid.");const R=c.createQuery(),{orderByFields:C}=i;C&&(R.orderByFields=C),R.outSpatialReference=n,R.returnGeometry=!1,R.num=s,R.outFields=l,g&&(R.geometry=g);if(!o.trim())return[];const{prefix:E="",suffix:D=""}=i,A=q(`${E}${o}${D}`);$(c)&&v(c,r)&&!a&&o&&(R.fullText=w({text:o,searchFields:r}));const N=M({searchTerm:A,layer:c,searchFields:r,filter:d,exactMatch:a,query:R,type:"suggest"});return R.where=N,F(R)?c.queryFeatures(R,{signal:p}).then((e=>B(e,i,u,t))):[]}))}function y(e,t){const{filter:r,withinViewEnabled:i}=e,n=t?.extent,l=r?.geometry;return l??(i&&n?n:void 0)}function h(e){return e&&e.includes("*")}async function x(e){e&&await e.load()}function F(e){return!(!e.fullText&&!e.where)}function v(e,t){const r=e?.indexes;if(!r||!t?.length)return!1;return r.filter((e=>"FullText"===e.indexType)).some((e=>{const r=e.fields?.split(",").map((e=>e.trim().toLowerCase()))||[];return t.every((e=>r.includes(e.toLowerCase())))}))}function w({text:e,searchFields:t}){return e.trim().split(" ").filter((e=>!!e.trim())).map((e=>new u({onFields:t,searchTerm:e,searchType:"prefix"})))}function $(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function T(e){return e?.capabilities?.query?.supportsPagination??!1}function b(e){return e?.fieldsIndex?.fields?.find((e=>"string"===e.type))?.name??""}function S(e){return e.displayField||e.layer.displayField||b(e.layer)}function j(e,t){return!(!e||!t?.length)&&t.every((t=>I(e,t)))}function I(e,t){return!!e.getField(t)}function L(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function R({codedValues:e},t,r){return i(e??[],(e=>{const i=e.name,n=r?i:i.toLowerCase();return(r?t:t.toLowerCase())===n?e.code.toString():null}))??null}function q(e){return e.replaceAll("'","''")}function C(e,t){const r=t?.where;return r?`(${e}) AND (${r})`:e}function E({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t?.type,s=t?.name;if("string"===o||"date"===o||"global-id"===o){const t=d.test(n??""),o=t&&L(e)?"N":"";if(i&&"search"===l)return C(`${s} = ${o}'${e}'`,r);if(t){return C(`${s} LIKE ${o}${`'${e}%'`}`,r)}return C(`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:C(`${s} = ${t}`,r)}return C(`${s} = ${e}`,r)}function D(e,t){return e?` OR (${t})`:`(${t})`}function M({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,query:l,type:o}){const{definitionExpression:s,url:u}=t;let a="";return!l.fullText&&e&&r&&r.forEach((r=>{const l=t.getField(r),s=t.getFieldDomain?.(r,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}),c=(s&&"coded-value"===s.type?R(s,e,n):null)||e||null;if(null!==c){const e=E({currentTerm:c,field:l,filter:i,exactMatch:n,url:u,type:o});e&&(a+=D(a,e))}})),s&&a?`(${s}) AND (${a})`:s||a}function A(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some((e=>e.code===t&&(r=e.name,!0))),r}function N(e,t){return e[t]??e[Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase()))]}function k(e,t,r){const i=e.sourceLayer,{attributes:n}=e,l=i.getFieldDomain?.(r,{feature:e,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});if(t)return a(t,n);if(r&&n){const e=i.getField(r),t=N(n,r);return null==t?"":l&&"coded-value"===l.type?A(l,t)??"":"date"===e?.type?c(new Date(t)):"number"==typeof t?t.toString():"string"!=typeof t?"":t.trim()}return""}function O(e,t,r,i){const n=e.sourceLayer,{attributes:l}=e,{objectIdField:o}=n,s=o?l[o]:null;return{text:k(e,t.suggestionTemplate,i),key:s,sourceIndex:r}}function B(e,t,r,i){return e.features.map((e=>O(e,t,r,i)))}function U(e){return null!=e&&null!=e.minScale&&null!=e.maxScale}function V(e,r,i,n,u,a,c){const d=e.clone();d.layer=e.layer;const f=e.sourceLayer,m=f?.objectIdField,p=m?e.attributes[m]:null,g=k(e,i.searchTemplate,u);null!=a&&U(f)&&(f.minScale&&f.minScale<a?a=f.minScale:f.maxScale&&f.maxScale>a&&(a=f.maxScale));const y=d.geometry?o(d.geometry,r??void 0,a??void 0):void 0,h="number"==typeof c&&y?s(t(y),r??void 0,c):y,x=e.clone();return x.layer=e.layer,null!=h&&(x.geometry=l.fromExtent(h)),{extent:h,target:x,feature:d,key:p,name:g,sourceIndex:n}}function Z(e,t,r,i,n,l,o){return e.features.map((e=>V(e,t,r,i,n,l,o)))}export{w as createFullTextSearchInfos,p as getResults,g as getSuggestions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Heading as e}from"./Heading.js";import{classes as t}from"./widgetUtils.js";import{tsx as n}from"./jsxFactory.js";const l="esri-item-list",i=`${l}__list-item`,r={filterContainerSticky:`${l}__filter-container--sticky`,group:`${l}__group`,groupHeader:`${l}__group__header`,item:i,itemDisabled:`${i}--disabled`,itemIcon:`${i}-icon`,itemContentEnd:`${i}-content-end`,noMatchesMessage:`${l}__no-matches-message`,scroller:`${l}__scroller`,scrollerEnabled:`${l}__scroller--enabled`},o=4;function s(e){const{disabled:t,filterText:l="",id:i,messages:r,onFilterChange:o,...s}=e;return n("div",{key:i},e.filterEnabled??1?c({disabled:t,filterText:l,id:i,messages:r,onFilterChange:o}):null,d({...s,disabled:t,enableListScroll:e.enableListScroll??!0,filterText:l,messages:r}))}function a(e){return!!e.items}function d(e){const{headingLevel:l,items:i,...o}=e;return 0===i.length?n("div",{class:r.noMatchesMessage,key:"no-matches"},e.messages.noMatches):n("div",{class:t({[r.scroller]:!0,[r.scrollerEnabled]:!!e.enableListScroll}),key:"item-container"},i.map((e=>a(e)?g({...o,group:e,headingLevel:l}):m({...o,grouped:!0,item:e}))))}function c(e){const{disabled:t,messages:l,filterText:i,enableListScroll:o}=e;return n("div",{class:o?void 0:r.filterContainerSticky,key:"filter"},n("calcite-input",{disabled:t,placeholder:l.filterPlaceholder,type:"search",value:i,onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)}}))}function m(e){const{disabled:l,grouped:i,identify:o,item:s,onItemMouseEnter:a,onItemMouseLeave:d,onItemSelect:c,renderIcon:m,renderCustomItem:g,renderItemContent:p,renderItemContentEnd:f,renderItemLabel:v,renderItemDescription:_,renderItemActionEnd:h,renderItemTitle:I,selectedItem:y}=e,C=u(s,o),k=C===u(y,o),$=g?.(e);if($)return $;const L=p?.(s),M=f?.(s),E=h?.(s),S=!(!s.disabled&&!l),T=m?.(s);return n("calcite-list-item",{afterUpdate:e=>{e.selected=k},"aria-level":i?"2":"",class:t({[r.item]:!0,[r.itemDisabled]:S}),"data-item":s,description:L?void 0:_?.(s)??void 0,disabled:S,key:C,label:L?void 0:v?.(s)??s.label??void 0,onblur:e=>d?.(b(e)),onfocus:e=>a?.(b(e)),onmouseenter:e=>a?.(b(e)),onmouseleave:e=>d?.(b(e)),selected:k,title:I?.(s)??void 0,onCalciteListItemSelect:e=>{e.preventDefault(),c?.(b(e))}},T?n("div",{class:r.itemIcon,key:"content-start",slot:"content-start"},T):void 0,L?n("div",{key:"content",slot:"content"},L):null,M?n("div",{class:r.itemContentEnd,key:"content-end",slot:"content-end"},M):null,E??null)}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function b(e){return e.currentTarget["data-item"]}function g(t){const{disabled:l,group:i,headingLevel:s=o,selectionMode:a="none",renderCustomGroupContent:d,...c}=t,u=d?.(t);return n("div",{class:r.group,key:i.label??void 0},n(e,{class:r.groupHeader,level:s},i.label),u||n("calcite-list",{disabled:l,label:i.label??"",selectionAppearance:"border",selectionMode:a},i.items.map((e=>m({...c,disabled:l,item:e,grouped:!0})))))}export{s as ItemList,g as renderGroup,m as renderItem};
5
+ import{Heading as e}from"./Heading.js";import{classes as t}from"./widgetUtils.js";import{tsx as n}from"./jsxFactory.js";const l="esri-item-list",i=`${l}__list-item`,r={filterContainerSticky:`${l}__filter-container--sticky`,group:`${l}__group`,groupHeader:`${l}__group__header`,item:i,itemDisabled:`${i}--disabled`,itemIcon:`${i}-icon`,itemContentEnd:`${i}-content-end`,noMatchesMessage:`${l}__no-matches-message`,scroller:`${l}__scroller`,scrollerEnabled:`${l}__scroller--enabled`},o=4;function s(e){const{disabled:t,filterText:l="",id:i,messages:r,onFilterChange:o,...s}=e;return n("div",{key:i},e.filterEnabled??1?c({disabled:t,filterText:l,id:i,messages:r,onFilterChange:o}):null,d({...s,disabled:t,enableListScroll:e.enableListScroll??!0,filterText:l,messages:r}))}function a(e){return!!e.items}function d(e){const{headingLevel:l,items:i,...o}=e;return 0===i.length?n("div",{class:r.noMatchesMessage,key:"no-matches"},e.messages.noMatches):n("div",{class:t({[r.scroller]:!0,[r.scrollerEnabled]:!!e.enableListScroll}),key:"item-container"},i.map((e=>a(e)?g({...o,group:e,headingLevel:l}):m({...o,grouped:!0,item:e}))))}function c(e){const{disabled:t,messages:l,filterText:i,enableListScroll:o}=e;return n("div",{class:o?void 0:r.filterContainerSticky,key:"filter"},n("calcite-input",{disabled:t,placeholder:l.filterPlaceholder,type:"search",value:i,onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)}}))}function m(e){const{disabled:l,identify:i,item:o,onItemMouseEnter:s,onItemMouseLeave:a,onItemSelect:d,renderIcon:c,renderCustomItem:m,renderItemContent:g,renderItemContentEnd:p,renderItemLabel:f,renderItemDescription:v,renderItemActionEnd:_,renderItemTitle:h,selectedItem:I}=e,y=u(o,i),C=y===u(I,i),k=m?.(e);if(k)return k;const $=g?.(o),L=p?.(o),M=_?.(o),E=!(!o.disabled&&!l),S=c?.(o);return n("calcite-list-item",{afterUpdate:e=>{e.selected=C},class:t({[r.item]:!0,[r.itemDisabled]:E}),"data-item":o,description:$?void 0:v?.(o)??void 0,disabled:E,key:y,label:$?void 0:f?.(o)??o.label??void 0,onblur:e=>a?.(b(e)),onfocus:e=>s?.(b(e)),onmouseenter:e=>s?.(b(e)),onmouseleave:e=>a?.(b(e)),selected:C,title:h?.(o)??void 0,onCalciteListItemSelect:e=>{e.preventDefault(),d?.(b(e))}},S?n("div",{class:r.itemIcon,key:"content-start",slot:"content-start"},S):void 0,$?n("div",{key:"content",slot:"content"},$):null,L?n("div",{class:r.itemContentEnd,key:"content-end",slot:"content-end"},L):null,M??null)}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function b(e){return e.currentTarget["data-item"]}function g(t){const{disabled:l,group:i,headingLevel:s=o,selectionMode:a="none",renderCustomGroupContent:d,...c}=t,u=d?.(t);return n("div",{class:r.group,key:i.label??void 0},n(e,{class:r.groupHeader,level:s},i.label),u||n("calcite-list",{disabled:l,label:i.label??"",selectionAppearance:"border",selectionMode:a},i.items.map((e=>m({...c,disabled:l,item:e,grouped:!0})))))}export{s as ItemList,g as renderGroup,m as renderItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/arrayUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchThumbnail as l}from"../symbolPreviewUtils.js";import s from"./ItemBase.js";let o=class extends s{constructor(t){super(t),this._title=null,this._thumbnail=null,this.graphic=null,this.layer=null,this.layerItem=null,this.thumbnailSize=24}get _filterTerms(){return[this.title,this.layerItem.title,this.layerItem.groupLayerItem?.title].filter(e)}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get objectId(){return this.graphic.getObjectId()}get title(){return this._title??this.objectId?.toString()}get thumbnail(){return this._thumbnail??void 0}get thumbnailKey(){return`${this.key}-${this.graphic.uid}`}get visible(){const{_filterTerms:t,viewModel:{activeLayerItem:e,filterText:i}}=this;if(e&&e.layer!==this.layer)return!1;if(null==i||""===i||!t.length)return!0;const r=new RegExp(i,"iu");return t.some((t=>r.test(t)))}async fetchThumbnail(){return this._thumbnail=await l(this.graphic,this.layer,{maxSize:this.thumbnailSize})}async sync(t){t.push(this._setFeatureTitle())}async _setFeatureTitle(){const{graphic:t,key:e,layer:i,viewModel:r}=this,l=r.featureTitleMap.get(e)||(i?.getFeatureTitle?await i.getFeatureTitle(t,{fetchMissingFields:!1}):null);l&&r.featureTitleMap.set(e,l),this._title=l}};t([i()],o.prototype,"_filterTerms",null),t([i()],o.prototype,"_title",void 0),t([i()],o.prototype,"_thumbnail",void 0),t([i()],o.prototype,"graphic",void 0),t([i()],o.prototype,"key",null),t([i()],o.prototype,"layer",void 0),t([i()],o.prototype,"layerItem",void 0),t([i()],o.prototype,"objectId",null),t([i()],o.prototype,"title",null),t([i()],o.prototype,"thumbnail",null),t([i()],o.prototype,"thumbnailKey",null),t([i()],o.prototype,"thumbnailSize",void 0),t([i()],o.prototype,"visible",null),o=t([r("esri.widgets.support.SelectionList.FeatureItem")],o);const a=o;export{a as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/arrayUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchThumbnail as l}from"../symbolPreviewUtils.js";import s from"./ItemBase.js";let o=class extends s{constructor(t){super(t),this._title=null,this._thumbnail=null,this.graphic=null,this.layer=null,this.layerItem=null,this.thumbnailSize=24}get _filterTerms(){return[this.title,this.layerItem.title,this.layerItem.groupLayerItem?.title].filter(e)}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get objectId(){return this.graphic.getObjectId()}get title(){return this._title??this.objectId?.toString()}get thumbnail(){return this._thumbnail??void 0}get thumbnailKey(){return`${this.key}-${this.graphic.uid}`}get visible(){const{_filterTerms:t,viewModel:{activeLayerItem:e,filterText:i}}=this;if(e&&e.layer!==this.layer)return!1;if(null==i||""===i||!t.length)return!0;const r=new RegExp(i,"iu");return t.some((t=>r.test(t)))}async fetchThumbnail(t){return this._thumbnail=await l(this.graphic,this.layer,{maxSize:this.thumbnailSize,ariaLabel:t?.ariaLabel})}async sync(t){t.push(this._setFeatureTitle())}async _setFeatureTitle(){const{graphic:t,key:e,layer:i,viewModel:r}=this,l=r.featureTitleMap.get(e)||(i?.getFeatureTitle?await i.getFeatureTitle(t,{fetchMissingFields:!1}):null);l&&r.featureTitleMap.set(e,l),this._title=l}};t([i()],o.prototype,"_filterTerms",null),t([i()],o.prototype,"_title",void 0),t([i()],o.prototype,"_thumbnail",void 0),t([i()],o.prototype,"graphic",void 0),t([i()],o.prototype,"key",null),t([i()],o.prototype,"layer",void 0),t([i()],o.prototype,"layerItem",void 0),t([i()],o.prototype,"objectId",null),t([i()],o.prototype,"title",null),t([i()],o.prototype,"thumbnail",null),t([i()],o.prototype,"thumbnailKey",null),t([i()],o.prototype,"thumbnailSize",void 0),t([i()],o.prototype,"visible",null),o=t([r("esri.widgets.support.SelectionList.FeatureItem")],o);const a=o;export{a 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{on as i,watch as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{loadCalciteComponents as r}from"./componentsUtils.js";import{globalCss as a}from"./globalCss.js";import{storeNode as c}from"./widgetUtils.js";import{messageBundle as m}from"./decorators/messageBundle.js";import{tsx as d}from"./jsxFactory.js";import{isGroupLayerItem as p,isLayerItem as h,isFeatureItem as u}from"./SelectionList/selectionListUtils.js";import v from"./SelectionList/SelectionListViewModel.js";import y from"./SelectionList/VisibleElements.js";import{formatNumber as g}from"../../intl/number.js";import{substitute as I}from"../../intl/substitute.js";const f="esri-selection-list",b=`${f}__list-item`,w={base:f,container:`${f}__container`,flowItem:`${f}__flow-item`,layerDropdown:`${f}__layer-dropdown`,listItemFeature:`${b}__feature`,listItemFeatureIcon:`${b}__feature-icon`,listItemIcon:`${b}__icon`,itemCount:`${f}__item-count`,notice:`${f}__notice`,panel:`${f}__panel`,totalCount:`${f}__total-count`};let _=class extends n{constructor(e,t){super(e,t),this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const i=e.target;if(this._hasIcon(i))return void t.unobserve(i);const s=this._getListItem(i);if(!s)return;this._setHasIcon(i,!0);const o=s.thumbnail??await s.fetchThumbnail().catch((()=>(this._setHasIcon(i,!1),null)));if(null==o)return;i.appendChild(o)}}))})),this._itemWithOpenMenu=null,this._list=null,this.displayMode="group",this.hightlightOnHoverEnabled=!1,this.itemActionConfigs=null,this.menuScale="m",this.messages=null,this.messagesCommon=null,this.onListItemSelect=null,this.scale="s",this.viewModel=new v,this.visibleElements=new y,this._afterItemCreate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseItems=this.collapseItems.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}initialize(){this.addHandles([i((()=>this.effectiveSelectionManager),"selection-change",(()=>this._closeItemMenu())),s((()=>this.hightlightOnHoverEnabled),(e=>{e||this.removeTemporaryHighlight()}))])}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return r({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get activeLayerItem(){return this.viewModel.activeLayerItem}get allLayerItems(){return this.viewModel.allLayerItems}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get featureTitleMap(){return this.viewModel.featureTitleMap}get filterText(){return this.viewModel.filterText}set filterText(e){this.viewModel.filterText=e}get icon(){return"selection"}set icon(e){this._overrideIfSome("icon",e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get state(){return this.viewModel.state}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}get visibleFeatureCount(){return this.viewModel.visibleFeatureCount}get visibleFeatureItems(){return this.viewModel.visibleFeatureItems}get visibleLayerCount(){return this.viewModel.visibleLayerCount}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseItems(){this._list?.filteredItems.forEach((e=>e.expanded=!1))}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}setSelection(e){this.viewModel.setSelection(e)}render(){return d("div",{class:this.classes(w.base,a.widget,a.panel)},d("calcite-flow",null,d("calcite-flow-item",{class:w.flowItem,heading:this.visibleElements.header?this.messages.selection:void 0,loading:"loading"===this.state,overlayPositioning:"fixed",scale:this.scale,selected:!0},d("calcite-panel",{class:w.panel,overlayPositioning:"fixed",scale:this.scale},d("div",{class:w.container},this._renderActiveLayerDropdown(),this._renderFilterInput(),this._renderList(),this._renderFilterNotice())),this._renderTotalChip(),this._renderMenuActions())))}_renderTotalChip(){const{visibleElements:e}=this;if(!e.totalCount||!e.header)return;const{effectiveCount:t}=this,i=g(t),s=I(this.messages.selectionCount,{count:i});return d("calcite-chip",{appearance:"outline",class:w.totalCount,closable:t>0,closed:0===t,icon:this.maxVisibleFeatureCountExceeded?"exclamation-mark-triangle":void 0,label:i,scale:this.scale,slot:"header-actions-end",title:s,onCalciteChipClose:this.clear},i)}_renderMenuActions(){const{visibleElements:e}=this;if(!e.header||!e.menu)return;const{menuScale:t}=this,i=0===this.effectiveCount;return[d("calcite-action",{disabled:i,icon:"reset",key:"clear-action",onclick:this.clear,scale:t,slot:"header-menu-actions",text:this.messagesCommon.clear,textEnabled:!0}),d("calcite-action",{disabled:i,icon:"folders",key:"collapse-action",onclick:this.collapseItems,scale:t,slot:"header-menu-actions",text:this.messages.collapseAll,textEnabled:!0})]}_renderActiveLayerDropdown(){const{layerItems:e,messages:t}=this;if(!(0===this.effectiveCount||e.length<2)&&this.visibleElements.layerFilter)return d("calcite-combobox",{class:w.layerDropdown,clearDisabled:!0,label:t.filterByLayer,overlayPositioning:"fixed",placeholder:t.filterByLayer,scale:this.scale,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.filterText=void 0;const t=e.selectedItems[0]?.value??void 0;this.layer="all-layers"===t?void 0:t}},d("calcite-combobox-item",{heading:I(t.allLayersCount,{count:e.length}),icon:"layers",key:"all-layers",selected:null==this.layer,value:"all-layers"}),this.layerItems.map((e=>this._renderActiveLayerDropdownItem(e))))}_renderFilterInput(){if(this.visibleElements.filter&&0!==this.effectiveCount)return d("calcite-input",{clearable:!0,icon:"search",placeholder:this.messages.filter,scale:this.scale,value:this.filterText,onCalciteInputInput:({target:{value:e}})=>{this.filterText=e}})}_renderActiveLayerDropdownItem(e){const t=e.title||this.messages.untitledLayer;return d("calcite-combobox-item",{heading:t,icon:e.iconName,key:e.key,selected:e.layer===this.layer,value:e.layer})}_renderList(){const{messages:e}=this;if(0!==this.visibleFeatureCount)return d("calcite-list",{afterCreate:c,bind:this,"data-node-ref":"_list",displayMode:"nested",interactionMode:"interactive",label:e.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:"none"},this._renderListContent(this.allLayerItems))}_renderListContent(e){return this.activeLayerItem?this._renderLayerItem(this.activeLayerItem):e.map((e=>p(e)?this._renderGroupItem(e):h(e)?this._renderLayerItem(e):null)).filter(t)}_renderFilterNotice(){const{visibleElements:e}=this;if(!("disabled"===this.state||this.visibleFeatureCount>0)&&e.filter&&e.filterNotice)return d("calcite-notice",{class:w.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale,width:"full"},d("div",{slot:"message"},this.messages.noMatchingFeatures))}_renderItemCount(e){if(!this.visibleElements.itemCount)return;const{messages:t}=this,i=g(e.total),s=g(e.visibleTotal),o=I(t.selectionCount,{count:i});return e.maxVisibleFeatureCountExceeded?d("span",{class:w.itemCount,slot:"content-end",title:o},d("calcite-icon",{icon:"exclamation-mark-triangle",scale:"s",title:t.tooManyFeatures}),`${g(this.maxVisibleFeatureCountPerLayer)}+`):d("span",{class:w.itemCount,slot:"content-end",title:o},s)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;const{messages:t,messagesCommon:i}=this,s=this._itemWithOpenMenu===e,o=u(e),l=h(e),n=p(e),r=o?t.deselectFeature:l?t.deselectLayer:t.deselectGroup;return[d("calcite-dropdown",{open:s,overlayPositioning:"fixed",scale:this.menuScale,slot:"actions-end",width:"m",onCalciteDropdownClose:()=>this._closeItemMenu(e),onCalciteDropdownOpen:()=>{this._itemWithOpenMenu=e}},d("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:this.scale,slot:"trigger",text:i.menu,textEnabled:!1}),s?d("calcite-dropdown-group",{selectionMode:"none"},d("calcite-dropdown-item",{iconStart:"layer-zoom-to",onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo),d("calcite-dropdown-item",{iconStart:"selection-filter",onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},o?t.onlySelectFeature:t.onlySelectThis),d("calcite-dropdown-item",{iconStart:"selection-x",onCalciteDropdownItemSelect:()=>this.deselectItem(e)},r),this.itemActionConfigs?.map((t=>{if(!t.type||"feature"===t.type&&o||"layer"===t.type&&l||"group"===t.type&&n)return d("calcite-dropdown-item",{iconStart:t.icon??void 0,onCalciteDropdownItemSelect:()=>t.callback({item:e})},t.label)}))):void 0)]}_renderGroupItem(e){const t=e.title||this.messages.untitledLayer;if(0===e.visibleTotal)return;const{displayMode:i}=this;if("layer"===i||"feature"===i)return this._renderListContent(e.items);const{visibleElements:s}=this;return d("calcite-list-item",{bind:this,closable:!!s.itemCloseActions,"data-type":"group",expanded:!0,iconStart:s.itemIcons?e.iconName:void 0,key:e.key,label:t,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemActions(e),this._renderListContent(e.items))}_renderLayerItem(e){if(0===e.visibleTotal||!e.visible)return;if("feature"===this.displayMode)return this._renderItems(e.featureItems);const{messages:t,visibleElements:i}=this,s=e.title||t.untitledLayer;return d("calcite-list-item",{bind:this,closable:!!i.itemCloseActions,"data-type":"layer",expanded:!0,iconStart:i.itemIcons?e.iconName:void 0,key:e.key,label:s,scale:this.scale,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemCount(e),this._renderItemActions(e),this._renderItems(e.featureItems),e.maxVisibleFeatureCountExceeded?d("calcite-notice",{class:w.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale},d("div",{slot:"message"},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map((e=>this._renderItem(e)))}_renderItem(e){if(!e.visible)return;const{hightlightOnHoverEnabled:t,messages:i,visibleElements:s}=this,o=e.title||i.untitledFeature,l=s.itemIcons&&"feature"!==this.displayMode;return d("calcite-list-item",{bind:this,class:l?w.listItemFeatureIcon:w.listItemFeature,closable:!!s.itemCloseActions,"data-item":e,"data-type":"feature",key:e.key,label:o,name:o,onblur:t?()=>this.removeTemporaryHighlight():void 0,onfocus:t?()=>this.addTemporaryHighlight(e):void 0,onpointerenter:t?()=>this.addTemporaryHighlight(e):void 0,onpointerleave:t?()=>this.removeTemporaryHighlight():void 0,scale:this.scale,value:o,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons)return d("div",{class:w.listItemIcon,key:"content-start",slot:"content-start"},d("span",{afterCreate:this._afterItemCreate,afterRemoved:this._afterItemRemoved,"data-has-icon":!1,"data-item":e,key:e.thumbnailKey}))}_getListItem(e){return e?.["data-item"]}_hasIcon(e){return!!e?.["data-has-icon"]}_setHasIcon(e,t){e&&(e["data-has-icon"]=t)}_onListItemSelect(e,t){t.stopPropagation(),this._closeItemMenu(),this.onListItemSelect?.({item:e})}_closeItemMenu(e){e&&e!==this._itemWithOpenMenu||(this._itemWithOpenMenu=null)}};e([o()],_.prototype,"_itemWithOpenMenu",void 0),e([o()],_.prototype,"_list",void 0),e([o()],_.prototype,"activeLayerItem",null),e([o()],_.prototype,"allLayerItems",null),e([o()],_.prototype,"displayMode",void 0),e([o()],_.prototype,"effectiveCount",null),e([o()],_.prototype,"effectiveSelectionManager",null),e([o()],_.prototype,"featureTitleMap",null),e([o()],_.prototype,"filterText",null),e([o()],_.prototype,"hightlightOnHoverEnabled",void 0),e([o()],_.prototype,"icon",null),e([o()],_.prototype,"itemActionConfigs",void 0),e([o()],_.prototype,"isUpdating",null),e([o()],_.prototype,"label",null),e([o()],_.prototype,"layer",null),e([o()],_.prototype,"layerItems",null),e([o()],_.prototype,"layerViewMap",null),e([o()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([o()],_.prototype,"maxVisibleFeatureCountPerLayer",null),e([o()],_.prototype,"menuScale",void 0),e([o(),m("esri/widgets/support/SelectionList/t9n/SelectionList")],_.prototype,"messages",void 0),e([o(),m("esri/t9n/common")],_.prototype,"messagesCommon",void 0),e([o()],_.prototype,"onListItemSelect",void 0),e([o()],_.prototype,"scale",void 0),e([o()],_.prototype,"selectionManager",null),e([o()],_.prototype,"state",null),e([o()],_.prototype,"view",null),e([o()],_.prototype,"viewLayersAndTables",null),e([o()],_.prototype,"viewModel",void 0),e([o({type:y,nonNullable:!0})],_.prototype,"visibleElements",void 0),e([o()],_.prototype,"visibleFeatureCount",null),e([o()],_.prototype,"visibleFeatureItems",null),e([o()],_.prototype,"visibleLayerCount",null),_=e([l("esri.widgets.support.SelectionList")],_);const C=_;export{C as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{on as i,watch as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{loadCalciteComponents as r}from"./componentsUtils.js";import{globalCss as a}from"./globalCss.js";import{storeNode as c}from"./widgetUtils.js";import{messageBundle as m}from"./decorators/messageBundle.js";import{tsx as d}from"./jsxFactory.js";import{isGroupLayerItem as p,isLayerItem as h,isFeatureItem as u}from"./SelectionList/selectionListUtils.js";import v from"./SelectionList/SelectionListViewModel.js";import g from"./SelectionList/VisibleElements.js";import{substitute as y}from"../../intl/substitute.js";import{formatNumber as I}from"../../intl/number.js";const b="esri-selection-list",f=`${b}__list-item`,w={base:b,container:`${b}__container`,flowItem:`${b}__flow-item`,layerDropdown:`${b}__layer-dropdown`,listItemFeature:`${f}__feature`,listItemFeatureIcon:`${f}__feature-icon`,listItemIcon:`${f}__icon`,itemCount:`${b}__item-count`,notice:`${b}__notice`,panel:`${b}__panel`,totalCount:`${b}__total-count`};let _=class extends n{constructor(e,t){super(e,t),this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const i=e.target;if(this._hasIcon(i))return void t.unobserve(i);const s=this._getListItem(i);if(!s)return;this._setHasIcon(i,!0);const o=s.title?y(this.messagesLegend.previewTemplateAriaLabel,{label:s.title}):this.messagesCommon.preview,l=s.thumbnail??await s.fetchThumbnail({ariaLabel:o}).catch((()=>(this._setHasIcon(i,!1),null)));if(null==l)return;i.appendChild(l)}}))})),this._itemWithOpenMenu=null,this._list=null,this.displayMode="group",this.hightlightOnHoverEnabled=!1,this.itemActionConfigs=null,this.menuScale="m",this.messages=null,this.messagesCommon=null,this.messagesLegend=null,this.onListItemSelect=null,this.scale="s",this.viewModel=new v,this.visibleElements=new g,this._afterItemCreate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseItems=this.collapseItems.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}initialize(){this.addHandles([i((()=>this.effectiveSelectionManager),"selection-change",(()=>this._closeItemMenu())),s((()=>this.hightlightOnHoverEnabled),(e=>{e||this.removeTemporaryHighlight()}))])}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return r({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get activeLayerItem(){return this.viewModel.activeLayerItem}get allLayerItems(){return this.viewModel.allLayerItems}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get featureTitleMap(){return this.viewModel.featureTitleMap}get filterText(){return this.viewModel.filterText}set filterText(e){this.viewModel.filterText=e}get icon(){return"selection"}set icon(e){this._overrideIfSome("icon",e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get state(){return this.viewModel.state}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}get visibleFeatureCount(){return this.viewModel.visibleFeatureCount}get visibleFeatureItems(){return this.viewModel.visibleFeatureItems}get visibleLayerCount(){return this.viewModel.visibleLayerCount}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseItems(){this._list?.filteredItems.forEach((e=>e.expanded=!1))}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}setSelection(e){this.viewModel.setSelection(e)}render(){return d("div",{class:this.classes(w.base,a.widget,a.panel)},d("calcite-flow",null,d("calcite-flow-item",{class:w.flowItem,heading:this.visibleElements.header?this.messages.selection:void 0,loading:"loading"===this.state,overlayPositioning:"fixed",scale:this.scale,selected:!0},d("calcite-panel",{class:w.panel,overlayPositioning:"fixed",scale:this.scale},d("div",{class:w.container},this._renderActiveLayerDropdown(),this._renderFilterInput(),this._renderList(),this._renderFilterNotice())),this._renderTotalChip(),this._renderMenuActions())))}_renderTotalChip(){const{visibleElements:e}=this;if(!e.totalCount||!e.header)return;const{effectiveCount:t}=this,i=I(t),s=y(this.messages.selectionCount,{count:i});return d("calcite-chip",{appearance:"outline",class:w.totalCount,closable:t>0,closed:0===t,icon:this.maxVisibleFeatureCountExceeded?"exclamation-mark-triangle":void 0,label:i,scale:this.scale,slot:"header-actions-end",title:s,onCalciteChipClose:this.clear},i)}_renderMenuActions(){const{visibleElements:e}=this;if(!e.header||!e.menu)return;const{menuScale:t}=this,i=0===this.effectiveCount;return[d("calcite-action",{disabled:i,icon:"reset",key:"clear-action",onclick:this.clear,scale:t,slot:"header-menu-actions",text:this.messagesCommon.clear,textEnabled:!0}),d("calcite-action",{disabled:i,icon:"folders",key:"collapse-action",onclick:this.collapseItems,scale:t,slot:"header-menu-actions",text:this.messages.collapseAll,textEnabled:!0})]}_renderActiveLayerDropdown(){const{layerItems:e,messages:t}=this;if(!(0===this.effectiveCount||e.length<2)&&this.visibleElements.layerFilter)return d("calcite-combobox",{class:w.layerDropdown,clearDisabled:!0,label:t.filterByLayer,overlayPositioning:"fixed",placeholder:t.filterByLayer,scale:this.scale,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.filterText=void 0;const t=e.selectedItems[0]?.value??void 0;this.layer="all-layers"===t?void 0:t}},d("calcite-combobox-item",{heading:y(t.allLayersCount,{count:e.length}),icon:"layers",key:"all-layers",selected:null==this.layer,value:"all-layers"}),this.layerItems.map((e=>this._renderActiveLayerDropdownItem(e))))}_renderFilterInput(){if(this.visibleElements.filter&&0!==this.effectiveCount)return d("calcite-input",{clearable:!0,icon:"search",placeholder:this.messages.filter,scale:this.scale,value:this.filterText,onCalciteInputInput:({target:{value:e}})=>{this.filterText=e}})}_renderActiveLayerDropdownItem(e){const t=e.title||this.messages.untitledLayer;return d("calcite-combobox-item",{heading:t,icon:e.iconName,key:e.key,selected:e.layer===this.layer,value:e.layer})}_renderList(){const{messages:e}=this;if(0!==this.visibleFeatureCount)return d("calcite-list",{afterCreate:c,bind:this,"data-node-ref":"_list",displayMode:"nested",interactionMode:"interactive",label:e.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:"none"},this._renderListContent(this.allLayerItems))}_renderListContent(e){return this.activeLayerItem?this._renderLayerItem(this.activeLayerItem):e.map((e=>p(e)?this._renderGroupItem(e):h(e)?this._renderLayerItem(e):null)).filter(t)}_renderFilterNotice(){const{visibleElements:e}=this;if(!("disabled"===this.state||this.visibleFeatureCount>0)&&e.filter&&e.filterNotice)return d("calcite-notice",{class:w.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale,width:"full"},d("div",{slot:"message"},this.messages.noMatchingFeatures))}_renderItemCount(e){if(!this.visibleElements.itemCount)return;const{messages:t}=this,i=I(e.total),s=I(e.visibleTotal),o=y(t.selectionCount,{count:i});return e.maxVisibleFeatureCountExceeded?d("span",{class:w.itemCount,slot:"content-end",title:o},d("calcite-icon",{icon:"exclamation-mark-triangle",scale:"s",title:t.tooManyFeatures}),`${I(this.maxVisibleFeatureCountPerLayer)}+`):d("span",{class:w.itemCount,slot:"content-end",title:o},s)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;const{messages:t,messagesCommon:i}=this,s=this._itemWithOpenMenu===e,o=u(e),l=h(e),n=p(e),r=o?t.deselectFeature:l?t.deselectLayer:t.deselectGroup;return[d("calcite-dropdown",{open:s,overlayPositioning:"fixed",scale:this.menuScale,slot:"actions-end",width:"m",onCalciteDropdownClose:()=>this._closeItemMenu(e),onCalciteDropdownOpen:()=>{this._itemWithOpenMenu=e}},d("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:this.scale,slot:"trigger",text:i.menu,textEnabled:!1}),s?d("calcite-dropdown-group",{selectionMode:"none"},d("calcite-dropdown-item",{iconStart:"layer-zoom-to",onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo),d("calcite-dropdown-item",{iconStart:"selection-filter",onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},o?t.onlySelectFeature:t.onlySelectThis),d("calcite-dropdown-item",{iconStart:"selection-x",onCalciteDropdownItemSelect:()=>this.deselectItem(e)},r),this.itemActionConfigs?.map((t=>{if(!t.type||"feature"===t.type&&o||"layer"===t.type&&l||"group"===t.type&&n)return d("calcite-dropdown-item",{iconStart:t.icon??void 0,onCalciteDropdownItemSelect:()=>t.callback({item:e})},t.label)}))):void 0)]}_renderGroupItem(e){const t=e.title||this.messages.untitledLayer;if(0===e.visibleTotal)return;const{displayMode:i}=this;if("layer"===i||"feature"===i)return this._renderListContent(e.items);const{visibleElements:s}=this;return d("calcite-list-item",{bind:this,closable:!!s.itemCloseActions,"data-type":"group",expanded:!0,iconStart:s.itemIcons?e.iconName:void 0,key:e.key,label:t,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemActions(e),this._renderListContent(e.items))}_renderLayerItem(e){if(0===e.visibleTotal||!e.visible)return;if("feature"===this.displayMode)return this._renderItems(e.featureItems);const{messages:t,visibleElements:i}=this,s=e.title||t.untitledLayer;return d("calcite-list-item",{bind:this,closable:!!i.itemCloseActions,"data-type":"layer",expanded:!0,iconStart:i.itemIcons?e.iconName:void 0,key:e.key,label:s,scale:this.scale,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemCount(e),this._renderItemActions(e),this._renderItems(e.featureItems),e.maxVisibleFeatureCountExceeded?d("calcite-notice",{class:w.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale},d("div",{slot:"message"},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map((e=>this._renderItem(e)))}_renderItem(e){if(!e.visible)return;const{hightlightOnHoverEnabled:t,messages:i,visibleElements:s}=this,o=e.title||i.untitledFeature,l=s.itemIcons&&"feature"!==this.displayMode;return d("calcite-list-item",{bind:this,class:l?w.listItemFeatureIcon:w.listItemFeature,closable:!!s.itemCloseActions,"data-item":e,"data-type":"feature",key:e.key,label:o,name:o,onblur:t?()=>this.removeTemporaryHighlight():void 0,onfocus:t?()=>this.addTemporaryHighlight(e):void 0,onpointerenter:t?()=>this.addTemporaryHighlight(e):void 0,onpointerleave:t?()=>this.removeTemporaryHighlight():void 0,scale:this.scale,value:o,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons)return d("div",{class:w.listItemIcon,key:"content-start",slot:"content-start"},d("span",{afterCreate:this._afterItemCreate,afterRemoved:this._afterItemRemoved,"data-has-icon":!1,"data-item":e,key:e.thumbnailKey}))}_getListItem(e){return e?.["data-item"]}_hasIcon(e){return!!e?.["data-has-icon"]}_setHasIcon(e,t){e&&(e["data-has-icon"]=t)}_onListItemSelect(e,t){t.stopPropagation(),this._closeItemMenu(),this.onListItemSelect?.({item:e})}_closeItemMenu(e){e&&e!==this._itemWithOpenMenu||(this._itemWithOpenMenu=null)}};e([o()],_.prototype,"_itemWithOpenMenu",void 0),e([o()],_.prototype,"_list",void 0),e([o()],_.prototype,"activeLayerItem",null),e([o()],_.prototype,"allLayerItems",null),e([o()],_.prototype,"displayMode",void 0),e([o()],_.prototype,"effectiveCount",null),e([o()],_.prototype,"effectiveSelectionManager",null),e([o()],_.prototype,"featureTitleMap",null),e([o()],_.prototype,"filterText",null),e([o()],_.prototype,"hightlightOnHoverEnabled",void 0),e([o()],_.prototype,"icon",null),e([o()],_.prototype,"itemActionConfigs",void 0),e([o()],_.prototype,"isUpdating",null),e([o()],_.prototype,"label",null),e([o()],_.prototype,"layer",null),e([o()],_.prototype,"layerItems",null),e([o()],_.prototype,"layerViewMap",null),e([o()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([o()],_.prototype,"maxVisibleFeatureCountPerLayer",null),e([o()],_.prototype,"menuScale",void 0),e([o(),m("esri/widgets/support/SelectionList/t9n/SelectionList")],_.prototype,"messages",void 0),e([o(),m("esri/t9n/common")],_.prototype,"messagesCommon",void 0),e([o(),m("esri/widgets/Legend/t9n/Legend")],_.prototype,"messagesLegend",void 0),e([o()],_.prototype,"onListItemSelect",void 0),e([o()],_.prototype,"scale",void 0),e([o()],_.prototype,"selectionManager",null),e([o()],_.prototype,"state",null),e([o()],_.prototype,"view",null),e([o()],_.prototype,"viewLayersAndTables",null),e([o()],_.prototype,"viewModel",void 0),e([o({type:g,nonNullable:!0})],_.prototype,"visibleElements",void 0),e([o()],_.prototype,"visibleFeatureCount",null),e([o()],_.prototype,"visibleFeatureItems",null),e([o()],_.prototype,"visibleLayerCount",null),_=e([l("esri.widgets.support.SelectionList")],_);const C=_;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../intl.js";import"../../core/has.js";import t from"../../core/Error.js";import{clamp as e}from"../../core/mathUtils.js";import{formatTimestamp as n,formatTimeOnly as o,formatDateOnly as l,formatDate as r,convertDateFormatToIntlOptions as i}from"../../intl/date.js";import{timestampOffsetToDateTime as u,timeOnlyToDateTime as a,dateOnlyToDateTime as s,TimeStampOffsetPattern as m,defaultDatePattern as f,defaultTimePattern as c}from"../../support/dateUtils.js";import{isString as d,isNumber as p}from"../../support/guards.js";import{utc as y}from"../../time/constants.js";import{DateTime as h,FixedOffsetZone as v}from"luxon";import{getLocale as O}from"../../intl/locale.js";const S=y,w={date:null,time:null,timeZoneOffset:null},g=new Map([["hours",3600],["minutes",60],["seconds",1],["deciseconds",.1],["centiseconds",.01],["milliseconds",.001]]),j="latn",x=new Set(["date-only","time-only","timestamp-offset"]),Z=t=>"valueAsDate"in t;function I(t){return{locale:O(),numberingSystem:j,zone:t??S}}function M(t){return t?.isValid?t.toMillis():null}function D(t,e){return null==t?null:h.fromMillis(t,I(e))}function V(t,e){if(null==t||!d(t)||""===t){if(e){const t=h.local({zone:e});return{date:null,time:null,timeZoneOffset:t.isValid?t.offset.toString():null}}return w}const n=h.fromISO(t,{setZone:!0});return{date:n.toFormat(f,I()),time:n.toFormat(m.HMS_MS,I()),timeZoneOffset:n.offset.toString()}}function C(t,e){if(null==t||!p(t)||isNaN(t))return w;const n=D(t,e);return n?{date:n.toFormat(f,I(e)),time:n.toFormat(c,I(e))}:w}function F(t){switch(t.type){case"date":default:return i("short-date-short-time");case"date-only":return i("short-date");case"time-only":return i("short-time");case"timestamp-offset":return{...i("short-date-short-time"),timeZone:void 0,timeZoneName:"short"}}}function T(t,e,i){if(!t||null==e)return null;switch(t.type){case"date":return r(e,i);case"date-only":return l(e,i);case"time-only":return o(e,i);case"timestamp-offset":return n(e,i);default:return null}}function b(t){const{dateComponent:e,defaultTimeZone:n,timeComponent:o,timeZoneComponent:l,oldValue:r}=t;if(!e?.value)return null;const{year:i,month:u,day:a}=h.fromFormat(e.value,f),{hour:s,minute:m,second:c,millisecond:d}=A(o,y)??h.now(),p=V(r,n),O=l?.value?parseInt(l.value,10):null!=p.timeZoneOffset?parseInt(p.timeZoneOffset,10):(new Date).getTimezoneOffset(),S=v.instance(O),w=h.fromObject({year:i,month:u,day:a,hour:s,minute:m,second:c,millisecond:d},{zone:S});return w.isValid?w.toISO({includeOffset:!0}):null}function z(t,e="system"){return h.fromJSDate(t,{zone:e}).isInDST}function N(t){const{dateComponent:e,timeComponent:n,timeZone:o,max:l,min:r,oldValue:i}=t,u=A(e,o);let a=!!t.applyRange;if(!u)return null;let s=null;if(null!=n?.value){const t=A(n,o),e=Date.now(),r=null!=l&&l<e?l:e,i=h.fromMillis(r,I(o)),a=u||i,{year:m,month:f,day:c}=a,{hour:d,minute:p,second:y,millisecond:v}=t||i;s=a.set({year:m,month:f,day:c,hour:d,minute:p,second:y,millisecond:v})}else{const t=D(U({value:i??Date.now(),max:l,min:r}),o),{year:e,month:n,day:m}=u,{hour:f,minute:c,second:d,millisecond:p}=t;a=!0,s=u.set({year:e,month:n,day:m,hour:f,minute:c,second:d,millisecond:p})}if(!s.isValid)return null;const m=s.toMillis();return a?U({value:m,max:l,min:r}):m}function A(t,e){if(null==t?.value||Array.isArray(t.value))return null;let n=null;return n=Z(t)?h.fromFormat(t.value,f,I(e)):a(t.value),n?.isValid?n:null}function k(t){const{max:e,min:n,value:o}=t;return!isNaN(o)&&(!(null!=e&&o>e)&&!(null!=n&&o<n))}function U(t){const{max:n,min:o,value:l}=t;return null!=n&&null!=o?e(l,o,n):null!=n&&l>n?n:null!=o&&l<o?o:l}function E(e){if(!e)return"";const n=e.split(".").at(0);if(!n||n.length<1)throw new t("invalid time-only field",`Cannot parse valid time-only field value from ${e}`);const o=n.split(":"),l=new Array(3);for(let t=0;t<3;t++){const e=o.at(t)??"";l[t]=e.padStart(2,"0")}return l.join(":")}function H(t,e){switch(e){case"date":return t.getTime();case"date-only":return t.toISODate();case"time-only":return E(t.toISOTime(!0,!1));case"timestamp-offset":return t.toISOString(!1);default:return null}}function J(t){return!!t&&"object"==typeof t&&"getTime"in t&&"toISOString"in t&&"timeZone"in t}function R(t){const{type:e,range:n,value:o}=t;if(null==o||!n||o===n.min||o===n.max)return!0;if("date"===e)return k({value:o,min:n.min,max:n.max});const{rawMax:l,rawMin:r}=n;let i=null,m=null,f=null;switch(e){case"date-only":i=s(l),m=s(r),f=s(o);break;case"time-only":i=a(l),m=a(r),f=a(o);break;case"timestamp-offset":i=u(l),m=u(r),f=u(o)}return!f||k({value:f.valueOf(),min:m?.valueOf(),max:i?.valueOf()})}export{H as arcadeDateToFieldValue,U as clampValueToRange,D as createDateTimeFromFieldValue,x as dateFieldsWithStringFieldValue,R as dateTimeIsInRange,M as dateTimeToFieldValue,I as getDefaultLocaleOptions,b as getISOFieldValueFromDateComponents,F as getIntlOptionsForField,T as getLabelForDateFieldValue,A as getLocalDateTimeFromComponent,N as getUnixFieldValueFromDateComponents,J as isArcadeDate,Z as isCalciteDateComponent,z as isInDST,E as normalizeTimeOnlyString,j as numberingSystem,V as prepareISOFieldValueForDateComponents,C as prepareUnixFieldValueForDateComponents,g as timeResolutionToStepMap,k as valueIsInRange};
5
+ import"../../intl.js";import"../../core/has.js";import t from"../../core/Error.js";import{clamp as e}from"../../core/mathUtils.js";import{formatTimestamp as n,formatTimeOnly as o,formatDateOnly as l,formatDate as r,convertDateFormatToIntlOptions as i}from"../../intl/date.js";import{timestampOffsetToDateTime as u,timeOnlyToDateTime as a,dateOnlyToDateTime as s,TimeStampOffsetPattern as m,defaultDatePattern as f,defaultTimePattern as c}from"../../support/dateUtils.js";import{isString as d,isNumber as p}from"../../support/guards.js";import{utc as y}from"../../time/constants.js";import{DateTime as h,FixedOffsetZone as v}from"luxon";import{getLocale as O}from"../../intl/locale.js";const S=y,w={date:null,time:null,timeZoneOffset:null},g=new Map([["hours",3600],["minutes",60],["seconds",1],["deciseconds",.1],["centiseconds",.01],["milliseconds",.001]]),j="latn",x=new Set(["date-only","time-only","timestamp-offset"]),Z=t=>"valueAsDate"in t;function I(t){return{locale:O(),numberingSystem:j,zone:t??S}}function M(t){return t?.isValid?t.toMillis():null}function D(t,e){return null==t?null:h.fromMillis(t,I(e))}function V(t,e){if(null==t||!d(t)||""===t){if(e){const t=h.local({zone:e});return{date:null,time:null,timeZoneOffset:t.isValid?t.offset.toString():null}}return w}const n=h.fromISO(t,{setZone:!0});return{date:n.toFormat(f,I()),time:n.toFormat(m.HMS_MS,I()),timeZoneOffset:n.offset.toString()}}function C(t,e){if(null==t||!p(t)||isNaN(t))return w;const n=D(t,e);return n?{date:n.toFormat(f,I(e)),time:n.toFormat(c,I(e))}:w}function F(t){switch(t.type){case"date":default:return i("short-date-short-time");case"date-only":return i("short-date");case"time-only":return i("short-time");case"timestamp-offset":return{...i("short-date-short-time"),timeZone:void 0,timeZoneName:"short"}}}function T(t,e,i){if(!t||null==e)return null;switch(t.type){case"date":return r(e,i);case"date-only":return l(e,i);case"time-only":return o(e,i);case"timestamp-offset":return n(e,i);default:return null}}function b(t){const{dateComponent:e,defaultTimeZone:n,timeComponent:o,timeZoneComponent:l,oldValue:r}=t;if(!e?.value)return null;const{year:i,month:u,day:a}=h.fromFormat(e.value,f),{hour:s,minute:m,second:c,millisecond:d}=A(o,y)??h.now(),p=V(r,n),O=""===l?.value?null:l?.value,S=O?parseInt(O,10):null!=p.timeZoneOffset?parseInt(p.timeZoneOffset,10):(new Date).getTimezoneOffset(),w=v.instance(S),g=h.fromObject({year:i,month:u,day:a,hour:s,minute:m,second:c,millisecond:d},{zone:w});return g.isValid?g.toISO({includeOffset:!0}):null}function z(t,e="system"){return h.fromJSDate(t,{zone:e}).isInDST}function N(t){const{dateComponent:e,timeComponent:n,timeZone:o,max:l,min:r,oldValue:i}=t,u=A(e,o);let a=!!t.applyRange;if(!u)return null;let s=null;if(null!=n?.value){const t=A(n,o),e=Date.now(),r=null!=l&&l<e?l:e,i=h.fromMillis(r,I(o)),a=u||i,{year:m,month:f,day:c}=a,{hour:d,minute:p,second:y,millisecond:v}=t||i;s=a.set({year:m,month:f,day:c,hour:d,minute:p,second:y,millisecond:v})}else{const t=D(U({value:i??Date.now(),max:l,min:r}),o),{year:e,month:n,day:m}=u,{hour:f,minute:c,second:d,millisecond:p}=t;a=!0,s=u.set({year:e,month:n,day:m,hour:f,minute:c,second:d,millisecond:p})}if(!s.isValid)return null;const m=s.toMillis();return a?U({value:m,max:l,min:r}):m}function A(t,e){if(null==t?.value||Array.isArray(t.value))return null;let n=null;return n=Z(t)?h.fromFormat(t.value,f,I(e)):a(t.value),n?.isValid?n:null}function k(t){const{max:e,min:n,value:o}=t;return!isNaN(o)&&(!(null!=e&&o>e)&&!(null!=n&&o<n))}function U(t){const{max:n,min:o,value:l}=t;return null!=n&&null!=o?e(l,o,n):null!=n&&l>n?n:null!=o&&l<o?o:l}function E(e){if(!e)return"";const n=e.split(".").at(0);if(!n||n.length<1)throw new t("invalid time-only field",`Cannot parse valid time-only field value from ${e}`);const o=n.split(":"),l=new Array(3);for(let t=0;t<3;t++){const e=o.at(t)??"";l[t]=e.padStart(2,"0")}return l.join(":")}function H(t,e){switch(e){case"date":return t.getTime();case"date-only":return t.toISODate();case"time-only":return E(t.toISOTime(!0,!1));case"timestamp-offset":return t.toISOString(!1);default:return null}}function J(t){return!!t&&"object"==typeof t&&"getTime"in t&&"toISOString"in t&&"timeZone"in t}function R(t){const{type:e,range:n,value:o}=t;if(null==o||!n||o===n.min||o===n.max)return!0;if("date"===e)return k({value:o,min:n.min,max:n.max});const{rawMax:l,rawMin:r}=n;let i=null,m=null,f=null;switch(e){case"date-only":i=s(l),m=s(r),f=s(o);break;case"time-only":i=a(l),m=a(r),f=a(o);break;case"timestamp-offset":i=u(l),m=u(r),f=u(o)}return!f||k({value:f.valueOf(),min:m?.valueOf(),max:i?.valueOf()})}export{H as arcadeDateToFieldValue,U as clampValueToRange,D as createDateTimeFromFieldValue,x as dateFieldsWithStringFieldValue,R as dateTimeIsInRange,M as dateTimeToFieldValue,I as getDefaultLocaleOptions,b as getISOFieldValueFromDateComponents,F as getIntlOptionsForField,T as getLabelForDateFieldValue,A as getLocalDateTimeFromComponent,N as getUnixFieldValueFromDateComponents,J as isArcadeDate,Z as isCalciteDateComponent,z as isInDST,E as normalizeTimeOnlyString,j as numberingSystem,V as prepareISOFieldValueForDateComponents,C as prepareUnixFieldValueForDateComponents,g as timeResolutionToStepMap,k as valueIsInRange};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import{px2pt as t}from"../../core/screenUtils.js";import{isSharedTemplateMetadata as r,isStandardFeatureTemplate as i}from"../../editing/templateUtils.js";import{isGraphic as n}from"../../support/guards.js";import{renderPreviewHTML as o}from"../../symbols/support/symbolUtils.js";async function s(e,s,a){if(!n(e)&&r(e)&&e.thumbnail){const t=`data:image/png;base64,${e.thumbnail.imageData}`,r=document.createElement("div");return r.classList.add("esri-thumbnail-preview"),"geometryType"in s&&s.geometryType&&r.classList.add(`esri-thumbnail-preview--${s.geometryType}`),r.style.backgroundImage=`url(${t})`,r}const l=await m(s,e);if(null==l)return null;const p={maxSize:t(a?.maxSize??32)};if((n(e)||i(e))&&"renderer"in s&&"dictionary"===s.renderer?.type&&(p.fieldMap=s.renderer.fieldMap??void 0,p.feature=n(e)?e:{attributes:e.prototype.attributes??{}}),n(e)&&e.geometry&&!1!==a?.useGeometry&&!e.geometry.type.includes("point")){p.geometry=e.geometry,p.useMarkerSymbolSize=!1;const r=t(a?.maxSize??22);p.size={width:r,height:r}}return await o(l,p)}async function m(t,i){if(!n(i)&&r(i))return a(t);if("renderer"in t&&t.renderer){const{renderer:r}=t,o=n(i)?i:new e({attributes:i.prototype.attributes});if("getSymbolAsync"in r){const e=await r.getSymbolAsync(o);if(e)return e}}return a(t)}async function a(e){if(!("geometryType"in e))return null;const{geometryType:t}=e,r="point"===t||"multipoint"===t?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===t?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===t||"mesh"===t||"multipatch"===t?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}export{s as fetchThumbnail};
5
+ import e from"../../Graphic.js";import{px2pt as t}from"../../core/screenUtils.js";import{isSharedTemplateMetadata as r,isStandardFeatureTemplate as i}from"../../editing/templateUtils.js";import{isGraphic as n}from"../../support/guards.js";import{renderPreviewHTML as o}from"../../symbols/support/symbolUtils.js";async function a(e,a,m){if(!n(e)&&r(e)&&e.thumbnail){const t=`data:image/png;base64,${e.thumbnail.imageData}`,r=document.createElement("div");return r.classList.add("esri-thumbnail-preview"),"geometryType"in a&&a.geometryType&&r.classList.add(`esri-thumbnail-preview--${a.geometryType}`),r.style.backgroundImage=`url(${t})`,r}const l=await s(a,e);if(null==l)return null;const p={maxSize:t(m?.maxSize??32),ariaLabel:m?.ariaLabel};if((n(e)||i(e))&&"renderer"in a&&"dictionary"===a.renderer?.type&&(p.fieldMap=a.renderer.fieldMap??void 0,p.feature=n(e)?e:{attributes:e.prototype.attributes??{}}),n(e)&&e.geometry&&!1!==m?.useGeometry&&!e.geometry.type.includes("point")){p.geometry=e.geometry,p.useMarkerSymbolSize=!1;const r=t(m?.maxSize??22);p.size={width:r,height:r}}return await o(l,p)}async function s(t,i){if(!n(i)&&r(i))return m(t);if("renderer"in t&&t.renderer){const{renderer:r}=t,o=n(i)?i:new e({attributes:i.prototype.attributes});if("getSymbolAsync"in r){const e=await r.getSymbolAsync(o);if(e)return e}}return m(t)}async function m(e){if(!("geometryType"in e))return null;const{geometryType:t}=e,r="point"===t||"multipoint"===t?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===t?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===t||"mesh"===t||"multipatch"===t?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}export{a as fetchThumbnail};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5751,8256],{4146:(e,t,i)=>{i.d(t,{A:()=>v});var r=i(90237),s=i(78888),n=i(49186),o=i(65529),a=i(4902),l=i(92474),h=i(53966),u=i(74887),d=i(84952),c=i(10107),p=(i(44208),i(87811),i(40608)),y=i(5443),g=i(16930),_=i(92602),f=i(64272);let m=0,v=class extends(o.A.EventedMixin(a.A.IdentifiableMixin(l.A))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new y.A(-180,-90,180,90,g.A.WGS84),this.id=Date.now().toString(16)+"-layer-"+m++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=g.A.WGS84,this.title=null,this.type=null,this.url=null,this.visibilityTimeExtent=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await i.e(7982).then(i.bind(i,27982))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},{fromItem:r}=await i.e(5613).then(i.bind(i,45613));try{return await r(t)}catch(e){const i=t?.portalItem,r=i?.id||"unset",s=i?.portal?.url||_.A.portalUrl;throw h.A.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+r+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,u.zf)(e)||h.A.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get effectiveVisible(){let e=this.visible;const t=this.parent;return e&&t&&"effectiveVisible"in t&&(e&&=t.effectiveVisible),e}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,d.An)(this.url)}createLayerView(e,t){return Promise.reject(new n.A("layer:create-layer-view","Layer does not support creating a layer view"))}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,s.A)(e,{query:{f:"json"},responseType:"json"})).data;throw new n.A("layer:no-attribution-data","Layer does not have attribution data")}};(0,r._)([(0,c.MZ)({type:String})],v.prototype,"attributionDataUrl",void 0),(0,r._)([(0,c.MZ)({readOnly:!0})],v.prototype,"effectiveVisible",null),(0,r._)([(0,c.MZ)({type:y.A})],v.prototype,"fullExtent",void 0),(0,r._)([(0,c.MZ)({readOnly:!0})],v.prototype,"hasAttributionData",null),(0,r._)([(0,c.MZ)({type:String,clonable:!1})],v.prototype,"id",void 0),(0,r._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],v.prototype,"legendEnabled",void 0),(0,r._)([(0,c.MZ)({type:["show","hide","hide-children"]})],v.prototype,"listMode",void 0),(0,r._)([(0,c.MZ)({type:Number,range:{min:0,max:1},nonNullable:!0})],v.prototype,"opacity",void 0),(0,r._)([(0,c.MZ)({clonable:!1})],v.prototype,"parent",void 0),(0,r._)([(0,c.MZ)({readOnly:!0})],v.prototype,"parsedUrl",null),(0,r._)([(0,c.MZ)({type:Boolean,readOnly:!0})],v.prototype,"persistenceEnabled",void 0),(0,r._)([(0,c.MZ)({type:Boolean})],v.prototype,"popupEnabled",void 0),(0,r._)([(0,c.MZ)({type:Boolean})],v.prototype,"attributionVisible",void 0),(0,r._)([(0,c.MZ)({type:g.A})],v.prototype,"spatialReference",void 0),(0,r._)([(0,c.MZ)({type:String})],v.prototype,"title",void 0),(0,r._)([(0,c.MZ)({readOnly:!0,json:{read:!1}})],v.prototype,"type",void 0),(0,r._)([(0,c.MZ)()],v.prototype,"url",void 0),(0,r._)([(0,c.MZ)({type:f.T})],v.prototype,"visibilityTimeExtent",void 0),(0,r._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],v.prototype,"visible",void 0),v=(0,r._)([(0,p.$)("esri.layers.Layer")],v)},4902:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(90237),s=i(40608);let n=0;const o=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+n++})}};return t=(0,r._)([(0,s.$)("esri.core.Identifiable")],t),t};let a=class extends(o(class{})){};var l;a=(0,r._)([(0,s.$)("esri.core.Identifiable")],a),(l=a||(a={})).IdentifiableMixin=o,l.NumericIdentifiableMixin=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:n++})}};return t=(0,r._)([(0,s.$)("esri.core.Identifiable.NumericIdentifiable")],t),t};const h=a},8303:(e,t,i)=>{i.d(t,{A:()=>S});var r=i(90237),s=i(92602),n=i(70333),o=i(78888),a=i(60999),l=i(49186),h=i(53966),u=i(97768),d=i(74887),c=i(84952),p=i(10107),y=(i(44208),i(87811),i(36005)),g=i(40608),_=i(43937),f=i(77548),m=i(20655),v=i(80812),w=i(41318),b=i(10407);const S=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,u.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new v.default({id:t.itemId,portal:i?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:r}=await i.e(1204).then(i.bind(i,41204));return(0,d.Te)(t),await r({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(e){throw(0,d.zf)(e)||h.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,d.QP)(e),!0))))}async setUserPrivileges(e,t){if(!s.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:i,fullEdit:r},content:{updateItem:s}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",i),this._set("userHasFullEditingPrivileges",r),this._set("userHasUpdateItemPrivileges",s)}catch(e){(0,d.QP)(e)}}async _fetchUserPrivileges(e,t){let i=this.portalItem;if(!e||!i||!i.loaded||i.sourceUrl)return this._fetchFallbackUserPrivileges(t);const r=!n.id?.findCredential(this.url),s=e===i.id;if(s&&i.portal.user)return this._getUserPrivileges(i,r);let o,a;if(s)o=i.portal.url;else try{o=await(0,f.wI)(this.url,t)}catch(e){(0,d.QP)(e)}if(!o||!(0,c.b8)(o,i.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;a=await(n.id?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,d.QP)(e)}const l=!0,h=!1,u=!1;if(!a)return{features:{edit:l,fullEdit:h},content:{updateItem:u}};try{if(s?await i.reload():(i=new v.default({id:e,portal:{url:o}}),await i.load(t)),i.portal.user)return this._getUserPrivileges(i,r)}catch(e){(0,d.QP)(e)}return{features:{edit:l,fullEdit:h},content:{updateItem:u}}}_getUserPrivileges(e,t){const i=(0,b.It)(e);return t&&(i.features.edit=!0),i}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,d.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?n.id?.findCredential(this.url):null;if(!t)return!0;const i=M.credential===t?M.user:await this._fetchEditingUser(e);return M.credential=t,M.user=i,null==i?.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const i=n.id?.findServerInfo(this.url??"");if(!i?.owningSystemUrl)return null;const r=`${i.owningSystemUrl}/sharing/rest`,s=m.A.getDefault();if(s&&s.loaded&&(0,c.S8)(s.restUrl)===(0,c.S8)(r))return s.user;const l=`${r}/community/self`,h=null!=e?e.signal:null,u=await(0,a.Ke)((0,o.A)(l,{authMode:"no-prompt",query:{f:"json"},signal:h}));return u.ok?w.A.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const i=t?.portal,r=this.portalItem?.id&&(this.portalItem.portal||m.A.getDefault());return i&&r&&!(0,c.ut)(r.restUrl,i.restUrl)?(t.messages&&t.messages.push(new l.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,r._)([(0,p.MZ)({type:v.default})],t.prototype,"portalItem",null),(0,r._)([(0,y.w)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,r._)([(0,_.K)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,r._)([(0,p.MZ)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,r._)([(0,p.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,r._)([(0,p.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,r._)([(0,p.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,r._)([(0,g.$)("esri.layers.mixins.PortalLayer")],t),t},M={credential:null,user:null}},18768:(e,t,i)=>{i.d(t,{b:()=>l});var r=i(90237),s=i(53966),n=i(10107),o=(i(44208),i(87811),i(40608)),a=i(60694);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,a.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,a.Jf)(e,s.A.getLogger(this)))}};return(0,r._)([(0,n.MZ)()],t.prototype,"title",null),(0,r._)([(0,n.MZ)({type:String})],t.prototype,"url",null),t=(0,r._)([(0,o.$)("esri.layers.mixins.ArcGISService")],t),t}},35982:(e,t,i)=>{i.d(t,{B:()=>l});var r=i(4576),s=i(36563),n=i(53966),o=i(74887),a=i(29953);class l{constructor(e,t,i,r,s={}){this._mainMethod=t,this._transferLists=i,this._listeners=[],this._promise=(0,a.ho)(e,{...s,schedule:r}).then((e=>{if(void 0===this._thread){this._thread=e,this._promise=null,s.hasInitialize&&this.broadcast({},"initialize");for(const e of this._listeners)this._connectListener(e)}else e.close()})),this._promise.catch((t=>n.A.getLogger("esri.core.workers.WorkerHandle").error(`Failed to initialize ${e} worker: ${t}`)))}on(e,t){const i={removed:!1,eventName:e,callback:t,threadHandle:null};return this._listeners.push(i),this._connectListener(i),(0,s.hA)((()=>{i.removed=!0,(0,r.TF)(this._listeners,i),this._thread&&null!=i.threadHandle&&i.threadHandle.remove()}))}destroy(){this._thread&&(this._thread.close(),this._thread=null),this._promise=null,this._listeners.length=0,this._transferLists={}}invoke(e,t,i){return this.invokeMethod(this._mainMethod,e,t,i)}invokeMethod(e,t,i,r){if(this._thread){const s=this._transferLists[e],n=s?s(t):[];return this._thread.invoke(e,t,{transferList:n,signal:i,priority:r})}return this._promise?this._promise.then((()=>((0,o.Te)(i),this.invokeMethod(e,t,i)))):Promise.reject(null)}broadcast(e,t){return this._thread?Promise.all(this._thread.broadcast(t,e)).then((()=>{})):this._promise?this._promise.then((()=>this.broadcast(e,t))):Promise.reject()}get promise(){return this._promise}_connectListener(e){this._thread&&this._thread.on(e.eventName,e.callback).then((t=>{e.removed||(e.threadHandle=t)}))}}},54239:(e,t,i)=>{i.d(t,{A:()=>f});var r,s=i(90237),n=i(4576),o=i(66552),a=i(25482),l=i(83047),h=i(67076),u=i(10107),d=(i(44208),i(53966),i(36005)),c=i(40608),p=i(43937);const y=(0,o.O)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),g=y.jsonValues.slice();(0,n.Xy)(g,"orthometric");const _=(0,o.O)()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let f=r=class extends a.A{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,i){return y.write(e,t,i)}readHeightModel(e,t,i){return y.read(e)||(i?.messages&&i.messages.push(function(e,t){return new h.A("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:i})),null)}readHeightUnit(e,t,i){return _.read(e)||(i?.messages&&i.messages.push(m(e,{context:i})),null)}readHeightUnitService(e,t,i){return(0,l.LA)(e)||_.read(e)||(i?.messages&&i.messages.push(m(e,{context:i})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new r({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const i=(0,l.k1)(t);return new r({heightModel:e.heightModel,heightUnit:i??void 0,vertCRS:e.vertCRS})}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new r;return t.read(e,{origin:"web-scene"}),t}};function m(e,t){return new h.A("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,s._)([(0,u.MZ)({type:y.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:g,default:"ellipsoidal",write:{isRequired:!0}}}}})],f.prototype,"heightModel",void 0),(0,s._)([(0,p.K)("web-scene","heightModel")],f.prototype,"writeHeightModel",null),(0,s._)([(0,d.w)(["web-scene","service"],"heightModel")],f.prototype,"readHeightModel",null),(0,s._)([(0,u.MZ)({type:_.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:_.jsonValues,write:{writer:_.write,isRequired:!0}}}}})],f.prototype,"heightUnit",void 0),(0,s._)([(0,d.w)("web-scene","heightUnit")],f.prototype,"readHeightUnit",null),(0,s._)([(0,d.w)("service","heightUnit")],f.prototype,"readHeightUnitService",null),(0,s._)([(0,u.MZ)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],f.prototype,"vertCRS",void 0),(0,s._)([(0,d.w)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],f.prototype,"readVertCRS",null),f=r=(0,s._)([(0,c.$)("esri.geometry.HeightModelInfo")],f)},64272:(e,t,i)=>{i.d(t,{T:()=>c});var r,s=i(90237),n=i(25482),o=i(88930),a=i(10107),l=(i(44208),i(53966),i(87811),i(36005)),h=i(40608),u=i(43937),d=i(98623);let c=class extends n.A{static{r=this}static get allTime(){return p}static get empty(){return y}static fromArray(e){return new r({start:null!=e[0]?new Date(e[0]):e[0],end:null!=e[1]?new Date(e[1]):e[1]})}constructor(e){super(e),this.end=null,this.start=null}readEnd(e,t){return null!=t.end?new Date(t.end):null}writeEnd(e,t){t.end=e?.getTime()??null}get isAllTime(){return this.equals(r.allTime)}get isEmpty(){return this.equals(r.empty)}readStart(e,t){return null!=t.start?new Date(t.start):null}writeStart(e,t){t.start=e?.getTime()??null}clone(){return new r({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=this.start?.getTime()??this.start,i=this.end?.getTime()??this.end,r=e.start?.getTime()??e.start,s=e.end?.getTime()??e.end;return t===r&&i===s}expandTo(e,t=d.qU){if(this.isEmpty||this.isAllTime)return this.clone();let i=this.start;i&&(i=(0,o.lL)(i,e,t));let s=this.end;if(s){const i=(0,o.lL)(s,e,t);s=s.getTime()===i.getTime()?i:(0,o.S1)(i,1,e,t)}return new r({start:i,end:s})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return r.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=this.start?.getTime()??-1/0,i=this.end?.getTime()??1/0,s=e.start?.getTime()??-1/0,n=e.end?.getTime()??1/0;let o,a;return s>=t&&s<=i?o=s:t>=s&&t<=n&&(o=t),i>=s&&i<=n?a=i:n>=t&&n<=i&&(a=n),null==o||null==a||isNaN(o)||isNaN(a)?r.empty:new r({start:o===-1/0?null:new Date(o),end:a===1/0?null:new Date(a)})}offset(e,t,i=d.qU){if(this.isEmpty||this.isAllTime)return this.clone();const s=new r,{start:n,end:a}=this;return null!=n&&(s.start=(0,o.S1)(n,e,t,i)),null!=a&&(s.end=(0,o.S1)(a,e,t,i)),s}toArray(){return this.isEmpty?[void 0,void 0]:[this.start?.getTime()??null,this.end?.getTime()??null]}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return p.clone();const t=null!=this.start&&null!=e.start?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,i=null!=this.end&&null!=e.end?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new r({start:t,end:i})}};(0,s._)([(0,a.MZ)({type:Date,json:{write:{allowNull:!0}}})],c.prototype,"end",void 0),(0,s._)([(0,l.w)("end")],c.prototype,"readEnd",null),(0,s._)([(0,u.K)("end")],c.prototype,"writeEnd",null),(0,s._)([(0,a.MZ)({readOnly:!0,json:{read:!1}})],c.prototype,"isAllTime",null),(0,s._)([(0,a.MZ)({readOnly:!0,json:{read:!1}})],c.prototype,"isEmpty",null),(0,s._)([(0,a.MZ)({type:Date,json:{write:{allowNull:!0}}})],c.prototype,"start",void 0),(0,s._)([(0,l.w)("start")],c.prototype,"readStart",null),(0,s._)([(0,u.K)("start")],c.prototype,"writeStart",null),c=r=(0,s._)([(0,h.$)("esri.time.TimeExtent")],c);const p=new c,y=new c({start:void 0,end:void 0})},66344:(e,t,i)=>{var r,s;i.d(t,{q:()=>l}),(s=r||(r={}))[s.ALL=0]="ALL",s[s.SOME=1]="SOME",Symbol.iterator;class n{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._users=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._users.clear()}register(e){this._users.set(e.id.slice(0,-1),e)}deregister(e){this.clear(e),this._sizeLimits.delete(e),this._users.delete(e.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,-1),this._checkSize()}getSize(e,t){const i=this._db.get(e.id+t);return i?.size??0}put(e,t,i,s,n){t=e.id+t;const a=this._db.get(t);if(a&&(this._size-=a.size,e.size-=a.size,this._db.delete(t),a.entry!==i&&this._notifyRemove(t,a.entry,a.size,r.ALL)),s>this._maxSize)return void this._notifyRemove(t,i,s,r.ALL);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!s||s<0)return console.warn(`Refusing to cache entry with size ${s} for key ${t}`),void this._notifyRemove(t,i,0,r.ALL);const l=1+Math.max(n,-4)- -3;this._db.set(t,new o(i,s,l)),this._size+=s,e.size+=s,this._checkSize()}updateSize(e,t,i,s){t=e.id+t;const n=this._db.get(t);if(n&&n.entry===i){for(this._size-=n.size,e.size-=n.size;s>this._maxSize;){const e=this._notifyRemove(t,i,s,r.SOME);if(!(null!=e&&e>0))return void this._db.delete(t);s=e}n.size=s,this._size+=s,e.size+=s,this._checkSize()}}pop(e,t){t=e.id+t;const i=this._db.get(t);if(i)return this._size-=i.size,e.size-=i.size,this._db.delete(t),++this._hit,i.entry;++this._miss}get(e,t){t=e.id+t;const i=this._db.get(t);if(void 0!==i)return this._db.delete(t),i.lives=i.lifetime,this._db.set(t,i),++this._hit,i.entry;++this._miss}peek(e,t){const i=this._db.get(e.id+t);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach(((e,r)=>{const s=e.lifetime;i[s]=(i[s]||0)+e.size,this._users.forEach((i=>{const{id:s,name:n}=i;if(r.startsWith(s)){const i=t[n]||0;t[n]=i+e.size}}))}));const r={};this._users.forEach((e=>{const i=e.name;if("hitRate"in e&&"number"==typeof e.hitRate&&!isNaN(e.hitRate)&&e.hitRate>0){const s=t[i]||0;t[i]=s,r[i]=Math.round(100*e.hitRate)+"%"}else r[i]="0%"}));const s=Object.keys(t);s.sort(((e,i)=>t[i]-t[e])),s.forEach((i=>e[i]=Math.round(t[i]/2**20)+"MB / "+r[i]));for(let t=i.length-1;t>=0;--t){const r=i[t];r&&(e["Priority "+(t+-3-1)]=Math.round(r/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forEach((e=>e.resetHitRate()))}clear(e){const t=e.id;this._db.forEach(((e,i)=>{i.startsWith(t)&&(this._size-=e.size,this._db.delete(i),this._notifyRemove(i,e.entry,e.size,r.ALL))})),e.size=0}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,e.size,r.ALL))),this._users.forEach((e=>e.size=0)),this._size=0,this._db.clear()}*values(e){for(const[t,i]of this._db)t.startsWith(e.id)&&(yield i.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i,r){const s=this._users.get(e.split(a)[0])?.removeFunc,n=s?.(t,r,i);return"number"==typeof n?n:null}_checkSize(){this._sizeLimits.forEach(((e,t)=>this._checkSizeLimits(e,t))),this._checkSizeLimits(this.maxSize)}setMaxSize(e,t){null==t||t<=0?this._sizeLimits.delete(e):this._sizeLimits.set(e,t)}_checkSizeLimits(e,t){const i=t??this;if(i.size<=e)return;const r=t?.id;let s=!0;for(;s;){s=!1;for(const[n,o]of this._db)if(0===o.lifetime&&(!r||n.startsWith(r))){const r=t??this._users.get(n.split(a)[0]);if(this._purgeItem(n,o,r),i.size<=.9*e)return;s||=this._db.has(n)}}for(const[s,n]of this._db)if(!r||s.startsWith(r)){const r=t??this._users.get(s.split(a)[0]);if(this._purgeItem(s,n,r),i.size<=.9*e)return}}_purgeItem(e,t,i){if(this._db.delete(e),t.lives<=1){this._size-=t.size,i&&(i.size-=t.size);const s=this._notifyRemove(e,t.entry,t.size,r.SOME);null!=s&&s>0&&(this._size+=s,i&&(i.size+=s),t.lives=t.lifetime,t.size=s,this._db.set(e,t))}else--t.lives,this._db.set(e,t)}}class o{constructor(e,t,i){this.entry=e,this.size=t,this.lifetime=i,this.lives=i}}const a=":";class l{constructor(e,t){this.removeFunc=t,this._storage=new n,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,t,i=1){this._storage.put(this,e,t,i,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}}},68611:(e,t,i)=>{i.r(t),i.d(t,{default:()=>E});var r=i(90237),s=i(78888),n=i(49186),o=i(97768),a=i(92071),l=i(74887),h=i(84952),u=i(10107),d=(i(44208),i(53966),i(87811),i(36005)),c=i(40608),p=i(54239),y=i(4146),g=i(89186),_=i(18768),f=i(16131),m=i(8303),v=i(10873);class w{constructor(e,t,i,r){this._hasNoDataValues=null,this._minValue=null,this._maxValue=null,"pixelData"in e?(this.values=e.pixelData,this.width=e.width,this.height=e.height,this.noDataValue=e.noDataValue):(this.values=e,this.width=t,this.height=i,this.noDataValue=r)}get hasNoDataValues(){if(null==this._hasNoDataValues){const e=this.noDataValue;this._hasNoDataValues=this.values.includes(e)}return this._hasNoDataValues}get minValue(){return this._ensureBounds(),this._minValue}get maxValue(){return this._ensureBounds(),this._maxValue}get cachedMemory(){return this.values.byteLength+256}_ensureBounds(){if(null!=this._minValue)return;const{noDataValue:e,values:t}=this;let i=1/0,r=-1/0,s=!0;for(const n of t)n===e?this._hasNoDataValues=!0:(i=n<i?n:i,r=n>r?n:r,s=!1);s?(this._minValue=0,this._maxValue=0):(this._minValue=i,this._maxValue=r>-3e38?r:0)}}var b=i(35982);class S extends b.B{constructor(e=null){super("LercWorker","_decode",{_decode:e=>[e.buffer]},e,{strategy:"dedicated"}),this.schedule=e,this.ref=0}decode(e,t,i){return e&&0!==e.byteLength?this.invoke({buffer:e,options:t},i):Promise.resolve(null)}release(){--this.ref<=0&&(M.forEach(((e,t)=>{e===this&&M.delete(t)})),this.destroy())}}const M=new Map;let A=class extends((0,g.f)((0,_.b)((0,f.q)((0,m.A)((0,a.P)(y.A)))))){constructor(...e){super(...e),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=function(e=null){let t=M.get(e);return t||(null!=e?(t=new S((t=>e.immediate.schedule(t))),M.set(e,t)):(t=new S,M.set(null,t))),++t.ref,t}()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._lercDecoder=(0,o.Gz)(this._lercDecoder)}readCapabilities(e,t){const i=t.capabilities&&t.capabilities.split(",").map((e=>e.toLowerCase().trim()));return i?{operations:{supportsTileMap:i.includes("tilemap")}}:{operations:{supportsTileMap:!1}}}readVersion(e,t){let i=t.currentVersion;return i||(i=9.3),i}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:e=>{if(e.typeKeywords)for(let t=0;t<e.typeKeywords.length;t++)if("elevation 3d layer"===e.typeKeywords[t].toLowerCase())return!0;throw new n.A("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}' ",{type:"Image Service",expectedType:"Image Service Elevation 3D Layer"})}},e).catch(l.QP).then((()=>this._fetchImageService(t)))),Promise.resolve(this)}fetchTile(e,t,i,r){const n=r?.signal,o={responseType:"array-buffer",signal:n},a={noDataValue:r?.noDataValue,returnFileInfo:!0};return this.load().then((()=>this._fetchTileAvailability(e,t,i,r))).then((()=>(0,s.A)(this.getTileUrl(e,t,i),o))).then((e=>this._lercDecoder.decode(e.data,a,n))).then((e=>new w(e)))}getTileUrl(e,t,i){const r=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=(0,h.x0)({...this.parsedUrl.query,blankTile:!r&&null});return`${this.parsedUrl.path}/tile/${e}/${t}/${i}${s?"?"+s:""}`}async queryElevation(e,t){const{ElevationQuery:r}=await i.e(3492).then(i.bind(i,63492));return(0,l.Te)(t),(new r).query(this,e,t)}async createElevationSampler(e,t){const{ElevationQuery:r}=await i.e(3492).then(i.bind(i,63492));return(0,l.Te)(t),(new r).createSampler(this,e,t)}_fetchTileAvailability(e,t,i,r){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,t,i,r):Promise.resolve("unknown")}async _fetchImageService(e){if(this.sourceJSON)return this.sourceJSON;const t={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},i=await(0,s.A)(this.parsedUrl.path,t);i.ssl&&(this.url=this.url?.replace(/^http:/i,"https:")),this.sourceJSON=i.data,this.read(i.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[z]}};(0,r._)([(0,u.MZ)({readOnly:!0})],A.prototype,"capabilities",void 0),(0,r._)([(0,d.w)("service","capabilities",["capabilities"])],A.prototype,"readCapabilities",null),(0,r._)([(0,u.MZ)({json:{read:{source:"copyrightText"}}})],A.prototype,"copyright",void 0),(0,r._)([(0,u.MZ)({readOnly:!0,type:p.A})],A.prototype,"heightModelInfo",void 0),(0,r._)([(0,u.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],A.prototype,"path",void 0),(0,r._)([(0,u.MZ)({type:["show","hide"]})],A.prototype,"listMode",void 0),(0,r._)([(0,u.MZ)({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],A.prototype,"minScale",void 0),(0,r._)([(0,u.MZ)({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],A.prototype,"maxScale",void 0),(0,r._)([(0,u.MZ)({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],A.prototype,"opacity",void 0),(0,r._)([(0,u.MZ)({type:["ArcGISTiledElevationServiceLayer"]})],A.prototype,"operationalLayerType",void 0),(0,r._)([(0,u.MZ)()],A.prototype,"sourceJSON",void 0),(0,r._)([(0,u.MZ)({json:{read:!1},value:"elevation",readOnly:!0})],A.prototype,"type",void 0),(0,r._)([(0,u.MZ)(v.OZ)],A.prototype,"url",void 0),(0,r._)([(0,u.MZ)()],A.prototype,"version",void 0),(0,r._)([(0,d.w)("version",["currentVersion"])],A.prototype,"readVersion",null),A=(0,r._)([(0,c.$)("esri.layers.ElevationLayer")],A);const z=Symbol("default-fetch-tile");A.prototype.fetchTile[z]=!0;const E=A},69397:(e,t,i)=>{i.d(t,{$B:()=>s,Qf:()=>h,Qh:()=>a,RS:()=>n,ez:()=>c,lM:()=>o,qK:()=>d});var r=i(34275);function s(e){return 32+e.length}const n=16;function o(e){if(!e)return 0;let t=d;for(const i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function a(e){if(!e)return 0;if("number"==typeof e[0])return h(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return u(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=d;for(const i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?a(e):d;case"string":return s(e);case"number":return n;case"boolean":return 4;default:return 8}}function h(...e){return e.reduce(((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+p:Array.isArray(t)?u(t,n):0:0)),0)}function u(e,t){return c+e.length*t}const d=32,c=16,p=145},69540:(e,t,i)=>{i.d(t,{A:()=>c});var r=i(90237),s=i(69622),n=(i(44208),i(4718)),o=(i(53966),i(97768)),a=i(35666),l=i(88620),h=i(40608);const u=e=>{let t=class extends e{clone(){const e=(0,l.oY)(this);(0,o.Lw)(e,"unable to clone instance of non-accessor class");const t=e.metadata,i=e.store,r={},s=new Map;for(const e in t){const o=t[e],l=i?.originOf(e),h=o.clonable;if(o.readOnly||!1===h||l!==a.Gr.USER&&l!==a.Gr.DEFAULTS&&l!==a.Gr.WEB_MAP&&l!==a.Gr.WEB_SCENE)continue;const u=this[e];let d=null;d="function"==typeof h?h(u):"reference"===h?u:(0,n.TU)(u),null!=u&&null==d||(l===a.Gr.DEFAULTS?s.set(e,d):r[e]=d)}const h=new(0,Object.getPrototypeOf(this).constructor)(r);if(s.size){const e=(0,l.oY)(h)?.store;if(e)for(const[t,i]of s)e.set(t,i,a.Gr.DEFAULTS)}return h}};return t=(0,r._)([(0,h.$)("esri.core.Clonable")],t),t};let d=class extends(u(s.A)){};d=(0,r._)([(0,h.$)("esri.core.Clonable")],d),(d||(d={})).ClonableMixin=u;const c=d},78553:(e,t,i)=>{i.d(t,{D:()=>n,p:()=>s});var r=i(56507);function s(e){const t=(0,r.Vr)(100*(1-e));return Math.max(0,Math.min(t,100))}function n(e){const t=1-e/100;return Math.max(0,Math.min(t,1))}},92071:(e,t,i)=>{i.d(t,{P:()=>v,L:()=>w});var r=i(90237),s=i(69622),n=i(76953),o=i(4718),a=i(35666);class l{constructor(){this._propertyOriginMap=new Map,this._originStores=new Array(a.AU),this._values=new Map,this.multipleOriginsSupported=!0}clone(e){const t=new l,i=this._originStores[a.Gr.DEFAULTS];i&&i.forEach(((e,i)=>{t.set(i,(0,o.o8)(e),a.Gr.DEFAULTS)}));for(let i=a.Gr.SERVICE;i<a.AU;i++){const r=this._originStores[i];r&&r.forEach(((r,s)=>{e&&e.has(s)||t.set(s,(0,o.o8)(r),i)}))}return t}get(e,t){const i=void 0===t?this._values:this._originStores[t];return i?i.get(e):void 0}keys(e){const t=null==e?this._values:this._originStores[e];return t?[...t.keys()]:[]}set(e,t,i=a.Gr.USER){let r=this._originStores[i];if(r||(r=new Map,this._originStores[i]=r),r.set(e,t),!this._values.has(e)||this._propertyOriginMap.get(e)<=i){const r=this._values.get(e);return this._values.set(e,t),this._propertyOriginMap.set(e,i),r!==t}return!1}delete(e,t=a.Gr.USER){const i=this._originStores[t];if(!i)return;const r=i.get(e);if(i.delete(e),this._values.has(e)&&this._propertyOriginMap.get(e)===t){this._values.delete(e);for(let i=t-1;i>=0;i--){const t=this._originStores[i];if(t&&t.has(e)){this._values.set(e,t.get(e)),this._propertyOriginMap.set(e,i);break}}}return r}has(e,t){const i=void 0===t?this._values:this._originStores[t];return!!i&&i.has(e)}revert(e,t){for(;t>0&&!this.has(e,t);)--t;const i=this._originStores[t],r=i?.get(e),s=this._values.get(e);return this._values.set(e,r),this._propertyOriginMap.set(e,t),s!==r}originOf(e){return this._propertyOriginMap.get(e)||a.Gr.DEFAULTS}isAtOrigin(e,t){return this.has(e,t)&&this.originOf(e)===t}isBelowOrigin(e,t){return!this.has(e)||this.originOf(e)<t}forEach(e){this._values.forEach(e)}}var h=i(45917),u=i(88620),d=i(40608);const c=e=>{let t=class extends e{constructor(...e){super(...e);const t=(0,u.oY)(this),i=t.store,r=new l;t.store=r,(0,n.k)(t,i,r)}read(e,t){(0,h.L)(this,e,t)}getAtOrigin(e,t){const i=p(this),r=(0,a.aB)(t);if("string"==typeof e)return i.get(e,r);const s={};return e.forEach((e=>{s[e]=i.get(e,r)})),s}originOf(e){return(0,a.OL)(this.originIdOf(e))}originIdOf(e){return p(this).originOf(e)}revert(e,t){const i=p(this),r=(0,a.aB)(t),s=(0,u.oY)(this);let n;n="string"==typeof e?"*"===e?i.keys(r):[e]:e,n.forEach((e=>{s.invalidate(e),i.revert(e,r),s.commit(e)}))}};return t=(0,r._)([(0,d.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],t),t};function p(e){return(0,u.oY)(e).store}let y=class extends(c(s.A)){};y=(0,r._)([(0,d.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],y);var g=i(16649),_=i(49422);const f=e=>{let t=class extends e{constructor(...e){super(...e)}clear(e,t="user"){(0,u.oY)(this).clearOrigin(e,(0,a.aB)(t))}write(e,t){return(0,_.M)(this,e=e||{},t),e}setAtOrigin(e,t,i){(0,u.oY)(this).setAtOrigin(e,t,(0,a.aB)(i))}removeOrigin(e){const t=m(this),i=(0,a.aB)(e),r=t.keys(i);for(const e of r)t.originOf(e)===i&&t.set(e,t.get(e,i),a.Gr.USER)}updateOrigin(e,t){const i=m(this),r=(0,a.aB)(t),s=(0,g.Jt)(this,e);for(let t=r+1;t<a.AU;++t)i.delete(e,t);i.set(e,s,r)}toJSON(e){return this.write({},e)}};return t=(0,r._)([(0,d.$)("esri.core.MultiOriginJSONSupport.WriteableMultiOriginJSONSupport")],t),t.prototype.toJSON.isDefaultToJSON=!0,t};function m(e){return(0,u.oY)(e).store}const v=e=>{let t=class extends(f(c(e))){constructor(...e){super(...e)}};return t=(0,r._)([(0,d.$)("esri.core.MultiOriginJSONSupport")],t),t};let w=class extends(v(s.A)){};w=(0,r._)([(0,d.$)("esri.core.MultiOriginJSONSupport")],w)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7982],{4513:(e,a,r)=>{r.d(a,{S:()=>t});const t={BingMapsLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(6424)]).then(r.bind(r,17029))).default,BuildingSceneLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(7937),r.e(2944),r.e(8947),r.e(8288),r.e(257),r.e(9875)]).then(r.bind(r,88303))).default,CSVLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(8446)]).then(r.bind(r,72256))).default,CatalogLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(708),r.e(4111),r.e(8506),r.e(364),r.e(8628),r.e(2593),r.e(1419),r.e(9141)]).then(r.bind(r,79003))).default,DimensionLayer:async()=>(await Promise.all([r.e(6131),r.e(3813)]).then(r.bind(r,71493))).default,ElevationLayer:async()=>(await Promise.all([r.e(6131),r.e(9953),r.e(9186),r.e(5751)]).then(r.bind(r,68611))).default,FeatureLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(9867)]).then(r.bind(r,13600))).default,GeoJSONLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(8551)]).then(r.bind(r,17625))).default,GeoRSSLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(3610)]).then(r.bind(r,63201))).default,GroupLayer:async()=>(await Promise.all([r.e(6131),r.e(3562),r.e(8256)]).then(r.bind(r,85989))).default,ImageryLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(9953),r.e(1956),r.e(364),r.e(1427),r.e(8542),r.e(4990)]).then(r.bind(r,58434))).default,ImageryTileLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(9953),r.e(1427),r.e(6049),r.e(8542),r.e(7677),r.e(5943)]).then(r.bind(r,35943))).default,IntegratedMesh3DTilesLayer:async()=>(await Promise.all([r.e(6131),r.e(9172),r.e(132)]).then(r.bind(r,61528))).default,IntegratedMeshLayer:async()=>(await Promise.all([r.e(6131),r.e(8947),r.e(9172),r.e(3642)]).then(r.bind(r,74660))).default,KMLLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(8039)]).then(r.bind(r,79465))).default,KnowledgeGraphLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(708),r.e(8368),r.e(4560),r.e(397),r.e(3202),r.e(217),r.e(8916),r.e(5655),r.e(2083),r.e(8692)]).then(r.bind(r,28692))).default,LineOfSightLayer:async()=>(await Promise.all([r.e(6131),r.e(7937),r.e(9405),r.e(9695)]).then(r.bind(r,49695))).default,LinkChartLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(708),r.e(8368),r.e(4560),r.e(397),r.e(3202),r.e(217),r.e(8916),r.e(5655),r.e(2083),r.e(1728)]).then(r.bind(r,71728))).default,MapImageLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(708),r.e(4111),r.e(364),r.e(5962),r.e(7656),r.e(2042)]).then(r.bind(r,7656))).default,MapNotesLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(5655),r.e(9945)]).then(r.bind(r,96953))).default,MediaLayer:async()=>(await Promise.all([r.e(7330),r.e(6131),r.e(2763)]).then(r.bind(r,19647))).default,OGCFeatureLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(3029),r.e(708),r.e(257),r.e(9936),r.e(681)]).then(r.bind(r,87152))).default,OpenStreetMapLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(2029),r.e(349)]).then(r.bind(r,40349))).default,OrientedImageryLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(8373),r.e(5011)]).then(r.bind(r,97927))).default,PointCloudLayer:async()=>(await Promise.all([r.e(6131),r.e(8948),r.e(8947),r.e(7984),r.e(6528)]).then(r.bind(r,76742))).default,RouteLayer:async()=>(await Promise.all([r.e(6131),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(217),r.e(4654)]).then(r.bind(r,64185))).default,SceneLayer:async()=>(await Promise.all([r.e(6131),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(7937),r.e(2944),r.e(8947),r.e(8288),r.e(257),r.e(1737)]).then(r.bind(r,13899))).default,StreamLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(3029),r.e(362)]).then(r.bind(r,60683))).default,SubtypeGroupLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1956),r.e(4796),r.e(4111),r.e(8506),r.e(2765)]).then(r.bind(r,59929))).default,TileLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(1956),r.e(4796),r.e(708),r.e(4111),r.e(364),r.e(9186),r.e(5962),r.e(573)]).then(r.bind(r,71756))).default,UnknownLayer:async()=>(await r.e(146).then(r.bind(r,146))).default,UnsupportedLayer:async()=>(await r.e(5165).then(r.bind(r,45165))).default,VectorTileLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(9186),r.e(9949),r.e(5897),r.e(4753)]).then(r.bind(r,48757))).default,VideoLayer:async()=>(await Promise.all([r.e(6131),r.e(3910),r.e(5715),r.e(5323),r.e(6830)]).then(r.bind(r,61269))).default,ViewshedLayer:async()=>(await Promise.all([r.e(6131),r.e(7937),r.e(9405),r.e(6650)]).then(r.bind(r,96650))).default,VoxelLayer:async()=>(await Promise.all([r.e(6131),r.e(8948),r.e(8947),r.e(1389)]).then(r.bind(r,16183))).default,WCSLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(9953),r.e(1427),r.e(6049),r.e(8542),r.e(7677),r.e(9547)]).then(r.bind(r,19547))).default,WFSLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5715),r.e(5323),r.e(13),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(2144)]).then(r.bind(r,16350))).default,WMSLayer:async()=>(await Promise.all([r.e(7330),r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(5323),r.e(3669)]).then(r.bind(r,51904))).default,WMTSLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(2029),r.e(309)]).then(r.bind(r,20309))).default,WebTileLayer:async()=>(await Promise.all([r.e(6131),r.e(8219),r.e(2029)]).then(r.bind(r,47314))).default}},23154:(e,a,r)=>{r.d(a,{K:()=>f,Q:()=>s});var t=r(77548),n=r(24183);const l=new Set(["Catalog Layer","Feature Layer","Oriented Imagery Layer"]);async function s(e,a){const{loadContext:r,...l}=a||{},s=r?await r.fetchServiceMetadata(e,l):await(0,n.V)(e,l),i=(0,t.$x)(e,s);d(s),c(s);const o={serviceJSON:s,preferredUrl:i};if((s.currentVersion??0)<10.5)return o;const u=`${i??e}/layers`,y=r?await r.fetchServiceMetadata(u,l):await(0,n.V)(u,l);return d(y),c(y),o.layersJSON={layers:y.layers,tables:y.tables},o}function i(e){const{type:a}=e;return!!a&&l.has(a)}function o(e){return"Table"===e.type}function c(e){e.layers=e.layers?.filter(i),e.tables=e.tables?.filter(o)}function u(e){e.type||="Feature Layer"}function y(e){e.type||="Table"}function d(e){e.layers?.forEach(u),e.tables?.forEach(y)}function f(e){switch(e){case"Feature Layer":case"Table":return"FeatureLayer";case"Oriented Imagery Layer":return"OrientedImageryLayer";case"Catalog Layer":return"CatalogLayer"}return"FeatureLayer"}},24183:(e,a,r)=>{r.d(a,{V:()=>n});var t=r(78888);async function n(e,a){const{data:r}=await(0,t.A)(e,{responseType:"json",query:{f:"json",...a?.customParameters,token:a?.apiKey}});return r}},27982:(e,a,r)=>{r.r(a),r.d(a,{fromUrl:()=>d});var t=r(49186),n=r(84952),l=r(60694),s=r(92009),i=r(23154),o=r(77548),c=r(4513),u=r(24183);const y={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function d(e){const{properties:a,url:t}=e,n={...a,url:t},l=await m(t,a?.customParameters),{Constructor:s,layerId:i,sourceJSON:o,parsedUrl:c,preferredUrl:u,layers:y,tables:d}=l;if(u&&(n.url=u),y.length+d.length===0)return null!=i&&(n.layerId=i),null!=o&&(n.sourceJSON=o),new s(n);const h=new(0,(await Promise.all([r.e(6131),r.e(3562)]).then(r.bind(r,85989))).default)({title:c.title});return await async function(e,a,r){const t=a.sublayerConstructorProvider;for(const{id:n,serverUrl:l}of a.layers){const s=f(a.sublayerInfos,n),i=w(l,n,s,(s&&t?.(s))??a.Constructor,r);e.add(i)}if(a.tables.length){const t=await p("FeatureLayer");a.tables.forEach((({id:n,serverUrl:l})=>{const s=w(l,n,f(a.tableInfos,n),t,r);e.tables.add(s)}))}}(h,l,n),h}function f(e,a){return e?e.find((({id:e})=>e===a)):null}function w(e,a,r,t,n){const l={...n,layerId:a};return null!=e&&(l.url=e),null!=r&&(l.sourceJSON=r),"sublayerTitleMode"in t.prototype&&(l.sublayerTitleMode="service-name"),new t(l)}async function m(e,a){let r=(0,l.qg)(e);if(null==r&&(r=await async function(e,a){const r=await(0,u.V)(e,{customParameters:a});let t=null,s=null;const i=r.type;if("Feature Layer"===i||"Table"===i?(t="FeatureServer",s=r.id??null):"indexedVector"===i?t="VectorTileServer":r.hasOwnProperty("mapName")?t="MapServer":r.hasOwnProperty("bandCount")&&r.hasOwnProperty("pixelSizeX")?t="ImageServer":r.hasOwnProperty("maxRecordCount")&&r.hasOwnProperty("allowGeometryUpdates")?t="FeatureServer":r.hasOwnProperty("streamUrls")?t="StreamServer":h(r)?(t="SceneServer",s=r.id):r.hasOwnProperty("layers")&&h(r.layers?.[0])&&(t="SceneServer"),!t)return null;const o=null!=s?(0,l.iz)(e):null;return{title:null!=o&&r.name||(0,n.e7)(e),serverType:t,sublayer:s,url:{path:null!=o?o.serviceUrl:(0,n.An)(e).path}}}(e,a)),null==r)throw new t.A("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:e});const{serverType:c,sublayer:d}=r;let f;const w={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===c,b="SceneServer"===c,L={parsedUrl:r,Constructor:null,layerId:m||b?d??void 0:void 0,layers:[],tables:[]};switch(c){case"MapServer":if(null!=d){const{type:r}=await(0,u.V)(e,{customParameters:a});switch(f="FeatureLayer",r){case"Catalog Layer":f="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new t.A("arcgis-layers:unsupported",`fromUrl() not supported for "${r}" layers`)}}else f=await async function(e,a){return(await(0,u.V)(e,{customParameters:a})).tileInfo}(e,a)?"TileLayer":"MapImageLayer";break;case"ImageServer":{const r=await(0,u.V)(e,{customParameters:a}),{tileInfo:t,cacheType:n}=r;f=t?"LERC"!==t?.format?.toUpperCase()||n&&"elevation"!==n.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await(0,u.V)(r.url.path,{customParameters:a});if(f="SceneLayer",e){const a=e?.layers;if("Voxel"===e?.layerType)f="VoxelLayer";else if(a?.length){const e=a[0]?.layerType;null!=e&&null!=o.XX[e]&&(f=o.XX[e])}}break}case"3DTilesServer":throw new t.A("arcgis-layers:unsupported","fromUrl() not supported for 3DTiles layers");case"FeatureServer":if(f="FeatureLayer",null!=d){const r=await(0,u.V)(e,{customParameters:a});L.sourceJSON=r,L.preferredUrl=(0,o.$x)(e,r),f=(0,i.K)(r.type)}break;default:f=w[c]}if(y[f]&&null==d){const r=await async function(e,a,r){let t,n,l,o=!1;switch(a){case"FeatureServer":{const a=await(0,i.Q)(e,{customParameters:r});l=a.preferredUrl,o=!!a.layersJSON,t=a.layersJSON||a.serviceJSON;break}case"SceneServer":{const a=await async function(e,a){const r=await(0,u.V)(e,{customParameters:a}),t=r.layers?.[0];if(!t)return{serviceInfo:r};try{const{serverUrl:t}=await(0,s.L)(e),n=await(0,u.V)(t,{customParameters:a}).catch((()=>null));return n&&(r.tables=n.tables),{serviceInfo:r,tableServerUrl:t}}catch{return{serviceInfo:r}}}(e,r);t=a.serviceInfo,n=a.tableServerUrl;break}default:t=await(0,u.V)(e,{customParameters:r})}const c=t?.layers,y=t?.tables;return{preferredUrl:l,layers:c?.map((e=>({id:e.id}))).reverse()||[],tables:y?.map((e=>({serverUrl:n,id:e.id}))).reverse()||[],layerInfos:o?c:[],tableInfos:o?y:[]}}(e,c,a);if(m&&(L.preferredUrl=r.preferredUrl,L.sublayerInfos=r.layerInfos,L.tableInfos=r.tableInfos),1!==r.layers.length+r.tables.length)L.layers=r.layers,L.tables=r.tables,m&&r.layerInfos?.length&&(L.sublayerConstructorProvider=await async function(e){if(!e.length)return;const a=new Set,r=[];for(const{type:t}of e)a.has(t)||(a.add(t),r.push(p((0,i.K)(t))));const t=await Promise.all(r),n=new Map;return Array.from(a).forEach(((e,a)=>{n.set(e,t[a])})),e=>n.get(e.type)}(r.layerInfos));else if(m||b){const e=r.layerInfos?.[0]??r.tableInfos?.[0];if(L.layerId=r.layers[0]?.id??r.tables[0]?.id,L.sourceJSON=e,m){const a=e?.type;f=(0,i.K)(a)}}}return L.Constructor=await p(f),L}function h(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function p(e){return(0,c.S[e])()}},92009:(e,a,r)=>{r.d(a,{L:()=>u});var t=r(70333),n=r(78888),l=r(49186),s=r(74887),i=r(60694),o=r(20655),c=r(80812);async function u(e,a){const r=(0,i.qg)(e);if(!r)throw new l.A("invalid-url","Invalid scene service url");const u={...a,sceneServerUrl:r.url.path,layerId:r.sublayer??void 0};if(u.sceneLayerItem??=await async function(e){const a=(await y(e)).serviceItemId;if(!a)return null;const r=new c.default({id:a,apiKey:e.apiKey}),l=await async function(e){const a=t.id?.findServerInfo(e.sceneServerUrl);if(a?.owningSystemUrl)return a.owningSystemUrl;const r=e.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const a=(await(0,n.A)(r,{query:{f:"json"},responseType:"json",signal:e.signal})).data.owningSystemUrl;if(a)return a}catch(e){(0,s.QP)(e)}return null}(e);null!=l&&(r.portal=new o.A({url:l}));try{return await r.load({signal:e.signal})}catch(e){return(0,s.QP)(e),null}}(u),null==u.sceneLayerItem)return d(u.sceneServerUrl.replace("/SceneServer","/FeatureServer"),u);const f=await async function({sceneLayerItem:e,signal:a}){if(!e)return null;try{const r=(await e.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},{signal:a})).find((e=>"Feature Service"===e.type))||null;if(!r)return null;const t=new c.default({portal:r.portal,id:r.id});return await t.load(),t}catch(e){return(0,s.QP)(e),null}}(u);if(!f?.url)throw new l.A("related-service-not-found","Could not find feature service through portal item relationship");u.featureServiceItem=f;const w=await d(f.url,u);return w.portalItem=f,w}async function y(e){if(e.rootDocument)return e.rootDocument;const a={query:{f:"json",...e.customParameters,token:e.apiKey},responseType:"json",signal:e.signal};try{const r=await(0,n.A)(e.sceneServerUrl,a);e.rootDocument=r.data}catch{e.rootDocument={}}return e.rootDocument}async function d(e,a){const r=(0,i.qg)(e);if(!r)throw new l.A("invalid-feature-service-url","Invalid feature service url");const t=r.url.path,s=a.layerId;if(null==s)return{serverUrl:t};const o=y(a),c=a.featureServiceItem?await a.featureServiceItem.fetchData("json"):null,u=(c?.layers?.[0]||c?.tables?.[0])?.customParameters,d=e=>{const r={query:{f:"json",...u},responseType:"json",authMode:e,signal:a.signal};return(0,n.A)(t,r)},f=d("anonymous").catch((()=>d("no-prompt"))),[w,m]=await Promise.all([f,o]),h=m?.layers,p=w.data&&w.data.layers;if(!Array.isArray(p))throw new Error("expected layers array");if(Array.isArray(h)){for(let e=0;e<Math.min(h.length,p.length);e++)if(h[e].id===s)return{serverUrl:t,layerId:p[e].id}}else if(null!=s&&s<p.length)return{serverUrl:t,layerId:p[s].id};throw new Error("could not find matching associated sublayer")}}}]);