/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as n } from "../../chunks/runtime.js";
import { css as o, html as s } from "lit";
import { d as p, a as b } from "../../chunks/downloadUtils.js";
import { u as d } from "../../chunks/useT9n.js";
import { createRef as g, ref as m } from "lit-html/directives/ref.js";
import { LitElement as P } from "@arcgis/lumina";
const c = [
  {
    descriptionPDF: {
      labelWidthDisplay: "2-5/8",
      labelHeightDisplay: "1",
      labelsPerPageDisplay: "30",
      averyPartNumber: "*60"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.1875,
        rightMargin: 0.1875,
        topMargin: 0.5,
        bottomMargin: 0.5
      },
      numLabelsAcross: 3,
      numLabelsDown: 10,
      labelWidth: 2.625,
      labelHeight: 1,
      horizGapIn: 0.125,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 11,
      maxNumLabelLines: 4
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "4",
      labelHeightDisplay: "1",
      labelsPerPageDisplay: "20",
      averyPartNumber: "*61"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.15625,
        rightMargin: 0.15625,
        topMargin: 0.47637821,
        bottomMargin: 0.5
      },
      numLabelsAcross: 2,
      numLabelsDown: 10,
      labelWidth: 4,
      labelHeight: 1.0025,
      horizGapIn: 0.1875,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 11,
      maxNumLabelLines: 4
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "4",
      labelHeightDisplay: "1-1/3",
      labelsPerPageDisplay: "14",
      averyPartNumber: "*62"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.15625,
        rightMargin: 0.15625,
        topMargin: 0.81889808,
        bottomMargin: 0.83464612
      },
      numLabelsAcross: 2,
      numLabelsDown: 7,
      labelWidth: 4,
      labelHeight: 1.3352,
      horizGapIn: 0.1875,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 11,
      maxNumLabelLines: 6
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "4",
      labelHeightDisplay: "2",
      labelsPerPageDisplay: "10",
      averyPartNumber: "*63"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.15625,
        rightMargin: 0.15625,
        topMargin: 0.5,
        bottomMargin: 0.5
      },
      numLabelsAcross: 2,
      numLabelsDown: 5,
      labelWidth: 4,
      labelHeight: 2,
      horizGapIn: 0.1875,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 12,
      maxNumLabelLines: 10
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "4",
      labelHeightDisplay: "3-1/3",
      labelsPerPageDisplay: "6",
      averyPartNumber: "*64"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.15625,
        rightMargin: 0.15625,
        topMargin: 0.4724412,
        bottomMargin: 0.50000027
      },
      numLabelsAcross: 2,
      numLabelsDown: 3,
      labelWidth: 4,
      labelHeight: 3.342,
      horizGapIn: 0.1875,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 14,
      maxNumLabelLines: 12
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "1-3/4",
      labelHeightDisplay: "1/2",
      labelsPerPageDisplay: "80",
      averyPartNumber: "*67"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.307086375,
        rightMargin: 0.307086375,
        topMargin: 0.4724412,
        bottomMargin: 0.49606326
      },
      numLabelsAcross: 4,
      numLabelsDown: 20,
      labelWidth: 1.75,
      labelHeight: 0.50155,
      horizGapIn: 0.29527575,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 8,
      maxNumLabelLines: 3
    }
  },
  {
    descriptionPDF: {
      labelWidthDisplay: "1-3/4",
      labelHeightDisplay: "2/3",
      labelsPerPageDisplay: "60",
      averyPartNumber: "*95"
    },
    labelSpec: {
      type: "AVERY",
      pageProperties: {
        pageType: "ANSI A",
        leftMargin: 0.28936983,
        rightMargin: 0.28936983,
        topMargin: 0.53937037,
        bottomMargin: 0.5511814
      },
      numLabelsAcross: 4,
      numLabelsDown: 15,
      labelWidth: 1.75,
      labelHeight: 0.6605,
      horizGapIn: 0.30708678,
      vertGapIn: 0,
      labelPadding: 0.1,
      fontSizePx: 8,
      maxNumLabelLines: 4
    }
  }
], u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: c
}, Symbol.toStringTag, { value: "Module" })), h = o`:host{display:block}`;
class y extends P {
  constructor() {
    super(...arguments), this.disabled = !1, this._translations = d({ name: "pdf-download", blocking: !0 }), this._labelInfoElement = g();
  }
  static {
    this.properties = { defaultNumLabelsPerPage: 9, disabled: 5, _translations: 16 };
  }
  static {
    this.styles = h;
  }
  async downloadCSV(a, i, e, l = !0) {
    return p(
      a,
      i,
      !0,
      // formatUsingLayerPopup
      e,
      l
    );
  }
  async downloadPDF(a, i, e = !1, l = "", t = "") {
    const r = this._labelInfoElement.value ? this._labelInfoElement.value.selectedOption?.value : "";
    return b(a, i, r, e, l, t);
  }
  render() {
    return s`<calcite-select .disabled=${this.disabled} label="Label format" ${m(this._labelInfoElement)}>${this._renderOptions()}</calcite-select>`;
  }
  _getLabelSizeText(a) {
    const i = a.descriptionPDF.labelsPerPageDisplay, e = a.descriptionPDF.labelWidthDisplay + " x " + a.descriptionPDF.labelHeightDisplay;
    return this._translations.pdfLabel ? this._translations.pdfLabel.replace("{{n}}", i).replace("{{labelSize}}", e) : "";
  }
  _renderOptions() {
    const a = u;
    return (a.default || a).sort((e, l) => {
      const t = Number.parseInt(e.descriptionPDF.labelsPerPageDisplay, 10), r = Number.parseInt(l.descriptionPDF.labelsPerPageDisplay, 10);
      return t < r ? -1 : t > r ? 1 : 0;
    }).map((e, l) => {
      let t = !1;
      return (this.defaultNumLabelsPerPage ? Number.parseInt(e.descriptionPDF.labelsPerPageDisplay, 10) === this.defaultNumLabelsPerPage : l === 0) && (t = !0), s`<calcite-option .selected=${t} .value=${e}>${this._getLabelSizeText(e)}</calcite-option>`;
    });
  }
}
n("pdf-download", y);
export {
  y as PdfDownload
};
