@arcgis/core 4.27.0-next.20230420 → 4.27.0-next.20230421
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
- package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
- package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
- package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
- package/assets/esri/core/workers/chunks/{852b4a6c0f3feb57cf54.js → 1db5e4c8244dbc21590c.js} +1 -1
- package/assets/esri/core/workers/chunks/{f0953e41d1653e66ba57.js → 2a1a5a1969e80a10dcca.js} +1 -1
- package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
- package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
- package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
- package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b647446a6a27798c5cf.js → 47bf38d910e71ac39bb8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
- package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
- package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
- package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
- package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
- package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
- package/assets/esri/core/workers/chunks/{b2358c2e27be7a5709cf.js → 6adb58f1bffc5d1c03bd.js} +1 -1
- package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
- package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
- package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
- package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
- package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{89e8ba4fc325838bf1a9.js → 88f9dededcf60fd011ef.js} +1 -1
- package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
- package/assets/esri/core/workers/chunks/{f11ec68ceb7c973cde74.js → 8ae7fea9f7fda38dd207.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
- package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
- package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
- package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
- package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
- package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
- package/assets/esri/core/workers/chunks/{25862269952c1bda910f.js → b833b4ea2973bb16792e.js} +1 -1
- package/assets/esri/core/workers/chunks/{e50d1afdc878258c437e.js → be4aa835a7abfc809126.js} +1 -1
- package/assets/esri/core/workers/chunks/{4fed7c08b5f4de23bb75.js → c2ec6e904f96173a7b83.js} +1 -1
- package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
- package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
- package/assets/esri/core/workers/chunks/{b28883e2a13f360310b3.js → c727d38f71e52bee17e1.js} +1 -1
- package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
- package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
- package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
- package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
- package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
- package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
- package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
- package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
- package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
- package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
- package/assets/esri/core/workers/chunks/{3dff550c29115dd625fa.js → f1a4165c2710ca90e5ea.js} +1 -1
- package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
- package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
- package/chunks/WaterSurface.glsl.js +35 -20
- package/chunks/index.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/Promise.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/watchUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/intl/messages.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TileKey.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/request.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/styleUtils.js +1 -1
- package/symbols/support/symbolLayerUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/layers/support/webStyleUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +5 -0
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ViewAnimation.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/support/QueueProcessor.js +1 -1
- package/views/ui/DefaultUI.js +1 -1
- package/views/ui/UI.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/deprecationUtils.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/Popup.js +1 -1
- package/assets/esri/core/workers/chunks/0cec1c16b25406858ae6.js +0 -1
- package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
- package/assets/esri/core/workers/chunks/337d59d624ef8a89aae5.js +0 -1
- package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
- package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
- package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
- package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
- package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
- package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
- package/assets/esri/core/workers/chunks/7e67e071789c6d264280.js +0 -1
- package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
- package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
- package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
- package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
- package/assets/esri/core/workers/chunks/914a0c78c80aa897b1a1.js +0 -1
- package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
- package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
- package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
- package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
- package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
- package/assets/esri/core/workers/chunks/c564055cb906857c8641.js +0 -1
- package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
- package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
- package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
- package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
- package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
- /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
package/widgets/Popup.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{eventKey as o}from"../core/events.js";import n from"../core/Handles.js";import s from"../core/Logger.js";import{watch as r,when as l,on as a,whenOnce as c,initial as u}from"../core/reactiveUtils.js";import{throttle as d}from"../core/throttle.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import m from"./Feature.js";import f from"./Spinner.js";import v from"./Widget.js";import{CSS as _}from"./Feature/resources.js";import{FeatureContentMixin as w}from"./Feature/support/FeatureContentMixin.js";import{getPointFromGeometry as b}from"./Popup/actionUtils.js";import{CSS as M}from"./Popup/css.js";import y from"./Popup/PopupViewModel.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as A}from"./support/Heading.js";import{accessibleHandler as C}from"./support/decorators/accessibleHandler.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import{storeNode as x,cssTransition as E,isRTL as N}from"./support/widgetUtils.js";import{isDarkTheme as B}from"../support/themeUtils.js";import{substitute as P}from"../intl/substitute.js";const D="selected-index",T=0,S="popup-spinner",L={buttonEnabled:!0,position:"auto",breakpoint:{width:544}},R="esri-popup";function V(e,t){return void 0===t?`${R}__${e}`:`${R}__${e}-${t}`}const j={closeButton:!0,featureNavigation:!0};let U=class extends(w(v)){constructor(e,i){super(e,i),this._blurClose=!1,this._blurContainer=!1,this._containerNode=null,this._mainContainerNode=null,this._featureMenuNode=null,this._actionsMenuNode=null,this._focusClose=!1,this._focusContainer=!1,this._focusDockButton=!1,this._focusFeatureMenuButton=!1,this._focusActionsMenuButton=!1,this._focusFirstFeature=!1,this._focusFirstAction=!1,this._handles=new n,this._pointerOffsetInPx=16,this._spinner=null,this._feature=null,this._featureMenuIntersectionObserverNode=null,this._featureMenuViewportNode=null,this._rootFlowItemNode=null,this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._displaySpinnerThrottled=d((()=>this._displaySpinner()),T),this._exitRelatedRecordsActions=new WeakMap,this._featureSelectionActions=new WeakMap,this._flowItems=new t,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.messagesCommon=null,this.spinnerEnabled=!0,this.viewModel=new y,this.visibleElements={...j},this._handleOpenRelatedFeature=e=>{this._openRelatedFeature(e)},this._addSelectedFeatureIndexHandle(),this.addHandles([r((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),r((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),r((()=>this.viewModel?.screenLocation),((e,t)=>{!!e!=!!t&&this.reposition()})),r((()=>[this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),r((()=>this.spinnerEnabled),(e=>this._spinnerEnabledChange(e))),r((()=>this.viewModel?.view?.size),((e,t)=>this._updateDockEnabledForViewSize(e,t))),r((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),r((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),r((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),r((()=>this.selectedFeatureWidget),(()=>this._destroyFlowItemWidgets())),r((()=>[this.selectedFeatureWidget?.viewModel?.title,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setTitleFromFeatureWidget())),r((()=>[this.selectedFeatureWidget?.viewModel?.content,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setContentFromFeatureWidget())),l((()=>!this.collapsed),(()=>{"xsmall"===this.viewModel?.view?.widthBreakpoint&&this.viewModel.active&&this.collapseEnabled&&this.viewModel.centerAtLocation()})),a((()=>this.viewModel?.allActions),"change",(()=>this._watchActions())),r((()=>this.viewModel?.allActions),(()=>this._watchActions()),u),r((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),a((()=>this._flowItems),"change",(()=>{this.notifyChange("_activeFlowItemWidget"),this.scheduleRender()})),r((()=>[this._activeFlowItemWidget?.viewModel?.state,this._activeFlowItemWidget?.viewModel?.title]),(()=>this.scheduleRender()))])}loadDependencies(){return k({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._destroyFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._handles?.destroy(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect()}get actionsMenuId(){return`${this.id}-actions-menu`}get actionsMenuButtonId(){return`${this.id}-actions-menu-button`}get featureMenuId(){return`${this.id}-feature-menu`}get titleId(){return`${this.id}-popup-title`}get contentId(){return`${this.id}-popup-content`}get hasContent(){const{selectedFeatureWidget:e,viewModel:t}=this;if(!e)return!!t?.content;const i=e.viewModel;if(i?.waitingForContent||"error"===i?.state)return!0;const o=i?.content;return Array.isArray(o)?!!o.length:!!o}get featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&null!=this.visibleElements.featureNavigation}get collapsible(){return!!(this.collapseEnabled&&this.viewModel.title&&this.hasContent)}get featureMenuVisible(){return this.featureNavigationVisible&&this.featureMenuOpen}get contentCollapsed(){return this.collapsible&&!this.featureMenuVisible&&this.collapsed}get dividedActions(){return this._divideActions()}get _activeFlowItemWidget(){const{_flowItems:e}=this;return e.getItemAt(e.length-1)||null}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}set actionsMenuOpen(e){this._set("actionsMenuOpen",!!e)}get actionsMenuOpen(){return!!this.viewModel.active&&this._get("actionsMenuOpen")}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get autoOpenEnabled(){return i(s.getLogger(this.declaredClass),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(e){i(s.getLogger(this.declaredClass),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||L}set dockOptions(e){const t={...L},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,visibleElements:t,headingLevel:i,_flowItems:o}=this,{selectedFeatureViewModel:n}=this.viewModel,s={...t,title:!1};return n?(e?(e.viewModel=n,e.visibleElements=s):this._feature=new m({flowItems:o,headingLevel:i+1,viewModel:n,visibleElements:s}),this._feature):null}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}castVisibleElements(e){return{...j,...e}}blur(){const{active:e}=this.viewModel;e||s.getLogger(this.declaredClass).warn("Popup can only be blurred when currently active."),this.visibleElements.closeButton?this._blurClose=!0:this._blurContainer=!0,this.scheduleRender()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||s.getLogger(this.declaredClass).warn("Popup can only be focused when currently active."),this.visibleElements.closeButton?this._focusClose=!0:this._focusContainer=!0,this.scheduleRender()}next(){return this.viewModel.next()}open(e){this._handles.remove(D);const t=!!e&&!!e.featureMenuOpen,i=!!e&&!!e.actionsMenuOpen,o={collapsed:!!e&&!!e.collapsed,actionsMenuOpen:i,featureMenuOpen:t};"xsmall"===this.viewModel?.view?.widthBreakpoint&&(o.collapsed=!0),this.set(o),this.viewModel.open(e),this._shouldFocus(e),this._addSelectedFeatureIndexHandle()}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{actionsMenuOpen:e,dockEnabled:t,featureMenuVisible:i,dividedActions:o,currentAlignment:n,currentDockPosition:s}=this,{active:r}=this.viewModel,{menuActions:l}=o,a=r&&l.length>1&&e,c=r&&t,u=r&&!t,d=this.selectedFeature?.layer?.title,h=this.selectedFeature?.layer?.id,p={[M.alignTopCenter]:"top-center"===n,[M.alignBottomCenter]:"bottom-center"===n,[M.alignTopLeft]:"top-left"===n,[M.alignBottomLeft]:"bottom-left"===n,[M.alignTopRight]:"top-right"===n,[M.alignBottomRight]:"bottom-right"===n,[M.isDocked]:c,[M.shadow]:u,[M.isDockedTopLeft]:"top-left"===s,[M.isDockedTopCenter]:"top-center"===s,[M.isDockedTopRight]:"top-right"===s,[M.isDockedBottomLeft]:"bottom-left"===s,[M.isDockedBottomCenter]:"bottom-center"===s,[M.isDockedBottomRight]:"bottom-right"===s,[M.isFeatureMenuOpen]:i,[M.isActionsMenuOpen]:a};return O("div",{class:this.classes(M.base,p),role:"presentation","data-layer-title":d,"data-layer-id":h,bind:this,afterCreate:this._positionContainer,afterUpdate:this._positionContainer},r?[this.renderMainContainer(),this.renderPointer()]:null)}renderLoadingIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconLoading,M.rotating)})}renderNavigationLoading(){const{messagesCommon:e}=this;return this.viewModel.pendingPromisesCount?O("div",{key:V("loading-container"),role:"presentation",class:M.loadingContainer,"aria-label":e.loading,title:e.loading},this.renderLoadingIcon()):null}renderPreviousButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._previous,onkeydown:this._previous,class:this.classes(M.button,M.paginationPrevious),"aria-label":e.previous,title:e.previous},O("calcite-icon",{icon:"chevron-left",scale:"s",class:M.paginationIcon}))}renderNextButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._next,onkeydown:this._next,class:this.classes(M.button,M.paginationNext),"aria-label":e.next,title:e.next},O("calcite-icon",{icon:"chevron-right",scale:"s",class:M.paginationIcon}))}renderFeatureMenuButton(){const{featureMenuOpen:e,featureMenuId:t,messagesCommon:i}=this,{featureCount:o,selectedFeatureIndex:n}=this.viewModel;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._toggleFeatureMenu,onkeydown:this._toggleFeatureMenu,afterCreate:this._focusFeatureMenuButtonNode,afterUpdate:this._focusFeatureMenuButtonNode,class:M.featureMenuButton,"aria-haspopup":"true","aria-controls":t,"aria-expanded":e.toString(),"aria-label":i.menu,title:i.menu},O("calcite-icon",{icon:"list-bullet",scale:"s",class:M.featureMenuButtonIcon}),this._getPageText(o,n))}renderNavigationButtons(){return this.featureNavigationVisible?[this.renderPreviousButton(),this.renderNextButton(),this.renderNavigationLoading()||this.renderFeatureMenuButton()]:[]}renderDockIcon(){const{dockEnabled:e}=this,t=this._wouldDockTo(),i={[M.iconUndock]:e,[M.iconDock]:!e,[M.iconDockToRight]:!e&&("top-right"===t||"bottom-right"===t),[M.iconDockToLeft]:!e&&("top-left"===t||"bottom-left"===t),[M.iconDockToTop]:!e&&"top-center"===t,[M.iconDockToBottom]:!e&&"bottom-center"===t};return O("span",{"aria-hidden":"true",class:this.classes(i,M.icon)})}renderDockButton(){const{dockEnabled:e,messages:t}=this,i=this.viewModel?.view?.widthBreakpoint,o=e?t.undock:t.dock;return"xsmall"!==i&&this.dockOptions?.buttonEnabled?O("div",{role:"button","aria-label":o,title:o,tabIndex:0,bind:this,onclick:this._toggleDockEnabled,onkeydown:this._toggleDockEnabled,afterCreate:this._focusDockButtonNode,afterUpdate:this._focusDockButtonNode,class:this.classes(M.button,M.buttonDock)},this.renderDockIcon()):null}renderTitle(){const{title:e}=this.viewModel,{titleId:t,collapsible:i,contentCollapsed:o,messagesCommon:n}=this,s={[M.headerContainerButton]:i},r=O(A,{level:this.headingLevel,class:M.headerTitle,innerHTML:e??""}),l=i?O("button",{key:`${e}--collapsible`,id:t,title:o?n.expand:n.collapse,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s),"aria-expanded":o?"false":"true",onclick:this._toggleCollapsed,type:"button"},r,O("calcite-icon",{class:M.collapseIcon,key:"collapse-icon",icon:o?"chevron-down":"chevron-up",scale:"m"})):O("div",{key:e??"title",id:t,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s)},r);return e?l:null}renderCloseIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconClose)})}renderCloseButton(){const{visibleElements:e,messagesCommon:t}=this;return e.closeButton?O("div",{role:"button",tabIndex:0,bind:this,onclick:this._close,onkeydown:this._close,class:M.button,"aria-label":t.close,title:t.close,afterCreate:this._closeButtonNodeUpdated,afterUpdate:this._closeButtonNodeUpdated},this.renderCloseIcon()):null}renderHeader(){return O("header",{class:M.header},this.renderTitle(),O("div",{class:M.headerButtons},this.renderDockButton(),this.renderCloseButton()))}renderContentContainer(){const{contentId:e,hasContent:t,contentCollapsed:i,_flowItems:o}=this,{content:n}=this.viewModel,s=o.toArray(),r={[M.contentHasFlows]:!!s.length};return t&&!i?O("div",{key:n??"content",enterAnimation:this._createFeatureUpdatedAnimation(),id:e,class:this.classes(M.content,r)},O("calcite-flow",{bind:this},O("calcite-flow-item",{bind:this,"data-node-ref":"_rootFlowItemNode",afterCreate:x,key:"root-flow-item",onCalciteFlowItemBack:this._handleBackClick},this.renderContent()),s.map((e=>this.renderFlowItem(e)))),s.map((e=>this.renderFlowItemTooltips(e)))):null}renderFlowItem(e){const{messages:t}=this,i=B(),o="graphic"in e&&!e.isTable;return O("calcite-flow-item",{bind:this,class:this.classes({[M.calciteThemeDark]:!i,[M.calciteThemeLight]:i}),heading:e.title??"",description:this._getFlowItemDescription(e),onCalciteFlowItemBack:this._handleBackClick,key:`flow-item-${e.viewModel.uid}`},O("calcite-action",{class:M.actionExit,icon:"move-up",label:t?.exitRelatedRecords,text:t?.exitRelatedRecords,slot:"header-actions-start",bind:this,afterCreate:t=>this._storeExitRelatedRecordsAction(e,t),onclick:this._destroyFlowItemWidgets}),o?O("calcite-action",{class:M.actionSelectFeature,icon:"zoom-to-object",label:t?.selectFeature,text:t?.selectFeature,slot:"header-actions-end",bind:this,afterCreate:t=>this._storeFeatureSelectionAction(e,t),onclick:()=>this._handleOpenRelatedFeature(e)}):null,O("div",{class:this.classes(M.contentFlowItem,{[M.calciteThemeDark]:i,[M.calciteThemeLight]:!i})},e.render()))}renderFlowItemTooltips(e){const{messages:t,_exitRelatedRecordsActions:i,_featureSelectionActions:o}=this,n=B(),s=o.get(e);return[O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`exit-related-records-tooltip-${e.viewModel.uid}`,label:t?.exitRelatedRecords,overlayPositioning:"fixed",referenceElement:i.get(e),placement:"top"},t?.exitRelatedRecords),s?O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`select-related-record-tooltip-${e.viewModel.uid}`,label:t?.selectFeature,overlayPositioning:"fixed",referenceElement:s,placement:"top"},t?.selectFeature):null]}renderActionsMenuButton(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o,messagesCommon:n}=this,s=i?n.close:n.open,{menuActions:r}=o;return r.length?O("div",{key:V("actions-menu-button"),class:this.classes(M.button,M.actionsMenuButton),role:"button",id:t,"aria-haspopup":"true","aria-controls":i?e:null,tabIndex:0,bind:this,onclick:this._toggleActionsMenu,onkeydown:this._toggleActionsMenu,afterCreate:this._focusActionsMenuButtonNode,afterUpdate:this._focusActionsMenuButtonNode,"aria-label":s,title:s},O("span",{"aria-hidden":"true",class:M.iconActionsMenu})):null}renderMenuActions(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o}=this,{menuActions:n}=o;return n.length&&i?O("ul",{id:e,role:"menu","aria-labelledby":t,key:V("actions"),class:M.actions,bind:this,onkeyup:this._handleActionMenuKeyup,afterCreate:this._actionsMenuNodeUpdated,afterUpdate:this._actionsMenuNodeUpdated},n.toArray().map((e=>this.renderAction({action:e,type:"menu-item"})))):null}renderInlineActions(){const{inlineActions:e}=this.dividedActions;return e.length?e.toArray().map((e=>this.renderAction({action:e,type:"inline"}))):[]}renderInlineActionsContainer(){const{inlineActions:e,menuActions:t}=this.dividedActions,i=!!e.length,o=!!t.length;return i||o?O("div",{key:"inline-actions-container","data-inline-actions":i.toString(),"data-menu-actions":o.toString(),class:M.inlineActionsContainer},this.renderInlineActions(),this.renderActionsMenuButton(),this.renderMenuActions()):null}renderNavigation(){return this.featureNavigationVisible?O("section",{key:V("navigation"),class:this.classes(M.navigation)},this.renderNavigationButtons()):null}renderFooter(){const{featureNavigationVisible:e,dividedActions:t}=this,{inlineActions:i,menuActions:o}=t,n=!!i.length,s=!!o.length,r={[M.footerHasPagination]:e,[M.footerHasActions]:n,[M.footerHasActionsMenu]:s};return e||n?O("div",{key:V("feature-buttons"),class:this.classes(M.footer,r)},this.renderInlineActionsContainer(),this.renderNavigation()):null}renderFeatureMenuContainer(){const{messages:e}=this,{featureViewModels:t,isLoadingFeature:i}=this.viewModel,o=P(e.selectedFeatures,{total:t.length});return O("section",{key:V("menu"),class:M.featureMenu},O("strong",{class:M.featureMenuHeader},o),O("nav",{bind:this,class:M.featureMenuViewport,"data-node-ref":"_featureMenuViewportNode",afterCreate:x},this.renderFeatureMenu(),O("div",{class:M.featureMenuObserver,bind:this,afterCreate:this._featureMenuIntersectionObserverCreated}),i?O("div",{class:M.featureMenuLoader},this.renderLoadingIcon()):null))}renderPointer(){return this.dockEnabled?null:O("div",{key:V("pointer"),class:M.pointer,role:"presentation"},O("div",{class:this.classes(M.pointerDirection,M.shadow)}))}renderMainContainer(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i,titleId:o,contentId:n,collapsible:s,hasContent:r,contentCollapsed:l,visibleElements:a}=this,{title:c}=this.viewModel,u="bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===i||"top-center"===i||"top-right"===i,d="top-left"===t||"top-center"===t||"top-right"===t||"bottom-left"===i||"bottom-center"===i||"bottom-right"===i,h={[M.shadow]:e,[M.isCollapsible]:s,[M.isCollapsed]:l};return O("div",{class:this.classes(M.main,M.widget,h),tabIndex:a.closeButton?void 0:-1,role:"dialog","aria-labelledby":c?o:"","aria-describedby":r&&!l?n:"",bind:this,onkeyup:this._handleMainKeyup,afterCreate:this._mainContainerNodeUpdated,afterUpdate:this._mainContainerNodeUpdated},u?this.renderFooter():null,u?this.renderFeatureMenuContainer():null,this.renderHeader(),this.renderContentContainer(),d?this.renderFooter():null,d?this.renderFeatureMenuContainer():null)}renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?O("div",{class:_.contentNode,key:e,innerHTML:e}):this.renderNodeContent(e):null}renderActionText(e){return O("span",{key:"text",class:M.actionText},e)}renderActionCalciteIcon(e,t){return O("calcite-icon",{scale:"s",key:`calcite-icon-${t}`,icon:e,class:M.icon})}renderActionIcon(e){const t=this._getActionClass(e),i=this._getActionImage(e),o={[M.iconLoading]:e.active,[M.rotating]:e.active,[M.icon]:!!t,[M.actionImage]:!e.active&&!!i};return t&&(o[t]=!e.active),O("span",{key:"icon","aria-hidden":"true",class:this.classes(M.icon,o),styles:this._getIconStyles(i)})}renderAction(e){const{action:t,type:i}=e,o=this._getActionTitle(t),n={[M.action]:"toggle"!==t.type,[M.actionToggle]:"toggle"===t.type,[M.actionToggleOn]:"toggle"===t.type&&t.value,[M.buttonDisabled]:t.disabled},s=[t.icon&&!t.active?this.renderActionCalciteIcon(t.icon,t.uid):this.renderActionIcon(t),this.renderActionText(o)],r="menu-item"===i?O("li",{key:t.uid,role:"menuitem",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s):O("div",{key:t.uid,role:"button",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s);return t.visible?r:null}renderFeatureMenuItem(e,t){const{messages:i,messagesCommon:o}=this,{selectedFeatureIndex:n,selectedFeatureViewModel:s}=this.viewModel,r=e===s,l={[M.featureMenuSelected]:r},a=r?O("span",{key:V(`feature-menu-selected-feature-${n}`),title:i.selectedFeature,"aria-label":i.selectedFeature,class:M.iconCheckMark}):null,c=O("span",{innerHTML:e.title||o.untitled});return O("li",{role:"menuitem",tabIndex:-1,key:V(`feature-menu-feature-${n}`),class:this.classes(l,M.featureMenuItem),bind:this,"data-feature-index":t,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onkeyup:this._handleFeatureMenuItemKeyup,onclick:this._selectFeature,onkeydown:this._selectFeature,onmouseover:this._setActiveFeature,onmouseleave:this._removeActiveFeature},O("span",{class:M.featureMenuTitle},c,a))}renderFeatureMenu(){const{featureMenuId:e}=this,{featureViewModels:t}=this.viewModel;return t.length>1?O("ol",{class:M.featureMenuList,id:e,bind:this,afterCreate:this._featureMenuNodeUpdated,afterUpdate:this._featureMenuNodeUpdated,onkeyup:this._handleFeatureMenuKeyup,role:"menu"},t.filter((e=>!!e.graphic)).map(((e,t)=>this.renderFeatureMenuItem(e,t)))):null}_storeFeatureSelectionAction(e,t){this._featureSelectionActions.set(e,t),this.scheduleRender()}_storeExitRelatedRecordsAction(e,t){this._exitRelatedRecordsActions.set(e,t),this.scheduleRender()}_getFlowItemDescription(e){return"featureCountDescription"in e?e.featureCountDescription:e.viewModel.description??""}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=b(i);this.open({features:[t],location:null!=o?o:void 0})}_destroyFlowItemWidgets(){this._flowItems.removeAll().forEach((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()}))}_handleBackClick(){const e=this._flowItems.pop();e&&(this._exitRelatedRecordsActions.delete(e),this._featureSelectionActions.delete(e),"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:n}=e,s=i?.attributes,r=e.title??"",l="zoom-to-feature"===n?P(r,{messages:t}):"remove-selected-feature"===n?P(r,{messages:o}):"zoom-to-clustered-features"===n||"browse-clustered-features"===n?P(r,{messages:t}):e.title;return l&&s?P(l,s):l??""}_getActionClass(e){const{selectedFeature:t}=this,i=t?.attributes,{className:o,image:n}=e,s=n||o?o:M.iconDefaultAction;return s&&i?P(s,i):s??""}_getActionImage(e){if(e.active)return"";const{selectedFeature:t}=this,i=t?.attributes,{image:o}=e;return o&&i?P(o,i):o??""}_createFeatureUpdatedAnimation(){return E("enter",M.hasFeatureUpdated)}_getInlineActionCount(){const{maxInlineActions:e,featureNavigationVisible:t}=this;if("number"!=typeof e)return null;const i=Math.round(e);return Math.max(t?i-1:i,0)}_watchActions(){const{allActions:e}=this.viewModel;this.notifyChange("dividedActions");const t="actions";this._handles.remove(t),e&&e.forEach((e=>{this._handles.add(r((()=>[e.uid,e.active,e.className,e.disabled,e.id,e.title,e.image,e.visible]),(()=>this.scheduleRender())),t)}))}_divideActions(){const{allActions:e}=this.viewModel,i=e.filter((e=>e.visible)),o=this._getInlineActionCount(),n=null===o,s=0===o;return{inlineActions:n?i.slice(0):s?new t:i.slice(0,o),menuActions:n?new t:s?i.slice(0):i.slice(o)}}_featureMenuOpenChanged(e){e?this._focusFirstFeature=!0:this._focusFeatureMenuButton=!0}_actionsMenuOpenChanged(e){e?this._focusFirstAction=!0:this._focusActionsMenuButton=!0}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this;e&&(this.viewModel.title="error"===e.viewModel?.state?t.errorMessage:e.viewModel?.title||"")}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_handleFeatureMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusFeatureMenuButton=!0,this.featureMenuOpen=!1,this.scheduleRender())}_handleActionMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusActionsMenuButton=!0,this.actionsMenuOpen=!1,this.scheduleRender())}_setActiveFeature(e){const{viewModel:t}=this,i=W(e.currentTarget);t.activeFeature=t.features[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_handleFeatureMenuItemKeyup(e){const t=o(e),{_featureMenuNode:i}=this,n=W(e.currentTarget);if(!i)return;const s=i.querySelectorAll("li"),r=s.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();s[s.length-1].focus()}else{e.stopPropagation();s[0].focus()}else{e.stopPropagation();s[(n+1+r)%r].focus()}else{e.stopPropagation();s[(n-1+r)%r].focus()}}_handleActionMenuItemKeyup(e){const t=o(e),{_actionsMenuNode:i}=this,n=e.currentTarget.dataset.actionUid,{menuActions:s}=this.dividedActions,r=s.findIndex((e=>e.uid===n));if(!i)return;const l=i.querySelectorAll("li"),a=l.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();l[l.length-1].focus()}else{e.stopPropagation();l[0].focus()}else{e.stopPropagation();l[(r+1+a)%a].focus()}else{e.stopPropagation();l[(r-1+a)%a].focus()}}_handleMainKeyup(e){const t=o(e);"ArrowLeft"===t&&(e.stopPropagation(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.next())}_spinnerEnabledChange(e){if(this._destroySpinner(),!e)return;const t=this.get("viewModel.view");this._createSpinner(t)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_getIconStyles(e){return{"background-image":e?`url(${e})`:""}}async _shouldFocus(e){e?.shouldFocus&&(await c((()=>!0===this.viewModel?.active)),this.focus())}_addSelectedFeatureIndexHandle(){const e=r((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this._handles.add(e,D)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this;i&&e!==t&&-1!==e&&(this._destroyFlowItemWidgets(),this.actionsMenuOpen=!1,this.featureMenuOpen=!1,this._mainContainerNode&&(this._mainContainerNode.scrollTop=0),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,e&&!e.destroyed&&e.destroy()),this._feature=null}_isScreenLocationWithinView(e,t){return e.x>-1&&e.y>-1&&e.x<=t.width&&e.y<=t.height}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";if(!this._isScreenLocationWithinView(s,r))return this._get("currentAlignment")||"top-center";function l(e){return parseInt(e.replace(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,c=a?l(a.getPropertyValue("max-height")):0,u=a?l(a.getPropertyValue("height")):0,{height:d,width:h}=i.getBoundingClientRect(),p=h+t,g=Math.max(d,c,u)+t,m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),_=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return f?v?"bottom-right":"top-right":m?v?"bottom-left":"top-left":v?_?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t}=this;return t||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return N(this.container)&&t.reverse(),e.replace(/leading/gi,t[0]).replace(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_wouldDockTo(){return this.dockEnabled?null:this._getDockPosition()}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=N(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0,top:0,bottom:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,c=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:c+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:c+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){if(e){const e=this.get("viewModel.view");this._wireUpView(e)}else t&&(this.close(),this.clear())}_wireUpView(e){if(this._destroySpinner(),!e)return;const{spinnerEnabled:t}=this;t&&this._createSpinner(e),this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.get("viewModel.view.padding")||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_focusDockButtonNode(e){this._focusDockButton&&(this._focusDockButton=!1,e.focus())}_closeButtonNodeUpdated(e){return this._focusClose?(this._focusClose=!1,void e.focus()):this._blurClose?(this._blurClose=!1,void e.blur()):void 0}_mainContainerNodeUpdated(e){return this._mainContainerNode=e,this._focusContainer?(this._focusContainer=!1,void e.focus()):this._blurContainer?(this._blurContainer=!1,void e.blur()):void 0}_featureMenuNodeUpdated(e){if(this._featureMenuNode=e,!e||!this._focusFirstFeature)return;this._focusFirstFeature=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_actionsMenuNodeUpdated(e){if(this._actionsMenuNode=e,!e||!this._focusFirstAction)return;this._focusFirstAction=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_focusFeatureMenuButtonNode(e){this._focusFeatureMenuButton&&(this._focusFeatureMenuButton=!1,e.focus())}_focusActionsMenuButtonNode(e){this._focusActionsMenuButton&&(this._focusActionsMenuButton=!1,e.focus())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&(this._featureMenuViewportNode.scrollTop=0)}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}_getPageText(e,t){return this.featureNavigationVisible?P(this.messages.pageText,{index:t+1,total:e}):null}_destroySpinner(){const{_spinner:e,view:t}=this;e&&(t&&t.ui&&t.ui.remove(e,S),e.destroy(),this._spinner=null)}_createSpinner(e){e&&(this._spinner=new f({view:e}),e.ui.add(this._spinner,{key:S,position:"manual"}))}_toggleCollapsed(){this.collapsed=!this.collapsed}_close(){this.close(),this.view&&this.view.focus()}_toggleDockEnabled(){this.dockEnabled=!this.dockEnabled,this._focusDockButton=!0,this.scheduleRender()}_toggleFeatureMenu(){const e=!this.featureMenuOpen;this._featureMenuOpenChanged(e),this.actionsMenuOpen=!1,this.featureMenuOpen=e}_toggleActionsMenu(){const e=!this.actionsMenuOpen;this._actionsMenuOpenChanged(e),this.featureMenuOpen=!1,this.actionsMenuOpen=e}_triggerAction(e){const t=e.currentTarget.dataset.actionUid,{allActions:i}=this.viewModel,o=i.findIndex((e=>e.uid===t)),n=i.getItemAt(o);n&&"toggle"===n.type&&(n.value=!n.value),this.actionsMenuOpen=!1,this.viewModel.triggerAction(o)}_selectFeature(e){const t=W(e.currentTarget);null==t||isNaN(t)||(this.viewModel.selectedFeatureIndex=t),this.featureMenuOpen=!1,this._focusFeatureMenuButton=!0,this.scheduleRender()}_next(){this.next()}_previous(){this.previous()}};function W(e){return e?.["data-feature-index"]}e([h({readOnly:!0})],U.prototype,"actionsMenuId",null),e([h({readOnly:!0})],U.prototype,"actionsMenuButtonId",null),e([h({readOnly:!0})],U.prototype,"featureMenuId",null),e([h({readOnly:!0})],U.prototype,"titleId",null),e([h({readOnly:!0})],U.prototype,"contentId",null),e([h({readOnly:!0})],U.prototype,"hasContent",null),e([h({readOnly:!0})],U.prototype,"featureNavigationVisible",null),e([h({readOnly:!0})],U.prototype,"collapsible",null),e([h({readOnly:!0})],U.prototype,"featureMenuVisible",null),e([h({readOnly:!0})],U.prototype,"contentCollapsed",null),e([h({readOnly:!0})],U.prototype,"dividedActions",null),e([h({readOnly:!0,dependsOn:["_flowItems.length"]})],U.prototype,"_activeFlowItemWidget",null),e([h()],U.prototype,"actions",null),e([h()],U.prototype,"actionsMenuOpen",null),e([h()],U.prototype,"alignment",void 0),e([h()],U.prototype,"autoCloseEnabled",null),e([h()],U.prototype,"autoOpenEnabled",null),e([h()],U.prototype,"defaultPopupTemplateEnabled",null),e([h()],U.prototype,"content",null),e([h()],U.prototype,"collapsed",void 0),e([h()],U.prototype,"collapseEnabled",void 0),e([h({readOnly:!0})],U.prototype,"currentAlignment",null),e([h({readOnly:!0})],U.prototype,"currentDockPosition",null),e([h()],U.prototype,"dockOptions",null),e([h()],U.prototype,"dockEnabled",void 0),e([h({readOnly:!0})],U.prototype,"featureCount",null),e([h()],U.prototype,"featureMenuOpen",null),e([h()],U.prototype,"features",null),e([h()],U.prototype,"goToOverride",null),e([h()],U.prototype,"headingLevel",void 0),e([h()],U.prototype,"highlightEnabled",null),e([h()],U.prototype,"location",null),e([h()],U.prototype,"label",null),e([h()],U.prototype,"maxInlineActions",void 0),e([h(),F("esri/widgets/Popup/t9n/Popup")],U.prototype,"messages",void 0),e([h(),F("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"promises",null),e([h({readOnly:!0})],U.prototype,"selectedFeature",null),e([h()],U.prototype,"selectedFeatureIndex",null),e([h({readOnly:!0})],U.prototype,"selectedFeatureWidget",null),e([h()],U.prototype,"spinnerEnabled",void 0),e([h()],U.prototype,"title",null),e([h()],U.prototype,"updateLocationEnabled",null),e([h()],U.prototype,"view",null),e([h({type:y}),I(["triggerAction","trigger-action"])],U.prototype,"viewModel",void 0),e([h()],U.prototype,"visible",null),e([h()],U.prototype,"visibleElements",void 0),e([p("visibleElements")],U.prototype,"castVisibleElements",null),e([C()],U.prototype,"_close",null),e([C()],U.prototype,"_toggleDockEnabled",null),e([C()],U.prototype,"_toggleFeatureMenu",null),e([C()],U.prototype,"_toggleActionsMenu",null),e([C()],U.prototype,"_triggerAction",null),e([C()],U.prototype,"_selectFeature",null),e([C()],U.prototype,"_next",null),e([C()],U.prototype,"_previous",null),U=e([g("esri.widgets.Popup")],U);const H=U;export{H as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{eventKey as o}from"../core/events.js";import n from"../core/Handles.js";import s from"../core/Logger.js";import{watch as r,when as l,on as a,whenOnce as c,initial as u}from"../core/reactiveUtils.js";import{throttle as d}from"../core/throttle.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import m from"./Feature.js";import f from"./Spinner.js";import v from"./Widget.js";import{CSS as _}from"./Feature/resources.js";import{FeatureContentMixin as w}from"./Feature/support/FeatureContentMixin.js";import{getPointFromGeometry as b}from"./Popup/actionUtils.js";import{CSS as M}from"./Popup/css.js";import y from"./Popup/PopupViewModel.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as A}from"./support/Heading.js";import{accessibleHandler as C}from"./support/decorators/accessibleHandler.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import{storeNode as x,cssTransition as E,isRTL as N}from"./support/widgetUtils.js";import{isDarkTheme as B}from"../support/themeUtils.js";import{substitute as P}from"../intl/substitute.js";const D="selected-index",T=0,S="popup-spinner",L={buttonEnabled:!0,position:"auto",breakpoint:{width:544}},R="esri-popup";function V(e,t){return void 0===t?`${R}__${e}`:`${R}__${e}-${t}`}const j={closeButton:!0,featureNavigation:!0};let U=class extends(w(v)){constructor(e,i){super(e,i),this._blurClose=!1,this._blurContainer=!1,this._containerNode=null,this._mainContainerNode=null,this._featureMenuNode=null,this._actionsMenuNode=null,this._focusClose=!1,this._focusContainer=!1,this._focusDockButton=!1,this._focusFeatureMenuButton=!1,this._focusActionsMenuButton=!1,this._focusFirstFeature=!1,this._focusFirstAction=!1,this._handles=new n,this._pointerOffsetInPx=16,this._spinner=null,this._feature=null,this._featureMenuIntersectionObserverNode=null,this._featureMenuViewportNode=null,this._rootFlowItemNode=null,this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._displaySpinnerThrottled=d((()=>this._displaySpinner()),T),this._exitRelatedRecordsActions=new WeakMap,this._featureSelectionActions=new WeakMap,this._flowItems=new t,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.messagesCommon=null,this.spinnerEnabled=!0,this.viewModel=new y,this.visibleElements={...j},this._handleOpenRelatedFeature=e=>{this._openRelatedFeature(e)},this._addSelectedFeatureIndexHandle(),this.addHandles([r((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),r((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),r((()=>this.viewModel?.screenLocation),((e,t)=>{!!e!=!!t&&this.reposition()})),r((()=>[this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),r((()=>this.spinnerEnabled),(e=>this._spinnerEnabledChange(e))),r((()=>this.viewModel?.view?.size),((e,t)=>this._updateDockEnabledForViewSize(e,t))),r((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),r((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),r((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),r((()=>this.selectedFeatureWidget),(()=>this._destroyFlowItemWidgets())),r((()=>[this.selectedFeatureWidget?.viewModel?.title,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setTitleFromFeatureWidget())),r((()=>[this.selectedFeatureWidget?.viewModel?.content,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setContentFromFeatureWidget())),l((()=>!this.collapsed),(()=>{"xsmall"===this.viewModel?.view?.widthBreakpoint&&this.viewModel.active&&this.collapseEnabled&&this.viewModel.centerAtLocation()})),a((()=>this.viewModel?.allActions),"change",(()=>this._watchActions())),r((()=>this.viewModel?.allActions),(()=>this._watchActions()),u),r((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),a((()=>this._flowItems),"change",(()=>{this.notifyChange("_activeFlowItemWidget"),this.scheduleRender()})),r((()=>[this._activeFlowItemWidget?.viewModel?.state,this._activeFlowItemWidget?.viewModel?.title]),(()=>this.scheduleRender()))])}loadDependencies(){return k({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}initialize(){this.addHandles(this._displaySpinnerThrottled)}destroy(){this._destroyFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._handles?.destroy(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect()}get actionsMenuId(){return`${this.id}-actions-menu`}get actionsMenuButtonId(){return`${this.id}-actions-menu-button`}get featureMenuId(){return`${this.id}-feature-menu`}get titleId(){return`${this.id}-popup-title`}get contentId(){return`${this.id}-popup-content`}get hasContent(){const{selectedFeatureWidget:e,viewModel:t}=this;if(!e)return!!t?.content;const i=e.viewModel;if(i?.waitingForContent||"error"===i?.state)return!0;const o=i?.content;return Array.isArray(o)?!!o.length:!!o}get featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&null!=this.visibleElements.featureNavigation}get collapsible(){return!!(this.collapseEnabled&&this.viewModel.title&&this.hasContent)}get featureMenuVisible(){return this.featureNavigationVisible&&this.featureMenuOpen}get contentCollapsed(){return this.collapsible&&!this.featureMenuVisible&&this.collapsed}get dividedActions(){return this._divideActions()}get _activeFlowItemWidget(){const{_flowItems:e}=this;return e.getItemAt(e.length-1)||null}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}set actionsMenuOpen(e){this._set("actionsMenuOpen",!!e)}get actionsMenuOpen(){return!!this.viewModel.active&&this._get("actionsMenuOpen")}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get autoOpenEnabled(){return i(s.getLogger(this.declaredClass),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(e){i(s.getLogger(this.declaredClass),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||L}set dockOptions(e){const t={...L},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,visibleElements:t,headingLevel:i,_flowItems:o}=this,{selectedFeatureViewModel:n}=this.viewModel,s={...t,title:!1};return n?(e?(e.viewModel=n,e.visibleElements=s):this._feature=new m({flowItems:o,headingLevel:i+1,viewModel:n,visibleElements:s}),this._feature):null}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}castVisibleElements(e){return{...j,...e}}blur(){const{active:e}=this.viewModel;e||s.getLogger(this.declaredClass).warn("Popup can only be blurred when currently active."),this.visibleElements.closeButton?this._blurClose=!0:this._blurContainer=!0,this.scheduleRender()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||s.getLogger(this.declaredClass).warn("Popup can only be focused when currently active."),this.visibleElements.closeButton?this._focusClose=!0:this._focusContainer=!0,this.scheduleRender()}next(){return this.viewModel.next()}open(e){this._handles.remove(D);const t=!!e&&!!e.featureMenuOpen,i=!!e&&!!e.actionsMenuOpen,o={collapsed:!!e&&!!e.collapsed,actionsMenuOpen:i,featureMenuOpen:t};"xsmall"===this.viewModel?.view?.widthBreakpoint&&(o.collapsed=!0),this.set(o),this.viewModel.open(e),this._shouldFocus(e),this._addSelectedFeatureIndexHandle()}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{actionsMenuOpen:e,dockEnabled:t,featureMenuVisible:i,dividedActions:o,currentAlignment:n,currentDockPosition:s}=this,{active:r}=this.viewModel,{menuActions:l}=o,a=r&&l.length>1&&e,c=r&&t,u=r&&!t,d=this.selectedFeature?.layer?.title,h=this.selectedFeature?.layer?.id,p={[M.alignTopCenter]:"top-center"===n,[M.alignBottomCenter]:"bottom-center"===n,[M.alignTopLeft]:"top-left"===n,[M.alignBottomLeft]:"bottom-left"===n,[M.alignTopRight]:"top-right"===n,[M.alignBottomRight]:"bottom-right"===n,[M.isDocked]:c,[M.shadow]:u,[M.isDockedTopLeft]:"top-left"===s,[M.isDockedTopCenter]:"top-center"===s,[M.isDockedTopRight]:"top-right"===s,[M.isDockedBottomLeft]:"bottom-left"===s,[M.isDockedBottomCenter]:"bottom-center"===s,[M.isDockedBottomRight]:"bottom-right"===s,[M.isFeatureMenuOpen]:i,[M.isActionsMenuOpen]:a};return O("div",{class:this.classes(M.base,p),role:"presentation","data-layer-title":d,"data-layer-id":h,bind:this,afterCreate:this._positionContainer,afterUpdate:this._positionContainer},r?[this.renderMainContainer(),this.renderPointer()]:null)}renderLoadingIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconLoading,M.rotating)})}renderNavigationLoading(){const{messagesCommon:e}=this;return this.viewModel.pendingPromisesCount?O("div",{key:V("loading-container"),role:"presentation",class:M.loadingContainer,"aria-label":e.loading,title:e.loading},this.renderLoadingIcon()):null}renderPreviousButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._previous,onkeydown:this._previous,class:this.classes(M.button,M.paginationPrevious),"aria-label":e.previous,title:e.previous},O("calcite-icon",{icon:"chevron-left",scale:"s",class:M.paginationIcon}))}renderNextButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._next,onkeydown:this._next,class:this.classes(M.button,M.paginationNext),"aria-label":e.next,title:e.next},O("calcite-icon",{icon:"chevron-right",scale:"s",class:M.paginationIcon}))}renderFeatureMenuButton(){const{featureMenuOpen:e,featureMenuId:t,messagesCommon:i}=this,{featureCount:o,selectedFeatureIndex:n}=this.viewModel;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._toggleFeatureMenu,onkeydown:this._toggleFeatureMenu,afterCreate:this._focusFeatureMenuButtonNode,afterUpdate:this._focusFeatureMenuButtonNode,class:M.featureMenuButton,"aria-haspopup":"true","aria-controls":t,"aria-expanded":e.toString(),"aria-label":i.menu,title:i.menu},O("calcite-icon",{icon:"list-bullet",scale:"s",class:M.featureMenuButtonIcon}),this._getPageText(o,n))}renderNavigationButtons(){return this.featureNavigationVisible?[this.renderPreviousButton(),this.renderNextButton(),this.renderNavigationLoading()||this.renderFeatureMenuButton()]:[]}renderDockIcon(){const{dockEnabled:e}=this,t=this._wouldDockTo(),i={[M.iconUndock]:e,[M.iconDock]:!e,[M.iconDockToRight]:!e&&("top-right"===t||"bottom-right"===t),[M.iconDockToLeft]:!e&&("top-left"===t||"bottom-left"===t),[M.iconDockToTop]:!e&&"top-center"===t,[M.iconDockToBottom]:!e&&"bottom-center"===t};return O("span",{"aria-hidden":"true",class:this.classes(i,M.icon)})}renderDockButton(){const{dockEnabled:e,messages:t}=this,i=this.viewModel?.view?.widthBreakpoint,o=e?t.undock:t.dock;return"xsmall"!==i&&this.dockOptions?.buttonEnabled?O("div",{role:"button","aria-label":o,title:o,tabIndex:0,bind:this,onclick:this._toggleDockEnabled,onkeydown:this._toggleDockEnabled,afterCreate:this._focusDockButtonNode,afterUpdate:this._focusDockButtonNode,class:this.classes(M.button,M.buttonDock)},this.renderDockIcon()):null}renderTitle(){const{title:e}=this.viewModel,{titleId:t,collapsible:i,contentCollapsed:o,messagesCommon:n}=this,s={[M.headerContainerButton]:i},r=O(A,{level:this.headingLevel,class:M.headerTitle,innerHTML:e??""}),l=i?O("button",{key:`${e}--collapsible`,id:t,title:o?n.expand:n.collapse,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s),"aria-expanded":o?"false":"true",onclick:this._toggleCollapsed,type:"button"},r,O("calcite-icon",{class:M.collapseIcon,key:"collapse-icon",icon:o?"chevron-down":"chevron-up",scale:"m"})):O("div",{key:e??"title",id:t,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s)},r);return e?l:null}renderCloseIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconClose)})}renderCloseButton(){const{visibleElements:e,messagesCommon:t}=this;return e.closeButton?O("div",{role:"button",tabIndex:0,bind:this,onclick:this._close,onkeydown:this._close,class:M.button,"aria-label":t.close,title:t.close,afterCreate:this._closeButtonNodeUpdated,afterUpdate:this._closeButtonNodeUpdated},this.renderCloseIcon()):null}renderHeader(){return O("header",{class:M.header},this.renderTitle(),O("div",{class:M.headerButtons},this.renderDockButton(),this.renderCloseButton()))}renderContentContainer(){const{contentId:e,hasContent:t,contentCollapsed:i,_flowItems:o}=this,{content:n}=this.viewModel,s=o.toArray(),r={[M.contentHasFlows]:!!s.length};return t&&!i?O("div",{key:n??"content",enterAnimation:this._createFeatureUpdatedAnimation(),id:e,class:this.classes(M.content,r)},O("calcite-flow",{bind:this},O("calcite-flow-item",{bind:this,"data-node-ref":"_rootFlowItemNode",afterCreate:x,key:"root-flow-item",onCalciteFlowItemBack:this._handleBackClick},this.renderContent()),s.map((e=>this.renderFlowItem(e)))),s.map((e=>this.renderFlowItemTooltips(e)))):null}renderFlowItem(e){const{messages:t}=this,i=B(),o="graphic"in e&&!e.isTable;return O("calcite-flow-item",{bind:this,class:this.classes({[M.calciteThemeDark]:!i,[M.calciteThemeLight]:i}),heading:e.title??"",description:this._getFlowItemDescription(e),onCalciteFlowItemBack:this._handleBackClick,key:`flow-item-${e.viewModel.uid}`},O("calcite-action",{class:M.actionExit,icon:"move-up",label:t?.exitRelatedRecords,text:t?.exitRelatedRecords,slot:"header-actions-start",bind:this,afterCreate:t=>this._storeExitRelatedRecordsAction(e,t),onclick:this._destroyFlowItemWidgets}),o?O("calcite-action",{class:M.actionSelectFeature,icon:"zoom-to-object",label:t?.selectFeature,text:t?.selectFeature,slot:"header-actions-end",bind:this,afterCreate:t=>this._storeFeatureSelectionAction(e,t),onclick:()=>this._handleOpenRelatedFeature(e)}):null,O("div",{class:this.classes(M.contentFlowItem,{[M.calciteThemeDark]:i,[M.calciteThemeLight]:!i})},e.render()))}renderFlowItemTooltips(e){const{messages:t,_exitRelatedRecordsActions:i,_featureSelectionActions:o}=this,n=B(),s=o.get(e);return[O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`exit-related-records-tooltip-${e.viewModel.uid}`,label:t?.exitRelatedRecords,overlayPositioning:"fixed",referenceElement:i.get(e),placement:"top"},t?.exitRelatedRecords),s?O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`select-related-record-tooltip-${e.viewModel.uid}`,label:t?.selectFeature,overlayPositioning:"fixed",referenceElement:s,placement:"top"},t?.selectFeature):null]}renderActionsMenuButton(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o,messagesCommon:n}=this,s=i?n.close:n.open,{menuActions:r}=o;return r.length?O("div",{key:V("actions-menu-button"),class:this.classes(M.button,M.actionsMenuButton),role:"button",id:t,"aria-haspopup":"true","aria-controls":i?e:null,tabIndex:0,bind:this,onclick:this._toggleActionsMenu,onkeydown:this._toggleActionsMenu,afterCreate:this._focusActionsMenuButtonNode,afterUpdate:this._focusActionsMenuButtonNode,"aria-label":s,title:s},O("span",{"aria-hidden":"true",class:M.iconActionsMenu})):null}renderMenuActions(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o}=this,{menuActions:n}=o;return n.length&&i?O("ul",{id:e,role:"menu","aria-labelledby":t,key:V("actions"),class:M.actions,bind:this,onkeyup:this._handleActionMenuKeyup,afterCreate:this._actionsMenuNodeUpdated,afterUpdate:this._actionsMenuNodeUpdated},n.toArray().map((e=>this.renderAction({action:e,type:"menu-item"})))):null}renderInlineActions(){const{inlineActions:e}=this.dividedActions;return e.length?e.toArray().map((e=>this.renderAction({action:e,type:"inline"}))):[]}renderInlineActionsContainer(){const{inlineActions:e,menuActions:t}=this.dividedActions,i=!!e.length,o=!!t.length;return i||o?O("div",{key:"inline-actions-container","data-inline-actions":i.toString(),"data-menu-actions":o.toString(),class:M.inlineActionsContainer},this.renderInlineActions(),this.renderActionsMenuButton(),this.renderMenuActions()):null}renderNavigation(){return this.featureNavigationVisible?O("section",{key:V("navigation"),class:this.classes(M.navigation)},this.renderNavigationButtons()):null}renderFooter(){const{featureNavigationVisible:e,dividedActions:t}=this,{inlineActions:i,menuActions:o}=t,n=!!i.length,s=!!o.length,r={[M.footerHasPagination]:e,[M.footerHasActions]:n,[M.footerHasActionsMenu]:s};return e||n?O("div",{key:V("feature-buttons"),class:this.classes(M.footer,r)},this.renderInlineActionsContainer(),this.renderNavigation()):null}renderFeatureMenuContainer(){const{messages:e}=this,{featureViewModels:t,isLoadingFeature:i}=this.viewModel,o=P(e.selectedFeatures,{total:t.length});return O("section",{key:V("menu"),class:M.featureMenu},O("strong",{class:M.featureMenuHeader},o),O("nav",{bind:this,class:M.featureMenuViewport,"data-node-ref":"_featureMenuViewportNode",afterCreate:x},this.renderFeatureMenu(),O("div",{class:M.featureMenuObserver,bind:this,afterCreate:this._featureMenuIntersectionObserverCreated}),i?O("div",{class:M.featureMenuLoader},this.renderLoadingIcon()):null))}renderPointer(){return this.dockEnabled?null:O("div",{key:V("pointer"),class:M.pointer,role:"presentation"},O("div",{class:this.classes(M.pointerDirection,M.shadow)}))}renderMainContainer(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i,titleId:o,contentId:n,collapsible:s,hasContent:r,contentCollapsed:l,visibleElements:a}=this,{title:c}=this.viewModel,u="bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===i||"top-center"===i||"top-right"===i,d="top-left"===t||"top-center"===t||"top-right"===t||"bottom-left"===i||"bottom-center"===i||"bottom-right"===i,h={[M.shadow]:e,[M.isCollapsible]:s,[M.isCollapsed]:l};return O("div",{class:this.classes(M.main,M.widget,h),tabIndex:a.closeButton?void 0:-1,role:"dialog","aria-labelledby":c?o:"","aria-describedby":r&&!l?n:"",bind:this,onkeyup:this._handleMainKeyup,afterCreate:this._mainContainerNodeUpdated,afterUpdate:this._mainContainerNodeUpdated},u?this.renderFooter():null,u?this.renderFeatureMenuContainer():null,this.renderHeader(),this.renderContentContainer(),d?this.renderFooter():null,d?this.renderFeatureMenuContainer():null)}renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?O("div",{class:_.contentNode,key:e,innerHTML:e}):this.renderNodeContent(e):null}renderActionText(e){return O("span",{key:"text",class:M.actionText},e)}renderActionCalciteIcon(e,t){return O("calcite-icon",{scale:"s",key:`calcite-icon-${t}`,icon:e,class:M.icon})}renderActionIcon(e){const t=this._getActionClass(e),i=this._getActionImage(e),o={[M.iconLoading]:e.active,[M.rotating]:e.active,[M.icon]:!!t,[M.actionImage]:!e.active&&!!i};return t&&(o[t]=!e.active),O("span",{key:"icon","aria-hidden":"true",class:this.classes(M.icon,o),styles:this._getIconStyles(i)})}renderAction(e){const{action:t,type:i}=e,o=this._getActionTitle(t),n={[M.action]:"toggle"!==t.type,[M.actionToggle]:"toggle"===t.type,[M.actionToggleOn]:"toggle"===t.type&&t.value,[M.buttonDisabled]:t.disabled},s=[t.icon&&!t.active?this.renderActionCalciteIcon(t.icon,t.uid):this.renderActionIcon(t),this.renderActionText(o)],r="menu-item"===i?O("li",{key:t.uid,role:"menuitem",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s):O("div",{key:t.uid,role:"button",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s);return t.visible?r:null}renderFeatureMenuItem(e,t){const{messages:i,messagesCommon:o}=this,{selectedFeatureIndex:n,selectedFeatureViewModel:s}=this.viewModel,r=e===s,l={[M.featureMenuSelected]:r},a=r?O("span",{key:V(`feature-menu-selected-feature-${n}`),title:i.selectedFeature,"aria-label":i.selectedFeature,class:M.iconCheckMark}):null,c=O("span",{innerHTML:e.title||o.untitled});return O("li",{role:"menuitem",tabIndex:-1,key:V(`feature-menu-feature-${n}`),class:this.classes(l,M.featureMenuItem),bind:this,"data-feature-index":t,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onkeyup:this._handleFeatureMenuItemKeyup,onclick:this._selectFeature,onkeydown:this._selectFeature,onmouseover:this._setActiveFeature,onmouseleave:this._removeActiveFeature},O("span",{class:M.featureMenuTitle},c,a))}renderFeatureMenu(){const{featureMenuId:e}=this,{featureViewModels:t}=this.viewModel;return t.length>1?O("ol",{class:M.featureMenuList,id:e,bind:this,afterCreate:this._featureMenuNodeUpdated,afterUpdate:this._featureMenuNodeUpdated,onkeyup:this._handleFeatureMenuKeyup,role:"menu"},t.filter((e=>!!e.graphic)).map(((e,t)=>this.renderFeatureMenuItem(e,t)))):null}_storeFeatureSelectionAction(e,t){this._featureSelectionActions.set(e,t),this.scheduleRender()}_storeExitRelatedRecordsAction(e,t){this._exitRelatedRecordsActions.set(e,t),this.scheduleRender()}_getFlowItemDescription(e){return"featureCountDescription"in e?e.featureCountDescription:e.viewModel.description??""}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=b(i);this.open({features:[t],location:null!=o?o:void 0})}_destroyFlowItemWidgets(){this._flowItems.removeAll().forEach((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()}))}_handleBackClick(){const e=this._flowItems.pop();e&&(this._exitRelatedRecordsActions.delete(e),this._featureSelectionActions.delete(e),"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:n}=e,s=i?.attributes,r=e.title??"",l="zoom-to-feature"===n?P(r,{messages:t}):"remove-selected-feature"===n?P(r,{messages:o}):"zoom-to-clustered-features"===n||"browse-clustered-features"===n?P(r,{messages:t}):e.title;return l&&s?P(l,s):l??""}_getActionClass(e){const{selectedFeature:t}=this,i=t?.attributes,{className:o,image:n}=e,s=n||o?o:M.iconDefaultAction;return s&&i?P(s,i):s??""}_getActionImage(e){if(e.active)return"";const{selectedFeature:t}=this,i=t?.attributes,{image:o}=e;return o&&i?P(o,i):o??""}_createFeatureUpdatedAnimation(){return E("enter",M.hasFeatureUpdated)}_getInlineActionCount(){const{maxInlineActions:e,featureNavigationVisible:t}=this;if("number"!=typeof e)return null;const i=Math.round(e);return Math.max(t?i-1:i,0)}_watchActions(){const{allActions:e}=this.viewModel;this.notifyChange("dividedActions");const t="actions";this._handles.remove(t),e&&e.forEach((e=>{this._handles.add(r((()=>[e.uid,e.active,e.className,e.disabled,e.id,e.title,e.image,e.visible]),(()=>this.scheduleRender())),t)}))}_divideActions(){const{allActions:e}=this.viewModel,i=e.filter((e=>e.visible)),o=this._getInlineActionCount(),n=null===o,s=0===o;return{inlineActions:n?i.slice(0):s?new t:i.slice(0,o),menuActions:n?new t:s?i.slice(0):i.slice(o)}}_featureMenuOpenChanged(e){e?this._focusFirstFeature=!0:this._focusFeatureMenuButton=!0}_actionsMenuOpenChanged(e){e?this._focusFirstAction=!0:this._focusActionsMenuButton=!0}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this;e&&(this.viewModel.title="error"===e.viewModel?.state?t.errorMessage:e.viewModel?.title||"")}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_handleFeatureMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusFeatureMenuButton=!0,this.featureMenuOpen=!1,this.scheduleRender())}_handleActionMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusActionsMenuButton=!0,this.actionsMenuOpen=!1,this.scheduleRender())}_setActiveFeature(e){const{viewModel:t}=this,i=W(e.currentTarget);t.activeFeature=t.features[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_handleFeatureMenuItemKeyup(e){const t=o(e),{_featureMenuNode:i}=this,n=W(e.currentTarget);if(!i)return;const s=i.querySelectorAll("li"),r=s.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();s[s.length-1].focus()}else{e.stopPropagation();s[0].focus()}else{e.stopPropagation();s[(n+1+r)%r].focus()}else{e.stopPropagation();s[(n-1+r)%r].focus()}}_handleActionMenuItemKeyup(e){const t=o(e),{_actionsMenuNode:i}=this,n=e.currentTarget.dataset.actionUid,{menuActions:s}=this.dividedActions,r=s.findIndex((e=>e.uid===n));if(!i)return;const l=i.querySelectorAll("li"),a=l.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();l[l.length-1].focus()}else{e.stopPropagation();l[0].focus()}else{e.stopPropagation();l[(r+1+a)%a].focus()}else{e.stopPropagation();l[(r-1+a)%a].focus()}}_handleMainKeyup(e){const t=o(e);"ArrowLeft"===t&&(e.stopPropagation(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.next())}_spinnerEnabledChange(e){if(this._destroySpinner(),!e)return;const t=this.get("viewModel.view");this._createSpinner(t)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_getIconStyles(e){return{"background-image":e?`url(${e})`:""}}async _shouldFocus(e){e?.shouldFocus&&(await c((()=>!0===this.viewModel?.active)),this.focus())}_addSelectedFeatureIndexHandle(){const e=r((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this._handles.add(e,D)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this;i&&e!==t&&-1!==e&&(this._destroyFlowItemWidgets(),this.actionsMenuOpen=!1,this.featureMenuOpen=!1,this._mainContainerNode&&(this._mainContainerNode.scrollTop=0),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,e&&!e.destroyed&&e.destroy()),this._feature=null}_isScreenLocationWithinView(e,t){return e.x>-1&&e.y>-1&&e.x<=t.width&&e.y<=t.height}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";if(!this._isScreenLocationWithinView(s,r))return this._get("currentAlignment")||"top-center";function l(e){return parseInt(e.replace(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,c=a?l(a.getPropertyValue("max-height")):0,u=a?l(a.getPropertyValue("height")):0,{height:d,width:h}=i.getBoundingClientRect(),p=h+t,g=Math.max(d,c,u)+t,m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),_=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return f?v?"bottom-right":"top-right":m?v?"bottom-left":"top-left":v?_?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t}=this;return t||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return N(this.container)&&t.reverse(),e?.replace(/leading/gi,t[0]).replace(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_wouldDockTo(){return this.dockEnabled?null:this._getDockPosition()}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=N(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0,top:0,bottom:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,c=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:c+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:c+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){if(e){const e=this.get("viewModel.view");this._wireUpView(e)}else t&&(this.close(),this.clear())}_wireUpView(e){if(this._destroySpinner(),!e)return;const{spinnerEnabled:t}=this;t&&this._createSpinner(e),this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.get("viewModel.view.padding")||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_focusDockButtonNode(e){this._focusDockButton&&(this._focusDockButton=!1,e.focus())}_closeButtonNodeUpdated(e){return this._focusClose?(this._focusClose=!1,void e.focus()):this._blurClose?(this._blurClose=!1,void e.blur()):void 0}_mainContainerNodeUpdated(e){return this._mainContainerNode=e,this._focusContainer?(this._focusContainer=!1,void e.focus()):this._blurContainer?(this._blurContainer=!1,void e.blur()):void 0}_featureMenuNodeUpdated(e){if(this._featureMenuNode=e,!e||!this._focusFirstFeature)return;this._focusFirstFeature=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_actionsMenuNodeUpdated(e){if(this._actionsMenuNode=e,!e||!this._focusFirstAction)return;this._focusFirstAction=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_focusFeatureMenuButtonNode(e){this._focusFeatureMenuButton&&(this._focusFeatureMenuButton=!1,e.focus())}_focusActionsMenuButtonNode(e){this._focusActionsMenuButton&&(this._focusActionsMenuButton=!1,e.focus())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&(this._featureMenuViewportNode.scrollTop=0)}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}_getPageText(e,t){return this.featureNavigationVisible?P(this.messages.pageText,{index:t+1,total:e}):null}_destroySpinner(){const{_spinner:e,view:t}=this;e&&(t&&t.ui&&t.ui.remove(e,S),e.destroy(),this._spinner=null)}_createSpinner(e){e&&(this._spinner=new f({view:e}),e.ui.add(this._spinner,{key:S,position:"manual"}))}_toggleCollapsed(){this.collapsed=!this.collapsed}_close(){this.close(),this.view&&this.view.focus()}_toggleDockEnabled(){this.dockEnabled=!this.dockEnabled,this._focusDockButton=!0,this.scheduleRender()}_toggleFeatureMenu(){const e=!this.featureMenuOpen;this._featureMenuOpenChanged(e),this.actionsMenuOpen=!1,this.featureMenuOpen=e}_toggleActionsMenu(){const e=!this.actionsMenuOpen;this._actionsMenuOpenChanged(e),this.featureMenuOpen=!1,this.actionsMenuOpen=e}_triggerAction(e){const t=e.currentTarget.dataset.actionUid,{allActions:i}=this.viewModel,o=i.findIndex((e=>e.uid===t)),n=i.getItemAt(o);n&&"toggle"===n.type&&(n.value=!n.value),this.actionsMenuOpen=!1,this.viewModel.triggerAction(o)}_selectFeature(e){const t=W(e.currentTarget);null==t||isNaN(t)||(this.viewModel.selectedFeatureIndex=t),this.featureMenuOpen=!1,this._focusFeatureMenuButton=!0,this.scheduleRender()}_next(){this.next()}_previous(){this.previous()}};function W(e){return e?.["data-feature-index"]}e([h({readOnly:!0})],U.prototype,"actionsMenuId",null),e([h({readOnly:!0})],U.prototype,"actionsMenuButtonId",null),e([h({readOnly:!0})],U.prototype,"featureMenuId",null),e([h({readOnly:!0})],U.prototype,"titleId",null),e([h({readOnly:!0})],U.prototype,"contentId",null),e([h({readOnly:!0})],U.prototype,"hasContent",null),e([h({readOnly:!0})],U.prototype,"featureNavigationVisible",null),e([h({readOnly:!0})],U.prototype,"collapsible",null),e([h({readOnly:!0})],U.prototype,"featureMenuVisible",null),e([h({readOnly:!0})],U.prototype,"contentCollapsed",null),e([h({readOnly:!0})],U.prototype,"dividedActions",null),e([h({readOnly:!0,dependsOn:["_flowItems.length"]})],U.prototype,"_activeFlowItemWidget",null),e([h()],U.prototype,"actions",null),e([h()],U.prototype,"actionsMenuOpen",null),e([h()],U.prototype,"alignment",void 0),e([h()],U.prototype,"autoCloseEnabled",null),e([h()],U.prototype,"autoOpenEnabled",null),e([h()],U.prototype,"defaultPopupTemplateEnabled",null),e([h()],U.prototype,"content",null),e([h()],U.prototype,"collapsed",void 0),e([h()],U.prototype,"collapseEnabled",void 0),e([h({readOnly:!0})],U.prototype,"currentAlignment",null),e([h({readOnly:!0})],U.prototype,"currentDockPosition",null),e([h()],U.prototype,"dockOptions",null),e([h()],U.prototype,"dockEnabled",void 0),e([h({readOnly:!0})],U.prototype,"featureCount",null),e([h()],U.prototype,"featureMenuOpen",null),e([h()],U.prototype,"features",null),e([h()],U.prototype,"goToOverride",null),e([h()],U.prototype,"headingLevel",void 0),e([h()],U.prototype,"highlightEnabled",null),e([h()],U.prototype,"location",null),e([h()],U.prototype,"label",null),e([h()],U.prototype,"maxInlineActions",void 0),e([h(),F("esri/widgets/Popup/t9n/Popup")],U.prototype,"messages",void 0),e([h(),F("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"promises",null),e([h({readOnly:!0})],U.prototype,"selectedFeature",null),e([h()],U.prototype,"selectedFeatureIndex",null),e([h({readOnly:!0})],U.prototype,"selectedFeatureWidget",null),e([h()],U.prototype,"spinnerEnabled",void 0),e([h()],U.prototype,"title",null),e([h()],U.prototype,"updateLocationEnabled",null),e([h()],U.prototype,"view",null),e([h({type:y}),I(["triggerAction","trigger-action"])],U.prototype,"viewModel",void 0),e([h()],U.prototype,"visible",null),e([h()],U.prototype,"visibleElements",void 0),e([p("visibleElements")],U.prototype,"castVisibleElements",null),e([C()],U.prototype,"_close",null),e([C()],U.prototype,"_toggleDockEnabled",null),e([C()],U.prototype,"_toggleFeatureMenu",null),e([C()],U.prototype,"_toggleActionsMenu",null),e([C()],U.prototype,"_triggerAction",null),e([C()],U.prototype,"_selectFeature",null),e([C()],U.prototype,"_next",null),e([C()],U.prototype,"_previous",null),U=e([g("esri.widgets.Popup")],U);const H=U;export{H as default};
|