{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "file-uploader",
  "type": "registry:ui",
  "title": "<ui-file-uploader>",
  "description": "Carbon `FileUploader` / `FileUploaderDropContainer`: a title, a description and either an \"Add file\" button (default) or a dashed drop zone (`drop`) that opens the file dialog; the chosen files are listed as `<ui-file-uploader-item>`s. `accept` (extensions or MIME types) and `max-file-size` mark rejected files invalid with `invalid-type-text` / `too-large-text`. Items start in `status` (edit / uploading / complete); update `files` yourself as uploads progress. Form-associated: every valid file is submitted under `name`. Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "lit@^3.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/button",
    "@kanok-ui/core-file-uploader",
    "@kanok-ui/progress-bar",
    "@kanok-ui/shared-element",
    "@kanok-ui/shared-field",
    "@kanok-ui/shared-form-control",
    "@kanok-ui/shared-localize",
    "@kanok-ui/shared-skeleton",
    "@kanok-ui/tokens"
  ],
  "files": [
    {
      "path": "src/primitives/file-uploader/file-uploader-item.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/file-uploader/file-uploader-item.ts",
      "content": "import { html, LitElement, css, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { srOnlyStyles, uid } from '../shared/field.ts';\nimport { LocalizeController } from '../shared/localize.ts';\nimport { UiElement } from '../shared/element.ts';\nimport { uploadPercent, itemErrorSubject, formatFileSize, formatPercent, type FileStatus } from '../../core/file-uploader.ts';\nimport type { FileUploaderSize } from './file-uploader-shared.ts';\nimport '../progress-bar/progress-bar.ts';\n\nconst closeIcon = html`<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M12 4.7 11.3 4 8 7.3 4.7 4 4 4.7 7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\" /></svg>`;\n\nconst checkIcon = html`<svg class=\"complete\" viewBox=\"0 0 16 16\"><path d=\"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-1 10.2L4 8.2l.8-.8L7 9.6l4.2-4.2.8.8z\" /></svg>`;\n\n// Carbon Renew (32px glyph drawn at 16px)\nconst renewIcon = html`<svg viewBox=\"0 0 32 32\" aria-hidden=\"true\"><path d=\"M12 10H6.78A11 11 0 0 1 27 16h2A13 13 0 0 0 6 7.68V4H4v8h8Z\" /><path d=\"M20 22h5.22A11 11 0 0 1 5 16H3a13 13 0 0 0 23 8.32V28h2v-8h-8Z\" /></svg>`;\n\nconst warningIcon = html`<svg class=\"invalid-icon\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-.5 3h1v5h-1zM8 12.2a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6Z\" /></svg>`;\n\n/** Focus a row that has no button left (a restarted upload shows only its spinner), so focus stays in the list; it leaves the tab order again on blur. */\nfunction focusRow(row: HTMLElement | null) {\n    if (!row) return;\n    row.tabIndex = -1;\n    row.addEventListener('blur', () => row.removeAttribute('tabindex'), { once: true });\n    row.focus();\n}\n\n/**\n * Carbon `FileUploaderItem`: one selected file. `status=\"edit\"` shows a remove button\n * (click, Enter or Space fire `ui-delete`), `\"uploading\"` a spinner, `\"complete\"` a check mark.\n * `invalid` outlines the row in red and shows `error-subject` / `error-body` as an alert.\n * Used by `<ui-file-uploader>` and on its own for server-side lists.\n *\n * Beyond Carbon: `progress` (0–100) while uploading swaps the spinner for the percentage, a\n * small progress bar under the row (the `progressbar` screen readers query; the percentage isn't\n * announced as it changes) and a remove button that cancels the upload. `retryable` on an invalid\n * row (a failed upload; \"Upload failed\" when there is no `error-subject`) adds a retry button that\n * fires `ui-retry`. `file-size` (bytes) shows the size in the page language (\"1.2 MB\").\n *\n * @fires ui-delete - detail: { uuid, name } when the user removes the file\n * @fires ui-retry - detail: { uuid, name } when the user retries a failed upload\n * @csspart base - The row\n * @csspart name - File name\n * @csspart size - The file size (`file-size`)\n * @csspart percent - The upload percentage (`progress`)\n * @csspart progress - The `<ui-progress-bar>` under the row (`progress`)\n * @csspart retry-button - The retry button (`retryable` invalid row)\n * @csspart delete-button - The × button (edit status, or uploading with `progress`)\n * @csspart error - The error block (invalid)\n * @cssprop --ui-file-item-radius - Corners of the row (default 0; Kanok: 6px); `--ui-file-item-edge` its box-shadow edge (default none; Kanok: a hairline)\n * @cssprop --ui-icon-control-radius - Corners of its small icon buttons, their hover fill and ring (default 0; Kanok: round)\n * @cssprop --ui-focus-offset - `outline-offset` of its focus ring (default -2px: inside; Kanok: 2px outside)\n */\n@customElement('ui-file-uploader-item')\nexport class UiFileUploaderItem extends UiElement {\n    /** `el.focus()` lands on the control inside. */\n    static override readonly shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n    static override readonly styles = [srOnlyStyles, css`\n        :host {\n            display: block;\n            max-inline-size: var(--ui-file-uploader-max-width, 320px); /* the uploader's width (Carbon 320px; Kanok: none) */\n            font-family: var(--ui-font-family);\n        }\n\n        /* 8px under each file but the last — on the row, collapsing through the host: a page-wide CSS reset would remove a :host margin */\n        .row {\n            margin-block-end: var(--ui-space-xs);\n        }\n\n        /* holds focus while a restarted upload shows only its spinner (see focusRow) */\n        .row:focus {\n            outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n            outline-offset: -2px;\n        }\n\n        /* a mouse or touch focus shows no ring in a design that sets --ui-pointer-focus (Kanok: keyboard only) */\n        .row:focus:not(:focus-visible) {\n            outline-color: var(--ui-pointer-focus, var(--ui-focus));\n        }\n\n        :host(:last-of-type) .row {\n            margin-block-end: 0;\n        }\n\n        /* a progress bar sits right under the row: the 8px goes under the bar */\n        .row.progressing {\n            margin-block-end: 0;\n        }\n\n        .progress {\n            margin-block-end: var(--ui-space-xs);\n        }\n\n        :host(:last-of-type) .progress {\n            margin-block-end: 0;\n        }\n\n        .row {\n            display: grid;\n            grid-template-columns: 1fr auto auto; /* name | size, percentage | state */\n            grid-auto-rows: auto;\n            align-items: center;\n            gap: 12px 0;\n            min-block-size: 48px;\n            /* Carbon: a square layer-coloured row; a design can round and outline it (Kanok: its layer is the page's white) */\n            border-radius: var(--ui-file-item-radius, 0);\n            box-shadow: var(--ui-file-item-edge, none);\n            background-color: var(--ui-surface-1);\n            overflow-wrap: break-word;\n        }\n\n        :host([size='md']) .row {\n            gap: var(--ui-space-xs) 0;\n            min-block-size: 40px;\n        }\n\n        :host([size='sm']) .row {\n            gap: var(--ui-space-xxs) 0;\n            min-block-size: 32px;\n        }\n\n        .row.invalid {\n            padding: 12px 0;\n            outline: 2px solid var(--ui-error);\n            outline-offset: -2px;\n        }\n\n        :host([size='md']) .row.invalid {\n            padding: var(--ui-space-xs) 0;\n        }\n\n        :host([size='sm']) .row.invalid {\n            padding: var(--ui-space-xxs) 0;\n        }\n\n        .name {\n            margin: 0 0 0 var(--ui-space-md);\n            overflow: hidden;\n            color: var(--ui-ink);\n            font: var(--ui-font-body-sm);\n            line-height: 18px; /* body-compact-01 */\n            letter-spacing: var(--ui-tracking-body);\n            text-overflow: ellipsis;\n            white-space: nowrap;\n        }\n\n        :host([disabled]) .name {\n            color: var(--ui-ink-disabled);\n        }\n\n        .meta {\n            display: flex;\n            gap: var(--ui-space-xs);\n            padding-inline: var(--ui-space-xs);\n            color: var(--ui-ink-muted);\n            font: var(--ui-font-caption);\n            font-variant-numeric: tabular-nums;\n            line-height: 16px; /* label-01 */\n            letter-spacing: var(--ui-tracking-caption);\n            white-space: nowrap;\n        }\n\n        :host([disabled]) .meta {\n            color: var(--ui-ink-disabled);\n        }\n\n        .state {\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            min-inline-size: 24px;\n            padding-inline-end: 12px;\n        }\n\n        .invalid-icon {\n            width: 16px;\n            height: 16px;\n            margin-inline-end: var(--ui-space-xs);\n            fill: var(--ui-error);\n        }\n\n        .close,\n        .retry {\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            inline-size: 24px;\n            block-size: 24px;\n            padding: 0;\n            border: none;\n            background: transparent;\n            color: var(--ui-icon-primary);\n            cursor: pointer;\n            outline: none;\n            border-radius: var(--ui-icon-control-radius, 0); /* round in a design that rounds icon controls (Kanok) */\n        }\n\n        .close svg,\n        .retry svg {\n            width: 16px;\n            height: 16px;\n            fill: currentColor;\n        }\n\n        .close:focus-visible,\n        .retry:focus-visible {\n            outline: var(--ui-focus-width, 2px) solid var(--ui-focus);\n            outline-offset: var(--ui-focus-offset, -2px);\n        }\n\n        .close:disabled,\n        .retry:disabled {\n            color: var(--ui-icon-disabled);\n            cursor: not-allowed;\n        }\n\n        .complete {\n            inline-size: 24px;\n            block-size: 16px;\n            fill: var(--ui-interactive, var(--ui-primary));\n        }\n\n        .spinner {\n            box-sizing: border-box;\n            inline-size: 16px;\n            block-size: 16px;\n            margin: var(--ui-space-xxs);\n            border: 2px solid var(--ui-layer-accent);\n            border-top-color: var(--ui-interactive, var(--ui-primary));\n            border-radius: 50%;\n            animation: spin 690ms linear infinite;\n        }\n\n        @media (prefers-reduced-motion: reduce) {\n            .spinner {\n                animation-duration: 2s;\n            }\n        }\n\n        @keyframes spin {\n            to {\n                transform: rotate(360deg);\n            }\n        }\n\n        .error {\n            grid-column: 1 / -1;\n            margin: 0;\n            padding: var(--ui-space-md) 0 0;\n            border-block-start: 1px solid var(--ui-hairline);\n        }\n\n        :host([size='md']) .error {\n            padding-block-start: 11px;\n        }\n\n        :host([size='sm']) .error {\n            padding-block-start: 7px;\n        }\n\n        .error-title,\n        .error-body {\n            margin: 0;\n            padding: 0 var(--ui-space-md);\n            font: var(--ui-font-caption);\n            line-height: 16px; /* label-01 */\n            letter-spacing: var(--ui-tracking-caption);\n        }\n\n        .error-title {\n            color: var(--ui-error-text, var(--ui-error));\n        }\n\n        .error-body {\n            color: var(--ui-ink);\n        }\n\n        @media (forced-colors: active) {\n            .row {\n                outline: 1px solid CanvasText;\n            }\n        }\n    `];\n\n    @property() name = '';\n\n    /** Identifies the file in `ui-delete`; defaults to `name`. */\n    @property() uuid = '';\n\n    @property({ reflect: true }) status: FileStatus = 'edit';\n\n    @property({ type: Boolean, reflect: true }) invalid = false;\n\n    @property({ attribute: 'error-subject' }) errorSubject = '';\n\n    @property({ attribute: 'error-body' }) errorBody = '';\n\n    @property({ reflect: true }) size: FileUploaderSize = 'md'; // Carbon default (40px)\n\n    @property({ type: Boolean, reflect: true }) disabled = false;\n\n    /** Describes the state icon / remove button: \"Remove file\", \"Uploading\", \"Uploaded\" (Carbon `iconDescription`); with `progress`, the bar. */\n    @property({ attribute: 'icon-label' }) iconLabel = '';\n\n    /** Upload progress 0–100, shown while `status` is uploading (percentage, bar, cancel button) instead of the spinner. */\n    @property({ type: Number }) progress?: number;\n\n    /** On an invalid row: a retry button (`ui-retry`) for a failed upload. */\n    @property({ type: Boolean, reflect: true }) retryable = false;\n\n    /** Bytes; shows the size in the row (\"1.2 MB\"). */\n    @property({ type: Number, attribute: 'file-size' }) fileSize?: number;\n\n    private readonly ids = uid('ui-file-uploader-item');\n\n    private readonly localize = new LocalizeController(this);\n\n    /** Set when an upload finishes, so the status region announces it (a spinner turning into a check mark is silent). */\n    @state() private announcement = '';\n\n    /** The retry button had focus before this update: if it goes (the upload restarts), focus the remove button, else the row. */\n    private retryFocused = false;\n\n    protected override willUpdate(changed: Map<string, unknown>) {\n        if (changed.get('status') === 'uploading' && this.status === 'complete') this.announcement = `${this.localize.t.fileUploader.uploaded}: ${this.name}`;\n        else if (changed.has('status')) this.announcement = '';\n        this.retryFocused = !!this.shadowRoot?.activeElement?.matches('.retry');\n    }\n\n    protected override updated() {\n        if (!this.retryFocused || this.renderRoot.querySelector('.retry')) return;\n        const close = this.renderRoot.querySelector<HTMLElement>('.close');\n        if (close) close.focus();\n        else focusRow(this.renderRoot.querySelector<HTMLElement>('.row'));\n    }\n\n    /** The upload percentage when it shows (uploading with a `progress`), else undefined. */\n    private get percent() {\n        return this.status === 'uploading' ? uploadPercent(this.progress) : undefined;\n    }\n\n    /** The row has a remove button (edit, or uploading with `progress`) and isn't disabled. */\n    get removable() {\n        return !this.disabled && (this.status === 'edit' || this.percent !== undefined);\n    }\n\n    /** `error-subject`, else \"Upload failed\" on a retryable invalid row. */\n    private get errorText() {\n        return itemErrorSubject(this, this.localize.t.fileUploader);\n    }\n\n    private get defaultIconLabel() {\n        const t = this.localize.t.fileUploader;\n        if (this.status === 'uploading') return t.uploading;\n        if (this.status === 'complete') return t.uploaded;\n        return t.removeFile;\n    }\n\n    /** Ask the owner to remove this file (fires `ui-delete`). */\n    requestDelete() {\n        if (this.disabled) return;\n        this.dispatchEvent(new CustomEvent('ui-delete', { detail: { uuid: this.uuid || this.name, name: this.name }, bubbles: true, composed: true }));\n    }\n\n    /** Ask the owner to upload this file again (fires `ui-retry`). */\n    requestRetry() {\n        if (this.disabled) return;\n        this.dispatchEvent(new CustomEvent('ui-retry', { detail: { uuid: this.uuid || this.name, name: this.name }, bubbles: true, composed: true }));\n    }\n\n    private renderState() {\n        const t = this.localize.t.fileUploader;\n        const label = this.iconLabel || this.defaultIconLabel;\n        const percent = this.percent;\n        // the icon is drawn, its meaning is text (rather than role=\"img\" on a span)\n        if (this.status === 'uploading' && percent === undefined) return html`<span class=\"spinner\" data-file-state aria-hidden=\"true\"></span><span class=\"sr-only\">${label}</span>`;\n        if (this.status === 'complete') return html`<span data-file-state aria-hidden=\"true\">${checkIcon}</span><span class=\"sr-only\">${label}</span>`;\n        const errorId = this.errorText ? `${this.ids}-error` : undefined;\n        const retry = this.invalid && this.retryable;\n        return html`${this.invalid ? warningIcon : nothing}${retry\n                ? html`<button\n                      class=\"retry\"\n                      part=\"retry-button\"\n                      type=\"button\"\n                      aria-label=${`${t.retry} - ${this.name}`}\n                      aria-describedby=${ifDefined(errorId)}\n                      ?disabled=${this.disabled}\n                      @click=${this.requestRetry}\n                  >\n                      ${renewIcon}\n                  </button>`\n                : nothing}<button\n                class=\"close\"\n                part=\"delete-button\"\n                type=\"button\"\n                aria-label=${`${percent === undefined ? label : t.cancelUpload} - ${this.name}`}\n                aria-describedby=${ifDefined(errorId)}\n                ?disabled=${this.disabled}\n                @click=${this.requestDelete}\n            >\n                ${closeIcon}\n            </button>`;\n    }\n\n    /** The size and the upload percentage between the name and the state (the bar carries the percentage for screen readers). */\n    private renderMeta(percent: number | undefined) {\n        const lang = this.localize.lang();\n        const size = typeof this.fileSize === 'number' && Number.isFinite(this.fileSize) ? formatFileSize(this.fileSize, lang) : '';\n        if (!size && percent === undefined) return nothing;\n        const sizeText = size ? html`<span part=\"size\">${size}</span>` : nothing;\n        const percentText = percent === undefined ? nothing : html`<span part=\"percent\" aria-hidden=\"true\">${formatPercent(percent, lang)}</span>`;\n        return html`<span class=\"meta\">${sizeText}${percentText}</span>`;\n    }\n\n    private renderError() {\n        const subject = this.errorText;\n        if (!subject) return nothing;\n        return html`<div class=\"error\" part=\"error\" role=\"alert\" id=\"${this.ids}-error\">\n            <div class=\"error-title\">${subject}</div>\n            ${this.errorBody ? html`<p class=\"error-body\">${this.errorBody}</p>` : nothing}\n        </div>`;\n    }\n\n    /** The small bar under the row while an upload shows its progress, named \"Uploading - name\". */\n    private renderProgress(percent: number | undefined) {\n        if (percent === undefined) return nothing;\n        const label = `${this.iconLabel || this.localize.t.fileUploader.uploading} - ${this.name}`;\n        return html`<ui-progress-bar class=\"progress\" part=\"progress\" size=\"sm\" hide-label label=${label} .value=${percent}></ui-progress-bar>`;\n    }\n\n    override render() {\n        const percent = this.percent;\n        return html`<div class=\"row ${classMap({ invalid: this.invalid, progressing: percent !== undefined })}\" part=\"base\" aria-disabled=${ifDefined(this.disabled ? 'true' : undefined)}>\n                <p class=\"name\" part=\"name\">${this.name}</p>\n                ${this.renderMeta(percent)}\n                <span class=\"state\">${this.renderState()}</span>\n                ${this.renderError()}\n                <span class=\"sr-only\" role=\"status\">${this.announcement}</span>\n            </div>\n            ${this.renderProgress(percent)}`;\n    }\n}\n\nexport interface FileItemDeleteDetail {\n    uuid: string;\n    name: string;\n}\n\n/** The item's `ui-retry` detail: the same as its `ui-delete`. */\nexport type FileItemRetryDetail = FileItemDeleteDetail;\n\nexport interface UiFileUploaderItemEventMap extends HTMLElementEventMap {\n    'ui-delete': CustomEvent<FileItemDeleteDetail>;\n    'ui-retry': CustomEvent<FileItemRetryDetail>;\n}\n\n/** Typed listeners for UiFileUploaderItem's events (declaration merging with the class). */\nexport interface UiFileUploaderItem {\n    addEventListener<K extends keyof UiFileUploaderItemEventMap>(type: K, listener: (this: UiFileUploaderItem, event: UiFileUploaderItemEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;\n    removeEventListener<K extends keyof UiFileUploaderItemEventMap>(type: K, listener: (this: UiFileUploaderItem, event: UiFileUploaderItemEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;\n    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-file-uploader-item': UiFileUploaderItem;\n    }\n}\n"
    },
    {
      "path": "src/primitives/file-uploader/file-uploader-shared.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/file-uploader/file-uploader-shared.ts",
      "content": "\nexport type FileUploaderSize = 'sm' | 'md' | 'lg';\n"
    },
    {
      "path": "src/primitives/file-uploader/file-uploader-skeleton.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/file-uploader/file-uploader-skeleton.ts",
      "content": "import { html, css } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { skeletonStyles, UiSkeletonElement } from '../shared/skeleton.ts';\n\n/**\n * Carbon `FileUploaderSkeleton` (`cds-file-uploader-skeleton`): a 100×24 title bar, a 225×16 description bar and a\n * 150×48 button bar, 8px apart. Hidden from assistive tech.\n *\n * @csspart title - The title bar\n * @csspart description - The description bar\n * @csspart button - The button bar\n */\n@customElement('ui-file-uploader-skeleton')\nexport class UiFileUploaderSkeleton extends UiSkeletonElement {\n    static override readonly styles = [\n        skeletonStyles,\n        css`\n            :host {\n                display: block;\n            }\n\n            .stack {\n                display: flex;\n                flex-direction: column;\n                align-items: flex-start;\n                gap: var(--ui-space-xs);\n            }\n\n            .title {\n                inline-size: 100px;\n                block-size: 24px;\n            }\n\n            .description {\n                inline-size: 225px;\n                block-size: 16px;\n            }\n\n            .button {\n                inline-size: 150px;\n                block-size: var(--ui-field-height-lg, 48px);\n            }\n        `,\n    ];\n\n    override render() {\n        return html`<div class=\"stack\">\n            <span class=\"bone title\" part=\"title\"></span><span class=\"bone description\" part=\"description\"></span><span class=\"bone button\" part=\"button\"></span>\n        </div>`;\n    }\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-file-uploader-skeleton': UiFileUploaderSkeleton;\n    }\n}\n"
    },
    {
      "path": "src/primitives/file-uploader/file-uploader.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/file-uploader/file-uploader.ts",
      "content": "// Its child elements are one per file beside it; this module re-exports them (one entry point).\nimport { LitElement, css, html, nothing, svg } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { srOnlyStyles, uid, barWhenDisabled, deepActiveElement } from '../shared/field.ts';\nimport { FormControlController } from '../shared/form-control.ts';\nimport type { ButtonKind } from '../button/button.ts';\nimport { LocalizeController } from '../shared/localize.ts';\nimport { UiElement } from '../shared/element.ts';\nimport { rejectionMessage, checkFiles, pickedFilesLabel, focusAfterRemoval, type FileStatus, type FileRejection } from '../../core/file-uploader.ts';\nimport type { FileUploaderSize } from './file-uploader-shared.ts';\nimport type { UiFileUploaderItem } from './file-uploader-item.ts';\nimport '../button/button.ts';\nimport '../progress-bar/progress-bar.ts';\nexport * from './file-uploader-item.ts';\nexport type { FileUploaderSize } from './file-uploader-shared.ts';\nexport type { FileStatus } from '../../core/file-uploader.ts';\n\n/** One file in a `<ui-file-uploader>`'s `files` list. */\nexport interface FileItem {\n    uuid: string;\n    name: string;\n    file: File;\n    /** Rejected by `accept` / `max-file-size` / `max-files` / `max-total-size` (Carbon `invalidFileType`), or a failed upload. */\n    invalid?: boolean;\n    status?: FileStatus;\n    errorSubject?: string;\n    errorBody?: string;\n    /** Upload progress 0–100 while `status` is uploading: a bar under the row and the percentage instead of the spinner. */\n    progress?: number;\n    /** An invalid row (a failed upload) shows a retry button (`ui-retry`); refused files aren't retryable. */\n    retryable?: boolean;\n}\n\n/** Carbon `upload` (32): the drop zone's icon where a design shows it (--ui-file-drop-icon-display). */\nconst uploadIcon = svg`<svg viewBox=\"0 0 32 32\"><path d=\"M6 18 7.41 19.41 15 11.83 15 30 17 30 17 11.83 24.59 19.41 26 18 16 8 6 18z\" /><path d=\"M6 8V4h20v4h2V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4z\" /></svg>`;\n\n/** Per-page counter for item uuids; `ids` already makes them unique per uploader. */\nlet fileSeq = 0;\n\nexport interface FileChangeDetail {\n    addedFiles: FileItem[];\n    removedFiles: FileItem[];\n    currentFiles: FileItem[];\n    action: 'add' | 'remove' | 'clear';\n}\n\n/**\n * Carbon `FileUploader` / `FileUploaderDropContainer`: a title, a description and either an\n * \"Add file\" button (default) or a dashed drop zone (`drop`) that opens the file dialog; the\n * chosen files are listed as `<ui-file-uploader-item>`s. `accept` (extensions or MIME types)\n * and `max-file-size` mark rejected files invalid with `invalid-type-text` / `too-large-text`.\n * Items start in `status` (edit / uploading / complete); update `files` yourself as uploads\n * progress. Form-associated: every valid file is submitted under `name`.\n *\n * Beyond Carbon: `max-files` and `max-total-size` (bytes) add the files past them as invalid rows\n * too (`too-many-text` / `total-too-large-text`); a file's `progress` shows a bar and the\n * percentage while it uploads; a failed upload you mark `invalid` + `retryable` gets a retry\n * button (`ui-retry`); `show-size` shows each file's size.\n *\n * State on the host for styling: `data-drag-over` while files are dragged over the drop zone.\n *\n * @cssstate drag-over - While files are dragged over the drop zone (also `[data-drag-over]`)\n * @slot - Extra `<ui-file-uploader-item>`s (e.g. files already on the server)\n * @fires ui-add - detail: { addedFiles } right after the user picks files (invalid ones included)\n * @fires ui-change - detail: { addedFiles, removedFiles, currentFiles, action }\n * @fires change - Native-style, alongside `ui-change`\n * @fires ui-delete - detail: { deletedFile, remainingFiles }\n * @fires ui-retry - detail: { retriedFile } when the user retries a failed upload\n * @csspart title - Label title\n * @csspart description - Label description\n * @csspart trigger - The button or drop zone\n * @csspart drop-icon - The drop zone's upload icon (hidden unless a design shows it)\n * @csspart items - The file list\n * @cssprop --ui-field-radius - Corner radius of the drop zone (the field setting); `--ui-file-drop-radius` overrides it (Kanok: 12px)\n * @cssprop --ui-file-uploader-max-width - Widest the drop zone and the file rows get (default Carbon's 320px; Kanok: none)\n * @cssprop --ui-file-drop-direction - The drop zone's layout: `flex-direction` (default row), `--ui-file-drop-align` / `-justify` / `-text-align` / `-gap` (default flex-start, space-between, start, 0; Kanok: a centred column, 12px apart)\n * @cssprop --ui-file-drop-height - `block-size` of the drop zone (default Carbon's 96px; Kanok: auto), `--ui-file-drop-min-height` (Kanok: 136px), `--ui-file-drop-padding` (default 16px; Kanok: 24px)\n * @cssprop --ui-file-drop-background - Fill of the drop zone (default transparent; Kanok: the fields' fill); `--ui-file-drop-hover-background` while hovered or dragged over (Kanok: `--ui-highlight`)\n * @cssprop --ui-file-drop-hover-border-color - Its dashed line while hovered or dragged over (default unchanged; Kanok: `--ui-primary`); `--ui-file-drop-hover-outline` the outline then (default `--ui-focus`; Kanok: transparent), `--ui-file-drop-hover-decoration` the text (default underline; Kanok: none)\n * @cssprop --ui-file-drop-icon-display - The upload icon (default none; Kanok: grid, a 40px circle: `--ui-file-drop-icon-background` its fill, `--ui-file-drop-icon-color` the icon)\n */\n@customElement('ui-file-uploader')\nexport class UiFileUploader extends UiElement {\n    static override hostStates: readonly string[] = ['drag-over'];\n\n    /** `el.focus()` lands on the control inside. */\n    static override readonly shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n    static readonly formAssociated = true;\n\n    static override readonly styles = [srOnlyStyles, css`\n        :host {\n            display: block;\n            inline-size: 100%;\n            font-family: var(--ui-font-family);\n        }\n\n        .title {\n            margin: 0 0 var(--ui-space-xs);\n            color: var(--ui-ink);\n            font: var(--ui-font-body-emphasis);\n            line-height: 18px; /* heading-compact-01 */\n            letter-spacing: var(--ui-tracking-body);\n        }\n\n        .description {\n            margin: 0 0 var(--ui-space-md);\n            color: var(--ui-ink-muted);\n            font: var(--ui-font-body-sm);\n            line-height: 18px; /* body-compact-01 */\n            letter-spacing: var(--ui-tracking-body);\n        }\n\n        :host([disabled]) .title,\n        :host([disabled]) .description {\n            color: var(--ui-ink-disabled);\n        }\n\n        /* Carbon's drop container; a design lays it out with --ui-file-drop-* (Kanok: a filled, centred tile with an icon) */\n        .drop {\n            display: flex;\n            flex-direction: var(--ui-file-drop-direction, row);\n            align-items: var(--ui-file-drop-align, flex-start);\n            justify-content: var(--ui-file-drop-justify, space-between);\n            gap: var(--ui-file-drop-gap, 0);\n            box-sizing: border-box;\n            inline-size: 100%;\n            max-inline-size: var(--ui-file-uploader-max-width, 320px);\n            block-size: var(--ui-file-drop-height, 96px);\n            min-block-size: var(--ui-file-drop-min-height, auto);\n            padding: var(--ui-file-drop-padding, var(--ui-space-md));\n            border: 1px dashed var(--ui-hairline-strong);\n            border-radius: var(--ui-file-drop-radius, var(--ui-field-radius, 0)); /* the field setting: a drop zone is an input */\n            background: var(--ui-file-drop-background, transparent);\n            color: var(--ui-link);\n            font: var(--ui-font-body-sm);\n            line-height: 18px;\n            letter-spacing: var(--ui-tracking-body);\n            text-align: var(--ui-file-drop-text-align, start);\n            overflow: hidden;\n            cursor: pointer;\n            outline: var(--ui-focus-width, 2px) solid transparent;\n            outline-offset: -2px;\n            /* Carbon file-browse-btn: everything at fast-02 (the outline, and the text colour while pressed) */\n            transition:\n                outline-color var(--ui-duration-moderate) var(--ui-easing),\n                color var(--ui-duration-moderate) var(--ui-easing);\n        }\n\n        .drop-icon {\n            display: var(--ui-file-drop-icon-display, none);\n            flex: none;\n            place-items: center;\n            inline-size: 40px;\n            block-size: 40px;\n            border-radius: 50%;\n            background: var(--ui-file-drop-icon-background, transparent);\n            fill: var(--ui-file-drop-icon-color, currentColor);\n        }\n\n        .drop:disabled .drop-icon {\n            fill: var(--ui-ink-disabled);\n        }\n\n        .drop-icon svg {\n            inline-size: 20px;\n            block-size: 20px;\n        }\n\n        .drop:hover,\n        .drop.drag-over {\n            border-color: var(--ui-file-drop-hover-border-color, var(--ui-hairline-strong));\n            background: var(--ui-file-drop-hover-background, var(--ui-file-drop-background, transparent));\n            outline-color: var(--ui-file-drop-hover-outline, var(--ui-focus));\n        }\n\n        .drop:focus-visible {\n            outline-color: var(--ui-focus);\n            text-decoration: underline;\n        }\n\n        .drop:hover {\n            text-decoration: var(--ui-file-drop-hover-decoration, underline);\n        }\n\n        .drop:active {\n            color: var(--ui-ink);\n        }\n\n        .drop:disabled {\n            border-color: var(--ui-button-disabled);\n            background: var(--ui-file-drop-background, transparent); /* no hover fill */\n            color: var(--ui-ink-disabled);\n            cursor: no-drop;\n            text-decoration: none;\n            outline: none;\n        }\n\n        .items {\n            margin-block-start: var(--ui-space-md);\n        }\n\n        :host([drop]) .items {\n            margin-block-start: var(--ui-space-xs);\n        }\n\n        .items:empty {\n            display: none;\n        }\n    `];\n\n    @property({ attribute: 'label-title' }) labelTitle = '';\n\n\n    private readonly localize = new LocalizeController(this);\n\n    @property({ attribute: 'label-description' }) labelDescription = '';\n\n    /** Button text; replaced by the file name / \"N files\" after a pick unless `keep-label`. */\n    @property({ attribute: 'button-label' }) buttonLabel = '';\n\n    @property({ attribute: 'button-kind' }) buttonKind: ButtonKind = 'primary';\n\n    /** Button and item sizes. */\n    @property({ reflect: true }) size: FileUploaderSize = 'md'; // Carbon default (40px)\n\n    /** Render the dashed drop zone instead of the button (Carbon `FileUploaderDropContainer`). */\n    @property({ type: Boolean, reflect: true }) drop = false;\n\n    @property({ attribute: 'drop-label' }) dropLabel = '';\n\n    /** Comma-separated extensions / MIME types, e.g. \".pdf,.jpg,image/png\". */\n    @property() accept = '';\n\n    @property({ type: Boolean, reflect: true }) multiple = false;\n\n    /** Bytes; larger files are added as invalid. */\n    @property({ type: Number, attribute: 'max-file-size' }) maxFileSize = 0;\n\n    /** Most valid files in the list; the ones past it are added as invalid (0 = no limit). */\n    @property({ type: Number, attribute: 'max-files' }) maxFiles = 0;\n\n    /** Bytes the valid files may add up to; a file that would go over is added as invalid (0 = no limit). */\n    @property({ type: Number, attribute: 'max-total-size' }) maxTotalSize = 0;\n\n    /** Show each file's size in its row (\"1.2 MB\", in the page language). */\n    @property({ type: Boolean, attribute: 'show-size' }) showSize = false;\n\n    @property({ reflect: true }) name = '';\n\n    @property({ type: Boolean, reflect: true }) disabled = false;\n\n    /** Status new items start in (Carbon `filenameStatus`). */\n    @property() status: FileStatus = 'edit';\n\n    @property({ attribute: 'icon-label' }) iconLabel = '';\n\n    @property({ type: Boolean, attribute: 'keep-label' }) keepLabel = false;\n\n    /** At least one valid file must be chosen before the form submits. */\n    @property({ type: Boolean, reflect: true }) required = false;\n\n    /** Validation message for `required`; defaults to the translation. */\n    @property({ attribute: 'required-text' }) requiredText = '';\n\n    @property({ attribute: 'invalid-type-text' }) invalidTypeText = '';\n\n    @property({ attribute: 'too-large-text' }) tooLargeText = '';\n\n    @property({ attribute: 'too-many-text' }) tooManyText = '';\n\n    @property({ attribute: 'total-too-large-text' }) totalTooLargeText = '';\n\n    @property({ attribute: 'invalid-body-text' }) invalidBodyText = '';\n\n    /** The current list; replace it (new array) to update statuses or errors. */\n    @property({ attribute: false }) files: FileItem[] = [];\n\n    @state() private dragOver = false;\n\n    @state() private pickedLabel = '';\n\n    /** Disabled, reset defaults, validation on submit and the name given from outside (shared by the form fields). */\n    private readonly formControl = new FormControlController(this);\n\n    @query('input[type=\"file\"]') private readonly input!: HTMLInputElement;\n\n\n    /** Message from `setCustomValidity()`; '' = none. */\n    private customValidityMessage = '';\n\n    /** Like `<input>.setCustomValidity()`: a non-empty message makes the field invalid until cleared with ''. */\n    setCustomValidity(message: string) {\n        this.customValidityMessage = message;\n        if (this.hasUpdated) this.syncFormValue();\n    }\n    private readonly ids = uid('ui-file-uploader');\n\n    get form() {\n        return this.internals.form;\n    }\n\n    get validity() {\n        return this.internals.validity;\n    }\n\n    get validationMessage() {\n        return this.internals.validationMessage;\n    }\n\n    checkValidity() {\n        return this.internals.checkValidity();\n    }\n\n    reportValidity() {\n        return this.formControl.reportValidity(this.internals);\n    }\n\n    /** Focus the trigger when the form reports this field first. */\n    override connectedCallback() {\n        super.connectedCallback();\n    }\n\n    override disconnectedCallback() {\n        super.disconnectedCallback();\n    }\n\n    formResetCallback() {\n        this.clearFiles();\n    }\n\n    formDisabledCallback(disabled: boolean) {\n        this.formControl.setFieldsetDisabled(disabled);\n    }\n\n    private get isDisabled() {\n        return this.formControl.disabled;\n    }\n\n    protected override updated(changed: Map<string, unknown>) {\n        if (['files', 'disabled', 'fieldsetDisabled', 'name', 'required', 'requiredText'].some((k) => changed.has(k))) this.syncFormValue();\n        this.toggleAttribute('data-drag-over', this.dragOver);\n    }\n\n    private syncFormValue() {\n        if (barWhenDisabled(this.internals, this.isDisabled)) return;\n        const valid = this.files.filter((item) => !item.invalid);\n        // no name: nothing to submit, but `required` still blocks the form (as `<input type=file required>`)\n        if (this.name) {\n            const data = new FormData();\n            for (const item of valid) data.append(this.name, item.file, item.name);\n            this.internals.setFormValue(data);\n        } else {\n            this.internals.setFormValue(null);\n        }\n        const anchor = this.shadowRoot?.querySelector<HTMLElement>('.drop, ui-button') ?? undefined;\n        if (this.customValidityMessage) this.internals.setValidity({ customError: true }, this.customValidityMessage, anchor);\n        else if (this.required && !valid.length) this.internals.setValidity({ valueMissing: true }, this.requiredText || this.localize.t.fileUploader.required, anchor);\n        else this.internals.setValidity({});\n    }\n\n    /** Open the file dialog. */\n    browse() {\n        if (this.isDisabled) return;\n        this.input.value = '';\n        this.input.click();\n    }\n\n    /** A picked file as a list item, invalid with its error when refused. */\n    private toItem(file: File, rejection: FileRejection): FileItem {\n        const item: FileItem = { uuid: `${this.ids}-${++fileSeq}`, name: file.name, file, status: this.status };\n        if (!rejection) return item;\n        const message = rejectionMessage(rejection, this.localize.t.fileUploader, this, { maxFiles: this.maxFiles, maxTotalSize: this.maxTotalSize, locale: this.localize.lang() });\n        return { ...item, invalid: true, ...message };\n    }\n\n    /** Add files as if the user picked them. */\n    addFiles(files: File[]) {\n        if (this.isDisabled || !files.length) return;\n        const picked = this.multiple ? files : [files[0]];\n        // Carbon `validateFiles` (core `checkFile`: size limit, then `accept`), then the count and total size next to the valid files kept\n        const kept = this.multiple ? this.files.filter((f) => !f.invalid).map((f) => f.file) : [];\n        const rules = { accept: this.accept, maxFileSize: this.maxFileSize, maxFiles: this.maxFiles, maxTotalSize: this.maxTotalSize };\n        const rejections = checkFiles(picked, rules, kept);\n        const added = picked.map((f, i) => this.toItem(f, rejections[i]));\n        this.dispatchEvent(new CustomEvent('ui-add', { detail: { addedFiles: added }, bubbles: true, composed: true }));\n        this.files = this.multiple ? [...this.files, ...added] : added;\n        if (!this.keepLabel) this.pickedLabel = pickedFilesLabel(picked.map((f) => f.name), this.localize.t.fileUploader.filesChosen);\n        this.emitChange({ addedFiles: added, removedFiles: [], currentFiles: this.files, action: 'add' });\n    }\n\n    removeFile(uuid: string) {\n        const item = this.files.find((f) => f.uuid === uuid);\n        if (!item) return;\n        this.files = this.files.filter((f) => f !== item);\n        this.dispatchEvent(new CustomEvent('ui-delete', { detail: { deletedFile: item, remainingFiles: this.files }, bubbles: true, composed: true }));\n        this.emitChange({ addedFiles: [], removedFiles: [item], currentFiles: this.files, action: 'remove' });\n    }\n\n    clearFiles() {\n        const removed = this.files;\n        this.files = [];\n        this.pickedLabel = '';\n        if (this.input) this.input.value = '';\n        if (removed.length) this.emitChange({ addedFiles: [], removedFiles: removed, currentFiles: [], action: 'clear' });\n    }\n\n    private emitChange(detail: FileChangeDetail) {\n        this.dispatchEvent(new CustomEvent<FileChangeDetail>('ui-change', { detail, bubbles: true, composed: true }));\n        this.dispatchEvent(new Event('change', { bubbles: true })); // like <input type=file>, for form libraries\n    }\n\n    private onInputChange(event: Event) {\n        this.addFiles([...((event.target as HTMLInputElement).files ?? [])]);\n    }\n\n    private onDragOver(event: DragEvent) {\n        event.preventDefault();\n        event.stopPropagation();\n        if (this.isDisabled) return;\n        this.dragOver = true;\n        if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';\n    }\n\n    private onDragLeave(event: DragEvent) {\n        event.preventDefault();\n        event.stopPropagation();\n        this.dragOver = false;\n    }\n\n    private onDrop(event: DragEvent) {\n        event.preventDefault();\n        event.stopPropagation();\n        this.dragOver = false;\n        if (this.isDisabled || !event.dataTransfer) return;\n        const items = [...event.dataTransfer.items];\n        const files = items.length\n            ? items.filter((i) => i.kind === 'file' && !i.webkitGetAsEntry?.()?.isDirectory).flatMap((i) => i.getAsFile() ?? [])\n            : [...event.dataTransfer.files];\n        this.addFiles(files);\n    }\n\n    private onTriggerKeydown(event: KeyboardEvent) {\n        if (event.key !== 'Enter' && event.key !== ' ') return;\n        event.preventDefault();\n        this.browse();\n    }\n\n    private onItemDelete(event: CustomEvent<{ uuid: string }>) {\n        const item = event.target as UiFileUploaderItem;\n        if (!item.closest('.items')) return; // slotted items are the author's\n        event.stopPropagation();\n        const index = this.renderedItems().indexOf(item);\n        const active = deepActiveElement();\n        const hadFocus = !!active && !!item.shadowRoot?.contains(active);\n        this.removeFile(event.detail.uuid);\n        if (hadFocus) void this.updateComplete.then(() => this.focusAfterRemoval(index));\n    }\n\n    /** Focus would fall to `<body>` with the removed row: move it to the next remove button, else the previous, else the trigger. */\n    private focusAfterRemoval(index: number) {\n        const rest = this.renderedItems();\n        const next = rest[focusAfterRemoval(rest.map((el) => el.removable), index)];\n        if (next) next.focus();\n        else this.renderRoot.querySelector<HTMLElement>('[part=\"trigger\"]')?.focus();\n    }\n\n    /** A listed file's retry: re-sent with the whole item (slotted items' events pass through as they are). */\n    private onItemRetry(event: CustomEvent<{ uuid: string }>) {\n        const item = event.target as UiFileUploaderItem;\n        if (!item.closest('.items')) return;\n        event.stopPropagation();\n        const retried = this.files.find((f) => f.uuid === event.detail.uuid);\n        if (retried) this.dispatchEvent(new CustomEvent<FileRetryDetail>('ui-retry', { detail: { retriedFile: retried }, bubbles: true, composed: true }));\n    }\n\n    private renderedItems() {\n        return [...this.renderRoot.querySelectorAll<UiFileUploaderItem>('.items > ui-file-uploader-item')];\n    }\n\n    private renderTrigger() {\n        if (this.drop) {\n            return html`<button\n                class=\"drop ${classMap({ 'drag-over': this.dragOver })}\"\n                part=\"trigger\"\n                type=\"button\"\n                ?disabled=${this.isDisabled}\n                @click=${this.browse}\n                @keydown=${this.onTriggerKeydown}\n            >\n                <span class=\"drop-icon\" part=\"drop-icon\" aria-hidden=\"true\">${uploadIcon}</span>\n                <span>${this.dropLabel || this.localize.t.fileUploader.dropHint}</span>\n            </button>`;\n        }\n        return html`<ui-button part=\"trigger\" kind=${this.buttonKind} size=${this.size} ?disabled=${this.isDisabled} @click=${this.browse}>\n            ${this.pickedLabel || (this.buttonLabel || this.localize.t.fileUploader.addFile)}\n        </ui-button>`;\n    }\n\n    override render() {\n        return html`\n            <div class=\"base\" role=\"group\" aria-labelledby=${ifDefined(this.labelTitle ? `${this.ids}-title` : undefined)} aria-disabled=${ifDefined(this.isDisabled ? 'true' : undefined)}>\n            ${this.labelTitle ? html`<p class=\"title\" part=\"title\" id=\"${this.ids}-title\">${this.labelTitle}</p>` : nothing}\n            ${this.labelDescription ? html`<p class=\"description\" part=\"description\" id=\"${this.ids}-description\">${this.labelDescription}</p>` : nothing}\n            <div class=\"zone\" @dragover=${this.onDragOver} @dragleave=${this.onDragLeave} @drop=${this.onDrop}>\n                ${this.renderTrigger()}\n                <label class=\"sr-only\" for=${`${this.ids}-input`}>${this.labelTitle || (this.buttonLabel || this.localize.t.fileUploader.addFile)}</label>\n                <input\n                    class=\"sr-only\"\n                    id=${`${this.ids}-input`}\n                    type=\"file\"\n                    tabindex=\"-1\"\n                    ?multiple=${this.multiple}\n                    accept=${this.accept || nothing}\n                    ?disabled=${this.isDisabled}\n                    @change=${this.onInputChange}\n                />\n            </div>\n            </div>\n            <div class=\"items\" part=\"items\" @ui-delete=${this.onItemDelete} @ui-retry=${this.onItemRetry}>\n                ${this.files.map(\n                    (f) => html`<ui-file-uploader-item\n                        uuid=${f.uuid}\n                        name=${f.name}\n                        status=${f.status ?? this.status}\n                        size=${this.size}\n                        ?invalid=${!!f.invalid}\n                        error-subject=${f.errorSubject ?? ''}\n                        error-body=${f.errorBody ?? ''}\n                        icon-label=${this.iconLabel}\n                        ?disabled=${this.isDisabled}\n                        .progress=${f.progress}\n                        ?retryable=${!!f.retryable}\n                        .fileSize=${this.showSize ? f.file.size : undefined}\n                    ></ui-file-uploader-item>`,\n                )}\n                <slot></slot>\n            </div>\n        `;\n    }\n}\n\nexport interface FileAddDetail {\n    addedFiles: FileItem[];\n}\n\nexport interface FileDeleteDetail {\n    deletedFile: FileItem;\n    remainingFiles: FileItem[];\n}\n\nexport interface FileRetryDetail {\n    retriedFile: FileItem;\n}\n\nexport interface UiFileUploaderEventMap extends HTMLElementEventMap {\n    'ui-add': CustomEvent<FileAddDetail>;\n    'ui-delete': CustomEvent<FileDeleteDetail>;\n    'ui-change': CustomEvent<FileChangeDetail>;\n    'ui-retry': CustomEvent<FileRetryDetail>;\n}\n\n/** Typed listeners for UiFileUploader's events (declaration merging with the class). */\nexport interface UiFileUploader {\n    addEventListener<K extends keyof UiFileUploaderEventMap>(type: K, listener: (this: UiFileUploader, event: UiFileUploaderEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;\n    removeEventListener<K extends keyof UiFileUploaderEventMap>(type: K, listener: (this: UiFileUploader, event: UiFileUploaderEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;\n    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-file-uploader': UiFileUploader;\n    }\n}\n"
    }
  ]
}
