@arcgis/core 4.31.0-next.20240920 → 4.31.0-next.20240921

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 (173) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcade/featureset/actions/Adapted.js +1 -1
  4. package/arcade/featureset/support/StatsField.js +1 -1
  5. package/arcade/featureset/support/errorsupport.js +1 -1
  6. package/arcade/featureset/support/sqlUtils.js +1 -1
  7. package/arcade/functions/maths.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/24d45530fe47b3114daf.js +1 -0
  10. package/assets/esri/core/workers/chunks/35f92652df2561845d47.js +1 -0
  11. package/assets/esri/core/workers/chunks/736e0c5cb9010ca818d8.js +1 -0
  12. package/assets/esri/core/workers/chunks/757b83799555958e059c.js +1 -0
  13. package/assets/esri/core/workers/chunks/76d8192015ce46dbf92a.js +1 -0
  14. package/assets/esri/core/workers/chunks/884cd0bd036c65567929.js +1 -0
  15. package/assets/esri/core/workers/chunks/{da3a4eb3fbb9dd509b4b.js → 98e872da08203455a5b6.js} +1 -1
  16. package/assets/esri/core/workers/chunks/d9c34e07627d93d4670b.js +1 -0
  17. package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +1 -0
  18. package/assets/esri/themes/base/_functions.scss +6 -2
  19. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +4 -0
  20. package/assets/esri/themes/dark/main.css +1 -1
  21. package/assets/esri/themes/light/main.css +1 -1
  22. package/assets/esri/themes/light/view.css +1 -1
  23. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  24. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  25. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  26. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  27. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  28. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  29. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  30. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  31. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  32. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  33. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  34. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  35. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  36. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  37. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  38. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  39. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  40. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  41. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  62. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  63. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  64. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  65. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  66. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  67. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  68. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  69. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  70. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  71. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  72. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  73. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  74. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  75. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  76. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  77. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  78. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  79. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  80. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  81. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  82. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  83. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nb.json +1 -1
  84. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  85. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  86. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  87. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  88. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  89. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  90. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  91. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  92. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  93. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  101. package/chunks/Bufferer-93RDFIRm.js +5 -0
  102. package/chunks/GeodeticDistanceCalculator-CN7xMqrJ.js +1 -1
  103. package/chunks/OperatorGeodeticArea.js +1 -1
  104. package/chunks/Polyline.js +1 -1
  105. package/chunks/Theme.js +1 -1
  106. package/core/mathUtils.js +1 -1
  107. package/core/sql/AggregateFunctions.js +1 -1
  108. package/core/sql/SqlInterval.js +1 -1
  109. package/core/sql/StandardizedFunctions.js +1 -1
  110. package/core/sql/WhereClause.js +1 -1
  111. package/core/sql/WhereGrammar.js +1 -1
  112. package/core/sql/errorSupport.js +5 -0
  113. package/core/sql/sqlArithmeticUtils.js +1 -1
  114. package/core/sql/sqlCompareUtils.js +1 -1
  115. package/core/sql/sqlDateParsingUtils.js +1 -1
  116. package/geometry/operators/crossesOperator.js +1 -1
  117. package/geometry/operators/equalsOperator.js +1 -1
  118. package/geometry/operators/graphicBufferOperator.js +5 -0
  119. package/geometry/operators/gx/operatorBuffer.js +1 -1
  120. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  121. package/geometry/operators/gx/operatorCut.js +1 -1
  122. package/geometry/operators/gx/operatorGraphicBuffer.js +5 -0
  123. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  124. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  125. package/geometry/operators/gx/operatorOffset.js +1 -1
  126. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  127. package/geometry/operators/intersectsOperator.js +1 -1
  128. package/geometry/operators/overlapsOperator.js +1 -1
  129. package/geometry/operators/proximityOperator.d.ts +4 -0
  130. package/geometry/operators/proximityOperator.js +1 -1
  131. package/geometry/operators/relateOperator.js +1 -1
  132. package/geometry/operators/reshapeOperator.js +1 -1
  133. package/geometry/operators/touchesOperator.js +1 -1
  134. package/geometry/operators/withinOperator.js +1 -1
  135. package/interfaces.d.ts +306 -24
  136. package/layers/mixins/ArcGISMapService.js +1 -1
  137. package/package.json +1 -1
  138. package/support/revision.js +1 -1
  139. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  140. package/views/2d/layers/LayerView2D.js +1 -1
  141. package/views/2d/support/highlightGroupUtils.js +1 -1
  142. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  143. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  144. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  145. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  146. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  147. package/views/View.js +1 -1
  148. package/views/View2D.js +1 -1
  149. package/views/draw/DrawGraphicTool.js +1 -1
  150. package/views/draw/support/Box.js +1 -1
  151. package/views/draw/support/Reshape.js +1 -1
  152. package/views/interactive/Tooltip.d.ts +4 -0
  153. package/views/interactive/Tooltip.js +5 -0
  154. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  155. package/webdoc/widgets/TimeSlider.js +1 -1
  156. package/webmap/InitialViewProperties.js +1 -1
  157. package/widgets/BasemapLayerList/css.js +1 -1
  158. package/widgets/BasemapLayerList.js +1 -1
  159. package/widgets/CatalogLayerList.js +1 -1
  160. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  161. package/widgets/LayerList/LayerListItem.js +1 -1
  162. package/widgets/LayerList.js +1 -1
  163. package/widgets/Sketch/SketchViewModel.js +1 -1
  164. package/widgets/Sketch.js +1 -1
  165. package/assets/esri/core/workers/chunks/3cb1de0b9bf9a25112e0.js +0 -1
  166. package/assets/esri/core/workers/chunks/41205645790e5f2bdaf7.js +0 -1
  167. package/assets/esri/core/workers/chunks/59833b27d8413b6d9312.js +0 -1
  168. package/assets/esri/core/workers/chunks/6d668f7696f280ec9588.js +0 -1
  169. package/assets/esri/core/workers/chunks/907e74abb4a85a76e3b5.js +0 -1
  170. package/assets/esri/core/workers/chunks/a6c3c1827d2e8bbfcd9e.js +0 -1
  171. package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +0 -1
  172. package/assets/esri/core/workers/chunks/ef7dcb8758e7f21d30bc.js +0 -1
  173. package/views/interactive/tooltip/Tooltip.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import{watch as l}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import c from"./BasemapLayerList/BasemapLayerListViewModel.js";import d from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as m}from"./BasemapLayerList/css.js";import p from"./LayerList/LayerListItem.js";import h from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as g,getLayerType as f,sortLayersToIds as b,sortChildLayersToIds as _}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{incrementHeadingLevel as y}from"./support/Heading.js";import{calciteListFilterProps as L}from"./support/listUtils.js";import{setFocus as w}from"./support/widgetUtils.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as E}from"./support/decorators/vmEvent.js";import{tsx as C}from"./support/jsxFactory.js";const T=t.ofType(h),M=".*\\S+.*",j="data-basemap-layer-type";let B=class extends(s(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusTableListFlowItem=!1,this._focusEditingFlowItem=!1,this._focusCatalogFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.openTableListItem=null,this.tableList=null,this.openCatalogItem=null,this.selectedItems=new T,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=g(e);if(!l?.sortable)return!1;const n=g(t),r=f(t),a=g(i),c=f(i),d=!!r&&!!c&&r===c,m={selected:l,from:n,to:a},p=t.group,h=i.group,u=n?.layer?.type??"",b=a?.layer?.type??"",_=new Set(["map-image","catalog","knowledge-graph"]),I="sublayer";return p&&h&&"function"==typeof o?o.call(null,m):d&&!_.has(u)&&!_.has(b)&&l?.layer?.type!==I},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTablesOpen=e=>{this.openTableListItem=e,this._focusTableListFlowItem=!0},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openCatalogItem=e.parent,this._focusCatalogFlowItem=!0},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=g(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const n=s,r=i;if(n!==r)this._moveLayerFromChildList({toEl:r,fromEl:n,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(n,e)}}}initialize(){this.addHandles([l((()=>this.openCatalogItem),(e=>e?this._createCatalog():this._destroyCatalog())),l((()=>this.openTableListItem),(e=>e?this._createTableList():this._destroyTableList()))])}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new d({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return I({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[v.hidden]:"loading"===e,[v.disabled]:"disabled"===e};return C("div",{class:this.classes(m.base,v.widget,v.panel,t)},this._renderItems())}_getTableListParams(e){const t=e?.layer;return"knowledge-graph"===t?.type?{...this.knowledgeGraphOptions,tables:t.tables}:null}async _createTableList(){this._destroyTableList();const{default:e}=await import("./TableList.js"),t=this._getTableListParams(this.openTableListItem);if(!t?.tables?.length)return;const{headingLevel:i,selectionMode:s,dragEnabled:o}=this;this._set("tableList",new e({headingLevel:i,selectionMode:s,dragEnabled:o,...t}))}_destroyTableList(){this.tableList?.destroy(),this._set("tableList",null)}_renderItemTooltip(e){return e?C("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}async _createCatalog(){this._destroyCatalog();const{default:e}=await import("./CatalogLayerList.js"),{headingLevel:t,catalogOptions:i,view:s,filterPlaceholder:o,baseListItemCreatedFunction:l,referenceListItemCreatedFunction:n,minFilterItems:r,selectionMode:a,visibilityAppearance:c,openCatalogItem:d,referenceItems:m}=this,p=d&&m.flatten((e=>e.children)).includes(d)?"reference":"base",h=this.openCatalogItem?.layer;this._set("catalogLayerList",new e({headingLevel:t,view:s,filterPlaceholder:o,minFilterItems:r,selectionMode:a,listItemCreatedFunction:"base"===p?l:n,visibilityAppearance:c,...i,catalogLayer:h}))}_destroyCatalog(){this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_renderCatalogFlowItem(){const{openCatalogItem:e,messages:t}=this;if(!e)return null;const i=this._getLayerTitle(e);return C("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openCatalogItem=null,this._focusRootFlowItem=!0}},this.catalogLayerList?.render())}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,w(e))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return C("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),C("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,w(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,w(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,w(e))}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i,s){return C(p,{activeItem:this._activeItem,canMove:this._canMove,css:m,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=g(i),l=g(e),n=g(t),r=k(t),a=k(e);r&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:n,toParentItem:l,newIndex:s,from:r,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=k(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;b(s,t)}else{const i=g(e);if(!i)return;_(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return C("div",{class:m.editing},C("calcite-label",null,e.basemapTitle,C("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:M,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return C("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return C("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?C("form",{bind:this,onsubmit:this._formSubmit},C("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?C("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return C("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return C("div",{class:m.itemMessage},C("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:n,viewModel:r,referenceItems:a,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[C("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?r.basemapTitle??n.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d),this._renderTableListFlowItem(),this._renderCatalogFlowItem()];return t?[l?C("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_focusTableListFlowItemNode(e){this._focusTableListFlowItem&&(this._focusTableListFlowItem=!1,w(e))}_renderTableListFlowItem(){const{openTableListItem:e,messages:t}=this;if(!e)return null;const i=e.title||this.messages.untitledLayer;return C("calcite-flow-item",{afterCreate:this._focusTableListFlowItemNode,afterUpdate:this._focusTableListFlowItemNode,bind:this,description:i,heading:t.tables,headingLevel:this.headingLevel,key:`flow-table-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openTableListItem=null,this._focusRootFlowItem=!0}},this.tableList?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:n,baseFilterText:r,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:p}=this,h="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return C("calcite-block",{class:m.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:y(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(h,t):null,C("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),filterProps:L,[j]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:n,filterText:u?"reference"===t?a:r:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?C("div",{class:m.filterNoResults,slot:"filter-no-results"},C("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(h))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function k(e){return e?.closest(`[${j}]`)?.getAttribute(j)}e([n()],B.prototype,"_activeItem",void 0),e([n()],B.prototype,"_tooltipReferenceMap",void 0),e([n()],B.prototype,"_focusRootFlowItem",void 0),e([n()],B.prototype,"_focusPanelFlowItem",void 0),e([n()],B.prototype,"_focusTableListFlowItem",void 0),e([n()],B.prototype,"_focusEditingFlowItem",void 0),e([n()],B.prototype,"_focusCatalogFlowItem",void 0),e([n()],B.prototype,"_totalBaseItems",null),e([n()],B.prototype,"_totalReferenceItems",null),e([n()],B.prototype,"_baseFilterEnabled",null),e([n()],B.prototype,"_referenceFilterEnabled",null),e([n()],B.prototype,"basemapTitle",null),e([n({readOnly:!0})],B.prototype,"catalogLayerList",void 0),e([n()],B.prototype,"catalogOptions",void 0),e([n()],B.prototype,"collapsed",void 0),e([n()],B.prototype,"dragEnabled",void 0),e([n()],B.prototype,"editingTitle",void 0),e([n()],B.prototype,"filterPlaceholder",void 0),e([n()],B.prototype,"baseFilterText",void 0),e([n()],B.prototype,"referenceFilterText",void 0),e([n()],B.prototype,"listItemCanGiveFunction",void 0),e([n()],B.prototype,"listItemCanReceiveFunction",void 0),e([n()],B.prototype,"baseListItemCreatedFunction",null),e([n()],B.prototype,"editingEnabled",null),e([n()],B.prototype,"headingLevel",void 0),e([n()],B.prototype,"icon",null),e([n()],B.prototype,"knowledgeGraphOptions",void 0),e([n()],B.prototype,"label",null),e([n(),F("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],B.prototype,"messages",void 0),e([n(),F("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([n()],B.prototype,"minFilterItems",void 0),e([n()],B.prototype,"multipleSelectionEnabled",null),e([n()],B.prototype,"openTableListItem",void 0),e([n()],B.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],B.prototype,"tableList",void 0),e([n({readOnly:!0})],B.prototype,"baseItems",null),e([n()],B.prototype,"openCatalogItem",void 0),e([n({readOnly:!0})],B.prototype,"referenceItems",null),e([n()],B.prototype,"selectedItems",void 0),e([n()],B.prototype,"selectionMode",void 0),e([n()],B.prototype,"view",null),e([E("trigger-action"),n({type:c})],B.prototype,"viewModel",void 0),e([n()],B.prototype,"visibilityAppearance",void 0),e([n({type:d,nonNullable:!0})],B.prototype,"visibleElements",void 0),B=e([r("esri.widgets.BasemapLayerList")],B);const R=B;export{R as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import p from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as h}from"./BasemapLayerList/css.js";import u from"./LayerList/LayerListItem.js";import g from"./LayerList/ListItem.js";import{minFilterItems as y,getItem as f,getLayerType as b,sortLayersToIds as _,sortChildLayersToIds as L}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import{incrementHeadingLevel as w}from"./support/Heading.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";const O=t.ofType(g),j=".*\\S+.*",A="data-basemap-layer-type";let B=class extends(s(c)){constructor(e,i){super(e,i),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=y,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new O,this.selectionMode="none",this.tileOptions=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=f(e);if(!l?.sortable)return!1;const r=f(t),n=b(t),a=f(i),d=b(i),c=!!n&&!!d&&n===d,p={selected:l,from:r,to:a},m=t.group,h=i.group,u=r?.layer?.type??"",g=a?.layer?.type??"",y=new Set(["map-image","catalog","knowledge-graph"]),_="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!y.has(u)&&!y.has(g)&&l?.layer?.type!==_},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer.parent),this._focusLayerFlowItem=e.layer.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(h.item)));this._activeItem=f(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const r=s,n=i;if(r!==n)this._moveLayerFromChildList({toEl:n,fromEl:r,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(r,e)}}}initialize(){this.addHandles(r((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),n))}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new m({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return v({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){return this.openedLayers.toArray().map((e=>this._renderLayerFlowItem(e)))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[I.hidden]:"loading"===e,[I.disabled]:"disabled"===e};return M("div",{class:this.classes(h.base,I.widget,I.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach(((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,o))));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?M("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return M("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),M("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,F(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItem(e,t,i,s){return M(u,{activeItem:this._activeItem,canMove:this._canMove,css:h,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=f(i),l=f(e),r=f(t),n=k(t),a=k(e);n&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:n,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=k(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;_(s,t)}else{const i=f(e);if(!i)return;L(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>f(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return M("div",{class:h.editing},M("calcite-label",null,e.basemapTitle,M("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:j,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return M("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return M("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?M("form",{bind:this,onsubmit:this._formSubmit},M("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?M("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return M("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return M("div",{class:h.itemMessage},M("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:n,referenceItems:a,baseItems:d}=this,c=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,p=this.visibleElements.baseLayers?this._getFilteredItems(d):null,m=[M("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?n.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(c),this._renderBaseSection(p,1===p?.length)),this._renderEditingForm(),this._renderPanelFlowItems(p),this._renderPanelFlowItems(c),this._renderedOpenLayerFlowItems];return t?[l?M("calcite-flow",{key:"root-flow"},m):m,this._renderItemTooltips(c),this._renderItemTooltips(p)]:null}_renderLayerFlowItem(e){const{messages:t,openedLayers:i}=this,s=e.title||this.messages.untitledLayer;return M("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:t["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i.pop();const t=i.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:n,referenceFilterText:a,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?c:d;return M("calcite-block",{class:h.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:w(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(m,t):null,M("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),filterProps:E,[A]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:r,filterText:u?"reference"===t?a:n:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?M("div",{class:h.filterNoResults,slot:"filter-no-results"},M("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function k(e){return e?.closest(`[${A}]`)?.getAttribute(A)}e([a()],B.prototype,"_activeItem",void 0),e([a()],B.prototype,"_tooltipReferenceMap",void 0),e([a()],B.prototype,"_focusRootFlowItem",void 0),e([a()],B.prototype,"_focusPanelFlowItem",void 0),e([a()],B.prototype,"_focusLayerFlowItem",void 0),e([a()],B.prototype,"_focusEditingFlowItem",void 0),e([a()],B.prototype,"_layerListMap",void 0),e([a()],B.prototype,"_totalBaseItems",null),e([a()],B.prototype,"_totalReferenceItems",null),e([a()],B.prototype,"_baseFilterEnabled",null),e([a()],B.prototype,"_referenceFilterEnabled",null),e([a()],B.prototype,"_renderedOpenLayerFlowItems",null),e([a()],B.prototype,"basemapTitle",null),e([a({readOnly:!0})],B.prototype,"catalogLayerList",void 0),e([a()],B.prototype,"catalogOptions",void 0),e([a()],B.prototype,"collapsed",void 0),e([a()],B.prototype,"dragEnabled",void 0),e([a()],B.prototype,"editingTitle",void 0),e([a()],B.prototype,"filterPlaceholder",void 0),e([a()],B.prototype,"baseFilterText",void 0),e([a()],B.prototype,"referenceFilterText",void 0),e([a()],B.prototype,"listItemCanGiveFunction",void 0),e([a()],B.prototype,"listItemCanReceiveFunction",void 0),e([a()],B.prototype,"baseListItemCreatedFunction",null),e([a()],B.prototype,"editingEnabled",null),e([a()],B.prototype,"headingLevel",void 0),e([a()],B.prototype,"icon",null),e([a()],B.prototype,"knowledgeGraphOptions",void 0),e([a()],B.prototype,"label",null),e([a()],B.prototype,"layerTablesEnabled",void 0),e([a()],B.prototype,"mapImageOptions",void 0),e([a(),C("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],B.prototype,"messages",void 0),e([a(),C("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([a()],B.prototype,"minFilterItems",void 0),e([a()],B.prototype,"multipleSelectionEnabled",null),e([a({readOnly:!0})],B.prototype,"openedLayers",void 0),e([a({readOnly:!0})],B.prototype,"openedLayerLists",void 0),e([a()],B.prototype,"referenceListItemCreatedFunction",null),e([a({readOnly:!0})],B.prototype,"tableList",void 0),e([a({readOnly:!0})],B.prototype,"baseItems",null),e([a({readOnly:!0})],B.prototype,"referenceItems",null),e([a()],B.prototype,"selectedItems",void 0),e([a()],B.prototype,"selectionMode",void 0),e([a()],B.prototype,"tileOptions",void 0),e([a()],B.prototype,"view",null),e([T("trigger-action"),a({type:p})],B.prototype,"viewModel",void 0),e([a()],B.prototype,"visibilityAppearance",void 0),e([a({type:m,nonNullable:!0})],B.prototype,"visibleElements",void 0),B=e([d("esri.widgets.BasemapLayerList")],B);const R=B;export{R 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import i from"../core/ReactiveMap.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./CatalogLayerList/CatalogLayerListViewModel.js";import n from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as c}from"./CatalogLayerList/css.js";import m from"./LayerList/LayerListItem.js";import p from"./LayerList/ListItem.js";import{minFilterItems as d,getItem as h}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{calciteListFilterProps as g}from"./support/listUtils.js";import{setFocus as v}from"./support/widgetUtils.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as y}from"./support/decorators/vmEvent.js";import{tsx as _}from"./support/jsxFactory.js";const w=t.ofType(p);let L=class extends(o(r)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new i,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._rootGroupUid=`operational-${this.uid}`,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.minFilterItems=d,this.selectedItems=new w,this.selectionMode="none",this.viewModel=new a,this.visibilityAppearance="default",this.visibleElements=new n,this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(c.item)));this._activeItem=h(t)}}loadDependencies(){return f({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[u.hidden]:"loading"===e,[u.disabled]:"disabled"===e},o=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return _("div",{class:this.classes(c.base,u.widget,u.panel,t)},o?.length?[this._renderItemTooltips(o),this._renderItems(o)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?_("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return _("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return _("div",{class:c.itemMessage,key:"esri-layer-list__no-items"},_("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const o=()=>this._handlePanelFlowItemBack(t);return _("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),o()}},t.render(),_("calcite-button",{appearance:"transparent",onclick:o,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,v(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,v(e))}_renderItems(e){const{visible:t,collapsed:o,_filterEnabled:i,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:r,heading:a,flow:n},selectionMode:m,filterText:p,filterPlaceholder:d,messages:h}=this,f=[_("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:o,collapsible:r,heading:a?h.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},_("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,filterEnabled:i,filterPlaceholder:d,filterProps:g,filterText:i?p:"",group:s,key:"root-list",label:h.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&i?_("div",{class:c.filterNoResults,slot:"filter-no-results"},_("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?n?_("calcite-flow",{key:"root-flow"},f):f:null}_renderItem(e,t,o){return _(m,{activeItem:this._activeItem,css:c,dragEnabled:!1,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:null,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onPanelOpen:this._onPanelOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const i=e.target.selectedItems.map((e=>h(e))).filter(Boolean);o.removeAll(),o.addMany(i)}};e([s()],L.prototype,"_activeItem",void 0),e([s()],L.prototype,"_tooltipReferenceMap",void 0),e([s()],L.prototype,"_focusRootFlowItem",void 0),e([s()],L.prototype,"_focusPanelFlowItem",void 0),e([s()],L.prototype,"_filterEnabled",null),e([s()],L.prototype,"catalogItems",null),e([s()],L.prototype,"catalogLayer",null),e([s()],L.prototype,"collapsed",void 0),e([s()],L.prototype,"filterPlaceholder",void 0),e([s()],L.prototype,"filterText",void 0),e([s()],L.prototype,"headingLevel",void 0),e([s()],L.prototype,"icon",null),e([s()],L.prototype,"label",null),e([s()],L.prototype,"listItemCreatedFunction",null),e([s(),I("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],L.prototype,"messages",void 0),e([s(),I("esri/t9n/common")],L.prototype,"messagesCommon",void 0),e([s()],L.prototype,"minFilterItems",void 0),e([s()],L.prototype,"selectedItems",void 0),e([s()],L.prototype,"selectionMode",void 0),e([s()],L.prototype,"view",null),e([y("trigger-action"),s({type:a})],L.prototype,"viewModel",void 0),e([s()],L.prototype,"visibilityAppearance",void 0),e([s({type:n,nonNullable:!0})],L.prototype,"visibleElements",void 0),L=e([l("esri.widgets.CatalogLayerList")],L);const b=L;export{b as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/ReactiveMap.js";import{on as i,initial as l}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import p from"./CatalogLayerList/CatalogLayerListViewModel.js";import c from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as d}from"./CatalogLayerList/css.js";import m from"./LayerList/LayerListItem.js";import h from"./LayerList/ListItem.js";import{minFilterItems as y,getItem as u}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as L}from"./support/globalCss.js";import{calciteListFilterProps as f}from"./support/listUtils.js";import{setFocus as _}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as I}from"./support/jsxFactory.js";var b;const C=t.ofType(h);let F=b=class extends(o(n)){constructor(e,o){super(e,o),this._activeItem=null,this._tooltipReferenceMap=new s,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new s,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=y,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new C,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new c,this._onTablesOpen=e=>{this.onTablesOpen?this.onTablesOpen(e):(this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer.uid)},this._onCatalogOpen=e=>{this.onCatalogOpen?this.onCatalogOpen(e):(this.openedLayers.push(e.layer.parent),this._focusLayerFlowItem=e.layer.uid)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(d.item)));this._activeItem=u(t)}}initialize(){this.addHandles(i((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),l))}loadDependencies(){return g({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){return this.openedLayers.toArray().map((e=>this._renderLayerFlowItem(e)))}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[L.hidden]:"loading"===e,[L.disabled]:"disabled"===e},o=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return I("div",{class:this.classes(d.base,L.widget,L.panel,t)},o?.length?[this._renderItemTooltips(o),this._renderItems(o)]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:o}=this,s=o.get(e);if(s)return s;const i="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||o.set(e,i),i}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:o}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:i}=s;this._openedLayersController=s,e.forEach(((o,s)=>{t.includes(s)||(o.destroy(),e.delete(s))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,i))));if(i.aborted)return;o.removeAll(),o.addMany(l);const a=o.at(-1);a?"catalogLayer"in a?(this._set("catalogLayerList",a),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",a)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?I("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return I("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return I("div",{class:d.itemMessage,key:"esri-layer-list__no-items"},I("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const o=()=>this._handlePanelFlowItemBack(t);return I("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),o()}},t.render(),I("calcite-button",{appearance:"transparent",onclick:o,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,_(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,_(e))}_renderItems(e){const{visible:t,collapsed:o,_filterEnabled:s,_rootGroupUid:i,visibleElements:{closeButton:l,collapseButton:a,heading:r,flow:n},selectionMode:p,filterText:c,filterPlaceholder:m,messages:h}=this,y=[I("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:o,collapsible:a,heading:r?h.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},I("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":i,filterEnabled:s,filterPlaceholder:m,filterProps:f,filterText:s?c:"",group:i,key:"root-list",label:h.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:p,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&s?I("div",{class:d.filterNoResults,slot:"filter-no-results"},I("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e),this._renderedOpenLayerFlowItems];return t?n?I("calcite-flow",{key:"root-flow"},y):y:null}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,_(e))}_renderLayerFlowItem(e){const{messages:t,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return I("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:t["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}async _createCatalogLayerList(e){const{headingLevel:t,catalogOptions:o,view:s,filterPlaceholder:i,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,onCatalogOpen:p,onTablesOpen:c}=this;return new b({headingLevel:t,view:s,filterPlaceholder:i,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,...o,catalogLayer:e,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:o,selectionMode:s}=this;return new t({headingLevel:o,selectionMode:s,...this._getTableListParams(e)})}_renderItem(e,t,o){return I(m,{activeItem:this._activeItem,css:d,dragEnabled:!1,item:e,key:`layerListItem-${e.layer.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:null,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>u(e))).filter(Boolean);o.removeAll(),o.addMany(s)}};e([a()],F.prototype,"_activeItem",void 0),e([a()],F.prototype,"_tooltipReferenceMap",void 0),e([a()],F.prototype,"_focusRootFlowItem",void 0),e([a()],F.prototype,"_focusPanelFlowItem",void 0),e([a()],F.prototype,"_focusLayerFlowItem",void 0),e([a()],F.prototype,"_layerListMap",void 0),e([a()],F.prototype,"_filterEnabled",null),e([a()],F.prototype,"_renderedOpenLayerFlowItems",null),e([a()],F.prototype,"catalogItems",null),e([a()],F.prototype,"catalogLayer",null),e([a({readOnly:!0})],F.prototype,"catalogLayerList",void 0),e([a()],F.prototype,"catalogOptions",void 0),e([a()],F.prototype,"collapsed",void 0),e([a()],F.prototype,"filterPlaceholder",void 0),e([a()],F.prototype,"filterText",void 0),e([a()],F.prototype,"headingLevel",void 0),e([a()],F.prototype,"icon",null),e([a()],F.prototype,"knowledgeGraphOptions",void 0),e([a()],F.prototype,"label",null),e([a()],F.prototype,"layerTablesEnabled",void 0),e([a()],F.prototype,"listItemCreatedFunction",null),e([a()],F.prototype,"mapImageOptions",void 0),e([a(),v("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],F.prototype,"messages",void 0),e([a(),v("esri/t9n/common")],F.prototype,"messagesCommon",void 0),e([a()],F.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],F.prototype,"openedLayers",void 0),e([a({readOnly:!0})],F.prototype,"openedLayerLists",void 0),e([a()],F.prototype,"onCatalogOpen",void 0),e([a()],F.prototype,"onTablesOpen",void 0),e([a()],F.prototype,"selectedItems",void 0),e([a()],F.prototype,"selectionMode",void 0),e([a({readOnly:!0})],F.prototype,"tableList",void 0),e([a()],F.prototype,"tileOptions",void 0),e([a()],F.prototype,"view",null),e([w("trigger-action"),a({type:p})],F.prototype,"viewModel",void 0),e([a()],F.prototype,"visibilityAppearance",void 0),e([a({type:c,nonNullable:!0})],F.prototype,"visibleElements",void 0),F=b=e([r("esri.widgets.CatalogLayerList")],F);const M=F;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{d as e}from"../../../chunks/tslib.es6.js";import{w as t,c as i,S as s,a,T as r}from"../../../chunks/Tick.js";import{w as l,x as n,L as o,l as h,y as c,p as u,P as d,z as g,A as p,e as y,k as b,T as f,a as m,j as _,g as x,i as v,v as w,B as k,D,t as R,u as A,m as P}from"../../../chunks/Theme.js";import{C as T}from"../../../chunks/ColorSet.js";import{s as L}from"../../../chunks/DefaultTheme.js";class N extends l{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeRadialText("",this.textStyle)})}_afterNew(){super._afterNew()}_beforeChanged(){super._beforeChanged(),this._display.clear(),this.isDirty("textType")&&(this._display.textType=this.get("textType"),this.markDirtyBounds()),this.isDirty("radius")&&(this._display.radius=this.get("radius"),this.markDirtyBounds()),this.isDirty("startAngle")&&(this._display.startAngle=(this.get("startAngle",0)+90)*n,this.markDirtyBounds()),this.isDirty("inside")&&(this._display.inside=this.get("inside"),this.markDirtyBounds()),this.isDirty("orientation")&&(this._display.orientation=this.get("orientation"),this.markDirtyBounds()),this.isDirty("kerning")&&(this._display.kerning=this.get("kerning"),this.markDirtyBounds())}}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialText"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:l.classNames.concat([N.className])});class C extends o{constructor(){super(...arguments),Object.defineProperty(this,"_flipped",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._textKeys.push("textType","kerning"),super._afterNew()}_makeText(){this._text=this.children.push(N.new(this._root,{}))}baseRadius(){const e=this.getPrivate("radius",0),t=this.getPrivate("innerRadius",0),i=this.get("baseRadius",0);return t+h(i,e-t)}radius(){const e=this.get("inside",!1);return this.baseRadius()+this.get("radius",0)*(e?-1:1)}_updateChildren(){if(super._updateChildren(),this.isDirty("baseRadius")||this.isPrivateDirty("radius")||this.isPrivateDirty("innerRadius")||this.isDirty("labelAngle")||this.isDirty("radius")||this.isDirty("inside")||this.isDirty("orientation")||this.isDirty("textType")){const e=this.get("textType","adjusted"),t=this.get("inside",!1),i=this.get("orientation");let s=c(this.get("labelAngle",0));this._text.set("startAngle",this.get("labelAngle",0)),this._text.set("inside",t);const a=p(s),r=g(s);let l=this.baseRadius(),n=this.radius();if(this._display.angle=0,"circular"==e)this.setAll({paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}),this.setRaw("x",void 0),this.setRaw("y",void 0),this._text.set("orientation",i),this._text.set("radius",n);else{0==l&&(s=0,n=0);let t=n*r,o=n*a;"radial"==e?(this.setRaw("x",t),this.setRaw("y",o),s<90||s>270||"auto"!=i?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):"adjusted"==e?(this.setRaw("centerX",u),this.setRaw("centerY",u),this.setRaw("x",t),this.setRaw("y",o)):"regular"==e&&(this.setRaw("x",t),this.setRaw("y",o))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const e=this.get("textType","regular"),t=this.get("inside",!1);let i=0,s=0,a=this.get("labelAngle",0),r=this.localBounds(),l=r.right-r.left,n=r.bottom-r.top;if("radial"==e){if(this._flipped){let e=this.get("centerX");e instanceof d&&(l*=1-2*e.value),i=l*g(a),s=l*p(a)}}else t||"adjusted"!=e||(i=l/2*g(a),s=n/2*p(a));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(C,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(C,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:o.classNames.concat([C.className])});const j=Math.abs,S=Math.atan2,O=Math.cos,I=Math.max,M=Math.min,B=Math.sin,F=Math.sqrt,H=1e-12,X=Math.PI,Y=X/2,z=2*X;function V(e){return e>1?0:e<-1?X:Math.acos(e)}function W(e){return e>=1?Y:e<=-1?-Y:Math.asin(e)}function U(e){return e.innerRadius}function K(e){return e.outerRadius}function q(e){return e.startAngle}function E(e){return e.endAngle}function G(e){return e&&e.padAngle}function J(e,t,i,s,a,r,l,n){var o=i-e,h=s-t,c=l-a,u=n-r,d=u*o-c*h;if(!(d*d<H))return[e+(d=(c*(t-r)-u*(e-a))/d)*o,t+d*h]}function Q(e,t,i,s,a,r,l){var n=e-i,o=t-s,h=(l?r:-r)/F(n*n+o*o),c=h*o,u=-h*n,d=e+c,g=t+u,p=i+c,y=s+u,b=(d+p)/2,f=(g+y)/2,m=p-d,_=y-g,x=m*m+_*_,v=a-r,w=d*y-p*g,k=(_<0?-1:1)*F(I(0,v*v*x-w*w)),D=(w*_-m*k)/x,R=(-w*m-_*k)/x,A=(w*_+m*k)/x,P=(-w*m+_*k)/x,T=D-b,L=R-f,N=A-b,C=P-f;return T*T+L*L>N*N+C*C&&(D=A,R=P),{cx:D,cy:R,x01:-c,y01:-u,x11:D*(a/v-1),y11:R*(a/v-1)}}function Z(){var e=U,s=K,a=i(0),r=null,l=q,n=E,o=G,h=null,c=t(u);function u(){var t,i,u=+e.apply(this,arguments),d=+s.apply(this,arguments),g=l.apply(this,arguments)-Y,p=n.apply(this,arguments)-Y,y=j(p-g),b=p>g;if(h||(h=t=c()),d<u&&(i=d,d=u,u=i),d>H)if(y>z-H)h.moveTo(d*O(g),d*B(g)),h.arc(0,0,d,g,p,!b),u>H&&(h.moveTo(u*O(p),u*B(p)),h.arc(0,0,u,p,g,b));else{var f,m,_=g,x=p,v=g,w=p,k=y,D=y,R=o.apply(this,arguments)/2,A=R>H&&(r?+r.apply(this,arguments):F(u*u+d*d)),P=M(j(d-u)/2,+a.apply(this,arguments)),T=P,L=P;if(A>H){var N=W(A/u*B(R)),C=W(A/d*B(R));(k-=2*N)>H?(v+=N*=b?1:-1,w-=N):(k=0,v=w=(g+p)/2),(D-=2*C)>H?(_+=C*=b?1:-1,x-=C):(D=0,_=x=(g+p)/2)}var I=d*O(_),U=d*B(_),K=u*O(w),q=u*B(w);if(P>H){var E,G=d*O(x),Z=d*B(x),$=u*O(v),ee=u*B(v);if(y<X)if(E=J(I,U,$,ee,G,Z,K,q)){var te=I-E[0],ie=U-E[1],se=G-E[0],ae=Z-E[1],re=1/B(V((te*se+ie*ae)/(F(te*te+ie*ie)*F(se*se+ae*ae)))/2),le=F(E[0]*E[0]+E[1]*E[1]);T=M(P,(u-le)/(re-1)),L=M(P,(d-le)/(re+1))}else T=L=0}D>H?L>H?(f=Q($,ee,I,U,d,L,b),m=Q(G,Z,K,q,d,L,b),h.moveTo(f.cx+f.x01,f.cy+f.y01),L<P?h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,d,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),!b),h.arc(m.cx,m.cy,L,S(m.y11,m.x11),S(m.y01,m.x01),!b))):(h.moveTo(I,U),h.arc(0,0,d,_,x,!b)):h.moveTo(I,U),u>H&&k>H?T>H?(f=Q(K,q,G,Z,u,-T,b),m=Q(I,U,$,ee,u,-T,b),h.lineTo(f.cx+f.x01,f.cy+f.y01),T<P?h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,u,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),b),h.arc(m.cx,m.cy,T,S(m.y11,m.x11),S(m.y01,m.x01),!b))):h.arc(0,0,u,w,v,b):h.lineTo(K,q)}else h.moveTo(0,0);if(h.closePath(),t)return h=null,t+""||null}return u.centroid=function(){var t=(+e.apply(this,arguments)+ +s.apply(this,arguments))/2,i=(+l.apply(this,arguments)+ +n.apply(this,arguments))/2-X/2;return[O(i)*t,B(i)*t]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),u):e},u.outerRadius=function(e){return arguments.length?(s="function"==typeof e?e:i(+e),u):s},u.cornerRadius=function(e){return arguments.length?(a="function"==typeof e?e:i(+e),u):a},u.padRadius=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:i(+e),u):r},u.startAngle=function(e){return arguments.length?(l="function"==typeof e?e:i(+e),u):l},u.endAngle=function(e){return arguments.length?(n="function"==typeof e?e:i(+e),u):n},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:i(+e),u):o},u.context=function(e){return arguments.length?(h=e??null,u):h},u}class $ extends y{constructor(){super(...arguments),Object.defineProperty(this,"ix",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generator",{enumerable:!0,configurable:!0,writable:!0,value:Z()})}_getTooltipPoint(){let e=this.get("tooltipX"),t=this.get("tooltipY"),i=0,s=0;b(e)&&(i=e),b(t)&&(s=t);let a=this.get("radius",0),r=this.get("innerRadius",0);return a+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=a+r),e instanceof d&&(i=this.ix*(r+(a-r)*e.value)),t instanceof d&&(s=this.iy*(r+(a-r)*t.value)),this.get("arc")>=360&&0==r&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius")||this.isDirty("shiftRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let e=this.get("startAngle",0),t=this.get("arc",0);const i=this._generator;t<0&&(e+=t,t*=-1),t>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),a=this.get("innerRadius",0);s+=this.get("dRadius",0),a+=this.get("dInnerRadius",0),a<0&&(a=s+a),i({innerRadius:a,outerRadius:s,startAngle:(e+90)*n,endAngle:(e+t+90)*n});let r=e+t/2;this.ix=g(r),this.iy=p(r);const l=this.get("shiftRadius",0);this.setRaw("dx",this.ix*l),this.setRaw("dy",this.iy*l),this.markDirtyPosition()}}}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:y.classNames.concat([$.className])});class ee extends f{setupDefaultRules(){super.setupDefaultRules();const e=this._root.interfaceColors,t=this.rule.bind(this);t("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:T.new(this._root,{}),width:m,height:m}),t("PieChart").setAll({radius:_(80),startAngle:-90,endAngle:270}),t("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),t("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),t("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),t("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),t("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),t("Slice",["pie"]).states.create("hover",{scale:1.04}),t("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),t("Tick",["pie"]).setAll({location:1}),t("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),t("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),t("FunnelSlice").setAll({interactive:!0,expandDistance:0}),t("FunnelSlice").states.create("hover",{expandDistance:.15}),t("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["funnel","vertical"]).setAll({centerY:u,centerX:0}),t("Tick",["funnel"]).setAll({location:1}),t("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),t("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),t("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),t("PyramidSeries").setAll({valueIs:"area"}),t("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),t("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),t("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),t("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),t("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),t("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["pyramid","vertical"]).setAll({centerY:u,centerX:0}),t("Tick",["pyramid"]).setAll({location:1}),t("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),t("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["pictorial","vertical"]).setAll({centerY:u,centerX:0}),t("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),t("Tick",["pictorial"]).setAll({location:.5});{const i=t("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),L(i,"fill",e,"alternativeBackground")}}}class te extends s{_afterNew(){this._defaultThemes.push(ee.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(e){super._processSeries(e),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(te,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(te,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:s.classNames.concat([te.className])});class ie extends a{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this._makeSlices()}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this._makeLabels()}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this._makeTicks()})}makeSlice(e){const t=this.slicesContainer.children.push(this.slices.make());return t.on("fill",(()=>{this.updateLegendMarker(e)})),t.on("fillPattern",(()=>{this.updateLegendMarker(e)})),t.on("stroke",(()=>{this.updateLegendMarker(e)})),t._setDataItem(e),e.set("slice",t),this.slices.push(t),t}makeLabel(e){const t=this.labelsContainer.children.push(this.labels.make());return t._setDataItem(e),e.set("label",t),this.labels.push(t),t}_shouldMakeBullet(e){return null!=e.get("value")}makeTick(e){const t=this.ticksContainer.children.push(this.ticks.make());return t._setDataItem(e),e.set("tick",t),this.ticks.push(t),t}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const e=this.get("colors");e&&e.reset();const t=this.get("patterns");t&&t.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let e=0,t=0,i=0,s=1/0,a=0;v(this._dataItems,(i=>{let s=i.get("valueWorking",0);e+=s,t+=Math.abs(s)})),v(this._dataItems,(e=>{let r=e.get("valueWorking",0);r>i&&(i=r),r<s&&(s=r),a++;let l=r/t;0==t&&(l=0),e.setRaw("valuePercentTotal",100*l)})),this.setPrivateRaw("valueLow",s),this.setPrivateRaw("valueHigh",i),this.setPrivateRaw("valueSum",e),this.setPrivateRaw("valueAverage",e/a),this.setPrivateRaw("valueAbsoluteSum",t)}}show(t){const i=Object.create(null,{show:{get:()=>super.show}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.show.call(this,t)),e.push(this._sequencedShowHide(!0,t)),yield Promise.all(e)}))}hide(t){const i=Object.create(null,{hide:{get:()=>super.hide}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.hide.call(this,t)),e.push(this._sequencedShowHide(!1,t)),yield Promise.all(e)}))}_updateChildren(){super._updateChildren(),this._valuesDirty&&v(this._dataItems,(e=>{e.get("label").text.markDirtyText()})),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&v(this._dataItems,(e=>{this.updateLegendValue(e)})),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),v(this.dataItems,(e=>{this._updateTick(e)}))}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(e){if(super.processDataItem(e),null==e.get("fill")){let t=this.get("colors");t&&e.setRaw("fill",t.next())}if(null==e.get("fillPattern")){let t=this.get("patterns");t&&e.setRaw("fillPattern",t.next())}}showDataItem(t,i){const s=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.showDataItem.call(this,t,i)];b(i)||(i=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");let r=t.get("value");const l=t.animate({key:"valueWorking",to:r,duration:i,easing:a});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.show(i));const o=t.get("label");o&&e.push(o.show(i));const h=t.get("slice");h&&e.push(h.show(i)),h.get("active")&&h.states.applyAnimate("active"),yield Promise.all(e)}))}hideDataItem(t,i){const s=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.hideDataItem.call(this,t,i)],a=this.states.create("hidden",{});b(i)||(i=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),l=t.animate({key:"valueWorking",to:0,duration:i,easing:r});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.hide(i));const o=t.get("label");o&&e.push(o.hide(i));const h=t.get("slice");h.hideTooltip(),h&&e.push(h.hide(i)),yield Promise.all(e)}))}disposeDataItem(e){super.disposeDataItem(e);let t=e.get("label");t&&(this.labels.removeValue(t),t.dispose());let i=e.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=e.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(e){const t=e.get("slice");t&&!t.isHidden()&&t.hover()}unhoverDataItem(e){const t=e.get("slice");t&&t.unhover()}updateLegendMarker(e){if(e){const t=e.get("slice");if(t){const i=e.get("legendDataItem");if(i){const e=i.get("markerRectangle");v(w,(i=>{null!=t.get(i)&&e.set(i,t.get(i))}))}}}}_arrangeDown(e){if(e){let t=this._getNextDown();e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.top;e.y+s<t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.bottom}))}}_getNextUp(){return this.labelsContainer.maxHeight()}_getNextDown(){return 0}_arrangeUp(e){if(e){let t=this._getNextUp();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.bottom;e.y+s>t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.top}))}}_arrangeRight(e){if(e){let t=0;e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.left;e.y+s<t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.right}))}}_arrangeLeft(e){if(e){let t=this.labelsContainer.maxWidth();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.right;e.y+s>t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.left}))}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(e){}_dispose(){super._dispose();const e=this.chart;e&&e.series.removeValue(this)}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:a.classNames.concat([ie.className])});class se extends te{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:u,y:u})}_prepareChildren(){super._prepareChildren();const e=this.chartContainer,t=e.innerWidth(),i=e.innerHeight(),s=this.get("startAngle",0),a=this.get("endAngle",0),r=this.get("innerRadius");let l=k(0,0,s,a,1);const n=t/(l.right-l.left),o=i/(l.bottom-l.top);let c={left:0,right:0,top:0,bottom:0};if(r instanceof d){let e=r.value,l=Math.min(n,o);e=Math.max(l*e,l-Math.min(i,t))/l,c=k(0,0,s,a,e),this.setPrivateRaw("irModifyer",e/r.value)}l=D([l,c]);const u=this._maxRadius;this._maxRadius=Math.min(n,o);const g=h(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-g*(l.bottom+l.top)/2,dx:-g*(l.right+l.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||u!=this._maxRadius)&&this.series.each((e=>{e._markDirtyKey("startAngle")})),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each((e=>{e._markDirtyKey("innerRadius")}))}radius(e){let t=h(this.get("radius",0),this._maxRadius),i=h(this.get("innerRadius",0),t);if(e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("radius");return null!=r?i+h(r,t-i):i+(t-i)/a*(s+1)}return t}innerRadius(e){const t=this.radius();let i=h(this.get("innerRadius",0),t);if(i<0&&(i=t+i),e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("innerRadius");return null!=r?i+h(r,t-i):i+(t-i)/a*s}return i}_updateSize(){super._updateSize(),this.markDirtyKey("radius")}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([se.className])});class ae extends ie{_makeSlices(){return new R(A.new({}),(()=>$._new(this._root,{themeTags:P(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template])))}_makeLabels(){return new R(A.new({}),(()=>C._new(this._root,{themeTags:P(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template])))}_makeTicks(){return new R(A.new({}),(()=>r._new(this._root,{themeTags:P(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template])))}processDataItem(e){super.processDataItem(e);const t=this.makeSlice(e);t.on("scale",(()=>{this._updateTick(e)})),t.on("shiftRadius",(()=>{this._updateTick(e)})),t.events.on("positionchanged",(()=>{this._updateTick(e)}));const i=this.makeLabel(e);i.events.on("positionchanged",(()=>{this._updateTick(e)})),this.makeTick(e),t.events.on("positionchanged",(()=>{i.markDirty()}))}_getNextUp(){const e=this.chart;return e?e._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const e=this.chart;return e?-e._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const e=this.chart;if(e){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let t=e.get("textType");null!=t&&"aligned"!=t||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const t=this.get("startAngle",e.get("startAngle",-90)),i=this.get("endAngle",e.get("endAngle",270))-t;let s=t;const a=e.radius(this);this.setPrivateRaw("radius",a);let r=e.innerRadius(this)*e.getPrivate("irModifyer",1);r<0&&(r=a+r),v(this._dataItems,(e=>{this.updateLegendValue(e);let t=i*e.get("valuePercentTotal")/100;const l=e.get("slice");if(l){l.set("radius",a),l.set("innerRadius",r),l.set("startAngle",s),l.set("arc",t);const i=e.get("fill");l._setDefault("fill",i),l._setDefault("stroke",i);const n=e.get("fillPattern");l._setDefault("fillPattern",n)}let n=c(s+t/2);const o=e.get("label");if(o&&(o.setPrivate("radius",a),o.setPrivate("innerRadius",r),o.set("labelAngle",n),"aligned"==o.get("textType"))){let e=a+o.get("radius",0),t=a*p(n);n>90&&n<=270?(o.isHidden()||o.isHiding()||this._lLabels.push({label:o,y:t}),e*=-1,e-=this.labelsContainer.get("paddingLeft",0),o.set("centerX",m),o.setPrivateRaw("left",!0)):(o.isHidden()||o.isHiding()||this._rLabels.push({label:o,y:t}),e+=this.labelsContainer.get("paddingRight",0),o.set("centerX",0),o.setPrivateRaw("left",!1)),o.set("x",e),o.set("y",a*p(n))}s+=t,this._updateTick(e)}))}}}_updateTick(e){const t=e.get("tick"),i=e.get("label"),s=e.get("slice"),a=t.get("location",1);if(t&&i&&s){const e=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*a,r=i.get("labelAngle",0),l=g(r),n=p(r),o=this.labelsContainer,h=o.get("paddingLeft",0),c=o.get("paddingRight",0);let u=0,d=0;u=i.x(),d=i.y();let y=[];if(0!=u||0!=d){if("circular"==i.get("textType")){const e=i.radius()-i.get("paddingBottom",0),t=i.get("labelAngle",0);u=e*g(t),d=e*p(t)}let t=-c;i.getPrivate("left")&&(t=h),y=[{x:s.x()+e*l,y:s.y()+e*n},{x:u+t,y:d},{x:u,y:d}]}t.set("points",y)}}_positionBullet(e){const t=e.get("sprite");if(t){const i=t.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),a=i.get("radius",0),r=i.get("startAngle",0)+i.get("arc",0)*e.get("locationX",.5),l=s+(a-s)*e.get("locationY",.5);t.setAll({x:g(r)*l,y:p(r)*l})}}}}Object.defineProperty(ae,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(ae,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:ie.classNames.concat([ae.className])});export{se as PieChartAm5,ae as PieSeriesAm5};
5
+ import{d as e}from"../../../chunks/tslib.es6.js";import{w as t,c as i,S as s,a,T as r}from"../../../chunks/Tick.js";import{w as l,x as n,L as o,l as h,y as c,z as u,A as d,p as g,P as p,e as y,k as b,T as f,a as m,j as _,g as x,i as v,v as w,B as k,D,t as R,u as A,m as P}from"../../../chunks/Theme.js";import{C as T}from"../../../chunks/ColorSet.js";import{s as L}from"../../../chunks/DefaultTheme.js";class N extends l{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeRadialText("",this.textStyle)})}_afterNew(){super._afterNew()}_beforeChanged(){super._beforeChanged(),this._display.clear(),this.isDirty("textType")&&(this._display.textType=this.get("textType"),this.markDirtyBounds()),this.isDirty("radius")&&(this._display.radius=this.get("radius"),this.markDirtyBounds()),this.isDirty("startAngle")&&(this._display.startAngle=(this.get("startAngle",0)+90)*n,this.markDirtyBounds()),this.isDirty("inside")&&(this._display.inside=this.get("inside"),this.markDirtyBounds()),this.isDirty("orientation")&&(this._display.orientation=this.get("orientation"),this.markDirtyBounds()),this.isDirty("kerning")&&(this._display.kerning=this.get("kerning"),this.markDirtyBounds())}}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialText"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:l.classNames.concat([N.className])});class C extends o{constructor(){super(...arguments),Object.defineProperty(this,"_flipped",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._textKeys.push("textType","kerning"),super._afterNew()}_makeText(){this._text=this.children.push(N.new(this._root,{}))}baseRadius(){const e=this.getPrivate("radius",0),t=this.getPrivate("innerRadius",0),i=this.get("baseRadius",0);return t+h(i,e-t)}radius(){const e=this.get("inside",!1);return this.baseRadius()+this.get("radius",0)*(e?-1:1)}_updateChildren(){if(super._updateChildren(),this.isDirty("baseRadius")||this.isPrivateDirty("radius")||this.isPrivateDirty("innerRadius")||this.isDirty("labelAngle")||this.isDirty("radius")||this.isDirty("inside")||this.isDirty("orientation")||this.isDirty("textType")){const e=this.get("textType","adjusted"),t=this.get("inside",!1),i=this.get("orientation");let s=c(this.get("labelAngle",0));this._text.set("startAngle",this.get("labelAngle",0)),this._text.set("inside",t);const a=u(s),r=d(s);let l=this.baseRadius(),n=this.radius();if(this._display.angle=0,"circular"==e)this.setAll({paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}),this.setRaw("x",void 0),this.setRaw("y",void 0),this._text.set("orientation",i),this._text.set("radius",n);else{0==l&&(s=0,n=0);let t=n*r,o=n*a;"radial"==e?(this.setRaw("x",t),this.setRaw("y",o),s<90||s>270||"auto"!=i?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):"adjusted"==e?(this.setRaw("centerX",g),this.setRaw("centerY",g),this.setRaw("x",t),this.setRaw("y",o)):"regular"==e&&(this.setRaw("x",t),this.setRaw("y",o))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const e=this.get("textType","regular"),t=this.get("inside",!1);let i=0,s=0,a=this.get("labelAngle",0),r=this.localBounds(),l=r.right-r.left,n=r.bottom-r.top;if("radial"==e){if(this._flipped){let e=this.get("centerX");e instanceof p&&(l*=1-2*e.value),i=l*d(a),s=l*u(a)}}else t||"adjusted"!=e||(i=l/2*d(a),s=n/2*u(a));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(C,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(C,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:o.classNames.concat([C.className])});const j=Math.abs,S=Math.atan2,O=Math.cos,I=Math.max,M=Math.min,B=Math.sin,F=Math.sqrt,H=1e-12,X=Math.PI,Y=X/2,z=2*X;function V(e){return e>1?0:e<-1?X:Math.acos(e)}function W(e){return e>=1?Y:e<=-1?-Y:Math.asin(e)}function U(e){return e.innerRadius}function K(e){return e.outerRadius}function q(e){return e.startAngle}function E(e){return e.endAngle}function G(e){return e&&e.padAngle}function J(e,t,i,s,a,r,l,n){var o=i-e,h=s-t,c=l-a,u=n-r,d=u*o-c*h;if(!(d*d<H))return[e+(d=(c*(t-r)-u*(e-a))/d)*o,t+d*h]}function Q(e,t,i,s,a,r,l){var n=e-i,o=t-s,h=(l?r:-r)/F(n*n+o*o),c=h*o,u=-h*n,d=e+c,g=t+u,p=i+c,y=s+u,b=(d+p)/2,f=(g+y)/2,m=p-d,_=y-g,x=m*m+_*_,v=a-r,w=d*y-p*g,k=(_<0?-1:1)*F(I(0,v*v*x-w*w)),D=(w*_-m*k)/x,R=(-w*m-_*k)/x,A=(w*_+m*k)/x,P=(-w*m+_*k)/x,T=D-b,L=R-f,N=A-b,C=P-f;return T*T+L*L>N*N+C*C&&(D=A,R=P),{cx:D,cy:R,x01:-c,y01:-u,x11:D*(a/v-1),y11:R*(a/v-1)}}function Z(){var e=U,s=K,a=i(0),r=null,l=q,n=E,o=G,h=null,c=t(u);function u(){var t,i,u=+e.apply(this,arguments),d=+s.apply(this,arguments),g=l.apply(this,arguments)-Y,p=n.apply(this,arguments)-Y,y=j(p-g),b=p>g;if(h||(h=t=c()),d<u&&(i=d,d=u,u=i),d>H)if(y>z-H)h.moveTo(d*O(g),d*B(g)),h.arc(0,0,d,g,p,!b),u>H&&(h.moveTo(u*O(p),u*B(p)),h.arc(0,0,u,p,g,b));else{var f,m,_=g,x=p,v=g,w=p,k=y,D=y,R=o.apply(this,arguments)/2,A=R>H&&(r?+r.apply(this,arguments):F(u*u+d*d)),P=M(j(d-u)/2,+a.apply(this,arguments)),T=P,L=P;if(A>H){var N=W(A/u*B(R)),C=W(A/d*B(R));(k-=2*N)>H?(v+=N*=b?1:-1,w-=N):(k=0,v=w=(g+p)/2),(D-=2*C)>H?(_+=C*=b?1:-1,x-=C):(D=0,_=x=(g+p)/2)}var I=d*O(_),U=d*B(_),K=u*O(w),q=u*B(w);if(P>H){var E,G=d*O(x),Z=d*B(x),$=u*O(v),ee=u*B(v);if(y<X)if(E=J(I,U,$,ee,G,Z,K,q)){var te=I-E[0],ie=U-E[1],se=G-E[0],ae=Z-E[1],re=1/B(V((te*se+ie*ae)/(F(te*te+ie*ie)*F(se*se+ae*ae)))/2),le=F(E[0]*E[0]+E[1]*E[1]);T=M(P,(u-le)/(re-1)),L=M(P,(d-le)/(re+1))}else T=L=0}D>H?L>H?(f=Q($,ee,I,U,d,L,b),m=Q(G,Z,K,q,d,L,b),h.moveTo(f.cx+f.x01,f.cy+f.y01),L<P?h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,d,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),!b),h.arc(m.cx,m.cy,L,S(m.y11,m.x11),S(m.y01,m.x01),!b))):(h.moveTo(I,U),h.arc(0,0,d,_,x,!b)):h.moveTo(I,U),u>H&&k>H?T>H?(f=Q(K,q,G,Z,u,-T,b),m=Q(I,U,$,ee,u,-T,b),h.lineTo(f.cx+f.x01,f.cy+f.y01),T<P?h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,u,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),b),h.arc(m.cx,m.cy,T,S(m.y11,m.x11),S(m.y01,m.x01),!b))):h.arc(0,0,u,w,v,b):h.lineTo(K,q)}else h.moveTo(0,0);if(h.closePath(),t)return h=null,t+""||null}return u.centroid=function(){var t=(+e.apply(this,arguments)+ +s.apply(this,arguments))/2,i=(+l.apply(this,arguments)+ +n.apply(this,arguments))/2-X/2;return[O(i)*t,B(i)*t]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),u):e},u.outerRadius=function(e){return arguments.length?(s="function"==typeof e?e:i(+e),u):s},u.cornerRadius=function(e){return arguments.length?(a="function"==typeof e?e:i(+e),u):a},u.padRadius=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:i(+e),u):r},u.startAngle=function(e){return arguments.length?(l="function"==typeof e?e:i(+e),u):l},u.endAngle=function(e){return arguments.length?(n="function"==typeof e?e:i(+e),u):n},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:i(+e),u):o},u.context=function(e){return arguments.length?(h=e??null,u):h},u}class $ extends y{constructor(){super(...arguments),Object.defineProperty(this,"ix",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generator",{enumerable:!0,configurable:!0,writable:!0,value:Z()})}_getTooltipPoint(){let e=this.get("tooltipX"),t=this.get("tooltipY"),i=0,s=0;b(e)&&(i=e),b(t)&&(s=t);let a=this.get("radius",0),r=this.get("innerRadius",0);return a+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=a+r),e instanceof p&&(i=this.ix*(r+(a-r)*e.value)),t instanceof p&&(s=this.iy*(r+(a-r)*t.value)),this.get("arc")>=360&&0==r&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius")||this.isDirty("shiftRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let e=this.get("startAngle",0),t=this.get("arc",0);const i=this._generator;t<0&&(e+=t,t*=-1),t>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),a=this.get("innerRadius",0);s+=this.get("dRadius",0),a+=this.get("dInnerRadius",0),a<0&&(a=s+a),i({innerRadius:a,outerRadius:s,startAngle:(e+90)*n,endAngle:(e+t+90)*n});let r=e+t/2;this.ix=d(r),this.iy=u(r);const l=this.get("shiftRadius",0);this.setRaw("dx",this.ix*l),this.setRaw("dy",this.iy*l),this.markDirtyPosition()}}}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:y.classNames.concat([$.className])});class ee extends f{setupDefaultRules(){super.setupDefaultRules();const e=this._root.interfaceColors,t=this.rule.bind(this);t("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:T.new(this._root,{}),width:m,height:m}),t("PieChart").setAll({radius:_(80),startAngle:-90,endAngle:270}),t("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),t("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),t("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),t("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),t("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),t("Slice",["pie"]).states.create("hover",{scale:1.04}),t("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),t("Tick",["pie"]).setAll({location:1}),t("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),t("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),t("FunnelSlice").setAll({interactive:!0,expandDistance:0}),t("FunnelSlice").states.create("hover",{expandDistance:.15}),t("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["funnel","vertical"]).setAll({centerY:g,centerX:0}),t("Tick",["funnel"]).setAll({location:1}),t("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),t("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),t("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),t("PyramidSeries").setAll({valueIs:"area"}),t("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),t("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),t("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),t("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),t("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),t("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["pyramid","vertical"]).setAll({centerY:g,centerX:0}),t("Tick",["pyramid"]).setAll({location:1}),t("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),t("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["pictorial","vertical"]).setAll({centerY:g,centerX:0}),t("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),t("Tick",["pictorial"]).setAll({location:.5});{const i=t("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),L(i,"fill",e,"alternativeBackground")}}}class te extends s{_afterNew(){this._defaultThemes.push(ee.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(e){super._processSeries(e),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(te,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(te,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:s.classNames.concat([te.className])});class ie extends a{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this._makeSlices()}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this._makeLabels()}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this._makeTicks()})}makeSlice(e){const t=this.slicesContainer.children.push(this.slices.make());return t.on("fill",(()=>{this.updateLegendMarker(e)})),t.on("fillPattern",(()=>{this.updateLegendMarker(e)})),t.on("stroke",(()=>{this.updateLegendMarker(e)})),t._setDataItem(e),e.set("slice",t),this.slices.push(t),t}makeLabel(e){const t=this.labelsContainer.children.push(this.labels.make());return t._setDataItem(e),e.set("label",t),this.labels.push(t),t}_shouldMakeBullet(e){return null!=e.get("value")}makeTick(e){const t=this.ticksContainer.children.push(this.ticks.make());return t._setDataItem(e),e.set("tick",t),this.ticks.push(t),t}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const e=this.get("colors");e&&e.reset();const t=this.get("patterns");t&&t.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let e=0,t=0,i=0,s=1/0,a=0;v(this._dataItems,(i=>{let s=i.get("valueWorking",0);e+=s,t+=Math.abs(s)})),v(this._dataItems,(e=>{let r=e.get("valueWorking",0);r>i&&(i=r),r<s&&(s=r),a++;let l=r/t;0==t&&(l=0),e.setRaw("valuePercentTotal",100*l)})),this.setPrivateRaw("valueLow",s),this.setPrivateRaw("valueHigh",i),this.setPrivateRaw("valueSum",e),this.setPrivateRaw("valueAverage",e/a),this.setPrivateRaw("valueAbsoluteSum",t)}}show(t){const i=Object.create(null,{show:{get:()=>super.show}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.show.call(this,t)),e.push(this._sequencedShowHide(!0,t)),yield Promise.all(e)}))}hide(t){const i=Object.create(null,{hide:{get:()=>super.hide}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.hide.call(this,t)),e.push(this._sequencedShowHide(!1,t)),yield Promise.all(e)}))}_updateChildren(){super._updateChildren(),this._valuesDirty&&v(this._dataItems,(e=>{e.get("label").text.markDirtyText()})),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&v(this._dataItems,(e=>{this.updateLegendValue(e)})),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),v(this.dataItems,(e=>{this._updateTick(e)}))}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(e){if(super.processDataItem(e),null==e.get("fill")){let t=this.get("colors");t&&e.setRaw("fill",t.next())}if(null==e.get("fillPattern")){let t=this.get("patterns");t&&e.setRaw("fillPattern",t.next())}}showDataItem(t,i){const s=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.showDataItem.call(this,t,i)];b(i)||(i=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");let r=t.get("value");const l=t.animate({key:"valueWorking",to:r,duration:i,easing:a});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.show(i));const o=t.get("label");o&&e.push(o.show(i));const h=t.get("slice");h&&e.push(h.show(i)),h.get("active")&&h.states.applyAnimate("active"),yield Promise.all(e)}))}hideDataItem(t,i){const s=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.hideDataItem.call(this,t,i)],a=this.states.create("hidden",{});b(i)||(i=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),l=t.animate({key:"valueWorking",to:0,duration:i,easing:r});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.hide(i));const o=t.get("label");o&&e.push(o.hide(i));const h=t.get("slice");h.hideTooltip(),h&&e.push(h.hide(i)),yield Promise.all(e)}))}disposeDataItem(e){super.disposeDataItem(e);let t=e.get("label");t&&(this.labels.removeValue(t),t.dispose());let i=e.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=e.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(e){const t=e.get("slice");t&&!t.isHidden()&&t.hover()}unhoverDataItem(e){const t=e.get("slice");t&&t.unhover()}updateLegendMarker(e){if(e){const t=e.get("slice");if(t){const i=e.get("legendDataItem");if(i){const e=i.get("markerRectangle");v(w,(i=>{null!=t.get(i)&&e.set(i,t.get(i))}))}}}}_arrangeDown(e){if(e){let t=this._getNextDown();e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.top;e.y+s<t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.bottom}))}}_getNextUp(){return this.labelsContainer.maxHeight()}_getNextDown(){return 0}_arrangeUp(e){if(e){let t=this._getNextUp();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.bottom;e.y+s>t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.top}))}}_arrangeRight(e){if(e){let t=0;e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.left;e.y+s<t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.right}))}}_arrangeLeft(e){if(e){let t=this.labelsContainer.maxWidth();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.right;e.y+s>t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.left}))}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(e){}_dispose(){super._dispose();const e=this.chart;e&&e.series.removeValue(this)}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:a.classNames.concat([ie.className])});class se extends te{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:g,y:g})}_prepareChildren(){super._prepareChildren();const e=this.chartContainer,t=e.innerWidth(),i=e.innerHeight(),s=this.get("startAngle",0),a=this.get("endAngle",0),r=this.get("innerRadius");let l=k(0,0,s,a,1);const n=t/(l.right-l.left),o=i/(l.bottom-l.top);let c={left:0,right:0,top:0,bottom:0};if(r instanceof p){let e=r.value,l=Math.min(n,o);e=Math.max(l*e,l-Math.min(i,t))/l,c=k(0,0,s,a,e),this.setPrivateRaw("irModifyer",e/r.value)}l=D([l,c]);const u=this._maxRadius;this._maxRadius=Math.min(n,o);const d=h(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-d*(l.bottom+l.top)/2,dx:-d*(l.right+l.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||u!=this._maxRadius)&&this.series.each((e=>{e._markDirtyKey("startAngle")})),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each((e=>{e._markDirtyKey("innerRadius")}))}radius(e){let t=h(this.get("radius",0),this._maxRadius),i=h(this.get("innerRadius",0),t);if(e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("radius");return null!=r?i+h(r,t-i):i+(t-i)/a*(s+1)}return t}innerRadius(e){const t=this.radius();let i=h(this.get("innerRadius",0),t);if(i<0&&(i=t+i),e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("innerRadius");return null!=r?i+h(r,t-i):i+(t-i)/a*s}return i}_updateSize(){super._updateSize(),this.markDirtyKey("radius")}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([se.className])});class ae extends ie{_makeSlices(){return new R(A.new({}),(()=>$._new(this._root,{themeTags:P(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template])))}_makeLabels(){return new R(A.new({}),(()=>C._new(this._root,{themeTags:P(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template])))}_makeTicks(){return new R(A.new({}),(()=>r._new(this._root,{themeTags:P(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template])))}processDataItem(e){super.processDataItem(e);const t=this.makeSlice(e);t.on("scale",(()=>{this._updateTick(e)})),t.on("shiftRadius",(()=>{this._updateTick(e)})),t.events.on("positionchanged",(()=>{this._updateTick(e)}));const i=this.makeLabel(e);i.events.on("positionchanged",(()=>{this._updateTick(e)})),this.makeTick(e),t.events.on("positionchanged",(()=>{i.markDirty()}))}_getNextUp(){const e=this.chart;return e?e._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const e=this.chart;return e?-e._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const e=this.chart;if(e){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let t=e.get("textType");null!=t&&"aligned"!=t||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const t=this.get("startAngle",e.get("startAngle",-90)),i=this.get("endAngle",e.get("endAngle",270))-t;let s=t;const a=e.radius(this);this.setPrivateRaw("radius",a);let r=e.innerRadius(this)*e.getPrivate("irModifyer",1);r<0&&(r=a+r),v(this._dataItems,(e=>{this.updateLegendValue(e);let t=i*e.get("valuePercentTotal")/100;const l=e.get("slice");if(l){l.set("radius",a),l.set("innerRadius",r),l.set("startAngle",s),l.set("arc",t);const i=e.get("fill");l._setDefault("fill",i),l._setDefault("stroke",i);const n=e.get("fillPattern");l._setDefault("fillPattern",n)}let n=c(s+t/2);const o=e.get("label");if(o&&(o.setPrivate("radius",a),o.setPrivate("innerRadius",r),o.set("labelAngle",n),"aligned"==o.get("textType"))){let e=a+o.get("radius",0),t=a*u(n);n>90&&n<=270?(o.isHidden()||o.isHiding()||this._lLabels.push({label:o,y:t}),e*=-1,e-=this.labelsContainer.get("paddingLeft",0),o.set("centerX",m),o.setPrivateRaw("left",!0)):(o.isHidden()||o.isHiding()||this._rLabels.push({label:o,y:t}),e+=this.labelsContainer.get("paddingRight",0),o.set("centerX",0),o.setPrivateRaw("left",!1)),o.set("x",e),o.set("y",a*u(n))}s+=t,this._updateTick(e)}))}}}_updateTick(e){const t=e.get("tick"),i=e.get("label"),s=e.get("slice"),a=t.get("location",1);if(t&&i&&s){const e=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*a,r=i.get("labelAngle",0),l=d(r),n=u(r),o=this.labelsContainer,h=o.get("paddingLeft",0),c=o.get("paddingRight",0);let g=0,p=0;g=i.x(),p=i.y();let y=[];if(0!=g||0!=p){if("circular"==i.get("textType")){const e=i.radius()-i.get("paddingBottom",0),t=i.get("labelAngle",0);g=e*d(t),p=e*u(t)}let t=-c;i.getPrivate("left")&&(t=h),y=[{x:s.x()+e*l,y:s.y()+e*n},{x:g+t,y:p},{x:g,y:p}]}t.set("points",y)}}_positionBullet(e){const t=e.get("sprite");if(t){const i=t.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),a=i.get("radius",0),r=i.get("startAngle",0)+i.get("arc",0)*e.get("locationX",.5),l=s+(a-s)*e.get("locationY",.5);t.setAll({x:d(r)*l,y:u(r)*l})}}}}Object.defineProperty(ae,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(ae,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:ie.classNames.concat([ae.className])});export{se as PieChartAm5,ae as PieSeriesAm5};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as o,getActionStyles as s}from"../../support/actions/actionUtils.js";import a from"../Widget.js";import{getStatusIcon as l,getVisibilityIcon as r,listItemHasChildren as c,areChildrenHidden as d,canSortSublayers as p,getSingleAction as m,getItem as g}from"./support/layerListUtils.js";import{loadCalciteComponents as u}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as y}from"../support/widgetUtils.js";var b;let v=b=class extends a{constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.target.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer.uid,null)}}loadDependencies(){return u({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectedDragItemLayerUid:o,selectionMode:s,selectedItems:a,messages:l,parent:r,css:c}=this,d="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in l&&!i.visibleAtCurrentTimeExtent?`${t} (${l.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in l&&!i.visibleAtCurrentScale?`${t} (${l.layerInvisibleAtScale})`:t,p="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:m}=i;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(c.item,"itemActive"in c&&{[c.itemActive]:n===i}),"data-item":i,"data-layer-id":m.id,dragDisabled:!i.sortable||p,dragSelected:m.uid===o,id:m.uid,key:`list-item-${m.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==s&&a.includes(i),title:d,value:m.uid,onCalciteListItemDragHandleChange:e=>this._handleCalciteListItemDragHandleChange(e,i),onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,r),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,h("div",{class:this.classes(c.itemContent,"itemInvisible"in c&&{[c.itemInvisible]:"visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent}),slot:"content"},t),this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,a="connectionStatus"in e?e.connectionStatus:void 0,r=!!a;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:r},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:r&&"connected"===a}),icon:l({connectionStatus:a,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,a="temporaryTableIndicators"in t&&t.temporaryTableIndicators,l="persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||a)&&l?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,a=t?.visibilityMode;if("inherited"===a)return null;const l=r({visible:s,exclusive:"exclusive"===a,visibilityAppearance:n}),c="checkbox"===n,d=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:c?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:c?"actions-start":"actions-end",text:d,title:d},c?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==a&&s}),icon:l,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:o(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t="catalog-footprint"===this.item.layer?.type;return"itemCatalogIcon"in e&&t?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t="catalog-dynamic-group"===this.item.layer?.type;return"itemCatalogIcon"in e&&t?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o}=this;if(!("visible"in t))return;const s=[...this.parentTitles??[],t.title],{children:a,layer:l}=t,r="catalog-dynamic-group"!==l?.type&&c(t),m=!n&&d(l);return r||!m&&!r&&e&&"group"===l?.type?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,dragEnabled:!!e&&(t.childrenSortable&&p(t)),group:`${i}-${l.uid}`,key:`child-list-${l.uid}`,selectionAppearance:"border",selectionMode:o},a?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItem(e,t,s))),this._renderedTablesItem):null}get _hasTables(){const e=this.item.layer;return"knowledge-graph"===e?.type&&e?.tables?.length>0}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n.id,dragDisabled:!0,key:`list-item-table-list-tables-${n.uid}`,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("div",{class:i.itemContent,slot:"content"},t.tables),h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:m(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:s,disabled:a,title:l,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent",disabled:a,icon:o(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:l??"",textEnabled:n,title:l??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,a={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(a[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,a),key:"icon",styles:s(o)}):null}_renderItem(e,t,i=[]){return h(b,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer.uid&&y(e)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this.onSelectedDragItemLayerUidChange?.(i?t.layer.uid:null)}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};v.vnodeSelector="calcite-list-item",e([t()],v.prototype,"activeItem",void 0),e([t()],v.prototype,"canMove",void 0),e([t()],v.prototype,"css",void 0),e([t()],v.prototype,"dragEnabled",void 0),e([t()],v.prototype,"item",void 0),e([t()],v.prototype,"listModeDisabled",void 0),e([t()],v.prototype,"messages",void 0),e([t()],v.prototype,"messagesCommon",void 0),e([t()],v.prototype,"onAction",void 0),e([t()],v.prototype,"onPanelOpen",void 0),e([t()],v.prototype,"onCatalogOpen",void 0),e([t()],v.prototype,"onTablesOpen",void 0),e([t()],v.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],v.prototype,"onTooltipReferenceChange",void 0),e([t()],v.prototype,"parent",void 0),e([t()],v.prototype,"parentTitles",void 0),e([t()],v.prototype,"rootGroupUid",void 0),e([t()],v.prototype,"selectionMode",void 0),e([t()],v.prototype,"selectedItems",void 0),e([t()],v.prototype,"selectedDragItemLayerUid",void 0),e([t()],v.prototype,"visibleElements",void 0),e([t()],v.prototype,"visibilityAppearance",void 0),e([t()],v.prototype,"_title",null),e([t()],v.prototype,"_renderedItemStatus",null),e([t()],v.prototype,"_renderedItemTemporaryIcon",null),e([t()],v.prototype,"_renderedItemToggle",null),e([t()],v.prototype,"_renderedPanel",null),e([t()],v.prototype,"_renderedPanelAction",null),e([t()],v.prototype,"_renderedActions",null),e([t()],v.prototype,"_renderedActionMenu",null),e([t()],v.prototype,"_renderedActionMenuContent",null),e([t()],v.prototype,"_renderedCatalogFootprintIcon",null),e([t()],v.prototype,"_renderedCatalogDynamicIcon",null),e([t()],v.prototype,"_renderedCatalogSelectNode",null),e([t()],v.prototype,"_renderedChildList",null),e([t()],v.prototype,"_hasTables",null),e([t()],v.prototype,"_renderedTablesItem",null),e([t()],v.prototype,"_renderedItemMessage",null),e([t()],v.prototype,"_singleAction",null),e([t()],v.prototype,"_filteredSections",null),e([t()],v.prototype,"_actionsCount",null),v=b=e([i("esri.widgets.LayerList.LayerListItem")],v);const _=v;export{_ as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as o,getActionStyles as s}from"../../support/actions/actionUtils.js";import a from"../Widget.js";import{getStatusIcon as l,getVisibilityIcon as r,listItemHasChildren as c,areChildrenHidden as d,canSortSublayers as p,getSingleAction as m,getItem as g}from"./support/layerListUtils.js";import{loadCalciteComponents as u}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as y}from"../support/widgetUtils.js";var b;let v=b=class extends a{constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.target.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer.uid,null)}}loadDependencies(){return u({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectedDragItemLayerUid:o,selectionMode:s,selectedItems:a,messages:l,parent:r,css:c}=this,d="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in l&&!i.visibleAtCurrentTimeExtent?`${t} (${l.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in l&&!i.visibleAtCurrentScale?`${t} (${l.layerInvisibleAtScale})`:t,p="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:m}=i;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(c.item,"itemActive"in c&&{[c.itemActive]:n===i}),"data-item":i,"data-layer-id":m.id,dragDisabled:!i.sortable||p,dragSelected:m.uid===o,id:m.uid,key:`list-item-${m.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==s&&a.includes(i),title:d,value:m.uid,onCalciteListItemDragHandleChange:e=>this._handleCalciteListItemDragHandleChange(e,i),onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,r),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,h("div",{class:this.classes(c.itemContent,"itemInvisible"in c&&{[c.itemInvisible]:"visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent}),slot:"content"},t),this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,a="connectionStatus"in e?e.connectionStatus:void 0,r=!!a;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:r},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:r&&"connected"===a}),icon:l({connectionStatus:a,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,a="temporaryTableIndicators"in t&&t.temporaryTableIndicators,l="persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||a)&&l?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,a=t?.visibilityMode;if("inherited"===a)return null;const l=r({visible:s,exclusive:"exclusive"===a,visibilityAppearance:n}),c="checkbox"===n,d=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:c?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:c?"actions-start":"actions-end",text:d,title:d},c?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==a&&s}),icon:l,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:o(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t="catalog-footprint"===this.item.layer?.type;return"itemCatalogIcon"in e&&t?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t="catalog-dynamic-group"===this.item.layer?.type;return"itemCatalogIcon"in e&&t?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o}=this;if(!("visible"in t))return;const s=[...this.parentTitles??[],t.title],{children:a,layer:l}=t,r="catalog-dynamic-group"!==l?.type&&c(t),m=!n&&d(l);return r||!m&&!r&&e&&"group"===l?.type?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,dragEnabled:!!e&&(t.childrenSortable&&p(t)),group:`${i}-${l.uid}`,key:`child-list-${l.uid}`,selectionAppearance:"border",selectionMode:o},a?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItem(e,t,s))),this._renderedTablesItem):null}get _hasTables(){const{layerTablesEnabled:e}=this,t=this.item.layer;if(!e||!t)return!1;switch(t.type){case"knowledge-graph":return e.includes(t.type)&&!!t.tables?.length;case"map-image":case"tile":return e.includes(t.type)&&!!t.subtables?.length;default:return!1}}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n.id,dragDisabled:!0,key:`list-item-table-list-tables-${n.uid}`,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("div",{class:i.itemContent,slot:"content"},t.tables),h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:m(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:s,disabled:a,title:l,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent",disabled:a,icon:o(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:l??"",textEnabled:n,title:l??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,a={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(a[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,a),key:"icon",styles:s(o)}):null}_renderItem(e,t,i=[]){return h(b,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer.uid&&y(e)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this.onSelectedDragItemLayerUidChange?.(i?t.layer.uid:null)}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};v.vnodeSelector="calcite-list-item",e([t()],v.prototype,"activeItem",void 0),e([t()],v.prototype,"canMove",void 0),e([t()],v.prototype,"css",void 0),e([t()],v.prototype,"dragEnabled",void 0),e([t()],v.prototype,"item",void 0),e([t()],v.prototype,"layerTablesEnabled",void 0),e([t()],v.prototype,"listModeDisabled",void 0),e([t()],v.prototype,"messages",void 0),e([t()],v.prototype,"messagesCommon",void 0),e([t()],v.prototype,"onAction",void 0),e([t()],v.prototype,"onPanelOpen",void 0),e([t()],v.prototype,"onCatalogOpen",void 0),e([t()],v.prototype,"onTablesOpen",void 0),e([t()],v.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],v.prototype,"onTooltipReferenceChange",void 0),e([t()],v.prototype,"parent",void 0),e([t()],v.prototype,"parentTitles",void 0),e([t()],v.prototype,"rootGroupUid",void 0),e([t()],v.prototype,"selectionMode",void 0),e([t()],v.prototype,"selectedItems",void 0),e([t()],v.prototype,"selectedDragItemLayerUid",void 0),e([t()],v.prototype,"visibleElements",void 0),e([t()],v.prototype,"visibilityAppearance",void 0),e([t()],v.prototype,"_title",null),e([t()],v.prototype,"_renderedItemStatus",null),e([t()],v.prototype,"_renderedItemTemporaryIcon",null),e([t()],v.prototype,"_renderedItemToggle",null),e([t()],v.prototype,"_renderedPanel",null),e([t()],v.prototype,"_renderedPanelAction",null),e([t()],v.prototype,"_renderedActions",null),e([t()],v.prototype,"_renderedActionMenu",null),e([t()],v.prototype,"_renderedActionMenuContent",null),e([t()],v.prototype,"_renderedCatalogFootprintIcon",null),e([t()],v.prototype,"_renderedCatalogDynamicIcon",null),e([t()],v.prototype,"_renderedCatalogSelectNode",null),e([t()],v.prototype,"_renderedChildList",null),e([t()],v.prototype,"_hasTables",null),e([t()],v.prototype,"_renderedTablesItem",null),e([t()],v.prototype,"_renderedItemMessage",null),e([t()],v.prototype,"_singleAction",null),e([t()],v.prototype,"_filteredSections",null),e([t()],v.prototype,"_actionsCount",null),v=b=e([i("esri.widgets.LayerList.LayerListItem")],v);const _=v;export{_ 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{watch as a}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{css as d}from"./LayerList/css.js";import m from"./LayerList/LayerListItem.js";import p from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import g from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as f,getItem as I,getLayerType as _,sortLayersToIds as y,sortChildLayersToIds as v}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as b}from"./support/globalCss.js";import{calciteListFilterProps as w}from"./support/listUtils.js";import{setFocus as C}from"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";const T=t.ofType(g);let j=class extends(o(c)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusTableListFlowItem=!1,this._focusCatalogFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=f,this.openCatalogItem=null,this.openTableListItem=null,this.selectedItems=new T,this.selectionMode="none",this.tableList=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=I(e);if(!l?.sortable)return!1;const a=I(t),r=_(t),n=I(i),c=_(i),d=!!r&&!!c&&r===c,m={selected:l,from:a,to:n},p=t.group,h=i.group,g=a?.layer?.type??"",u=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return p&&h&&"function"==typeof s?s.call(null,m):d&&!f.has(g)&&!f.has(u)&&l?.layer?.type!==y},this._onCatalogOpen=e=>{this.openCatalogItem=e.parent,this._focusCatalogFlowItem=!0},this._onTablesOpen=e=>{this.openTableListItem=e,this._focusTableListFlowItem=!0},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(d.item)));this._activeItem=I(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([a((()=>this.openCatalogItem),(e=>e?this._createCatalog():this._destroyCatalog())),a((()=>this.openTableListItem),(e=>e?this._createTableList():this._destroyTableList()))])}loadDependencies(){return L({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._destroyTableList(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get multipleSelectionEnabled(){return i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.selectionEnabled?"single":"none"}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get selectionEnabled(){return i(s.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled}set selectionEnabled(e){i(s.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[b.hidden]:"loading"===e,[b.disabled]:"disabled"===e},i=this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return M("div",{class:this.classes(d.base,b.widget,b.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?M("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return M("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return M("div",{class:d.itemMessage,key:"esri-layer-list__no-items"},M("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_destroyCatalog(){this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_destroyTableList(){this.tableList?.destroy(),this._set("tableList",null)}async _createCatalog(){this._destroyCatalog();const{default:e}=await import("./CatalogLayerList.js"),{headingLevel:t,catalogOptions:i,view:o,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n}=this,c=this.openCatalogItem?.layer;this._set("catalogLayerList",new e({headingLevel:t,view:o,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,...i,catalogLayer:c}))}_getTableListParams(e){const t=e?.layer;return"knowledge-graph"===t?.type?{...this.knowledgeGraphOptions,tables:t.tables}:null}async _createTableList(){this._destroyTableList();const{default:e}=await import("./TableList.js"),t=this._getTableListParams(this.openTableListItem);if(!t?.tables?.length)return;const{headingLevel:i,selectionMode:o,dragEnabled:s}=this;this._set("tableList",new e({headingLevel:i,selectionMode:o,dragEnabled:s,...t}))}_renderCatalogFlowItem(){const{openCatalogItem:e,messages:t}=this;if(!e)return null;const i=e.title||this.messages.untitledLayer;return M("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openCatalogItem=null,this._focusRootFlowItem=!0}},this.catalogLayerList?.render())}_renderTableListFlowItem(){const{openTableListItem:e,messages:t}=this;if(!e)return null;const i=e.title||this.messages.untitledLayer;return M("calcite-flow-item",{afterCreate:this._focusTableListFlowItemNode,afterUpdate:this._focusTableListFlowItemNode,bind:this,description:i,heading:t.tables,headingLevel:this.headingLevel,key:`flow-table-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openTableListItem=null,this._focusRootFlowItem=!0}},this.tableList?.render())}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return M("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),M("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,C(e))}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,C(e))}_focusTableListFlowItemNode(e){this._focusTableListFlowItem&&(this._focusTableListFlowItem=!1,C(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,C(e))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:a,heading:r,flow:n},_dragEnabled:c,selectionMode:m,filterText:p,filterPlaceholder:h,messages:g}=this,u=[M("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:a,heading:r?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},M("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":s,dragEnabled:c,filterEnabled:o,filterPlaceholder:h,filterProps:w,filterText:o?p:"",group:s,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?M("div",{class:d.filterNoResults,slot:"filter-no-results"},M("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e),this._renderTableListFlowItem(),this._renderCatalogFlowItem()];return t?n?M("calcite-flow",{key:"root-flow"},u):u:null}_renderItem(e,t,i){return M(m,{activeItem:this._activeItem,canMove:this._canMove,css:d,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=I(i),l=I(e),a=I(t);this.viewModel.moveListItem(s,a,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid)y(this.view?.map?.layers,t);else{const i=I(e);if(!i)return;v(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>I(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([r()],j.prototype,"_activeItem",void 0),e([r()],j.prototype,"_tooltipReferenceMap",void 0),e([r()],j.prototype,"_focusRootFlowItem",void 0),e([r()],j.prototype,"_focusPanelFlowItem",void 0),e([r()],j.prototype,"_focusTableListFlowItem",void 0),e([r()],j.prototype,"_focusCatalogFlowItem",void 0),e([r()],j.prototype,"_totalItems",null),e([r()],j.prototype,"_dragEnabled",null),e([r()],j.prototype,"_filterEnabled",null),e([r({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([r()],j.prototype,"catalogOptions",void 0),e([r()],j.prototype,"collapsed",void 0),e([r()],j.prototype,"dragEnabled",void 0),e([r()],j.prototype,"filterPlaceholder",void 0),e([r()],j.prototype,"filterText",void 0),e([r()],j.prototype,"headingLevel",void 0),e([r()],j.prototype,"icon",null),e([r()],j.prototype,"knowledgeGraphOptions",void 0),e([r()],j.prototype,"label",null),e([r()],j.prototype,"listItemCanGiveFunction",void 0),e([r()],j.prototype,"listItemCanReceiveFunction",void 0),e([r()],j.prototype,"listItemCreatedFunction",null),e([r(),E("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([r(),E("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([r()],j.prototype,"minDragEnabledItems",void 0),e([r()],j.prototype,"minFilterItems",void 0),e([r()],j.prototype,"multipleSelectionEnabled",null),e([r()],j.prototype,"openCatalogItem",void 0),e([r()],j.prototype,"openTableListItem",void 0),e([r()],j.prototype,"operationalItems",null),e([r()],j.prototype,"selectionEnabled",null),e([r()],j.prototype,"selectedItems",void 0),e([r()],j.prototype,"selectionMode",void 0),e([r({readOnly:!0})],j.prototype,"tableList",void 0),e([r()],j.prototype,"view",null),e([F("trigger-action"),r({type:p})],j.prototype,"viewModel",void 0),e([r()],j.prototype,"visibilityAppearance",void 0),e([r({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const A=j;export{A as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{css as p}from"./LayerList/css.js";import m from"./LayerList/LayerListItem.js";import h from"./LayerList/LayerListViewModel.js";import u from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as g,minFilterItems as f,getItem as L,getLayerType as _,sortLayersToIds as v,sortChildLayersToIds as I}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as C}from"./support/widgetUtils.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";const T=t.ofType(y);let j=class extends(o(c)){constructor(e,i){super(e,i),this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=g,this.minFilterItems=f,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new T,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new h,this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=L(e);if(!l?.sortable)return!1;const r=L(t),a=_(t),n=L(i),d=_(i),c=!!a&&!!d&&a===d,p={selected:l,from:r,to:n},m=t.group,h=i.group,u=r?.layer?.type??"",y=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,p):c&&!g.has(u)&&!g.has(y)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer.parent),this._focusLayerFlowItem=e.layer.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=L(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles(r((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),a))}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){return this.openedLayers.toArray().map((e=>this._renderLayerFlowItem(e)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get multipleSelectionEnabled(){return i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.selectionEnabled?"single":"none"}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get selectionEnabled(){return i(s.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled}set selectionEnabled(e){i(s.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e},i=this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return O("div",{class:this.classes(p.base,w.widget,w.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?O("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return O("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return O("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},O("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:c,_onTablesOpen:p,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:c,onTablesOpen:p})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e){const{messages:t,openedLayers:i}=this,o=e.title||this.messages.untitledLayer;return O("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:t["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i.pop();const t=i.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return O("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),O("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,C(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,C(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,C(e))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:r,heading:a,flow:n},_dragEnabled:d,selectionMode:c,filterText:m,filterPlaceholder:h,messages:u}=this,y=[O("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:r,heading:a?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},O("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":s,dragEnabled:d,filterEnabled:o,filterPlaceholder:h,filterProps:E,filterText:o?m:"",group:s,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?O("div",{class:p.filterNoResults,slot:"filter-no-results"},O("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e),this._renderedOpenLayerFlowItems];return t?n?O("calcite-flow",{key:"root-flow"},y):y:null}_renderItem(e,t,i){return O(m,{activeItem:this._activeItem,canMove:this._canMove,css:p,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=L(i),l=L(e),r=L(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid)v(this.view?.map?.layers,t);else{const i=L(e);if(!i)return;I(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>L(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([n()],j.prototype,"_activeItem",void 0),e([n()],j.prototype,"_tooltipReferenceMap",void 0),e([n()],j.prototype,"_focusRootFlowItem",void 0),e([n()],j.prototype,"_focusPanelFlowItem",void 0),e([n()],j.prototype,"_focusLayerFlowItem",void 0),e([n()],j.prototype,"_layerListMap",void 0),e([n()],j.prototype,"_totalItems",null),e([n()],j.prototype,"_dragEnabled",null),e([n()],j.prototype,"_filterEnabled",null),e([n()],j.prototype,"_renderedOpenLayerFlowItems",null),e([n({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([n()],j.prototype,"catalogOptions",void 0),e([n()],j.prototype,"collapsed",void 0),e([n()],j.prototype,"dragEnabled",void 0),e([n()],j.prototype,"filterPlaceholder",void 0),e([n()],j.prototype,"filterText",void 0),e([n()],j.prototype,"headingLevel",void 0),e([n()],j.prototype,"icon",null),e([n()],j.prototype,"knowledgeGraphOptions",void 0),e([n()],j.prototype,"label",null),e([n()],j.prototype,"layerTablesEnabled",void 0),e([n()],j.prototype,"listItemCanGiveFunction",void 0),e([n()],j.prototype,"listItemCanReceiveFunction",void 0),e([n()],j.prototype,"listItemCreatedFunction",null),e([n()],j.prototype,"mapImageOptions",void 0),e([n(),F("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([n(),F("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([n()],j.prototype,"minDragEnabledItems",void 0),e([n()],j.prototype,"minFilterItems",void 0),e([n()],j.prototype,"multipleSelectionEnabled",null),e([n({readOnly:!0})],j.prototype,"openedLayers",void 0),e([n({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([n()],j.prototype,"operationalItems",null),e([n()],j.prototype,"selectionEnabled",null),e([n()],j.prototype,"selectedItems",void 0),e([n()],j.prototype,"selectionMode",void 0),e([n({readOnly:!0})],j.prototype,"tableList",void 0),e([n()],j.prototype,"tileOptions",void 0),e([n()],j.prototype,"view",null),e([M("trigger-action"),n({type:h})],j.prototype,"viewModel",void 0),e([n()],j.prototype,"visibilityAppearance",void 0),e([n({type:u,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([d("esri.widgets.LayerList")],j);const A=j;export{A as default};