import { c as r } from "../../chunks/runtime.js";
import { css as c, html as e } from "lit";
import { classes as p } from "@arcgis/toolkit/dom";
import { watch as l } from "@arcgis/core/core/reactiveUtils.js";
import { LitElement as d, safeClassMap as i } from "@arcgis/lumina";
import { u as m } from "../../chunks/useHandles.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 h = c`.arcgis-print__advanced-options-section{border:1px solid var(--calcite-color-border-1);margin-bottom:var(--calcite-spacing-sm)}.arcgis-print__layout-section{padding:var(--calcite-spacing-sm) var(--calcite-spacing-sm)}.arcgis-print__panel-container{display:flex;flex:1 0;flex-direction:column;gap:var(--calcite-spacing-sm)}`, a = "arcgis-print", s = {
  advancedOptionsSection: `${a}__advanced-options-section`,
  layoutSection: `${a}__layout-section`,
  panelContainer: `${a}__panel-container`
};
class u extends d {
  constructor() {
    super(...arguments), this._handles = m("disconnect");
  }
  static {
    this.properties = { _selectedTemplate: 16, _showSelectedTemplateTitleText: 16, viewModel: 0, messages: 0, showTemplateSelector: 0, selectExportsTab: 0 };
  }
  static {
    this.styles = h;
  }
  loaded() {
    this.manager.onLifecycle(() => [
      l(() => this.viewModel.templateOptions.id, (t) => {
        this._handles.removeHandles("template-handle"), this._selectedTemplate = t ? this.viewModel.getLayoutTemplateById(t) ?? void 0 : void 0, this._handles.addHandles(l(() => this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText, () => {
          this._showSelectedTemplateTitleText = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText ?? !0;
        }, { initial: !0 }), "template-handle");
      }, { initial: !0 })
    ]);
  }
  render() {
    return e`<section class=${i(s.layoutSection)} role=tabpanel><div class=${i(s.panelContainer)}>${this._renderTitleInput()}${this._renderTemplateSelect()}${this._renderFileFormatSection()}${this._renderAdvancedSection()}${this._renderExportButton()}</div></section>`;
  }
  _renderTitleInput() {
    if (!this._showSelectedTemplateTitleText)
      return null;
    const { title: t, titlePlaceHolder: n } = this.messages;
    return e`<calcite-label>${t}<calcite-input .placeholder=${n} .value=${this.viewModel.templateOptions.title ?? ""} @calciteInputInput=${(o) => {
      this.viewModel.templateOptions.title = o.currentTarget.value;
    }}></calcite-input></calcite-label>`;
  }
  _renderTemplateSelect() {
    return e`<div><calcite-label>${this.messages.template}<arcgis-print-template-select .messages=${this.messages} .viewModel=${this.viewModel} .showTemplateSelector=${this.showTemplateSelector}></arcgis-print-template-select></calcite-label><arcgis-print-preview-input .viewModel=${this.viewModel} .messages=${this.messages}></arcgis-print-preview-input></div>`;
  }
  _renderFileFormatSection() {
    return e`<arcgis-print-format-select .viewModel=${this.viewModel} .messages=${this.messages}></arcgis-print-format-select>`;
  }
  _renderAdvancedSection() {
    return e`<calcite-block .ariaLabel=${this.messages.advancedOptions} class=${i(p(s.panelContainer, s.advancedOptionsSection))} collapsible .disabled=${!this._selectedTemplate} .heading=${this.messages.advancedOptions}><arcgis-print-layout-advanced-options .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-layout-advanced-options></calcite-block>`;
  }
  _renderExportButton() {
    return e`<arcgis-print-export-button .fileName=${this.viewModel.templateOptions.title ?? void 0} .messages=${this.messages} .viewModel=${this.viewModel} .selectExportsTab=${this.selectExportsTab}></arcgis-print-export-button>`;
  }
}
r("arcgis-print-layout-panel", u);
export {
  u as PrintLayoutPanel
};
