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ACT,iBAGa","file":"/npm/@ecl/vanilla-component-file@4.10.0/file.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@ecl/vanilla-component-file@4.10.0/file.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { queryOne } from '@ecl/dom-utils';\n\n/**\n * @param {HTMLElement} element DOM element for component instantiation and scope\n * @param {Object} options\n * @param {String} options.translationToggleSelector Selector for toggling translatoins section\n * @param {String} options.translationContainerSelector Selector for translations section container\n * @param {Boolean} options.attachClickListener Whether or not to bind click events on toggle\n */\nexport class FileDownload {\n  /**\n   * @static\n   * Shorthand for instance creation and initialisation.\n   *\n   * @param {HTMLElement} root DOM element for component instantiation and scope\n   *\n   * @return {FileDownload} An instance of FileDownload.\n   */\n  static autoInit(root, { FILE_DOWNLOAD: defaultOptions = {} } = {}) {\n    const fileDownload = new FileDownload(root, defaultOptions);\n    fileDownload.init();\n    root.ECLFileDownload = fileDownload;\n    return fileDownload;\n  }\n\n  constructor(\n    element,\n    {\n      translationToggleSelector = '[data-ecl-file-translation-toggle]',\n      translationContainerSelector = '[data-ecl-file-translation-container]',\n      attachClickListener = true,\n    } = {},\n  ) {\n    // Check element\n    if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n      throw new TypeError(\n        'DOM element should be given to initialize this widget.',\n      );\n    }\n\n    this.element = element;\n\n    // Options\n    this.translationToggleSelector = translationToggleSelector;\n    this.translationContainerSelector = translationContainerSelector;\n    this.attachClickListener = attachClickListener;\n\n    // Private variables\n    this.translationToggle = null;\n    this.translationContainer = null;\n\n    // Bind `this` for use in callbacks\n    this.handleClickOnToggle = this.handleClickOnToggle.bind(this);\n  }\n\n  /**\n   * Initialise component.\n   */\n  init() {\n    if (!ECL) {\n      throw new TypeError('Called init but ECL is not present');\n    }\n    ECL.components = ECL.components || new Map();\n\n    this.translationToggle = queryOne(\n      this.translationToggleSelector,\n      this.element,\n    );\n    this.translationContainer = queryOne(\n      this.translationContainerSelector,\n      this.element,\n    );\n\n    // Bind click event on toggle\n    if (this.attachClickListener && this.translationToggle) {\n      this.translationToggle.addEventListener(\n        'click',\n        this.handleClickOnToggle,\n      );\n    }\n\n    // Set ecl initialized attribute\n    this.element.setAttribute('data-ecl-auto-initialized', 'true');\n    ECL.components.set(this.element, this);\n  }\n\n  /**\n   * Destroy component.\n   */\n  destroy() {\n    if (this.attachClickListener && this.translationToggle) {\n      this.translationToggle.removeEventListener(\n        'click',\n        this.handleClickOnToggle,\n      );\n    }\n    if (this.element) {\n      this.element.removeAttribute('data-ecl-auto-initialized');\n      ECL.components.delete(this.element);\n    }\n  }\n\n  /**\n   * @param {Event} e\n   */\n  handleClickOnToggle(e) {\n    e.preventDefault();\n\n    if (this.translationToggle.getAttribute('aria-expanded') === 'true') {\n      this.translationToggle.setAttribute('aria-expanded', 'false');\n    } else {\n      this.translationToggle.setAttribute('aria-expanded', 'true');\n    }\n\n    return this;\n  }\n}\n\nexport default FileDownload;\n"]}