/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c } from "../../chunks/runtime.js";
import { css as p, html as o } from "lit";
import { LitElement as d } from "@arcgis/lumina";
import { r as m } from "../../chunks/utils3.js";
const h = p`.export-button-container{display:flex;flex-direction:column;align-items:center;gap:.5rem}`;
class u extends d {
  static {
    this.properties = { viewModel: 0, messages: 0, fileName: 1, selectExportsTab: 0 };
  }
  static {
    this.styles = h;
  }
  loaded() {
    this.manager.onLifecycle(() => []);
  }
  async _handlePrintMap() {
    this.viewModel.export(this.fileName || this.messages.untitled), this.selectExportsTab();
  }
  render() {
    const { messages: t } = this, { layout: i, layoutItem: e, format: l } = this.viewModel.templateOptions, a = this.viewModel.state !== "ready" || !(i || e), r = m.test(this.viewModel.portal?.url), s = `5 ${t.credits}`, n = !!e?.id;
    return o`<div class="export-button-container">${r && n ? o`<calcite-chip icon=credits kind=neutral .label=${s} scale=s>${s}</calcite-chip>` : null}<calcite-button .ariaLabel=${t.exportDescription} .disabled=${a || !(i || e?.id) && !l} @click=${this._handlePrintMap} scale=l width=full>${t.export}</calcite-button></div>`;
  }
}
c("arcgis-print-export-button", u);
export {
  u as PrintExportButton
};
