var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
/**
 * @license
 * Copyright 2025-2026 Open Home Foundation
 * SPDX-License-Identifier: Apache-2.0
 */
import "@material/web/button/text-button";
import "@material/web/dialog/dialog";
import "@material/web/list/list";
import "@material/web/list/list-item";
import { html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { preventDefault } from "../../../util/prevent_default.js";
let ComissionNodeDialog = class extends LitElement {
  render() {
    return html`
            <md-dialog open @cancel=${preventDefault} @closed=${this._handleClosed}>
                <div slot="headline">Commission node</div>
                <div slot="content" @node-commissioned=${this._nodeCommissioned}>
                    ${!this._mode ? html`<md-list>
                              <md-list-item
                                  type="button"
                                  .disabled=${!this.client.serverInfo.bluetooth_enabled}
                                  @click=${this._commissionWifi}
                                  >Commission new WiFi device</md-list-item
                              >
                              <md-list-item
                                  type="button"
                                  .disabled=${!this.client.serverInfo.bluetooth_enabled}
                                  @click=${this._commissionThread}
                                  >Commission new Thread device</md-list-item
                              >
                              <md-list-item type="button" @click=${this._commissionExisting}
                                  >Commission existing device</md-list-item
                              >
                          </md-list>` : this._mode === "wifi" ? html` <commission-node-wifi></commission-node-wifi> ` : this._mode === "thread" ? html` <commission-node-thread></commission-node-thread> ` : html` <commission-node-existing></commission-node-existing> `}
                </div>
                <div slot="actions">
                    <md-text-button @click=${this._close}>Cancel</md-text-button>
                </div>
            </md-dialog>
        `;
  }
  _commissionWifi() {
    if (!this.client.serverInfo.bluetooth_enabled) {
      return;
    }
    import("./commission-node-wifi.js");
    this._mode = "wifi";
  }
  _commissionThread() {
    if (!this.client.serverInfo.bluetooth_enabled) {
      return;
    }
    import("./commission-node-thread.js");
    this._mode = "thread";
  }
  _commissionExisting() {
    import("./commission-node-existing.js");
    this._mode = "existing";
  }
  _nodeCommissioned(ev) {
    window.location.href = `#node/${ev.detail.node_id}`;
    this._close();
  }
  _close() {
    this.shadowRoot.querySelector("md-dialog").close();
  }
  _handleClosed() {
    this.parentNode.removeChild(this);
  }
};
__decorateClass([
  property({ attribute: false })
], ComissionNodeDialog.prototype, "client", 2);
__decorateClass([
  state()
], ComissionNodeDialog.prototype, "_mode", 2);
ComissionNodeDialog = __decorateClass([
  customElement("commission-node-dialog")
], ComissionNodeDialog);
export {
  ComissionNodeDialog
};
//# sourceMappingURL=commission-node-dialog.js.map
