'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-58ea899e.js');
const component = require('./component-1e352960.js');
const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
const componentUsageRuntimeMetrics = require('./component-usage-runtime-metrics-389d1548.js');
const internalIconManager = require('./internal-icon-manager-66c48800.js');
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-ba6a95f3.js');
const vegaEventId = require('./vega-event-id-f95480b7.js');
const misc = require('./misc-3d30df91.js');
const accessibility = require('./accessibility-88f8af84.js');
const trashCan = require('./trash-can-46a5e19a.js');
const eventEmitSlimmer = require('./event-emit-slimmer-73c42d7e.js');
const changeManager = require('./change-manager-a297e4d2.js');
const staticSubjectTitle = require('./static-subject-title-5829a298.js');
const formFieldControllerSlimmer = require('./form-field-controller-slimmer-44091874.js');
const fileUploaderRequiredRule = require('./file-uploader-required-rule-313ec9e3.js');
const dropFileAcceptFilterSlimmer = require('./drop-file-accept-filter-slimmer-cd619cc7.js');
const translationSlimmer = require('./translation-slimmer-a4a7f0eb.js');
require('./icon-manager-e855446d.js');
require('./create-public-api-runtime-metrics-slimmer-122350c3.js');
require('./dynamic-slimmer-f31fdfd7.js');
require('./observer-f49483e8.js');
require('./ui-3727d685.js');
require('./internal-vega-event-manager-063c17cb.js');
require('./try-get-document-c0ebd39a.js');
require('./string-39438062.js');
require('./vega-internal-event-id-e138d4d6.js');
require('./internal-translation-controller-f0da24b2.js');
require('./index-592b4052.js');
require('./page-resize-observer-slimmer-273d62ef.js');
require('./breakpoints-1cc2c4c6.js');
require('./ui-32120990.js');
require('./breakpoints-ebde4837.js');
require('./internal-form-field-validation-rule.abstract-07cdff46.js');
require('./mutation-observer-slimmer-749d5020.js');
require('./mutation-observer-filters-38cebc6d.js');
require('./array-249289f2.js');
require('./number-4816603d.js');
require('./sub-state-observer-slimmer-aa93ab4f.js');
require('./required-field-rule-d73c1d8c.js');

var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/** renders a file uploader component with specified properties. */
class VegaFileUploaderRenderer extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * The render function returns a JSX element that includes a field label, file uploader button, hint, and file list renderer.
   *
   * @returns {HTMLElement} An HTMLElement containing a fragment with a vega-field-label component, a
   * vegaFileUploaderContainerRenderer element, a vega-hint component (if hint is provided), and a vegaFileUploaderFileListRenderer element.
   */
  render() {
    return (index.h(index.Fragment, null,
      index.h("vega-field-label", { isFieldRequired: this.required, disabled: this.disabled, label: this.label }),
      this.vegaFileUploaderContainerRenderer.render(),
      this.hint ? index.h("vega-hint", null, this.hint) : null,
      this.vegaFileUploaderFileListRenderer.render()));
  }
}
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "required", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "disabled", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "label", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "hint", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "vegaFileUploaderContainerRenderer", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderRenderer.prototype, "vegaFileUploaderFileListRenderer", void 0);

const arrowUpFromLine = {
  icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.3V208 320c0 17.7 14.3 32 32 32s32-14.3 32-32V208 141.3l73.4 73.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-128-128zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"/></svg>`,
};

var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/* rendering a file uploader with options for drag and drop or button upload functionality. */
class VegaFileUploaderContainerRenderer extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    /**
     * An event handler function that is triggered when the drop area is clicked
     *
     * @param {MouseEvent} e click event object
     */
    this.handleDropAreaClick = (e) => {
      e.stopPropagation();
      if (!this.shouldDisableUploadButton()) {
        this.triggerFileInputClick();
      }
    };
    /**
     * Trigger a click event on the native input element.
     */
    this.triggerFileInputClick = () => {
      this.inputElementRef.click();
    };
    /**
     * An event handler function that is triggered when the input file is changed
     *
     * @param {MouseEvent} e change event object
     */
    this.inputChangeHandler = (e) => {
      e.stopPropagation();
      const files = this.getVegaFilesFromFileList(e.target.files);
      this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(files));
      this.inputElementRef.value = '';
    };
    /**
     * an event handler that is triggered when files are dropped onto the file uploader drop area
     *
     * @param {DragEvent} e drag event object
     */
    this.dropHandler = (e) => {
      var _a;
      e.preventDefault();
      if (!this.shouldDisableUploadButton()) {
        const files = this.getVegaFilesFromFileList(this.dropFileFilterController.process((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files));
        this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(files));
      }
    };
  }
  /**
   * The function `getUploaderContainerRef` returns a reference to an HTMLDivElement element.
   * @returns {HTMLDivElement} An HTMLDivElement with the reference to the uploader container.
   */
  getUploaderContainerRef() {
    return this.uploaderContainerRef;
  }
  /**
   * generating the HTML structure of the file uploader component
   *
   * @returns {HTMLElement} uploader component upload area element
   */
  render() {
    return (index.h("div", { class: "vega-file-uploader-container", ref: (ref) => (this.uploaderContainerRef = ref) },
      index.h("input", { onChange: this.inputChangeHandler, type: "file", multiple: !this.fileLimitController.isSingleMode(), accept: this.accept, style: { display: 'none' }, ref: (node) => (this.inputElementRef = node) }),
      this.variant === 'uploadButton' ? this.renderUploadButton() : this.renderUploadDropArea()));
  }
  /**
   * An upload button element
   *
   * @returns {HTMLElement} html element
   */
  renderUploadButton() {
    return (index.h("vega-button", { label: "Upload Document", icon: internalIconManager.VegaInternalIconManager.getIconKey('arrow-up-from-line'), variant: "secondary", size: "small", disabled: this.shouldDisableUploadButton(), ref: (button) => {
        domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, this.triggerFileInputClick);
      } }));
  }
  /**
   * The uploader file drop area element
   *
   * @returns {HTMLElement} html element
   */
  renderUploadDropArea() {
    return (index.h("vega-box", { class: {
        'vega-file-upload-area': true,
        'disabled': this.shouldDisableUploadButton(),
      }, padding: "size-24", border: "border-input-field", borderStyle: "dashed", backgroundColor: "bg-tertiary", corners: "rounded-8", tabIndex: 0, onDrop: this.dropHandler, onDragEnter: this.preventDefaultBehavior, onDragOver: this.preventDefaultBehavior, onClick: this.handleDropAreaClick, onKeyDown: accessibility.createEnterKeyHandlerToTriggerClick() },
      index.h("vega-flex", { gap: "size-8", alignItems: "center", justifyContent: "center" },
        index.h("vega-icon", { color: "text-link", icon: internalIconManager.VegaInternalIconManager.getIconKey('arrow-up-from-line') }),
        index.h("vega-font", { color: "text-link", variant: "font-btn-label" }, this.translationSlimmer.t('Select or drop your file here')))));
  }
  /**
   * Used to prevent the default behavior of the browser when a drag event occurs, such as preventing the browser from opening the file when it is dropped onto the page.
   *
   * @param {DragEvent} e drag event object
   */
  preventDefaultBehavior(e) {
    e.preventDefault();
  }
  /**
   * emits a custom event with selected files and updates the value if the event is not prevented.
   *
   * @param {VegaFileUploaderFile[]} files - The `files` parameter in the `selectFileChangeEventEmitHandler` method is an array of `VegaFileUploaderFile` objects.
   */
  selectFileChangeEventEmitHandler(files) {
    if (files && files.length) {
      const e = this.selectFileChangeEventEmitter.emit(files);
      if (!e.defaultPrevented) {
        this.vegaFileUploaderValueController.setValue(this.value && this.value.length
          ? new Array().concat(this.value, files)
          : files);
      }
    }
  }
  /**
   * extracting the files from a file list object. It first initializes an empty array `result` to store the extracted files
   *
   * @param {FileList|File[]|null} fileList file list object
   * @returns {VegaFileUploaderFile[]} the vega file array
   */
  getVegaFilesFromFileList(fileList) {
    const result = [];
    if (fileList && fileList.length) {
      Array.from(fileList).map((file) => {
        result.push({
          key: misc.generateUUID(),
          name: file.name,
          url: file,
        });
      });
    }
    return result;
  }
  /**
   * Determines if the upload button should be disabled based on the component's state.
   *
   * @returns {boolean} True if the upload button should be disabled, otherwise false.
   */
  shouldDisableUploadButton() {
    return this.disabled || !!(this.value && this.maxCount && this.value.length >= this.maxCount);
  }
  /**
   * Filters the selected files to ensure the total number of files does not exceed the maximum count.
   *
   * @param {VegaFileUploaderFile[]} selectedFiles - The files selected by the user.
   * @returns {VegaFileUploaderFile[]} The filtered list of files that do not exceed the maximum count.
   */
  filterExceedLimitFiles(selectedFiles) {
    const maxCount = Number(this.maxCount);
    if (!isNaN(maxCount) && maxCount && selectedFiles.length) {
      const existFileCount = this.value ? this.value.length : 0;
      const availableFileCount = Math.max(0, maxCount - existFileCount);
      return selectedFiles.slice(0, availableFileCount);
    }
    return selectedFiles;
  }
}
(() => {
  internalIconManager.VegaInternalIconManager.register({ 'arrow-up-from-line': arrowUpFromLine });
})();
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "variant", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "accept", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "disabled", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "value", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "selectFileChangeEventEmitter", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "vegaFileUploaderValueController", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "dropFileFilterController", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "translationSlimmer", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "fileLimitController", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderContainerRenderer.prototype, "maxCount", void 0);

const arrowRotateRight = {
  icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M456 224c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24s-24 10.7-24 24v80.1l-20-23.5C371 63.4 309.1 32 240 32C116.3 32 16 132.3 16 256s100.3 224 224 224c50.4 0 97-16.7 134.4-44.8c10.6-8 12.7-23 4.8-33.6s-23-12.7-33.6-4.8C316.2 418.9 279.7 432 240 432c-97.2 0-176-78.8-176-176s78.8-176 176-176c54.3 0 102.9 24.6 135.2 63.4l.1 .2 0 0L402.9 176H312c-13.3 0-24 10.7-24 24s10.7 24 24 24H456z"/></svg>`,
};

var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/** renders a list of files for a file uploader component. */
class VegaFileUploaderFileListRenderer extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    /**
     * Used to trigger an event or action related to remove a specific file in the file uploader component
     *
     * @param {VegaFileUploaderFile} file the vega file object
     */
    this.fileRemoveHandler = (file) => {
      const removeEvent = this.removeEventEmitter.emit(file);
      if (!removeEvent.defaultPrevented) {
        this.vegaFileUploaderValueController.setValue(this.value.filter((item) => item !== file));
      }
    };
    /**
     * Used to trigger an event or action related to retrying the upload of a specific file in the file uploader component
     *
     * @param {VegaFileUploaderFile} file the vega file object
     */
    this.fileReUploadHandler = (file) => {
      this.retryEventEmitter.emit(file);
    };
    /**
     * Used to trigger an event or action related to preview of a specific file in the file uploader component
     *
     * @param {VegaFileUploaderFile} file the vega file object
     */
    this.filePreviewHandler = (file) => {
      this.previewEventEmitter.emit(file);
    };
  }
  /**
   * The function renders a list of file within a div element based on the value provided.
   *
   * @returns {HTMLElement} An HTMLElement containing a div element with class 'file-uploader-file-list' and
   * 'file-list-hidden' if the value is empty. If the value is not empty, it will map over the value
   * array and return a div element for each file with the file name displayed.
   */
  render() {
    const isFileListEmpty = !this.value || this.value.length < 1;
    return (index.h("div", { class: {
        'vega-file-uploader-file-list': true,
        'vega-file-list-hidden': isFileListEmpty,
      } }, !isFileListEmpty &&
      this.value.map((file) => {
        return (index.h("vega-box", { key: file.key, class: "vega-file-uploader-file", padding: "size-8", corners: "rounded-8" },
          index.h("vega-flex", { alignItems: "start", justifyContent: "space-between" },
            index.h("vega-flex", { class: "vega-file-status-and-name", gap: "size-8", alignItems: "start" },
              index.h("div", { style: { paddingTop: '3px' } }, this.vegaFileUploaderFileStatusRenderer.render(file.status, file.uploadingPercent)),
              index.h("vega-flex", { gap: "size-4", direction: "col" },
                index.h("vega-font", { color: file.status === 'done' || file.status === 'error'
                    ? 'text-primary'
                    : 'text-secondary', variant: "font-field-label" }, file.name),
                file.status === 'error' && file.errorMessage && (index.h("vega-font", { color: "text-error", variant: "font-footnote1-short" }, file.errorMessage)))),
            index.h("vega-flex", { gap: "size-4", class: "vega-file-list-buttons", justifyContent: "end" },
              file.previewable && (index.h("vega-button-circle", { class: "vega-file-preview-button", variant: "icon-only", size: "small", icon: "zoom-in", iconColor: "text-secondary", label: "Preview", tooltip: { disableInteractive: true }, ref: (button) => {
                  domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, () => {
                    this.filePreviewHandler(file);
                  });
                } })),
              file.status === 'error' && (index.h("vega-button-circle", { variant: "icon-only", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('arrow-rotate-right'), iconColor: "text-secondary", label: "Retry", tooltip: { disableInteractive: true }, disabled: this.disabled, ref: (button) => {
                  domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, () => {
                    this.fileReUploadHandler(file);
                  });
                } })),
              index.h("vega-button-circle", { variant: "icon-only", size: "small", icon: internalIconManager.VegaInternalIconManager.getIconKey('trash-can'), iconColor: "text-secondary", label: "Delete", tooltip: { disableInteractive: true }, disabled: this.disabled, ref: (button) => {
                  domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(button, vegaEventId.VegaClick, () => {
                    this.fileRemoveHandler(file);
                  });
                } })))));
      })));
  }
}
(() => {
  internalIconManager.VegaInternalIconManager.register({
    'trash-can': trashCan.trashCan,
    'arrow-rotate-right': arrowRotateRight,
  });
})();
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "value", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "disabled", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "vegaFileUploaderFileStatusRenderer", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "removeEventEmitter", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "vegaFileUploaderValueController", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "retryEventEmitter", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderFileListRenderer.prototype, "previewEventEmitter", void 0);

const circleXmark = {
  icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M175 175C184.4 165.7 199.6 165.7 208.1 175L255.1 222.1L303 175C312.4 165.7 327.6 165.7 336.1 175C346.3 184.4 346.3 199.6 336.1 208.1L289.9 255.1L336.1 303C346.3 312.4 346.3 327.6 336.1 336.1C327.6 346.3 312.4 346.3 303 336.1L255.1 289.9L208.1 336.1C199.6 346.3 184.4 346.3 175 336.1C165.7 327.6 165.7 312.4 175 303L222.1 255.1L175 208.1C165.7 199.6 165.7 184.4 175 175V175zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>`,
};

const circleCheckRegular = {
  icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M243.8 339.8C232.9 350.7 215.1 350.7 204.2 339.8L140.2 275.8C129.3 264.9 129.3 247.1 140.2 236.2C151.1 225.3 168.9 225.3 179.8 236.2L224 280.4L332.2 172.2C343.1 161.3 360.9 161.3 371.8 172.2C382.7 183.1 382.7 200.9 371.8 211.8L243.8 339.8zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>`,
};

/** renders file status for a file uploader component. */
class VegaFileUploaderFileStatusRenderer extends globalSlimmerRegistry.VegaSlimmer {
  render(status, uploadingPercent) {
    switch (status) {
      case 'uploading':
        return (index.h("vega-loading-indicator", Object.assign({ class: "vega-file-list-status", mode: uploadingPercent ? 'determinate' : 'indeterminate', size: "micro" }, (uploadingPercent ? { percent: uploadingPercent } : {}))));
      case 'done':
        return (index.h("vega-icon", { class: "vega-file-list-status", color: "text-success", icon: internalIconManager.VegaInternalIconManager.getIconKey('circle-check-regular') }));
      case 'error':
        return (index.h("vega-icon", { class: "vega-file-list-status", color: "text-error", icon: internalIconManager.VegaInternalIconManager.getIconKey('circle-xmark') }));
      default:
        return (index.h("vega-loading-indicator", { class: "vega-file-list-status", mode: "determinate", size: "micro" }));
    }
  }
}
(() => {
  internalIconManager.VegaInternalIconManager.register({
    'circle-check-regular': circleCheckRegular,
    'circle-xmark': circleXmark,
  });
})();

var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/** manages the value and change events for a file uploader component. */
class VegaFileUploaderValueController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * Emit the change event and notify the value change subject when component value change, reset the value to null if the value is not valid
   *
   * @param {VegaFileUploaderFile[]} newValue The new value
   */
  valueChangeHandler(newValue) {
    if (!newValue || Array.isArray(newValue)) {
      this.changeEventEmitter.emit(newValue);
      changeManager.ChangeManager.notify(staticSubjectTitle.FORM_ELEMENT_VALUE_CHANGE, {
        host: this.host,
        detail: this.value,
      });
    }
    else if (newValue && !Array.isArray(newValue)) {
      this.setValue(null);
    }
  }
  /**
   * Set the component value to a new value
   *
   * @param {VegaFileUploaderFile[]|null} value The new value
   */
  setValue(value) {
    this.value = value;
  }
}
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderValueController.prototype, "host", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaFileUploaderValueController.prototype, "value", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaFileUploaderValueController.prototype, "changeEventEmitter", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentMethod('watchValue')
], VegaFileUploaderValueController.prototype, "valueChangeHandler", null);

var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * Controller class for managing the file upload limit in the Vega file uploader component.
 */
class VegaFileUploaderFileLimitController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * Determines if the file uploader is in single mode.
   *
   * @returns {boolean} `true` if the maximum file count is 1, otherwise `false`.
   */
  isSingleMode() {
    return Number(this.maxCount) === 1;
  }
  /**
   * Checks if the `maxCount` property is valid. If `maxCount` is less than 1 and not `null`, it will be set to `null`.
   */
  checkMaxCount() {
    if (this.maxCount !== null && this.maxCount < 1) {
      this.maxCount = null;
    }
  }
}
__decorate$1([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaFileUploaderFileLimitController.prototype, "maxCount", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentMethod('componentDidLoad'),
  globalSlimmerRegistry.MapToComponentMethod('watchMaxCount')
], VegaFileUploaderFileLimitController.prototype, "checkMaxCount", null);

const vegaFileUploaderCss = ":host{display:inline-block;text-align:left;width:100%;line-height:normal}:host .vega-file-uploader-container .vega-file-upload-area{text-align:center}:host .vega-file-uploader-container .vega-file-upload-area:hover{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-input-field-hover, 115, 160, 190, 1))}:host .vega-file-uploader-container .vega-file-upload-area:hover vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:hover vega-font{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host .vega-file-uploader-container .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host .vega-file-uploader-container .vega-file-upload-area:active{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area:active vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:active vega-font{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area.disabled{border-color:rgba(var(--v-border-color-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-tertiary, 240, 243, 247, 1));outline:none}:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-icon,:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-font{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-file-uploader-container vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error .vega-file-upload-area{border-color:rgba(var(--v-border-color-input-field-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:hover{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}:host .vega-file-uploader-container.error .vega-file-upload-area:active{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error vega-button::part(button),:host .vega-file-uploader-container.error vega-button::part(button):hover{color:rgba(var(--v-text-danger-link, 230, 50, 87, 1));border-color:rgba(var(--v-border-color-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error vega-button::part(button):hover{background-color:rgba(var(--v-bg-danger-tertiary-hover, 255, 87, 114, 0.2));border-color:rgba(var(--v-border-color-danger-hover, 255, 87, 114, 1));color:rgba(var(--v-text-danger-link-hover, 233, 71, 104, 1))}:host .vega-file-uploader-container.error vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error vega-button::part(button):active{color:rgba(var(--v-text-danger-link-active, 189, 41, 71, 1));border-color:rgba(var(--v-border-color-danger-active, 189, 41, 71, 1));background-color:rgba(var(--v-bg-danger-tertiary-active, 189, 41, 71, 0.2))}:host .vega-file-uploader-file-list .vega-file-uploader-file .vega-file-preview-button{visibility:hidden}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover{background-color:rgba(var(--v-bg-action-tertiary-hover, 4, 4, 28, 0.05))}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover .vega-file-preview-button{visibility:visible}:host .vega-file-uploader-file-list .vega-file-list-buttons{margin-left:8px;flex-shrink:0}:host .vega-file-uploader-file-list .vega-file-list-status svg{width:16px;height:16px}:host .vega-file-uploader-file-list .vega-file-status-and-name{padding-top:5px}:host .vega-file-uploader-file-list .vega-file-status-and-name vega-font{word-break:break-word}:host vega-field-label{margin-bottom:8px}:host .vega-file-uploader-file-list{margin-top:8px}:host .vega-file-uploader-file-list.vega-file-list-hidden{display:none}:host .vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-hidden{display:none}";

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const VegaFileUploader = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.vegaChange = index.createEvent(this, "vegaChange", 7);
    this.change = index.createEvent(this, "change", 7);
    this.vegaSelectedFileChange = index.createEvent(this, "vegaSelectedFileChange", 7);
    this.selectedFileChange = index.createEvent(this, "selectedFileChange", 7);
    this.vegaRemove = index.createEvent(this, "vegaRemove", 7);
    this.remove = index.createEvent(this, "remove", 7);
    this.vegaRetry = index.createEvent(this, "vegaRetry", 7);
    this.retry = index.createEvent(this, "retry", 7);
    this.vegaPreview = index.createEvent(this, "vegaPreview", 7);
    this.preview = index.createEvent(this, "preview", 7);
    this.globalSlimmers = {};
    this.translationSlimmer = new translationSlimmer.TranslationSlimmer();
    this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer();
    this.formFieldController = new formFieldControllerSlimmer.FormFieldControllerSlimmer({
      propertyRules: [
        {
          propertyName: 'required',
          ruleFactory: (isRequired) => isRequired ? new fileUploaderRequiredRule.FileUploaderRequiredRule() : null,
        },
      ],
      validationRulesName: 'validationRules',
      defaultValue: [],
      attributeGetter: (propertyName) => this[propertyName],
      inputContainerGetter: () => this.vegaFileUploaderContainerRenderer.getUploaderContainerRef(),
      touchableAreaGetter: () => [this.vegaFileUploaderContainerRenderer.getUploaderContainerRef()],
    });
    this.vegaFileUploaderRenderer = new VegaFileUploaderRenderer();
    this.vegaFileUploaderContainerRenderer = new VegaFileUploaderContainerRenderer();
    this.vegaFileUploaderFileListRenderer = new VegaFileUploaderFileListRenderer();
    this.vegaFileUploaderFileStatusRenderer = new VegaFileUploaderFileStatusRenderer();
    this.vegaFileUploaderValueController = new VegaFileUploaderValueController();
    this.dropFileFilterController = new dropFileAcceptFilterSlimmer.DropFileAcceptFilterSlimmer();
    this.fileLimitController = new VegaFileUploaderFileLimitController();
    this.changeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaFileUploader, vegaEventId.VegaChange);
    this.selectFileChangeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaFileUploader, vegaEventId.VegaSelectFileChange);
    this.removeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaFileUploader, vegaEventId.VegaRemove);
    this.retryEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaFileUploader, vegaEventId.VegaRetry);
    this.previewEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaFileUploader, vegaEventId.VegaPreview);
    /**
     * Specifies the label or title for the field.
     *
     * It provides descriptive text that helps identify the
     *    purpose or content expected in the field.
     *
     * @vegaVersion 2.25.0
     */
    this.label = '';
    /**
     * Specifies the uploader type that activates when clicked
     *    or when a file is dragged, determining how users
     *    interact with the file uploader.
     *
     * @vegaVersion 2.25.0
     */
    this.variant = 'uploadArea';
    /**
     * Provides a supplementary prompt message that assists users in
     *    understanding the expected value for the file uploader field.
     *
     * @vegaVersion 2.25.0
     */
    this.hint = '';
    /**
     * Specifies the initial file content to display, enabling a preview
     *    of the uploaded file or a default placeholder.
     *
     * @vegaVersion 2.25.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.value = [];
    /**
     * Specifies whether the File Uploader field is disabled.
     *
     * @vegaVersion 2.25.0
     */
    this.disabled = false;
    /**
     * Specifies the maximum number of files that can be uploaded using the File Uploader. The value must be a positive integer.
     *
     * @vegaVersion 2.36.0
     */
    this.maxCount = null;
    /**
     * Specifies whether uploading a file is mandatory.
     *
     * @vegaVersion 2.25.0
     */
    this.required = false;
    /**
     * Defines custom validation rules for the File Uploader field.
     *
     * @vegaVersion 2.25.0
     */
    this.validationRules = [];
    /**
     * Determines whether the input field should undergo automatic validation
     *    during the user's input.
     *
     * @vegaVersion 2.25.0
     */
    this.autoValidation = true;
    /**
     * Specifies the validation status of the file uploader component.
     *
     * @vegaVersion 2.25.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.isValid = null;
  }
  /**
   * Watches the value change.
   *
   * @param {VegaFileUploaderFile[]} newValue The new value
   */
  watchValue(newValue) {
  }
  /**
   * Watches the maxCount change.
   */
  watchMaxCount() {
  }
  watchValidationRules() {
  }
  render() {
    return component.sanitizeVegaComponent(index.h(index.Host, null, this.vegaFileUploaderRenderer.render()), this.host);
  }
  get host() { return index.getElement(this); }
  static get watchers() { return {
    "value": ["watchValue"],
    "maxCount": ["watchMaxCount"],
    "validationRules": ["watchValidationRules"]
  }; }
};
__decorate([
  componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
], VegaFileUploader.prototype, "globalSlimmers", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "translationSlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "formFieldController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaFileUploaderRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaFileUploaderContainerRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaFileUploaderFileListRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaFileUploaderFileStatusRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "vegaFileUploaderValueController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "dropFileFilterController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "fileLimitController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "changeEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "selectFileChangeEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "removeEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "retryEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaFileUploader.prototype, "previewEventEmitter", void 0);
VegaFileUploader.style = vegaFileUploaderCss;

exports.vega_file_uploader = VegaFileUploader;
