import { c as a } from "../../chunks/runtime.js";
import { css as d, html as o } from "lit";
import { keyed as n } from "lit/directives/keyed.js";
import h from "@arcgis/core/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js";
import { LitElement as b, createEvent as f } from "@arcgis/lumina";
import { createRef as c, ref as s } from "lit/directives/ref.js";
import { u as g } from "../../chunks/useT9n.js";
import { m as u } from "../../chunks/useViewModel.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
const p = d`.esri-widget__heading{color:var(--calcite-color-text-2);margin:0 0 .5rem;font-weight:var(--calcite-font-weight-semibold)}h1.esri-widget__heading{font-size:var(--calcite-font-size-xl)}h2.esri-widget__heading{font-size:var(--calcite-font-size-md)}h3.esri-widget__heading,h4.esri-widget__heading,h5.esri-widget__heading,h6.esri-widget__heading{font-size:var(--calcite-font-size)}.esri-widget{--esri-widget-padding-x: 15px;--esri-widget-padding-y: var(--calcite-spacing-md);--esri-widget-padding: var(--esri-widget-padding-y) var(--esri-widget-padding-x);box-sizing:border-box;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);font-size:var(--calcite-font-size);line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget *,.esri-widget :before,.esri-widget :after{box-sizing:inherit}.esri-widget.esri-widget--disabled>*{opacity:.4;pointer-events:none}.esri-widget.esri-widget--compact{--esri-widget-padding-y: 0;--esri-widget-padding-x: 0}.esri-widget__anchor{color:var(--calcite-color-text-2)}.esri-widget__anchor:hover{color:var(--calcite-color-text-3)}.esri-widget__anchor:hover,.esri-widget__anchor:focus{text-decoration:underline}.esri-widget__anchor--disabled{opacity:.4;pointer-events:none}.esri-widget__header{background-color:var(--calcite-color-foreground-1);flex:1 0 100%;justify-content:space-between;align-items:center;width:100%;min-height:48px;padding:12px 0 12px 15px;display:flex}.esri-widget__header .esri-widget__heading{width:calc(100% - 48px);text-align:initial;color:var(--calcite-color-text-1);align-items:center;margin:0;padding:0;display:flex}.esri-widget__header-button{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);border:none;flex:0 0 48px;justify-content:center;align-self:stretch;align-items:center;width:48px;padding:0;display:flex}.esri-widget__footer{background-color:var(--calcite-color-foreground-1);justify-content:center;align-items:center;width:100%;min-height:48px;display:flex}.esri-widget__footer-pagination{color:var(--calcite-color-text-2);justify-content:space-between;align-items:center;display:flex}.esri-widget__footer-pagination-previous-button,.esri-widget__footer-pagination-next-button{cursor:pointer;background-color:var(--calcite-color-foreground-1);border:0;margin:0 7px;padding:12px 15px;transition:background-color .125s ease-in-out}.esri-widget__footer-pagination-previous-button:hover,.esri-widget__footer-pagination-previous-button:focus,.esri-widget__footer-pagination-next-button:hover,.esri-widget__footer-pagination-next-button:focus{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1)}.esri-menu{visibility:hidden;z-index:1;background-clip:padding;background-color:var(--calcite-color-foreground-1);background-clip:padding-box;width:100%;max-height:0;margin:2px 0 0;padding:0;font-size:var(--calcite-font-size);line-height:var(--calcite-spacing-xl);position:absolute;top:100%;left:0;overflow:hidden;box-shadow:0 1px 2px #0000004d}.esri-menu .esri-menu__header{color:var(--calcite-color-text-inverse);background-color:var(--calcite-color-inverse);padding:6px 12px}.esri-menu__list{margin:0;padding:0;list-style:none}.esri-menu__list-item{cursor:pointer;border-top:1px solid #adadad4d;border-left:3px solid #0000;padding:.8em 1em}.esri-menu__list-item [class^=esri-icon-],.esri-menu__list-item [class*=" esri-icon-"]{padding-right:2.8px}.esri-menu__list-item:first-child{border-top:none}.esri-menu__list-item--focus,.esri-menu__list-item:hover,.esri-menu__list-item:focus{background-color:var(--calcite-color-foreground-1)}.esri-menu__list-item:active{background-color:var(--calcite-color-foreground-current)}.esri-menu__list-item--active,.esri-menu__list-item--active:hover,.esri-menu__list-item--active:focus{background-color:var(--calcite-color-foreground-1);border-left-color:var(--calcite-color-brand)}.esri-widget__table{border-collapse:collapse;color:var(--calcite-color-text-1);border:none;width:100%;line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget__table tr:nth-child(odd){background-color:var(--calcite-color-transparent)}.esri-widget__table tr:nth-child(2n){background-color:var(--calcite-color-transparent-press)}.esri-widget__table tr a{color:var(--calcite-color-text-2)}.esri-widget__table tr a:hover,.esri-widget__table tr a:focus{color:var(--calcite-color-text-1)}.esri-widget__table tr td,.esri-widget__table tr th{vertical-align:top;word-break:break-word;padding:.5em .7em;font-size:var(--calcite-font-size-sm);font-weight:var(--calcite-font-weight-regular)}.esri-widget__table tr th{text-align:left;border-right:3px solid #0000000d;width:50%}.esri-widget__table tr td{width:50%}.esri-input{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1);border:1px solid #959595;font-size:var(--calcite-font-size)}.esri-input::-ms-clear{display:none}.esri-input::placeholder{opacity:1;color:var(--calcite-color-text-2)}.esri-input:placeholder-shown{text-overflow:ellipsis}.esri-input[type=text],.esri-input[type=password],.esri-input[type=number]{height:32px;padding:0 .5em}calcite-combobox.esri-input{border:none}.esri-widget__content--empty{text-align:center;color:var(--calcite-color-border-input);flex-flow:column wrap;align-items:center;padding:18px 22px;display:flex}.esri-widget__content--empty h1.esri-widget__heading,.esri-widget__content--empty h2.esri-widget__heading,.esri-widget__content--empty h3.esri-widget__heading,.esri-widget__content--empty h4.esri-widget__heading,.esri-widget__content--empty h5.esri-widget__heading{font-weight:var(--calcite-font-weight-regular)}.esri-widget__content-illustration--empty{width:128px;padding:1rem 0}.esri-widget__content-icon--empty{width:32px;padding:.5rem 0}.esri-select{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background:var(--calcite-color-foreground-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-8 -8 32 32' width='32' height='32'%3E%3Cpath d='M8 11.207l-4-4V5.793l4 4 4-4v1.414z' fill='%23adadad' fillrule='nonzero'/%3E%3C/svg%3E") 100% no-repeat;border:1px solid #959595;border-radius:0;width:100%;height:32px;margin:0;padding:0 .5em;font-family:inherit;font-size:.85em;display:block}.esri-select[disabled]{cursor:auto}.esri-select::-ms-expand{display:none}.esri-disabled a,.esri-disabled [role=menu],.esri-disabled [role=checkbox],.esri-disabled [class^=esri-icon-],.esri-disabled [class*=" esri-icon-"]{color:var(--calcite-color-text-3)}.keynav-mode .esri-widget:focus,.keynav-mode .esri-widget :focus{z-index:1;outline-offset:2px;outline:2px solid #adadad}.esri-widget__loader-animation{border:.15em solid #adadad4d;border-top-color:var(--calcite-color-border-input);border-radius:100%;width:1em;height:1em;font-size:var(--calcite-font-size-md);animation:1.25s linear infinite esri-rotate;display:block;transform:translateZ(0)}:dir(rtl) .esri-widget__table th{text-align:right;border-left:3px solid #0000000d;border-right:none}:dir(rtl) .esri-select{background-position:0}:dir(rtl) .esri-menu__list-item{border-left:none;border-right:3px solid #0000}:dir(rtl) .esri-menu__list-item [class^=esri-icon-],:dir(rtl) .esri-menu__list-item [class*=" esri-icon-"]{padding-left:2px;padding-right:0}:dir(rtl) .esri-menu__list-item--active{border-right-color:var(--calcite-color-brand)}.esri-icon-font-fallback-text{clip:rect(0 0 0 0);width:1px;height:1px;position:absolute;overflow:hidden}.esri-rotating{animation:1.25s linear infinite esri-rotate;transform:translateZ(0)}.esri-clearfix:before,.esri-clearfix:after{content:" ";display:table}.esri-clearfix:after{clear:both}.esri-interactive{cursor:pointer}.esri-invisible{visibility:hidden!important}.esri-offscreen{position:absolute;top:-999em;left:-999em}.esri-match-height{flex-direction:column;flex:auto;display:flex;overflow:hidden}.esri-hidden{display:none!important}[class^=esri-icon-],[class*=" esri-icon-"]{speak:none;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-style:normal;font-weight:var(--calcite-font-weight-normal);line-height:1;font-family:CalciteWebCoreIcons!important}.esri-icon-close:before{content:"";color:inherit}.esri-icon-drag-horizontal:before{content:"";color:inherit}.esri-icon-drag-vertical:before{content:"";color:inherit}.esri-icon-handle-horizontal:before{content:"";color:inherit}.esri-icon-handle-vertical:before{content:"";color:inherit}.esri-icon-check-mark:before{content:"";color:inherit}.esri-icon-left-triangle-arrow:before{content:"";color:inherit}.esri-icon-right-triangle-arrow:before{content:"";color:inherit}.esri-icon-down-arrow:before{content:"";color:inherit}.esri-icon-up-arrow:before{content:"";color:inherit}.esri-icon-overview-arrow-bottom-left:before{content:"";color:inherit}.esri-icon-overview-arrow-bottom-right:before{content:"";color:inherit}.esri-icon-overview-arrow-top-left:before{content:"";color:inherit}.esri-icon-overview-arrow-top-right:before{content:"";color:inherit}.esri-icon-maximize:before{content:"";color:inherit}.esri-icon-minimize:before{content:"";color:inherit}.esri-icon-checkbox-unchecked:before{content:"";color:inherit}.esri-icon-checkbox-checked:before{content:"";color:inherit}.esri-icon-radio-unchecked:before{content:"";color:inherit}.esri-icon-radio-checked:before{content:"";color:inherit}.esri-icon-up-arrow-circled:before{content:"";color:inherit}.esri-icon-down-arrow-circled:before{content:"";color:inherit}.esri-icon-left-arrow-circled:before{content:"";color:inherit}.esri-icon-right-arrow-circled:before{content:"";color:inherit}.esri-icon-zoom-out-fixed:before{content:"";color:inherit}.esri-icon-zoom-in-fixed:before{content:"";color:inherit}.esri-icon-refresh:before{content:"";color:inherit}.esri-icon-edit:before{content:"";color:inherit}.esri-icon-authorize:before{content:"";color:inherit}.esri-icon-map-pin:before{content:"";color:inherit}.esri-icon-blank-map-pin:before{content:"";color:inherit}.esri-icon-table:before{content:"";color:inherit}.esri-icon-plus:before{content:"+";color:inherit}.esri-icon-minus:before{content:"";color:inherit}.esri-icon-beginning:before{content:"";color:inherit}.esri-icon-reverse:before{content:"";color:inherit}.esri-icon-pause:before{content:"";color:inherit}.esri-icon-play:before{content:"";color:inherit}.esri-icon-forward:before{content:"";color:inherit}.esri-icon-end:before{content:"";color:inherit}.esri-icon-erase:before{content:"";color:inherit}.esri-icon-up-down-arrows:before{content:"";color:inherit}.esri-icon-left:before{content:"";color:inherit}.esri-icon-right:before{content:"";color:inherit}.esri-icon-announcement:before{content:"";color:inherit}.esri-icon-notice-round:before{content:"";color:inherit}.esri-icon-notice-triangle:before{content:"";color:inherit}.esri-icon-home:before{content:"";color:inherit}.esri-icon-locate:before{content:"";color:inherit}.esri-icon-expand:before{content:"";color:inherit}.esri-icon-collapse:before{content:"";color:inherit}.esri-icon-layer-list:before{content:"";color:inherit}.esri-icon-basemap:before{content:"";color:inherit}.esri-icon-globe:before{content:"";color:inherit}.esri-icon-applications:before{content:"";color:inherit}.esri-icon-arrow-up-circled:before{content:"";color:inherit}.esri-icon-arrow-down-circled:before{content:"";color:inherit}.esri-icon-arrow-left-circled:before{content:"";color:inherit}.esri-icon-arrow-right-circled:before{content:"";color:inherit}.esri-icon-minus-circled:before{content:"";color:inherit}.esri-icon-plus-circled:before{content:"";color:inherit}.esri-icon-add-attachment:before{content:"";color:inherit}.esri-icon-attachment:before{content:"";color:inherit}.esri-icon-calendar:before{content:"";color:inherit}.esri-icon-close-circled:before{content:"";color:inherit}.esri-icon-browser:before{content:"";color:inherit}.esri-icon-collection:before{content:"";color:inherit}.esri-icon-comment:before{content:"";color:inherit}.esri-icon-configure-popup:before{content:"";color:inherit}.esri-icon-contact:before{content:"";color:inherit}.esri-icon-dashboard:before{content:"";color:inherit}.esri-icon-deny:before{content:"";color:inherit}.esri-icon-description:before{content:"";color:inherit}.esri-icon-directions:before{content:"";color:inherit}.esri-icon-directions2:before{content:"";color:inherit}.esri-icon-documentation:before{content:"";color:inherit}.esri-icon-duplicate:before{content:"";color:inherit}.esri-icon-review:before{content:"";color:inherit}.esri-icon-environment-settings:before{content:"";color:inherit}.esri-icon-error:before{content:"";color:inherit}.esri-icon-error2:before{content:"";color:inherit}.esri-icon-experimental:before{content:"";color:inherit}.esri-icon-feature-layer:before{content:"";color:inherit}.esri-icon-filter:before{content:"";color:inherit}.esri-icon-grant:before{content:"";color:inherit}.esri-icon-group:before{content:"";color:inherit}.esri-icon-key:before{content:"";color:inherit}.esri-icon-labels:before{content:"";color:inherit}.esri-icon-tag:before{content:"";color:inherit}.esri-icon-layers:before{content:"";color:inherit}.esri-icon-left-arrow:before{content:"";color:inherit}.esri-icon-right-arrow:before{content:"";color:inherit}.esri-icon-link-external:before{content:"";color:inherit}.esri-icon-link:before{content:"";color:inherit}.esri-icon-loading-indicator:before{content:"";color:inherit}.esri-icon-maps:before{content:"";color:inherit}.esri-icon-marketplace:before{content:"";color:inherit}.esri-icon-media:before{content:"";color:inherit}.esri-icon-media2:before{content:"";color:inherit}.esri-icon-menu:before{content:"";color:inherit}.esri-icon-mobile:before{content:"";color:inherit}.esri-icon-phone:before{content:"";color:inherit}.esri-icon-navigation:before{content:"";color:inherit}.esri-icon-pan:before{content:"";color:inherit}.esri-icon-printer:before{content:"";color:inherit}.esri-icon-pie-chart:before{content:"";color:inherit}.esri-icon-chart:before{content:"";color:inherit}.esri-icon-line-chart:before{content:"";color:inherit}.esri-icon-question:before{content:"";color:inherit}.esri-icon-resend-invitation:before{content:"";color:inherit}.esri-icon-rotate:before{content:"";color:inherit}.esri-icon-save:before{content:"";color:inherit}.esri-icon-settings:before{content:"";color:inherit}.esri-icon-settings2:before{content:"";color:inherit}.esri-icon-share:before{content:"";color:inherit}.esri-icon-sign-out:before{content:"";color:inherit}.esri-icon-support:before{content:"";color:inherit}.esri-icon-user:before{content:"";color:inherit}.esri-icon-time-clock:before{content:"";color:inherit}.esri-icon-trash:before{content:"";color:inherit}.esri-icon-upload:before{content:"";color:inherit}.esri-icon-download:before{content:"";color:inherit}.esri-icon-zoom-in-magnifying-glass:before{content:"";color:inherit}.esri-icon-search:before{content:"";color:inherit}.esri-icon-zoom-out-magnifying-glass:before{content:"";color:inherit}.esri-icon-locked:before{content:"";color:inherit}.esri-icon-unlocked:before{content:"";color:inherit}.esri-icon-favorites:before{content:"";color:inherit}.esri-icon-compass:before{content:"";color:inherit}.esri-icon-down:before{content:"";color:inherit}.esri-icon-up:before{content:"";color:inherit}.esri-icon-chat:before{content:"";color:inherit}.esri-icon-dock-bottom:before{content:"";color:inherit}.esri-icon-dock-left:before{content:"";color:inherit}.esri-icon-dock-right:before{content:"";color:inherit}.esri-icon-organization:before{content:"";color:inherit}.esri-icon-north-navigation:before{content:"";color:inherit}.esri-icon-locate-circled:before{content:"";color:inherit}.esri-icon-dial:before{content:"";color:inherit}.esri-icon-polygon:before{content:"";color:inherit}.esri-icon-polyline:before{content:"";color:inherit}.esri-icon-visible:before{content:"";color:inherit}.esri-icon-non-visible:before{content:"";color:inherit}.esri-icon-link-vertical:before{content:"";color:inherit}.esri-icon-unlocked-link-vertical:before{content:"";color:inherit}.esri-icon-link-horizontal:before{content:"";color:inherit}.esri-icon-unlocked-link-horizontal:before{content:"";color:inherit}.esri-icon-swap:before{content:"";color:inherit}.esri-icon-cta-link-external:before{content:"";color:inherit}.esri-icon-reply:before{content:"";color:inherit}.esri-icon-public:before{content:"";color:inherit}.esri-icon-share2:before{content:"";color:inherit}.esri-icon-launch-link-external:before{content:"";color:inherit}.esri-icon-rotate-back:before{content:"";color:inherit}.esri-icon-pan2:before{content:"";color:inherit}.esri-icon-tracking:before{content:"";color:inherit}.esri-icon-expand2:before{content:"";color:inherit}.esri-icon-arrow-down:before{content:"";color:inherit}.esri-icon-arrow-up:before{content:"";color:inherit}.esri-icon-hollow-eye:before{content:"";color:inherit}.esri-icon-play-circled:before{content:"";color:inherit}.esri-icon-volume-off:before{content:"";color:inherit}.esri-icon-volume-on:before{content:"";color:inherit}.esri-icon-bookmark:before{content:"";color:inherit}.esri-icon-lightbulb:before{content:"";color:inherit}.esri-icon-sketch-rectangle:before{content:"";color:inherit}.esri-icon-north-navigation-filled:before{content:"";color:inherit}.esri-icon-default-action:before{content:"";color:inherit}.esri-icon-undo:before{content:"";color:inherit}.esri-icon-redo:before{content:"";color:inherit}.esri-icon-cursor:before{content:"";color:inherit}.esri-icon-cursor-filled:before{content:"";color:inherit}.esri-icon-measure:before{content:"";color:inherit}.esri-icon-measure-line:before{content:"";color:inherit}.esri-icon-measure-area:before{content:"";color:inherit}.esri-icon-legend:before{content:"";color:inherit}.esri-icon-sliders:before{content:"";color:inherit}.esri-icon-sliders-horizontal:before{content:"";color:inherit}.esri-icon-cursor-marquee:before{content:"";color:inherit}.esri-icon-lasso:before{content:"";color:inherit}.esri-icon-elevation-profile:before{content:"";color:inherit}.esri-icon-slice:before{content:"";color:inherit}.esri-icon-line-of-sight:before{content:"";color:inherit}.esri-icon-zoom-to-object:before{content:"";color:inherit}.esri-icon-urban-model:before{content:"";color:inherit}.esri-icon-measure-building-height-shadow:before{content:"";color:inherit}.esri-icon-partly-cloudy:before{content:"";color:inherit}:host{min-width:300px}.arcgis-utility-network-trace-analysis{flex:auto;width:300px}.arcgis-utility-network-trace-analysis calcite-tab{background-color:var(--calcite-color-foreground-1);padding-top:0;padding-bottom:0;--calcite-tab-content-space-y: 0}.arcgis-utility-network-trace-analysis calcite-tab:not([selected]){flex:0}.arcgis-utility-network-trace-analysis calcite-block{--calcite-block-border-color: transparent;margin:0;background-color:transparent}.arcgis-utility-network-trace-analysis calcite-block calcite-label:last-child{--calcite-label-margin-bottom: 0}.arcgis-utility-network-trace-analysis calcite-notice{padding:var(--calcite-spacing-xs)}`, w = u(h), r = "map-components:utility-network-trace-analysis";
class m extends b {
  constructor() {
    super(...arguments), this._traceInputsRef = c(), this._traceResultsRef = c(), this.messages = g({ blocking: !0 }), this.viewModel = w(this), this._activeTab = "input", this._enableRunTraceButton = !1, this._viewLoaded = !1, this.allowEditingDisabled = !1, this.autoDestroyDisabled = !1, this.closable = !1, this.state = this.viewModel.state, this.view = this.viewModel.view, this.arcgisReady = f();
  }
  static {
    this.properties = { _activeTab: 16, _enableRunTraceButton: 16, _traceResult: 16, _viewLoaded: 16, allowEditingDisabled: 5, autoDestroyDisabled: 5, closable: 7, icon: 1, label: 3, messageOverrides: 0, mode: 1, referenceElement: 1, state: 3, view: 0 };
  }
  static {
    this.styles = p;
  }
  get _allLayers() {
    const { view: e } = this;
    return e?.map ? e.map.allLayers.toArray().concat(e.map.allTables.toArray()) : [];
  }
  get _traceResultsExist() {
    const { _traceResult: e } = this;
    return e !== void 0 && this._numTraceResults > 0;
  }
  get _numTraceResults() {
    const { _traceResult: e } = this;
    return e ? e.elements.length + e.globalFunctionResults.length : 0;
  }
  async destroy() {
    await this.manager.destroy();
  }
  _clearTraceResult() {
    this._traceResult = void 0;
  }
  _switchTab(e) {
    this._activeTab = e;
  }
  _getLoadError(e) {
    const { messages: i } = this;
    switch (e) {
      case "no-user-type-extension":
        return i.loadErrors.noUserTypeExtension;
      case "no-utility-network":
        return i.loadErrors.noUtilityNetwork;
      case "no-view":
        return i.loadErrors.noView;
      case "sceneView-not-supported":
        return i.loadErrors.sceneViewNotSupported;
      default:
        return e;
    }
  }
  async _runTrace() {
    const { viewModel: e, _selectedTraceConfig: i } = this;
    if (!i) {
      console.error(`${r} - Trace configuration not found`);
      return;
    }
    try {
      this._traceResult = await e.executeNamedTraceConfiguration({
        namedTraceConfigurationGlobalId: i.globalId
      });
    } catch (t) {
      console.error(`${r} - Error while running trace: `, String(t)), this._traceResult = void 0;
    }
  }
  _handleSubnetworkTraceConfigChange() {
    const { _selectedTraceConfig: e } = this;
    if (!e?.traceConfiguration) {
      console.error(`${r} - Trace configuration not found`);
      return;
    }
    const t = (e.traceConfiguration.subnetworkName ?? "") !== "";
    this._enableRunTraceButton = t;
  }
  _handleTraceConfigChange() {
    if (this._enableRunTraceButton = !1, this._selectedTraceConfig = this._traceInputsRef.value?.selectedTraceConfiguration, !this._selectedTraceConfig) {
      console.error(`${r} - Trace configuration not found`);
      return;
    }
    switch (this._selectedTraceConfig.traceType) {
      case "subnetwork":
        this._handleSubnetworkTraceConfigChange();
        break;
      default:
        console.error(`${r} - Unknown trace configuration type`);
    }
  }
  _handleTraceInputsChange() {
    this._handleTraceConfigChange();
  }
  _handleUtilityNetworkChange() {
    this.viewModel.utilityNetwork = this._traceInputsRef.value?.selectedUtilityNetwork;
  }
  renderResultsTab() {
    return n(`${this.el.id}__results-tab-item`, o`<calcite-tab .selected=${this._activeTab === "results"}>${this.viewModel.state === "executing" ? o`<calcite-loader .label=${this.messages.runningTrace} .text=${this.messages.runningTrace}></calcite-loader>` : o`<arcgis-utility-network-trace-results .layers=${this._allLayers} .traceConfigTitle=${this._selectedTraceConfig?.title} .traceResult=${this._traceResult} .utilityNetwork=${this.viewModel.utilityNetwork ?? void 0} ${s(this._traceResultsRef)}></arcgis-utility-network-trace-results>`}</calcite-tab>`);
  }
  renderResultsFooter() {
    const { _numTraceResults: e, _traceResultsExist: i } = this;
    return o`<calcite-button appearance=outline width=full @click=${() => {
      this._switchTab("input"), this._clearTraceResult();
    }} .disabled=${!i} slot=footer>${i ? this.messages.buttons.clearResultsCustom.replace("{number}", e.toString()) : this.messages.buttons.clearResultsGeneric}</calcite-button>`;
  }
  renderInputTab() {
    return n(`${this.el.id}__inputs-tab-item`, o`<calcite-tab .selected=${this._activeTab === "input"}><arcgis-utility-network-trace-inputs .view=${this.view || void 0} @arcgisTraceInputsChange=${this._handleTraceInputsChange} @arcgisUtilityNetworkChange=${this._handleUtilityNetworkChange} ${s(this._traceInputsRef)}></arcgis-utility-network-trace-inputs></calcite-tab>`);
  }
  renderInputFooter() {
    return o`<calcite-button appearance=solid width=full @click=${() => {
      this._switchTab("results"), this._runTrace();
    }} .disabled=${!this._enableRunTraceButton} slot=footer>${this.messages.buttons.getResults}</calcite-button>`;
  }
  render() {
    const { messages: e, viewModel: { loadError: i, state: t } } = this, l = t === "disabled" && i != null && i !== "no-utility-network" ? o`<calcite-notice kind=warning open scale=s slot=content-top width=full><div slot=message>${this._getLoadError(i)}</div></calcite-notice>` : void 0;
    return o`<div class="arcgis-utility-network-trace-analysis"><calcite-panel .loading=${this.view === void 0}><calcite-tabs layout=center position=top><calcite-tab-nav slot=title-group><calcite-tab-title @click=${() => {
      this._switchTab("input");
    }} .selected=${this._activeTab === "input"}>${e.tabs.inputTab}</calcite-tab-title><calcite-tab-title @click=${() => {
      this._switchTab("results");
    }} .selected=${this._activeTab === "results"}>${e.tabs.resultsTab}</calcite-tab-title></calcite-tab-nav>${this.view !== void 0 ? o`${this.renderInputTab()}${this.renderResultsTab()}` : null}</calcite-tabs>${l}${this._activeTab === "input" ? this.renderInputFooter() : null}${this._activeTab === "results" ? this.renderResultsFooter() : null}</calcite-panel></div>`;
  }
}
a("arcgis-utility-network-trace-analysis", m);
export {
  m as ArcgisUtilityNetworkTraceAnalysis
};
