/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as A } from "../../chunks/runtime.js";
import { css as E, html as w } from "lit";
import P from "@arcgis/core/popup/Features.js";
import { u as F } from "../../chunks/useT9n.js";
import { useDirection as O, usePropertyChange as $ } from "@arcgis/lumina/controllers";
import { m as N } from "../../chunks/useViewModel.js";
import { LitElement as L, createEvent as _, safeStyleMap as S, safeClassMap as y } from "@arcgis/lumina";
import { stripHTML as T } from "@arcgis/core/applications/Components/stringUtils.js";
import { classes as x } from "@arcgis/toolkit/dom";
import { createRef as g, ref as m } from "lit/directives/ref.js";
import { watch as p } from "@arcgis/core/core/reactiveUtils.js";
import V from "@arcgis/core/support/actions/ActionButton.js";
import { t as H } from "../../chunks/screenLocation.js";
import "../arcgis-search-result-renderer/customElement.js";
const B = E`:host{display:contents;--arcgis-internal-popup-pointer-size: 12px;--arcgis-internal-popup-content-small-size: 280px;--arcgis-internal-popup-content-medium-size: 340px;--arcgis-internal-popup-content-large-size: 400px;--arcgis-internal-popup-content-x-large-size: 460px;--arcgis-internal-popup-content-min-size-y: 48px;--arcgis-internal-popup-pointer-size-half: calc(var(--arcgis-internal-popup-pointer-size) / 2);--arcgis-internal-popup-pointer-size-half-negative: calc(var(--arcgis-internal-popup-pointer-size-half) * -1)}.root{display:flex;position:absolute;flex-flow:column nowrap;z-index:401;pointer-events:none;border:none;overflow:visible;padding:0;width:auto;height:auto;background-color:transparent}.hidden{visibility:hidden}.root:popover-open{display:flex;position:fixed;flex-flow:column nowrap;margin:0}arcgis-features{flex:1;width:100%}.shadow{box-shadow:var(--calcite-shadow-sm)}.aligned-top-center{transform-origin:50% 100%}.aligned-bottom-center{transform-origin:50% -5%}.aligned-top-left,.aligned-bottom-left{transform-origin:100% 50%}.aligned-top-right,.aligned-bottom-right{transform-origin:-5% 50%}.aligned-top-center,.aligned-top-left,.aligned-top-right{animation:popup-intro-animation-down .2s ease-in-out}.aligned-bottom-center,.aligned-bottom-left,.aligned-bottom-right{animation:popup-intro-animation-up .2s ease-in-out}.main-container{display:flex;position:relative;z-index:1;background-color:var(--calcite-color-foreground-1);width:var(--arcgis-internal-popup-content-medium-size);min-height:var(--arcgis-internal-popup-content-min-size-y);max-height:var(--arcgis-internal-popup-content-medium-size);overflow:hidden;pointer-events:auto}.pointer{position:absolute;width:0;height:0}.pointer-direction{position:absolute;width:var(--arcgis-internal-popup-pointer-size);height:var(--arcgis-internal-popup-pointer-size);content:"";background-color:var(--calcite-color-foreground-1)}.aligned-top-center .pointer{top:100%;left:50%;margin:0 0 0 var(--arcgis-internal-popup-pointer-size-half-negative)}.aligned-bottom-center .pointer{bottom:100%;left:50%;margin:0 0 0 var(--arcgis-internal-popup-pointer-size-half-negative)}.aligned-top-left .pointer{right:var(--arcgis-internal-popup-pointer-size-half);bottom:var(--arcgis-internal-popup-pointer-size-half);transform:rotate(-45deg)}.aligned-bottom-left .pointer{top:var(--arcgis-internal-popup-pointer-size-half);right:var(--arcgis-internal-popup-pointer-size-half);transform:rotate(45deg)}.aligned-top-right .pointer{bottom:var(--arcgis-internal-popup-pointer-size-half);left:var(--arcgis-internal-popup-pointer-size-half);transform:rotate(45deg)}.aligned-bottom-right .pointer{top:var(--arcgis-internal-popup-pointer-size-half);left:var(--arcgis-internal-popup-pointer-size-half);transform:rotate(-45deg)}.aligned-top-center .pointer-direction,.aligned-bottom-center .pointer-direction{transform:scale(.75,2) rotate(45deg)}.aligned-top-left .pointer-direction,.aligned-bottom-left .pointer-direction,.aligned-top-right .pointer-direction,.aligned-bottom-right .pointer-direction{top:var(--arcgis-internal-popup-pointer-size-half-negative);left:var(--arcgis-internal-popup-pointer-size-half-negative);transform:scale(.75,2.5) rotate(45deg)}.aligned-top-center .pointer-direction{top:var(--arcgis-internal-popup-pointer-size-half-negative);left:0}.aligned-bottom-center .pointer-direction{bottom:var(--arcgis-internal-popup-pointer-size-half-negative);left:0}.is-xl-width-breakpoint .main-container{width:var(--arcgis-internal-popup-content-x-large-size)}.is-lg-width-breakpoint .main-container{width:var(--arcgis-internal-popup-content-large-size)}.is-md-width-breakpoint .main-container{width:var(--arcgis-internal-popup-content-medium-size)}.is-sm-width-breakpoint .main-container,.is-xs-width-breakpoint .main-container{width:var(--arcgis-internal-popup-content-small-size)}.is-xs-width-breakpoint.is-docked-top-center,.is-xs-width-breakpoint.is-docked-bottom-center{margin:0;width:auto}.is-xs-width-breakpoint.is-docked-top-center .main-container,.is-xs-width-breakpoint.is-docked-bottom-center .main-container{position:absolute;right:0;left:0;width:100%;max-height:75%}.is-xs-width-breakpoint.is-docked-bottom-center .main-container{bottom:0}.is-xs-width-breakpoint.is-docked-top-center .main-container{top:0}.is-xl-height-breakpoint .main-container{max-height:var(--arcgis-internal-popup-content-x-large-size)}.is-lg-height-breakpoint .main-container{max-height:var(--arcgis-internal-popup-content-large-size)}.is-sm-height-breakpoint .main-container,.is-xs-height-breakpoint .main-container{max-height:var(--arcgis-internal-popup-content-small-size)}.is-docked{flex-flow:row nowrap;inset:0;margin:var(--arcgis-layout-overlay-space-top, 0) var(--arcgis-layout-overlay-space-right, 0) var(--arcgis-layout-overlay-space-bottom, 0) var(--arcgis-layout-overlay-space-left, 0);padding:var(--calcite-spacing-lg) var(--calcite-spacing-lg) var(--calcite-spacing-xxxl) var(--calcite-spacing-lg);animation:docking-animation .25s ease-out}.is-docked-top-left,.is-docked-top-center,.is-docked-top-right,.is-docked-top-start,.is-docked-top-end{align-items:flex-start}.is-docked-bottom-left,.is-docked-bottom-center,.is-docked-bottom-right,.is-docked-bottom-start,.is-docked-bottom-end{align-items:flex-end}.is-docked-top-left,.is-docked-bottom-left,.is-docked-top-start,.is-docked-bottom-start{justify-content:flex-start}.is-docked-top-center,.is-docked-bottom-center{justify-content:center}.is-docked-top-right,.is-docked-bottom-right,.is-docked-top-end,.is-docked-bottom-end{justify-content:flex-end}.is-docked-top-left.is-rtl,.is-docked-top-right.is-rtl,.is-docked-bottom-left.is-rtl,.is-docked-bottom-right.is-rtl{flex-direction:row-reverse}.is-docked-top-left .main-container,.is-docked-top-right .main-container,.is-docked-bottom-left .main-container,.is-docked-bottom-right .main-container,.is-docked-top-start .main-container,.is-docked-top-end .main-container,.is-docked-bottom-start .main-container,.is-docked-bottom-end .main-container{max-height:80%}.is-docked-top-center .main-container,.is-docked-bottom-center .main-container{max-height:40%}@media(prefers-reduced-motion){.aligned-top-center,.aligned-top-left,.aligned-top-right,.aligned-bottom-center,.aligned-bottom-left,.aligned-bottom-right{animation:none}}@media(prefers-reduced-motion){.is-docked{animation:none}}@keyframes docking-animation{0%{opacity:0}25%{opacity:0}to{opacity:1}}@keyframes popup-intro-animation-down{0%{transform:translateY(calc(var(--calcite-spacing-xs) * -1));opacity:0}to{transform:translate(0);opacity:1}}@keyframes popup-intro-animation-up{0%{transform:translateY(var(--calcite-spacing-xs));opacity:0}to{transform:translate(0);opacity:1}}`;
function f(b) {
  return b && Number.parseInt(b.replaceAll(/[^-\d.]/gu, ""), 10) || 0;
}
const I = N(P), C = {
  buttonEnabled: !0,
  position: "auto",
  breakpoint: {
    width: 544
  }
};
class j extends L {
  constructor() {
    super(...arguments), this._direction = O(), this._featuresComponent = g(), this._dockAction = new V({ id: "popup-dock-action" }), this._mainContainerNode = g(), this._pointerNode = g(), this.messages = F(), this.viewModel = I(this), this._containerNode = g(), this._popupResizeObserver = new ResizeObserver(() => this._positionContainer()), this._positionContainer = () => {
      this.positionStyle = this._calculatePositionStyle();
    }, this.screenLocation = H(this), this.actions = this.viewModel.actions, this.active = this.viewModel.active, this.alignment = "auto", this.autoCloseEnabled = !1, this.autoDestroyDisabled = !1, this.collapsed = !1, this.content = this.viewModel.content, this.defaultPopupTemplateEnabled = this.viewModel.defaultPopupTemplateEnabled, this.dockEnabled = !1, this.effectiveHeading = this.viewModel.effectiveHeading, this.featureCount = this.viewModel.featureCount, this.featureMenuOpen = !1, this.features = this.viewModel.features, this.focusTrapDisabled = !1, this.goToOverride = this.viewModel.goToOverride, this.heading = this.viewModel.heading, this.headingLevel = 2, this.hideActionBar = !1, this.hideCloseButton = !1, this.hideCollapseButton = !1, this.hideFeatureMenuHeading = !1, this.hideFeatureNavigation = !1, this.hideFeatureListLayerTitle = !1, this.hideHeading = !1, this.hideSpinner = !1, this.highlightDisabled = this.viewModel.highlightEnabled, this.includeDefaultActionsDisabled = this.viewModel.includeDefaultActions, this.initialDisplayMode = this.viewModel.initialDisplayMode, this.location = this.viewModel.location, this.open = this.viewModel.open, this.promises = this.viewModel.promises, this.selectedFeature = this.viewModel.selectedFeature, this.selectedFeatureIndex = this.viewModel.selectedFeatureIndex, this.state = this.viewModel.state, this.topLayerDisabled = !1, this.updateLocationEnabled = this.viewModel.updateLocationEnabled, this.view = this.viewModel.view, this.arcgisPropertyChange = $()("active", "collapsed", "currentAlignment", "dockEnabled", "effectiveHeading", "featureCount", "featureMenuOpen", "features", "promises", "selectedDrillInFeature", "selectedFeature", "selectedFeatureComponent", "selectedFeatureIndex", "state", "open"), this.arcgisReady = _(), this.arcgisClose = _(), this.arcgisTriggerAction = _();
  }
  static {
    this.properties = { screenLocation: 16, positionStyle: 16, _featureNavigationTop: 16, actions: 0, active: 0, alignment: 1, autoCloseEnabled: 5, autoDestroyDisabled: 5, collapsed: 5, content: 1, currentAlignment: 32, currentDockPosition: 32, defaultPopupTemplateEnabled: 5, dockEnabled: 5, dockOptions: 0, effectiveHeading: 32, featureCount: 0, featureMenuOpen: 5, featureMenuTitle: 1, features: 0, focusTrapDisabled: 5, goToOverride: 0, heading: 1, headingLevel: 9, hideActionBar: 5, hideCloseButton: 5, hideCollapseButton: 5, hideFeatureMenuHeading: 5, hideFeatureNavigation: 5, hideFeatureListLayerTitle: 5, hideHeading: 5, hideSpinner: 5, highlightDisabled: 5, includeDefaultActionsDisabled: 5, initialDisplayMode: 1, label: 1, location: 0, messageOverrides: 0, open: 5, promises: 0, referenceElement: 1, selectedDrillInFeature: 32, selectedFeature: 0, selectedFeatureComponent: 32, selectedFeatureIndex: 9, state: 32, topLayerDisabled: 5, updateLocationEnabled: 5, view: 0 };
  }
  static {
    this.styles = B;
  }
  get trackLocation() {
    return this.active && !this.dockEnabled;
  }
  get _featureNavigationTop() {
    const { currentAlignment: t, currentDockPosition: e } = this;
    return t === "bottom-left" || t === "bottom-center" || t === "bottom-right" || t === "bottom-start" || t === "bottom-end" || e === "top-left" || e === "top-center" || e === "top-right" || e === "top-start" || e === "top-end";
  }
  get currentAlignment() {
    return this._getCurrentAlignment();
  }
  get currentDockPosition() {
    return this._getCurrentDockPosition();
  }
  get dockOptions() {
    return this._dockOptions || C;
  }
  set dockOptions(t) {
    const e = { ...C }, o = this.viewModel?.view?.breakpoints, i = {};
    o && (i.width = o.xsmall, i.height = o.xsmall);
    const s = { ...e, ...t }, n = { ...e.breakpoint, ...i }, { breakpoint: a } = s;
    typeof a == "object" ? s.breakpoint = { ...n, ...a } : a && (s.breakpoint = n), this._dockOptions = s;
  }
  get selectedDrillInFeature() {
    return this._featuresComponent.value?.selectedDrillInFeature ?? null;
  }
  get selectedFeatureComponent() {
    return this._featuresComponent.value?.selectedFeatureComponent ?? null;
  }
  async handleViewClick(t) {
    return this.viewModel.handleViewClick(t);
  }
  async clear() {
    return this.viewModel.clear();
  }
  async destroy() {
    await this.manager.destroy(), this._dockAction.destroy(), this._popupResizeObserver.disconnect();
  }
  async fetchFeatures(t, e) {
    return await this._featuresComponent.value?.fetchFeatures(t, e);
  }
  async next() {
    return this.viewModel.next();
  }
  async previous() {
    return this.viewModel.previous();
  }
  async setFocus() {
    this._featuresComponent.value?.setFocus();
  }
  async triggerAction(t) {
    return await this._featuresComponent.value?.triggerAction(t);
  }
  connectedCallback() {
    super.connectedCallback(), this._syncPopupResizeObserver();
  }
  loaded() {
    this.manager.onLifecycle(() => [
      p(() => [this.viewModel?.view?.widthBreakpoint, this.dockEnabled, this._direction], () => this._handleDockIcon(), { initial: !0 }),
      p(() => [this.dockEnabled, this.messages?.undock, this.messages?.dock], () => this._handleDockEnabled(), { initial: !0 }),
      p(() => [this.dockOptions, this._featuresComponent.value], () => {
        const { _dockAction: t, dockOptions: e } = this, o = this._featuresComponent.value?.headerActions;
        o?.remove(t), e.buttonEnabled && o?.add(t);
      }, { initial: !0 }),
      p(() => [
        this._pointerNode.value,
        this.alignment,
        this.currentAlignment,
        this.dockEnabled,
        this.dockOptions,
        this.screenLocation,
        this.viewModel?.active,
        this.viewModel?.location,
        this.viewModel?.view?.size
      ], () => this._positionContainer(), { initial: !0 }),
      p(() => this._mainContainerNode.value, (t) => {
        this._syncPopupResizeObserver(t);
      }, { initial: !0 }),
      p(() => this.viewModel?.view?.size, (t, e) => this._updateDockEnabledForViewSize(t, e)),
      p(() => this.viewModel?.view?.ready, () => this._setDockEnabledForViewSize(this.dockOptions), { initial: !0 }),
      p(() => this.view?.map, (t) => {
        this.viewModel.map = t;
      }, { initial: !0 }),
      p(() => this.screenLocation, (t, e) => this._autoClose(t, e)),
      p(() => [this.active, this._containerNode.value, this.dockEnabled, this.topLayerDisabled], () => this._togglePopover(), { initial: !0 })
    ]);
  }
  disconnectedCallback() {
    super.disconnectedCallback(), this._popupResizeObserver.disconnect();
  }
  _togglePopover() {
    this._containerNode.value?.togglePopover(this.active && !this.dockEnabled && !this.topLayerDisabled);
  }
  _syncPopupResizeObserver(t = this._mainContainerNode.value) {
    this._popupResizeObserver.disconnect(), t && this._popupResizeObserver.observe(t);
  }
  _handleClose(t) {
    t.stopPropagation(), this.arcgisClose.emit();
  }
  _autoClose(t, e) {
    this.autoCloseEnabled && t != null && e != null && (this.open = !1);
  }
  _handleArcgisPropertyChange(t) {
    t.detail.name === "collapsed" && (this.collapsed = t.target.collapsed);
  }
  _handleArcgisTriggerAction(t) {
    t.stopPropagation(), t.detail.action === this._dockAction && (this.dockEnabled = !this.dockEnabled), this.arcgisTriggerAction.emit({ action: t.detail.action });
  }
  _isOutsideView(t) {
    const { popupHeight: e, popupWidth: o, screenLocation: i, side: s, view: n } = t;
    return Number.isNaN(o) || Number.isNaN(e) || !n || !i ? !1 : s === "right" && i.x + o / 2 > n.width || s === "left" && i.x - o / 2 < 0 || s === "top" && i.y - e < 0 || s === "bottom" && i.y + e > n.height;
  }
  _getPointerSize() {
    const { _pointerNode: t } = this, e = t.value ? window.getComputedStyle(t.value) : null, o = f(e?.height), i = f(e?.width);
    return Math.hypot(o, i);
  }
  _calculateAutoAlignment(t) {
    if (t !== "auto")
      return t;
    const { _mainContainerNode: e, _popupRect: o, viewModel: i } = this, { view: s } = i, { screenLocation: n } = this;
    if (n == null || !s || !o || !e.value)
      return "top-center";
    const a = window.getComputedStyle(e.value), l = f(a.maxHeight), r = f(a.height), c = this._getPointerSize(), { height: d, width: k } = o, h = k + c, u = Math.max(d, l, r) + c, z = this._isOutsideView({
      popupHeight: u,
      popupWidth: h,
      screenLocation: n,
      side: "right",
      view: s
    }), D = this._isOutsideView({
      popupHeight: u,
      popupWidth: h,
      screenLocation: n,
      side: "left",
      view: s
    }), v = this._isOutsideView({
      popupHeight: u,
      popupWidth: h,
      screenLocation: n,
      side: "top",
      view: s
    }), M = this._isOutsideView({
      popupHeight: u,
      popupWidth: h,
      screenLocation: n,
      side: "bottom",
      view: s
    });
    return D ? v ? "bottom-right" : "top-right" : z ? v ? "bottom-left" : "top-left" : v ? M ? "top-center" : "bottom-center" : "top-center";
  }
  _callCurrentAlignment(t) {
    return typeof t == "function" ? t.call(this) : t;
  }
  _getCurrentAlignment() {
    return this.dockEnabled || !this.active || !this._mainContainerNode.value ? null : this._calculateAutoAlignment(this._callCurrentAlignment(this.alignment));
  }
  _callDockPosition(t) {
    return typeof t == "function" ? t.call(this) : t;
  }
  _getDockPosition() {
    return this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position));
  }
  _getCurrentDockPosition() {
    return this.dockEnabled && this.active ? this._getDockPosition() : null;
  }
  _calculateAutoDockPosition(t) {
    if (t !== "auto")
      return t;
    const e = this.viewModel?.view, o = "top-end";
    if (!e)
      return o;
    const { breakpoints: i } = e;
    return i?.xsmall && e.width <= i.xsmall ? "bottom-center" : o;
  }
  _getDockIcon() {
    const t = this._getDockPosition(), { _direction: e } = this;
    if (this.dockEnabled)
      return "minimize";
    switch (t) {
      case "top-left":
      case "bottom-left":
        return "dock-left";
      case "top-center":
        return "maximize";
      case "bottom-center":
        return "dock-bottom";
      case "top-right":
      case "bottom-right":
        return "dock-right";
      case "top-start":
      case "bottom-start":
        return e === "rtl" ? "dock-right" : "dock-left";
      default:
        return e === "rtl" ? "dock-left" : "dock-right";
    }
  }
  _handleDockIcon() {
    this._dockAction.icon = this._getDockIcon();
  }
  _handleDockEnabled() {
    this._dockAction.title = this.dockEnabled ? this.messages?.undock : this.messages?.dock;
  }
  _calculateAlignmentPosition(t, e, o, i) {
    if (t < 0 || e < 0 || !o || !i || t > o.width || e > o.height)
      return;
    const { topLayerDisabled: s } = this, n = s ? t : t + o.x, a = s ? e : e + o.y, { _direction: l, currentAlignment: r } = this, c = this._getPointerSize(), d = c / 2;
    if (r === "top-left" || r === "top-start" && l === "ltr" || r === "top-end" && l === "rtl")
      return {
        top: a - (i.height + d),
        left: n - i.width - d
      };
    if (r === "top-center")
      return {
        top: a - (i.height + c),
        left: n - i.width / 2
      };
    if (r === "top-right" || r === "top-end" && l === "ltr" || r === "top-start" && l === "rtl")
      return {
        top: a - (i.height + d),
        left: n + d
      };
    if (r === "bottom-left" || r === "bottom-start" && l === "ltr" || r === "bottom-end" && l === "rtl")
      return {
        top: a + d,
        left: n - i.width - d
      };
    if (r === "bottom-center")
      return {
        top: a + c,
        left: n - i.width / 2
      };
    if (r === "bottom-right" || r === "bottom-end" && l === "ltr" || r === "bottom-start" && l === "rtl")
      return {
        top: a + d,
        left: n + d
      };
  }
  _getPositionStyleValue(t) {
    return t != null ? `${t}px` : "auto";
  }
  _calculatePositionStyle() {
    if (this.dockEnabled)
      return;
    const { screenLocation: t } = this;
    if (t == null)
      return;
    const e = this.view?.container?.getBoundingClientRect(), o = this._mainContainerNode.value?.getBoundingClientRect();
    this._popupRect = o;
    const i = this._calculateAlignmentPosition(t.x, t.y, e, o);
    if (i)
      return `inset: ${this._getPositionStyleValue(i.top)} ${this._getPositionStyleValue(i.right)} ${this._getPositionStyleValue(i.bottom)} ${this._getPositionStyleValue(i.left)};`;
  }
  _dockingThresholdCrossed(t, e, o) {
    const [i, s] = t, [n, a] = e, { width: l = 0, height: r = 0 } = o ?? {};
    return i <= l && n > l || i > l && n <= l || s <= r && a > r || s > r && a <= r;
  }
  _updateDockEnabledForViewSize(t, e) {
    if (!t || !e || !this.viewModel?.view?.ready)
      return;
    const { dockOptions: o } = this, i = o.breakpoint;
    typeof i == "object" && this._dockingThresholdCrossed(t, e, i) && this._setDockEnabledForViewSize(o);
  }
  _shouldDockAtCurrentViewSize(t) {
    const e = t.breakpoint, o = this.viewModel?.view?.ui;
    if (!o)
      return !1;
    const { width: i, height: s } = o;
    if (Number.isNaN(i) || Number.isNaN(s) || typeof e != "object")
      return !1;
    const n = typeof e.width == "number" && i <= (e.width ?? 0), a = typeof e.height == "number" && s <= (e.height ?? 0);
    return n || a;
  }
  _setDockEnabledForViewSize(t) {
    this.viewModel?.view?.ready && typeof t.breakpoint == "object" && (this.dockEnabled = this._shouldDockAtCurrentViewSize(t));
  }
  render() {
    const { _direction: t, dockEnabled: e, currentAlignment: o, currentDockPosition: i, positionStyle: s } = this, { active: n, view: a } = this.viewModel, l = n && e, r = n && !e, c = a?.widthBreakpoint, d = a?.heightBreakpoint, k = {
      "aligned-top-center": o === "top-center",
      "aligned-bottom-center": o === "bottom-center",
      "aligned-top-left": o === "top-left" || o === "top-start" && t === "ltr" || o === "top-end" && t === "rtl",
      "aligned-bottom-left": o === "bottom-left" || o === "bottom-start" && t === "ltr" || o === "bottom-end" && t === "rtl",
      "aligned-top-right": o === "top-right" || o === "top-end" && t === "ltr" || o === "top-start" && t === "rtl",
      "aligned-bottom-right": o === "bottom-right" || o === "bottom-end" && t === "ltr" || o === "bottom-start" && t === "rtl",
      "is-docked": l,
      shadow: r,
      "is-rtl": this._direction === "rtl",
      "is-docked-top-start": i === "top-start",
      "is-docked-top-end": i === "top-end",
      "is-docked-top-left": i === "top-left",
      "is-docked-top-center": i === "top-center",
      "is-docked-top-right": i === "top-right",
      "is-docked-bottom-left": i === "bottom-left",
      "is-docked-bottom-center": i === "bottom-center",
      "is-docked-bottom-right": i === "bottom-right",
      "is-docked-bottom-start": i === "bottom-start",
      "is-docked-bottom-end": i === "bottom-end",
      "is-xl-width-breakpoint": c === "xlarge",
      "is-lg-width-breakpoint": c === "large",
      "is-md-width-breakpoint": c === "medium",
      "is-sm-width-breakpoint": c === "small",
      "is-xs-width-breakpoint": c === "xsmall",
      "is-xl-height-breakpoint": d === "xlarge",
      "is-lg-height-breakpoint": d === "large",
      "is-md-height-breakpoint": d === "medium",
      "is-sm-height-breakpoint": d === "small",
      "is-xs-height-breakpoint": d === "xsmall"
    };
    return w`<div style=${S(s)} class=${y(x("root", k, {
      hidden: !n || !s && !e
    }))} .ariaHidden=${!n} .ariaLabel=${T(this.heading ?? "")} role=dialog popover=manual ${m(this._containerNode)}>${this._renderMainContainer()}${this._renderPointer()}</div>`;
  }
  _renderPointer() {
    return !this.dockEnabled || !this.active ? w`<div class="pointer" role=presentation><div class=${y(x("pointer-direction", "shadow"))} ${m(this._pointerNode)}></div></div>` : null;
  }
  _renderMainContainer() {
    const t = {
      shadow: this.dockEnabled
    };
    return w`<div class=${y(x("main-container", t))} ${m(this._mainContainerNode)}><arcgis-features-next .collapsed=${this.collapsed} .autoDestroyDisabled=${this.autoDestroyDisabled} .featureNavigationTop=${this._featureNavigationTop} .focusTrapEnabled=${!this.focusTrapDisabled} .headingLevel=${this.headingLevel} .hideActionBar=${this.hideActionBar} .hideCloseButton=${this.hideCloseButton} .hideFeatureListLayerTitle=${this.hideFeatureListLayerTitle} .hideFeatureMenuHeading=${this.hideFeatureMenuHeading} .hideFeatureNavigation=${this.hideFeatureNavigation} .hideHeading=${this.hideHeading} .hideSpinner=${this.hideSpinner} @arcgisPropertyChange=${this._handleArcgisPropertyChange} @arcgisTriggerAction=${this._handleArcgisTriggerAction} @arcgisClose=${this._handleClose} .messageOverrides=${{ collapse: this.messages.collapse, expand: this.messages.expand }} .referenceElement=${this.referenceElement} .responsiveActionsEnabled=${!0} .showCollapseButton=${!this.hideCollapseButton} .viewModel=${this.viewModel} ${m(this._featuresComponent)}><slot name=actions-start slot=actions-start></slot><slot name=actions-end slot=actions-end></slot></arcgis-features-next></div>`;
  }
}
A("arcgis-popup", j);
export {
  j as ArcgisPopup
};
