wj-elements 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +6937 -6800
- package/dist/dark.css +1 -1
- package/dist/light.css +1 -1
- package/dist/packages/translations/en-gb.d.ts +1 -0
- package/dist/packages/translations/sk-sk.d.ts +1 -0
- package/dist/packages/wje-button/button.element.d.ts +14 -1
- package/dist/packages/wje-pagination/pagination.element.d.ts +21 -0
- package/dist/web-types.json +531 -517
- package/dist/wje-button.js +55 -10
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-checkbox.js +1 -1
- package/dist/wje-master.js +3 -1
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-pagination.js +29 -3
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-select.js +21 -7
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-stepper.js +1 -1
- package/dist/wje-store.js +1 -1
- package/dist/wje-store.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-pagination.js","sources":["../packages/wje-pagination/service/service.js","../packages/wje-pagination/pagination.element.js","../packages/wje-pagination/pagination.js"],"sourcesContent":["/**\n * Paginates items based on the total number of items, current page, page size, and maximum number of pages to display.\n * @param {number} totalItems The total number of items to paginate.\n * @param {number} [currentPage] The current page number (default is 1).\n * @param {number} [pageSize] The number of items per page (default is 10).\n * @param {number} [maxPages] The maximum number of pages to display in the pagination control (default is 5).\n * @returns {object} An object containing pagination details including total items, current page, page size, total pages, start/end page, start/end index, and the pages array.\n */\nexport function paginate(totalItems, currentPage = 1, pageSize = 10, maxPages = 5) {\n // Calculate total pages\n const totalPages = Math.ceil(totalItems / pageSize);\n\n // Ensure current page is within valid range\n if (currentPage < 1) {\n currentPage = 1;\n } else if (currentPage > totalPages) {\n currentPage = totalPages;\n }\n\n let startPage;\n let endPage;\n\n const pagesNearEnd = maxPages + 1; // Define how close to the end we switch back to 5 pages 4\n\n const boundary = pagesNearEnd + 3;\n\n if (totalPages > boundary) {\n if (currentPage < pagesNearEnd) {\n // If in the first 4 pages, show up to 5 pages\n startPage = 1;\n endPage = Math.min(pagesNearEnd + 1, totalPages); //5\n } else if (currentPage >= totalPages - pagesNearEnd) {\n // If within 4 pages from the end, show last 5 pages\n startPage = Math.max(totalPages - pagesNearEnd, 1); //4\n endPage = totalPages;\n } else {\n const halfPages = Math.floor(maxPages / 2);\n // Otherwise, only show 3 pages (current, previous, next)\n startPage = currentPage - halfPages + 1;\n endPage = maxPages % 2 === 1 ? currentPage + halfPages + 1 : currentPage + halfPages - 1;\n }\n } else {\n startPage = 1;\n endPage = totalPages;\n }\n\n // Calculate start and end item indexes\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1);\n\n // Create an array of pages to display\n const pages = Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);\n\n // Return object with all pager properties (preserving original format)\n return {\n boundary: boundary,\n currentPage: currentPage,\n endIndex: endIndex,\n endPage: endPage,\n totalPages: totalPages,\n pages: pages,\n pageSize: pageSize,\n startIndex: startIndex,\n startPage: startPage,\n totalItems: totalItems,\n };\n}\n","import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport { paginate } from './service/service.js';\nimport Icon from '../wje-icon/icon.js';\nimport Button from '../wje-button/button.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents the Pagination component for navigating through paginated content and dynamically updating navigation elements based on attributes like the number of items, page size, etc. Extends the WJElement class.\n * @documentation https://elements.webjet.sk/components/pagination\n * @status stable\n * @augments WJElement\n * @dependency wje-icon, wje-button\n * @csspart native - The wrapper element for the pagination component.\n */\nexport default class Pagination extends WJElement {\n /**\n * Creates an instance of Pagination.\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n\n this._paginateObj = null;\n }\n\n /**\n * Sets the value of the 'page' attribute for the object.\n * @param {string} value The value to set for the 'page' attribute.\n */\n set page(value) {\n this.setAttribute('page', value);\n }\n\n /**\n * Retrieves the current page number as a numeric value.\n * @returns {number} The current page number. Returns 0 if the attribute 'page' is not set or is not a numeric value.\n */\n get page() {\n return +this.getAttribute('page') || 0;\n }\n\n /**\n * Sets the maximum number of pages.\n * Updates the 'max-pages' attribute with the provided value.\n * @param {number|string} value The maximum number of pages to set. Can be a number or a parsable string representing a number.\n */\n set maxPages(value) {\n this.setAttribute('max-pages', value);\n }\n\n /**\n * Gets the maximum number of pages.\n * This getter retrieves the value of the \"max-pages\" attribute from the element.\n * If the attribute is not set or is invalid, it defaults to 3.\n * @returns {number} The maximum number of pages as a numeric value.\n */\n get maxPages() {\n return +this.getAttribute('max-pages') || 10;\n }\n\n /**\n * Sets the `pageSize` attribute to the specified value.\n * @param {number|string} value The desired page size value. This can be a number or a string representation of the size.\n */\n set pageSize(value) {\n this.setAttribute('page-size', value);\n }\n\n /**\n * Retrieves the value of the 'page-size' attribute and converts it to a number.\n * If the attribute is not set or is invalid, returns the default value of 3.\n * @returns {number} The numeric value of the 'page-size' attribute or the default value of 3.\n */\n get pageSize() {\n return +this.getAttribute('page-size') || 3;\n }\n\n /**\n * Sets the total number of items.\n * @param {number} value The new total number of items to set.\n */\n set totalItems(value) {\n this.setAttribute('total-items', value);\n }\n\n /**\n * Retrieves the total number of items represented by the 'total-items' attribute.\n * @returns {number} The total number of items. Defaults to 0 if the attribute is not set or is invalid.\n */\n get totalItems() {\n return +this.getAttribute('total-items') || 0;\n }\n\n /**\n * Sets the visibility of the first button based on the provided value.\n * Adds the 'show-first-button' attribute when the value is truthy, and removes it otherwise.\n * @param {boolean} value Determines whether to show the first button. If true, the 'show-first-button' attribute is added; if false, it is removed.\n */\n set showFirstButton(value) {\n this.removeAttribute('show-first-button');\n\n if (value) {\n this.setAttribute('show-first-button', '');\n }\n }\n\n /**\n * Determines whether the 'show-first-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-first-button' attribute is set; otherwise, false.\n */\n get showFirstButton() {\n return this.hasAttribute('show-first-button');\n }\n\n /**\n * Sets the visibility of the \"last\" button. This method controls the presence\n * or absence of the \"show-last-button\" attribute based on the provided value.\n * @param {boolean} value A boolean value indicating whether to show the \"last\" button.\n * If true, the \"show-last-button\" attribute is added;\n * if false, the attribute is removed.\n */\n set showLastButton(value) {\n this.removeAttribute('show-last-button');\n\n if (value) {\n this.setAttribute('show-last-button', '');\n }\n }\n\n /**\n * Determines if the 'show-last-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-last-button' attribute is present, otherwise false.\n */\n get showLastButton() {\n return this.hasAttribute('show-last-button');\n }\n\n /**\n * Sets the pagination object by calculating the pagination details\n * based on the total items, current page, page size, and maximum pages.\n * @param {object} value The value to set the pagination object. The pagination details are computed internally.\n */\n set paginateObj(value) {\n this._paginateObj = value;\n }\n\n /**\n * Retrieves the pagination object used for managing paginated data.\n * @returns {object} The pagination object containing details and functionality for paginating data.\n */\n get paginateObj() {\n return this._paginateObj;\n }\n\n /**\n * Sets the 'round' attribute on the element. If the provided value is truthy,\n * the 'round' attribute is added. If the value is falsy, the attribute is removed.\n * @param {boolean} value A boolean value determining whether to add or remove the 'round' attribute.\n */\n set round(value) {\n this.removeAttribute('round');\n\n if (value) {\n this.setAttribute('round', '');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute for the current element.\n * @returns {boolean} A boolean indicating whether the 'round' attribute is present on the element.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Sets the `show-info` attribute on the element based on the provided value.\n * @param {boolean} value A boolean indicating whether to add or remove the `show-info` attribute.\n */\n set showInfo(value) {\n this.removeAttribute('show-info');\n\n if (value) {\n this.setAttribute('show-info', '');\n }\n }\n\n /**\n * Retrieves the value of the 'show-info' attribute.\n * Checks if the 'show-info' attribute is present on the element.\n * @returns {boolean} True if the 'show-info' attribute is present, otherwise false.\n */\n get showInfo() {\n return this.hasAttribute('show-info');\n }\n\n set showPageSizeOptions(value) {\n if (!value) return;\n this.setAttribute('show-page-size-options', value);\n }\n\n get showPageSizeOptions() {\n return this.hasAttribute('show-page-size-options');\n }\n\n set pageSizeOptions(value) {\n if (!value) return;\n this.setAttribute('page-size-options', value);\n }\n\n /**\n * Retrieves the list of available page size options.\n * This method is used to fetch the values representing the different page size options\n * that can be provided or configured in a paginated component or system.\n * @returns {Array<number>} An array of numbers representing the selectable page size options.\n */\n get pageSizeOptions() {\n let options = this.getAttribute('page-size-options');\n if (!options) return [6, 10, 50, 100, 500];\n return options.split(',').map((o) => +o).filter((o) => !isNaN(o));\n }\n\n set hideEmpty(value) {\n if (!value) return;\n this.setAttribute('hide-empty', value);\n }\n\n get hideEmpty() {\n return this.hasAttribute('hide-empty');\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n 'wje-button': Button,\n };\n\n className = 'Pagination';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['page', 'total-items', 'page-size'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'navigation',\n });\n }\n\n async beforeDraw() {\n this.classList.remove('empty');\n this.removeAttribute(\"hidden\");\n\n if (!this.totalItems || this.totalItems === 0) {\n this.classList.add('empty');\n if (this.hideEmpty)\n this.setAttribute(\"hidden\", \"\");\n\n return;\n }\n\n this.paginateObj = await paginate(this.totalItems, this.page + 1, this.pageSize, this.maxPages) || {};\n }\n\n /**\n * Creates a document fragment, appends a new slot element to it, and returns the fragment.\n * @returns {DocumentFragment} A document fragment containing a slot element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-pagination');\n\n native.append(this.htmlPagination());\n\n fragment.append(native);\n\n return fragment;\n }\n\n /**\n * Creates a pagination control for navigating between pages of content.\n * This method generates and returns a document fragment containing pagination controls, including buttons for navigating to the first, previous, next, and last pages, as well as optional informational text about the current set of displayed items and total number of items.\n * @returns {DocumentFragment} A document fragment containing the pagination controls.\n */\n htmlPagination() {\n let fragment = document.createDocumentFragment();\n\n let select = document.createElement('wje-select');\n select.setAttribute('size', 'small');\n select.setAttribute('variant', 'standard');\n select.setAttribute('value', this.pageSize);\n select.addEventListener('wje-select:change', (e) => {\n\n if(+e.detail.context.value[0] !== this.pageSize) {\n this.pageSize = +e.detail.context.value[0];\n this.page = 0; // Reset to first page when page size changes\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', { page: this.page, pageSize: this.pageSize });\n }\n });\n\n let options = this.pageSizeOptions.map((o) => {\n let option = document.createElement('wje-option');\n option.value = o;\n option.textContent = o;\n return option;\n });\n\n let info = document.createElement('div');\n info.classList.add('info');\n info.innerHTML = `${this.paginateObj?.startIndex + 1} - ${this.paginateObj?.endIndex + 1} ${this.localizer.translate('wj.pagination.of')} ${this.totalItems}`;\n\n let pagination = document.createElement('div');\n pagination.classList.add('pages');\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n // First button\n let firstButton = button.cloneNode(true);\n firstButton.title = this.localizer.translate('wj.pagination.first');\n firstButton.setAttribute('aria-label', firstButton.title);\n firstButton.innerHTML = `<wje-icon name=\"chevron-left-pipe\" slot=\"icon-only\"></wje-icon>`;\n firstButton.addEventListener('click', (e) => this.pageClickAction(e, 0));\n\n // Previous button\n const prevButton = button.cloneNode(true);\n prevButton.title = this.localizer.translate('wj.pagination.prev');\n prevButton.setAttribute('aria-label', prevButton.title);\n prevButton.innerHTML = `<wje-icon name=\"chevron-left\" slot=\"icon-only\"></wje-icon>`;\n if (this.page === 0) prevButton.disabled = true;\n prevButton.addEventListener('click', (e) => this.pageClickAction(e, this.page - 1));\n\n // Next button\n const nextButton = button.cloneNode(true);\n nextButton.title = this.localizer.translate('wj.pagination.next');\n nextButton.setAttribute('aria-label', nextButton.title);\n nextButton.innerHTML = `<wje-icon name=\"chevron-right\" slot=\"icon-only\"></wje-icon>`;\n if (this.page + 1 >= this.paginateObj?.totalPages) nextButton.disabled = true;\n nextButton.addEventListener('click', (e) => this.pageClickAction(e, this.page + 1));\n\n // Last button\n let lastButton = button.cloneNode(true);\n lastButton.title = this.localizer.translate('wj.pagination.last');\n lastButton.setAttribute('aria-label', lastButton.title);\n lastButton.innerHTML = `<wje-icon name=\"chevron-right-pipe\" slot=\"icon-only\"></wje-icon>`;\n lastButton.disabled = this.paginateObj?.endIndex + 1 >= this.totalItems;\n lastButton.addEventListener('click', (e) =>\n this.pageClickAction(e, this.paginateObj?.totalPages - 1)\n );\n\n select.append(...options);\n\n if (this.showFirstButton) pagination.appendChild(firstButton);\n pagination.appendChild(prevButton);\n pagination.appendChild(this.htmlStackButtons(this.paginateObj));\n pagination.appendChild(nextButton);\n if (this.showLastButton) pagination.appendChild(lastButton);\n\n if (this.showPageSizeOptions) fragment.append(select);\n if (this.showInfo) fragment.appendChild(info);\n fragment.appendChild(pagination);\n\n return fragment;\n }\n\n /**\n * Creates and returns a DocumentFragment containing a series of buttons for pagination purposes,\n * based on the provided pagination object.\n * @param {object} paginateObj An object containing pagination details.\n * @param {number} paginateObj.currentPage The current active page index (1-based).\n * @param {Array<number>} paginateObj.pages An array of page numbers to display in the pagination.\n * @param {number} paginateObj.totalPages Total number of pages available for pagination.\n * @returns {DocumentFragment} A DocumentFragment containing the buttons and additional pagination elements.\n */\n htmlStackButtons(paginateObj) {\n let fragment = document.createDocumentFragment();\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n let dots = document.createElement('span');\n dots.classList.add('dots');\n dots.setAttribute('aria-hidden', 'true');\n\n const first = button.cloneNode(true);\n first.textContent = '1';\n first.addEventListener('click', (e) => this.pageClickAction(e, 0));\n\n const last = button.cloneNode(true);\n last.textContent = paginateObj?.totalPages;\n last.addEventListener('click', (e) => this.pageClickAction(e, paginateObj?.totalPages - 1));\n\n if (paginateObj?.currentPage >= this.maxPages + 1 && paginateObj?.boundary < paginateObj?.totalPages) {\n fragment.appendChild(first);\n fragment.appendChild(dots);\n }\n\n paginateObj?.pages.forEach((page) => {\n let newButton = button.cloneNode(true);\n newButton.textContent = page;\n\n if (page - 1 === this.page) {\n newButton.removeAttribute('fill');\n newButton.setAttribute('aria-current', 'page');\n } else {\n newButton.addEventListener('click', (e) => this.pageClickAction(e, page - 1));\n }\n\n fragment.appendChild(newButton);\n });\n\n if (\n (paginateObj?.pages.length === this.maxPages || paginateObj?.currentPage < this.maxPages + 1) &&\n paginateObj.boundary < paginateObj?.totalPages\n ) {\n fragment.appendChild(dots.cloneNode(true));\n fragment.appendChild(last);\n }\n\n return fragment;\n }\n\n /**\n * Handles the click action for pagination and updates the current page.\n * If the clicked page number is the same as the current page, no action is performed.\n * Otherwise, the current page is updated to the new page number, and a custom event\n * 'wje-pagination:page-change' is dispatched with the pagination object.\n * @param {Event} e The event triggered by the page click.\n * @param {number} page The page number that was clicked.\n */\n pageClickAction = (e, page) => {\n if (+page === this.page || this.page > this.paginateObj.totalPages) return;\n this.page = page;\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', { page: this.page, pageSize: this.pageSize });\n };\n}\n\nPagination.define('wje-pagination', Pagination);\n","import Pagination from './pagination.element.js';\n\nexport default Pagination;\n\nPagination.define('wje-pagination', Pagination);\n"],"names":["_a"],"mappings":";;;;;;;;AAQO,SAAS,SAAS,YAAY,cAAc,GAAG,WAAW,IAAI,WAAW,GAAG;AAE/E,QAAM,aAAa,KAAK,KAAK,aAAa,QAAQ;AAGlD,MAAI,cAAc,GAAG;AACjB,kBAAc;AAAA,EAClB,WAAW,cAAc,YAAY;AACjC,kBAAc;AAAA,EAClB;AAEA,MAAI;AACJ,MAAI;AAEJ,QAAM,eAAe,WAAW;AAEhC,QAAM,WAAW,eA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Y,KAAK,UAAU,IAAI,CAAC;AACzC,eAAS,YAAY,IAAI;AAAA,IAC7B;AAEA,WAAO;AAAA,EACX;AAeJ;AAEA,WAAW,OAAO,kBAAkB,UAAU;AC3c9C,WAAW,OAAO,kBAAkB,UAAU;"}
|
|
1
|
+
{"version":3,"file":"wje-pagination.js","sources":["../packages/wje-pagination/service/service.js","../packages/wje-pagination/pagination.element.js","../packages/wje-pagination/pagination.js"],"sourcesContent":["/**\n * Paginates items based on the total number of items, current page, page size, and maximum number of pages to display.\n * @param {number} totalItems The total number of items to paginate.\n * @param {number} [currentPage] The current page number (default is 1).\n * @param {number} [pageSize] The number of items per page (default is 10).\n * @param {number} [maxPages] The maximum number of pages to display in the pagination control (default is 5).\n * @returns {object} An object containing pagination details including total items, current page, page size, total pages, start/end page, start/end index, and the pages array.\n */\nexport function paginate(totalItems, currentPage = 1, pageSize = 10, maxPages = 5) {\n // Calculate total pages\n const totalPages = Math.ceil(totalItems / pageSize);\n\n // Ensure current page is within valid range\n if (currentPage < 1) {\n currentPage = 1;\n } else if (currentPage > totalPages) {\n currentPage = totalPages;\n }\n\n let startPage;\n let endPage;\n\n const pagesNearEnd = maxPages + 1; // Define how close to the end we switch back to 5 pages 4\n\n const boundary = pagesNearEnd + 3;\n\n if (totalPages > boundary) {\n if (currentPage < pagesNearEnd) {\n // If in the first 4 pages, show up to 5 pages\n startPage = 1;\n endPage = Math.min(pagesNearEnd + 1, totalPages); //5\n } else if (currentPage >= totalPages - pagesNearEnd) {\n // If within 4 pages from the end, show last 5 pages\n startPage = Math.max(totalPages - pagesNearEnd, 1); //4\n endPage = totalPages;\n } else {\n const halfPages = Math.floor(maxPages / 2);\n // Otherwise, only show 3 pages (current, previous, next)\n startPage = currentPage - halfPages + 1;\n endPage = maxPages % 2 === 1 ? currentPage + halfPages + 1 : currentPage + halfPages - 1;\n }\n } else {\n startPage = 1;\n endPage = totalPages;\n }\n\n // Calculate start and end item indexes\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1);\n\n // Create an array of pages to display\n const pages = Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);\n\n // Return object with all pager properties (preserving original format)\n return {\n boundary: boundary,\n currentPage: currentPage,\n endIndex: endIndex,\n endPage: endPage,\n totalPages: totalPages,\n pages: pages,\n pageSize: pageSize,\n startIndex: startIndex,\n startPage: startPage,\n totalItems: totalItems,\n };\n}\n","import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport { paginate } from './service/service.js';\nimport Icon from '../wje-icon/icon.js';\nimport Button from '../wje-button/button.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents the Pagination component for navigating through paginated content and dynamically updating navigation elements based on attributes like the number of items, page size, etc. Extends the WJElement class.\n * @documentation https://elements.webjet.sk/components/pagination\n * @status stable\n * @augments WJElement\n * @dependency wje-icon, wje-button\n * @csspart native - The wrapper element for the pagination component.\n * @csspart summary - The wrapper for the page-size selector and item range.\n * @csspart page-size - The wrapper for the page-size label and selector.\n * @csspart page-size-label - The page-size selector label.\n * @csspart page-size-select - The page-size selector.\n * @csspart info - The item range information.\n * @csspart pages - The page navigation wrapper.\n * @csspart page-button - Any pagination button.\n * @csspart page-number - A numbered page button.\n * @csspart current-page - The current page button.\n * @csspart first-button - The button that navigates to the first page.\n * @csspart previous-button - The button that navigates to the previous page.\n * @csspart next-button - The button that navigates to the next page.\n * @csspart last-button - The button that navigates to the last page.\n * @csspart dots - The page range ellipsis.\n * @cssproperty [--wje-pagination-gap=1rem] - Gap between the summary and page navigation.\n * @cssproperty [--wje-pagination-summary-gap=1rem] - Gap between summary items.\n * @cssproperty [--wje-pagination-page-size-gap=var(--wje-spacing-small)] - Gap between the page-size label and selector.\n * @cssproperty [--wje-pagination-mobile-gap=var(--wje-spacing-x-large)] - Gap between pagination rows below the md container width.\n * @cssproperty [--wje-pagination-page-size-width=68px] - Width of the page-size selector.\n * @cssproperty [--wje-pagination-page-button-width=32px] - Width of pagination buttons.\n * @cssproperty [--wje-pagination-page-button-gap=0.5rem] - Gap between pagination buttons.\n */\nexport default class Pagination extends WJElement {\n /**\n * Creates an instance of Pagination.\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n\n this._paginateObj = null;\n }\n\n /**\n * Sets the value of the 'page' attribute for the object.\n * @param {string} value The value to set for the 'page' attribute.\n */\n set page(value) {\n this.setAttribute('page', value);\n }\n\n /**\n * Retrieves the current page number as a numeric value.\n * @returns {number} The current page number. Returns 0 if the attribute 'page' is not set or is not a numeric value.\n */\n get page() {\n return +this.getAttribute('page') || 0;\n }\n\n /**\n * Sets the maximum number of pages.\n * Updates the 'max-pages' attribute with the provided value.\n * @param {number|string} value The maximum number of pages to set. Can be a number or a parsable string representing a number.\n */\n set maxPages(value) {\n this.setAttribute('max-pages', value);\n }\n\n /**\n * Gets the maximum number of pages.\n * This getter retrieves the value of the \"max-pages\" attribute from the element.\n * If the attribute is not set or is invalid, it defaults to 3.\n * @returns {number} The maximum number of pages as a numeric value.\n */\n get maxPages() {\n return +this.getAttribute('max-pages') || 10;\n }\n\n /**\n * Sets the `pageSize` attribute to the specified value.\n * @param {number|string} value The desired page size value. This can be a number or a string representation of the size.\n */\n set pageSize(value) {\n this.setAttribute('page-size', value);\n }\n\n /**\n * Retrieves the value of the 'page-size' attribute and converts it to a number.\n * If the attribute is not set or is invalid, returns the default value of 3.\n * @returns {number} The numeric value of the 'page-size' attribute or the default value of 3.\n */\n get pageSize() {\n return +this.getAttribute('page-size') || 3;\n }\n\n /**\n * Sets the total number of items.\n * @param {number} value The new total number of items to set.\n */\n set totalItems(value) {\n this.setAttribute('total-items', value);\n }\n\n /**\n * Retrieves the total number of items represented by the 'total-items' attribute.\n * @returns {number} The total number of items. Defaults to 0 if the attribute is not set or is invalid.\n */\n get totalItems() {\n return +this.getAttribute('total-items') || 0;\n }\n\n /**\n * Sets the visibility of the first button based on the provided value.\n * Adds the 'show-first-button' attribute when the value is truthy, and removes it otherwise.\n * @param {boolean} value Determines whether to show the first button. If true, the 'show-first-button' attribute is added; if false, it is removed.\n */\n set showFirstButton(value) {\n this.removeAttribute('show-first-button');\n\n if (value) {\n this.setAttribute('show-first-button', '');\n }\n }\n\n /**\n * Determines whether the 'show-first-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-first-button' attribute is set; otherwise, false.\n */\n get showFirstButton() {\n return this.hasAttribute('show-first-button');\n }\n\n /**\n * Sets the visibility of the \"last\" button. This method controls the presence\n * or absence of the \"show-last-button\" attribute based on the provided value.\n * @param {boolean} value A boolean value indicating whether to show the \"last\" button.\n * If true, the \"show-last-button\" attribute is added;\n * if false, the attribute is removed.\n */\n set showLastButton(value) {\n this.removeAttribute('show-last-button');\n\n if (value) {\n this.setAttribute('show-last-button', '');\n }\n }\n\n /**\n * Determines if the 'show-last-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-last-button' attribute is present, otherwise false.\n */\n get showLastButton() {\n return this.hasAttribute('show-last-button');\n }\n\n /**\n * Sets the pagination object by calculating the pagination details\n * based on the total items, current page, page size, and maximum pages.\n * @param {object} value The value to set the pagination object. The pagination details are computed internally.\n */\n set paginateObj(value) {\n this._paginateObj = value;\n }\n\n /**\n * Retrieves the pagination object used for managing paginated data.\n * @returns {object} The pagination object containing details and functionality for paginating data.\n */\n get paginateObj() {\n return this._paginateObj;\n }\n\n /**\n * Sets the 'round' attribute on the element. If the provided value is truthy,\n * the 'round' attribute is added. If the value is falsy, the attribute is removed.\n * @param {boolean} value A boolean value determining whether to add or remove the 'round' attribute.\n */\n set round(value) {\n this.removeAttribute('round');\n\n if (value) {\n this.setAttribute('round', '');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute for the current element.\n * @returns {boolean} A boolean indicating whether the 'round' attribute is present on the element.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Sets the `show-info` attribute on the element based on the provided value.\n * @param {boolean} value A boolean indicating whether to add or remove the `show-info` attribute.\n */\n set showInfo(value) {\n this.removeAttribute('show-info');\n\n if (value) {\n this.setAttribute('show-info', '');\n }\n }\n\n /**\n * Retrieves the value of the 'show-info' attribute.\n * Checks if the 'show-info' attribute is present on the element.\n * @returns {boolean} True if the 'show-info' attribute is present, otherwise false.\n */\n get showInfo() {\n return this.hasAttribute('show-info');\n }\n\n set showPageSizeOptions(value) {\n if (!value) return;\n this.setAttribute('show-page-size-options', value);\n }\n\n get showPageSizeOptions() {\n return this.hasAttribute('show-page-size-options');\n }\n\n set pageSizeOptions(value) {\n if (!value) return;\n this.setAttribute('page-size-options', value);\n }\n\n /**\n * Retrieves the list of available page size options.\n * This method is used to fetch the values representing the different page size options\n * that can be provided or configured in a paginated component or system.\n * @returns {Array<number>} An array of numbers representing the selectable page size options.\n */\n get pageSizeOptions() {\n let options = this.getAttribute('page-size-options');\n if (!options) return [6, 10, 50, 100, 500];\n return options.split(',').map((o) => +o).filter((o) => !isNaN(o));\n }\n\n set hideEmpty(value) {\n if (!value) return;\n this.setAttribute('hide-empty', value);\n }\n\n get hideEmpty() {\n return this.hasAttribute('hide-empty');\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n 'wje-button': Button,\n };\n\n className = 'Pagination';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['page', 'total-items', 'page-size'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'navigation',\n });\n }\n\n async beforeDraw() {\n this.classList.remove('empty');\n this.removeAttribute(\"hidden\");\n\n if (!this.totalItems || this.totalItems === 0) {\n this.classList.add('empty');\n if (this.hideEmpty)\n this.setAttribute(\"hidden\", \"\");\n\n return;\n }\n\n this.paginateObj = await paginate(this.totalItems, this.page + 1, this.pageSize, this.maxPages) || {};\n }\n\n /**\n * Creates a document fragment, appends a new slot element to it, and returns the fragment.\n * @returns {DocumentFragment} A document fragment containing a slot element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-pagination');\n\n native.append(this.htmlPagination());\n\n fragment.append(native);\n\n return fragment;\n }\n\n /**\n * Creates a pagination control for navigating between pages of content.\n * This method generates and returns a document fragment containing pagination controls, including buttons for navigating to the first, previous, next, and last pages, as well as optional informational text about the current set of displayed items and total number of items.\n * @returns {DocumentFragment} A document fragment containing the pagination controls.\n */\n htmlPagination() {\n let fragment = document.createDocumentFragment();\n\n let summary = document.createElement('div');\n summary.setAttribute('part', 'summary');\n summary.classList.add('summary');\n\n let pageSize = document.createElement('div');\n pageSize.setAttribute('part', 'page-size');\n pageSize.classList.add('page-size');\n\n let pageSizeLabel = document.createElement('span');\n pageSizeLabel.setAttribute('part', 'page-size-label');\n pageSizeLabel.classList.add('page-size-label');\n pageSizeLabel.textContent = this.localizer.translate('wj.pagination.itemsPerPage');\n\n let select = document.createElement('wje-select');\n select.setAttribute('part', 'page-size-select');\n select.setAttribute('size', 'small');\n select.setAttribute('variant', 'standard');\n select.setAttribute('value', this.pageSize);\n select.setAttribute('aria-label', pageSizeLabel.textContent);\n select.addEventListener('wje-select:change', (e) => {\n\n if(+e.detail.context.value[0] !== this.pageSize) {\n this.pageSize = +e.detail.context.value[0];\n this.page = 0; // Reset to first page when page size changes\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', { page: this.page, pageSize: this.pageSize });\n }\n });\n\n let options = this.pageSizeOptions.map((o) => {\n let option = document.createElement('wje-option');\n option.value = o;\n option.textContent = o;\n return option;\n });\n\n let info = document.createElement('div');\n info.setAttribute('part', 'info');\n info.classList.add('info');\n info.innerHTML = `${this.paginateObj?.startIndex + 1} - ${this.paginateObj?.endIndex + 1} ${this.localizer.translate('wj.pagination.of')} ${this.totalItems}`;\n\n let pagination = document.createElement('div');\n pagination.setAttribute('part', 'pages');\n pagination.classList.add('pages');\n\n const button = document.createElement('wje-button');\n button.setAttribute('part', 'page-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n // First button\n let firstButton = button.cloneNode(true);\n firstButton.setAttribute('part', 'page-button first-button');\n firstButton.title = this.localizer.translate('wj.pagination.first');\n firstButton.setAttribute('aria-label', firstButton.title);\n firstButton.innerHTML = `<wje-icon name=\"chevron-left-pipe\" slot=\"icon-only\"></wje-icon>`;\n firstButton.addEventListener('click', (e) => this.pageClickAction(e, 0));\n\n // Previous button\n const prevButton = button.cloneNode(true);\n prevButton.setAttribute('part', 'page-button previous-button');\n prevButton.title = this.localizer.translate('wj.pagination.prev');\n prevButton.setAttribute('aria-label', prevButton.title);\n prevButton.innerHTML = `<wje-icon name=\"chevron-left\" slot=\"icon-only\"></wje-icon>`;\n if (this.page === 0) prevButton.disabled = true;\n prevButton.addEventListener('click', (e) => this.pageClickAction(e, this.page - 1));\n\n // Next button\n const nextButton = button.cloneNode(true);\n nextButton.setAttribute('part', 'page-button next-button');\n nextButton.title = this.localizer.translate('wj.pagination.next');\n nextButton.setAttribute('aria-label', nextButton.title);\n nextButton.innerHTML = `<wje-icon name=\"chevron-right\" slot=\"icon-only\"></wje-icon>`;\n if (this.page + 1 >= this.paginateObj?.totalPages) nextButton.disabled = true;\n nextButton.addEventListener('click', (e) => this.pageClickAction(e, this.page + 1));\n\n // Last button\n let lastButton = button.cloneNode(true);\n lastButton.setAttribute('part', 'page-button last-button');\n lastButton.title = this.localizer.translate('wj.pagination.last');\n lastButton.setAttribute('aria-label', lastButton.title);\n lastButton.innerHTML = `<wje-icon name=\"chevron-right-pipe\" slot=\"icon-only\"></wje-icon>`;\n lastButton.disabled = this.paginateObj?.endIndex + 1 >= this.totalItems;\n lastButton.addEventListener('click', (e) =>\n this.pageClickAction(e, this.paginateObj?.totalPages - 1)\n );\n\n select.append(...options);\n\n if (this.showFirstButton) pagination.appendChild(firstButton);\n pagination.appendChild(prevButton);\n pagination.appendChild(this.htmlStackButtons(this.paginateObj));\n pagination.appendChild(nextButton);\n if (this.showLastButton) pagination.appendChild(lastButton);\n\n if (this.showPageSizeOptions) {\n pageSize.append(pageSizeLabel, select);\n summary.append(pageSize);\n }\n if (this.showInfo) summary.append(info);\n if (summary.childElementCount) fragment.append(summary);\n fragment.appendChild(pagination);\n\n return fragment;\n }\n\n /**\n * Creates and returns a DocumentFragment containing a series of buttons for pagination purposes,\n * based on the provided pagination object.\n * @param {object} paginateObj An object containing pagination details.\n * @param {number} paginateObj.currentPage The current active page index (1-based).\n * @param {Array<number>} paginateObj.pages An array of page numbers to display in the pagination.\n * @param {number} paginateObj.totalPages Total number of pages available for pagination.\n * @returns {DocumentFragment} A DocumentFragment containing the buttons and additional pagination elements.\n */\n htmlStackButtons(paginateObj) {\n let fragment = document.createDocumentFragment();\n\n const button = document.createElement('wje-button');\n button.setAttribute('part', 'page-button page-number');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n let dots = document.createElement('span');\n dots.setAttribute('part', 'dots');\n dots.classList.add('dots');\n dots.setAttribute('aria-hidden', 'true');\n\n const first = button.cloneNode(true);\n first.textContent = '1';\n first.addEventListener('click', (e) => this.pageClickAction(e, 0));\n\n const last = button.cloneNode(true);\n last.textContent = paginateObj?.totalPages;\n last.addEventListener('click', (e) => this.pageClickAction(e, paginateObj?.totalPages - 1));\n\n if (paginateObj?.currentPage >= this.maxPages + 1 && paginateObj?.boundary < paginateObj?.totalPages) {\n fragment.appendChild(first);\n fragment.appendChild(dots);\n }\n\n paginateObj?.pages.forEach((page) => {\n let newButton = button.cloneNode(true);\n newButton.textContent = page;\n\n if (page - 1 === this.page) {\n newButton.removeAttribute('fill');\n newButton.setAttribute('aria-current', 'page');\n newButton.setAttribute('part', 'page-button page-number current-page');\n } else {\n newButton.addEventListener('click', (e) => this.pageClickAction(e, page - 1));\n }\n\n fragment.appendChild(newButton);\n });\n\n if (\n (paginateObj?.pages.length === this.maxPages || paginateObj?.currentPage < this.maxPages + 1) &&\n paginateObj.boundary < paginateObj?.totalPages\n ) {\n fragment.appendChild(dots.cloneNode(true));\n fragment.appendChild(last);\n }\n\n return fragment;\n }\n\n /**\n * Handles the click action for pagination and updates the current page.\n * If the clicked page number is the same as the current page, no action is performed.\n * Otherwise, the current page is updated to the new page number, and a custom event\n * 'wje-pagination:page-change' is dispatched with the pagination object.\n * @param {Event} e The event triggered by the page click.\n * @param {number} page The page number that was clicked.\n */\n pageClickAction = (e, page) => {\n if (+page === this.page || this.page > this.paginateObj.totalPages) return;\n this.page = page;\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', { page: this.page, pageSize: this.pageSize });\n };\n}\n\nPagination.define('wje-pagination', Pagination);\n","import Pagination from './pagination.element.js';\n\nexport default Pagination;\n\nPagination.define('wje-pagination', Pagination);\n"],"names":["_a"],"mappings":";;;;;;;;AAQO,SAAS,SAAS,YAAY,cAAc,GAAG,WAAW,IAAI,WAAW,GAAG;AAE/E,QAAM,aAAa,KAAK,KAAK,aAAa,QAAQ;AAGlD,MAAI,cAAc,GAAG;AACjB,kBAAc;AAAA,EAClB,WAAW,cAAc,YAAY;AACjC,kBAAc;AAAA,EAClB;AAEA,MAAI;AACJ,MAAI;AAEJ,QAAM,eAAe,WAAW;AAEhC,QAAM,WAAW,eAAe;AAEhC,MAAI,aAAa,UAAU;AACvB,QAAI,cAAc,cAAc;AAE5B,kBAAY;AACZ,gBAAU,KAAK,IAAI,eAAe,GAAG,UAAU;AAAA,IACnD,WAAW,eAAe,aAAa,cAAc;AAEjD,kBAAY,KAAK,IAAI,aAAa,cAAc,CAAC;AACjD,gBAAU;AAAA,IACd,OAAO;AACH,YAAM,YAAY,KAAK,MAAM,WAAW,CAAC;AAEzC,kBAAY,cAAc,YAAY;AACtC,gBAAU,WAAW,MAAM,IAAI,cAAc,YAAY,IAAI,cAAc,YAAY;AAAA,IAC3F;AAAA,EACJ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AEA,+CAAa,MAAM,QAAQ,CAAC,SAAS;AACjC,UAAI,YAAY,OAAO,UAAU,IAAI;AACrC,gBAAU,cAAc;AAExB,UAAI,OAAO,MAAM,KAAK,MAAM;AACxB,kBAAU,gBAAgB,MAAM;AAChC,kBAAU,aAAa,gBAAgB,MAAM;AAC7C,kBAAU,aAAa,QAAQ,sCAAsC;AAAA,MACzE,OAAO;AACH,kBAAU,iBAAiB,SAAS,CAAC,MAAM,KAAK,gBAAgB,GAAG,OAAO,CAAC,CAAC;AAAA,MAChF;AAEA,eAAS,YAAY,SAAS;AAAA,IAClC;AAEA,UACK,2CAAa,MAAM,YAAW,KAAK,aAAY,2CAAa,eAAc,KAAK,WAAW,MAC3F,YAAY,YAAW,2CAAa,aACtC;AACE,eAAS,YAAY,KAAK,UAAU,IAAI,CAAC;AACzC,eAAS,YAAY,IAAI;AAAA,IAC7B;AAEA,WAAO;AAAA,EACX;AAeJ;AAEA,WAAW,OAAO,kBAAkB,UAAU;AC7f9C,WAAW,OAAO,kBAAkB,UAAU;"}
|
package/dist/wje-select.js
CHANGED
|
@@ -112,7 +112,7 @@ const _Select = class _Select extends FormAssociatedElement {
|
|
|
112
112
|
__publicField(this, "processClickedOption", (option, multiple = false) => {
|
|
113
113
|
const isSelected = option.hasAttribute("selected");
|
|
114
114
|
option.selected = !isSelected;
|
|
115
|
-
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this);
|
|
115
|
+
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, multiple ? this.selectedOptions : []);
|
|
116
116
|
this.syncAria();
|
|
117
117
|
});
|
|
118
118
|
/**
|
|
@@ -167,7 +167,7 @@ const _Select = class _Select extends FormAssociatedElement {
|
|
|
167
167
|
existingOption.selected = true;
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
|
-
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this);
|
|
170
|
+
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, this.selectedOptions);
|
|
171
171
|
this.selections(true);
|
|
172
172
|
__privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
|
|
173
173
|
__privateMethod(this, _Select_instances, syncOptionOwners_fn).call(this);
|
|
@@ -1014,7 +1014,7 @@ const _Select = class _Select extends FormAssociatedElement {
|
|
|
1014
1014
|
if (!option.hasAttribute("selected")) {
|
|
1015
1015
|
option.selected = true;
|
|
1016
1016
|
}
|
|
1017
|
-
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this);
|
|
1017
|
+
this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, this.hasAttribute("multiple") ? this.selectedOptions : []);
|
|
1018
1018
|
} else {
|
|
1019
1019
|
this.processClickedOption(option, this.hasAttribute("multiple"));
|
|
1020
1020
|
}
|
|
@@ -1127,11 +1127,25 @@ htmlSelectedItem_fn = function(item) {
|
|
|
1127
1127
|
return this.htmlSelectedItem(value);
|
|
1128
1128
|
};
|
|
1129
1129
|
/**
|
|
1130
|
-
* Retrieves the
|
|
1131
|
-
*
|
|
1130
|
+
* Retrieves the selected options while retaining selections that are temporarily absent from the rendered list.
|
|
1131
|
+
* Lazy search and pagination replace option elements, so the currently rendered DOM cannot be the sole source of
|
|
1132
|
+
* truth for a multiple selection. Rendered options override retained options with the same value, including when
|
|
1133
|
+
* a rendered option has been explicitly deselected.
|
|
1134
|
+
* @param {Array<Element>} [retainedOptions] Previously selected option elements that may no longer be rendered.
|
|
1135
|
+
* @returns {Array<Element>} An array of selected option elements, deduplicated by value.
|
|
1132
1136
|
*/
|
|
1133
|
-
getSelectedOptions_fn = function() {
|
|
1134
|
-
|
|
1137
|
+
getSelectedOptions_fn = function(retainedOptions = []) {
|
|
1138
|
+
const renderedOptions = this.getAllOptions();
|
|
1139
|
+
const renderedValues = new Set(renderedOptions.map((option) => option.value));
|
|
1140
|
+
const selectedByValue = new Map(
|
|
1141
|
+
renderedOptions.filter((option) => option.hasAttribute("selected")).map((option) => [option.value, option])
|
|
1142
|
+
);
|
|
1143
|
+
retainedOptions.forEach((option) => {
|
|
1144
|
+
if ((option == null ? void 0 : option.hasAttribute("selected")) && !renderedValues.has(option.value)) {
|
|
1145
|
+
selectedByValue.set(option.value, option);
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
return Array.from(selectedByValue.values());
|
|
1135
1149
|
};
|
|
1136
1150
|
/**
|
|
1137
1151
|
* Determines whether the select currently contains at least one visible option.
|
package/dist/wje-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\nimport { Localizer } from '../utils/localize.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\nexport class Select extends FormAssociatedElement {\n\tstatic _instanceId = 0;\n\tstatic portalStyles = `\n\t\t[data-wje-select-portal] .options-wrapper {\n\t\t\tbox-sizing: border-box;\n\t\t\tmin-width: 100%;\n\t\t\tborder-width: var(--wje-select-options-border-width, 1px);\n\t\t\tborder-style: var(--wje-select-options-border-style, solid);\n\t\t\tborder-color: var(--wje-select-options-border-color, var(--wje-border-color, #dcdfe3));\n\t\t\tborder-radius: var(--wje-select-options-border-radius, var(--wje-border-radius, 4px));\n\t\t\tmargin-top: calc(0px - var(--wje-select-border-width, 1px));\n\t\t\tbackground-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t[data-wje-select-portal] .find {\n\t\t\tmargin-block: var(--wje-select-find-margin-block, .5rem);\n\t\t\tmargin-inline: var(--wje-select-find-margin-inline, .5rem);\n\t\t\twidth: var(--wje-select-find-width, calc(100% - 1rem));\n\t\t}\n\n\t\t[data-wje-select-portal] .list {\n\t\t\toverflow: auto;\n\t\t\theight: 100%;\n\t\t\tposition: relative;\n\t\t}\n\n\t\t[data-wje-select-portal] .list:has(.empty:not([hidden])) {\n\t\t\tmin-height: 44px;\n\t\t}\n\n\t\t[data-wje-select-portal] .empty {\n\t\t\tposition: absolute;\n\t\t\tinset: 0;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tpadding: var(--wje-spacing-small, 1rem);\n\t\t\tcolor: var(--wje-select-color, inherit);\n\t\t\ttext-align: center;\n\t\t\tbackground-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n\t\t\tpointer-events: none;\n\t\t}\n\n\t\t[data-wje-select-portal] .empty[hidden] {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t[data-wje-select-portal] .options-wrapper:has(.find) .list {\n\t\t\theight: calc(100% - 32px - 2 * var(--wje-select-find-margin-block, .5rem));\n\t\t}\n\t`;\n\t#addedOptions = [];\n\t#htmlOptions = [];\n\t#portaledOptionRecords = [];\n\t#remoteOptionsLoaded = false;\n\t#isRemoteOptionsLoading = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.localizer = new Localizer(this);\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the counter element, initially null.\n\t\t * @private\n\t\t */\n\t\tthis.counterEl = null;\n\n\t\t/**\n\t\t * @type {boolean}\n\t\t * @description Tracks whether the select element was previously opened, initially false.\n\t\t * @private\n\t\t * @default {boolean} false\n\t\t */\n\t\tthis._wasOppened = false;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the native select element, initially null.\n\t\t */\n\t\tthis.native = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the popup element, initially null.\n\t\t */\n\t\tthis.popup = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the label element, initially null.\n\t\t */\n\t\tthis.labelElement = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot start element, initially null.\n\t\t */\n\t\tthis.slotStart = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot end element, initially null.\n\t\t */\n\t\tthis.slotEnd = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the input element, initially null.\n\t\t */\n\t\tthis.input = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the visible selected text element, initially null.\n\t\t */\n\t\tthis.displayText = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the chips element, initially null.\n\t\t */\n\t\tthis.chips = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the clear button element, initially null.\n\t\t */\n\t\tthis.clear = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the list element, initially null.\n\t\t */\n\t\tthis.list = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the empty state element, initially null.\n\t\t */\n\t\tthis.emptyState = null;\n\n\t\tthis._value = [];\n\t\tthis._selectedOptions = [];\n\t\tthis._instanceId = ++Select._instanceId;\n\t}\n\n\t/**\n\t * An object representing component dependencies with their respective classes.\n\t * Each property in the object maps a custom component name (as a string key)\n\t * to its corresponding class or constructor.\n\t * @typedef {{[key: string]: Function}} Dependencies\n\t * @property {Function} 'wje-button' Represents the Button component class.\n\t * @property {Function} 'wje-popup' Represents the Popup component class.\n\t * @property {Function} 'wje-icon' Represents the Icon component class.\n\t * @property {Function} 'wje-label' Represents the Label component class.\n\t * @property {Function} 'wje-chip' Represents the Chip component class.\n\t * @property {Function} 'wje-input' Represents the Input component class.\n\t * @property {Function} 'wje-option' Represents the Option component class.\n\t * @property {Function} 'wje-checkbox' Represents the Checkbox component class.\n\t */\n\tdependencies = {\n\t\t'wje-button': Button,\n\t\t'wje-popup': Popup,\n\t\t'wje-icon': Icon,\n\t\t'wje-label': Label,\n\t\t'wje-chip': Chip,\n\t\t'wje-input': Input,\n\t\t'wje-option': Option,\n\t\t'wje-options': Options,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the value for the form field. Converts the input value into a FormData object\n\t * if it is not already an array, splitting by spaces if necessary, and sets the\n\t * internal form value as well as the selected values.\n\t * @param {string|Array} value The value to be set. Can be a string (which will be\n\t * split into an array by spaces) or an array of values.\n\t */\n\tset value(value) {\n\t\tconst originalValue = value;\n\t\tconst formData = new FormData();\n\n\t\tif (value) {\n\t\t\tlet data = value;\n\t\t\tlet dataString = value;\n\n\t\t\tif (!Array.isArray(data)) {\n\t\t\t\tdata = data.split(' ');\n\t\t\t} else {\n\t\t\t\tdataString = data.join(' ');\n\t\t\t}\n\n\t\t\tdata.forEach(v => {\n\t\t\t\tformData.append(this.name, v)\n\t\t\t});\n\n\t\t\tvalue = formData;\n\n\t\t\tthis._value = data;\n\n\t\t\tthis.setAttribute('value', dataString);\n\t\t} else {\n\t\t\tformData.delete(this.name);\n\t\t\tvalue = formData;\n\t\t\tthis._value = [];\n\t\t\tthis.removeAttribute('value');\n\t\t}\n\t\tthis.internals.setFormValue(value);\n\t}\n\n\t/**\n\t * Retrieves the current value.\n\t * @returns {any} The value of the `_value` property.\n\t */\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Sets the maximum number of options allowed.\n\t * @param { number | object} value The value to set as the maximum number of options.\n\t * If null, the 'max-options' attribute will be removed.\n\t */\n\tset maxOptions(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-options', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-options');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum number of options allowed.\n\t * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n\t * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n\t * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n\t */\n\tget maxOptions() {\n\t\treturn +this.getAttribute('max-options') || 1;\n\t}\n\n\t/**\n\t * @summary Setter for the defaultValue attribute.\n\t * This method sets the 'value' attribute of the custom input element to the provided value.\n\t * The 'value' attribute represents the default value of the input element.\n\t * @param {string} value The value to set as the default value.\n\t */\n\tset defaultValue(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\t/**\n\t * @summary Getter for the defaultValue attribute.\n\t * This method retrieves the 'value' attribute of the custom input element.\n\t * The 'value' attribute represents the default value of the input element.\n\t * If the 'value' attribute is not set, it returns an empty string.\n\t * @returns {string} The default value of the input element.\n\t */\n\tget defaultValue() {\n\t\treturn this.getAttribute('value') ?? '';\n\t}\n\n\t/**\n\t * Sets or removes the `portaled` attribute on the select.\n\t * Mirrors the dropdown API so popup content can be rendered in a portal root.\n\t * @param {boolean|string} value Determines whether and where the popup should be portaled.\n\t */\n\tset portaled(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('portaled', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('portaled');\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the `portaled` attribute value.\n\t * @returns {string} The configured portal target or an empty string for the default body portal.\n\t */\n\tget portaled() {\n\t\treturn this.getAttribute('portaled') || '';\n\t}\n\n\t/**\n\t * Checks whether popup content should be portaled.\n\t * @returns {boolean} True when the `portaled` attribute is present.\n\t */\n\tget isPortaled() {\n\t\treturn this.hasAttribute('portaled');\n\t}\n\n\t/**\n\t * Sets the trigger value.\n\t * @param {string} value The trigger value to set.\n\t */\n\tset trigger(value) {\n\t\tthis.setAttribute('trigger', value);\n\t}\n\n\t/**\n\t * Returns the trigger value.\n\t * @returns {string} The trigger value.\n\t */\n\tget trigger() {\n\t\treturn this.getAttribute('trigger') || 'click';\n\t}\n\n\t/**\n\t * Sets or removes the disabled state for the associated elements.\n\t * @param {boolean} value A boolean indicating whether the elements should be disabled.\n\t * If true, the disabled attribute is added to the elements. If false, the disabled attribute is removed.\n\t */\n\tset disabled(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('disabled', '');\n\n\t\t\tthis.input?.setAttribute('disabled', '');\n\t\t\tthis.displayInput?.setAttribute('disabled', '');\n\n\t\t\tthis.popup?.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('disabled');\n\n\t\t\tthis.input?.removeAttribute('disabled');\n\t\t\tthis.displayInput?.removeAttribute('disabled');\n\n\t\t\tthis.popup?.removeAttribute('disabled');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the current state of the 'disabled' attribute.\n\t * @returns {boolean} Returns true if the 'disabled' attribute is present, otherwise false.\n\t */\n\tget disabled() {\n\t\treturn this.hasAttribute('disabled');\n\t}\n\n\t/**\n\t * Sets the readonly state of the element. When set to true,\n\t * the element and its associated inputs are marked as readonly or disabled.\n\t * When set to false, the readonly and disabled attributes are removed,\n\t * allowing user interaction.\n\t * @param {boolean} value A boolean value indicating whether to set the\n\t * element and its associated inputs to readonly (true) or not (false).\n\t */\n\tset readonly(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('readonly', '');\n\n\t\t\t// inputs nemusia existovať ešte pred draw()\n\t\t\tthis.input?.setAttribute('readonly', '');\n\t\t\tthis.displayInput?.setAttribute('readonly', '');\n\n\t\t\t// popup môže existovať, ak to toggle-uješ po renderi\n\t\t\tthis.popup?.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('readonly');\n\n\t\t\tthis.input?.removeAttribute('readonly');\n\t\t\tthis.displayInput?.removeAttribute('readonly');\n\n\t\t\tthis.popup?.removeAttribute('disabled');\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the 'readonly' attribute is present on the element.\n\t * @returns {boolean} Returns true if the 'readonly' attribute is set, otherwise false.\n\t */\n\tget readonly() {\n\t\treturn this.hasAttribute('readonly');\n\t}\n\n\t/**\n\t * Sets the maximum height value for the element.\n\t * If a value is provided, it sets the 'max-height' attribute on the element.\n\t * If no value is provided, it removes the 'max-height' attribute from the element.\n\t * @param {string|null} value The maximum height to be set. If null or undefined, the attribute is removed.\n\t */\n\tset maxHeight(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-height', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-height');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum height value, which is determined by the 'max-height' attribute.\n\t * If the attribute is not set, a default value of '200px' is returned.\n\t * @returns {string} The maximum height value as a string.\n\t */\n\tget maxHeight() {\n\t\treturn this.getAttribute('max-height') || 'auto';\n\t}\n\n\t/**\n\t * Sets the offset attribute for the element.\n\t * @param {string} value The value to assign to the offset attribute.\n\t */\n\tset offset(value) {\n\t\tthis.setAttribute('offset', value);\n\t}\n\n\t/**\n\t * Gets the value of the offset attribute of the current element.\n\t * If the offset attribute is not present, returns a default value of '0'.\n\t * @returns {string} The value of the offset attribute or the default value '0'.\n\t */\n\tget offset() {\n\t\treturn this.getAttribute('offset') || '5';\n\t}\n\n\t/**\n\t * Sets the selected options for the object.\n\t * @param {Array|object} value The new value for the selected options. It can be an array or object containing the selected options.\n\t */\n\tset selectedOptions(value) {\n\t\tthis._selectedOptions = value;\n\t}\n\n\t/**\n\t * Retrieves the selected options.\n\t * @returns {Array} An array containing the currently selected options. If no options are selected, an empty array is returned.\n\t */\n\tget selectedOptions() {\n\t\treturn this._selectedOptions || [];\n\t}\n\n\t/**\n\t * Sets the `lazy` attribute on the element. If the provided value is truthy, the `lazy` attribute is added. If the value is falsy, the `lazy` attribute is removed.\n\t * @param {boolean} value A boolean value indicating whether to add or remove the `lazy` attribute. If `true`, the attribute is added; if `false`, it is removed.\n\t */\n\tset lazy(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('lazy', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('lazy');\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the 'lazy' property.\n\t * @returns {boolean} Returns true if the 'lazy' attribute is present on the element, otherwise false.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Sets or removes the 'no-size' attribute on an element.\n\t * @param {boolean} value A boolean indicating whether to add or remove the 'no-size' attribute. If true, the attribute is added; if false, the attribute is removed.\n\t */\n\tset noSize(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('no-size', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('no-size');\n\t\t}\n\t}\n\n\t/**\n\t * Gets the value of the 'no-size' attribute for the element.\n\t * @returns {boolean} True if the 'no-size' attribute is present, otherwise false.\n\t */\n\tget noSize() {\n\t\treturn this.hasAttribute('no-size');\n\t}\n\n\t/**\n\t * Getter for the customErrorDisplay attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget customErrorDisplay() {\n\t\treturn this.hasAttribute('custom-error-display');\n\t}\n\n\t/**\n\t * Retrieves the complete list of options available for the component.\n\t * The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.\n\t * If a `wje-options` element is present within the component, its loaded options are included in the merged list.\n\t * In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.\n\t * @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.\n\t */\n\tget options() {\n\t\tif (this.querySelector('wje-options')) {\n\t\t\tconst allOptions = [...this.querySelector('wje-options').loadedOptions, ...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn allOptions\n\t\t} else {\n\t\t\tconst allOptions = [...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn Array.from(\n\t\t\t\tnew Map(allOptions.reverse().map(obj => [obj.value, obj])).values()\n\t\t\t).reverse();\n\t\t}\n\t}\n\n\tclassName = 'Select';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['active', 'disabled', 'readonly', 'portaled'];\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\tbeforeDraw() {\n\t\tif (this.hasAttribute('value')) {\n\t\t\t// If a value attribute is explicitly provided, respect it.\n\t\t\tthis.value = this.getAttribute('value');\n\t\t} else {\n\t\t\t// No explicit value – derive initial value from currently selected options.\n\t\t\tconst selectedOptions = this.#getSelectedOptions();\n\n\t\t\tif (selectedOptions.length > 0) {\n\t\t\t\tconst values = selectedOptions.map((opt) => opt.value);\n\t\t\t\tthis.value = this.hasAttribute('multiple') ? values : values[0];\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Draws the component for the select.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tthis.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n\t\t// zakladny obalovac\n\t\tlet native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.classList.add('native-select', this.variant || 'default');\n\n\t\t// wrapper pre label a inputWrapper\n\t\tlet wrapper = document.createElement('div');\n\t\twrapper.classList.add('wrapper');\n\t\twrapper.setAttribute('slot', 'anchor');\n\n\t\t// label\n\t\tlet label = document.createElement('label');\n\t\tlabel.setAttribute('part', 'label');\n\t\tlabel.innerText = this.label || '';\n\n\t\t// obalovac pre input\n\t\tlet inputWrapper = document.createElement('div');\n\t\tinputWrapper.setAttribute('part', 'input-wrapper');\n\t\tinputWrapper.classList.add('input-wrapper');\n\n\t\tlet slotStart = document.createElement('div');\n\t\tslotStart.classList.add('slot-start');\n\n\t\tlet input = document.createElement('input');\n\t\tinput.setAttribute('type', 'text');\n\t\tinput.value = this.value.join(' ').trim();\n\t\tinput.classList.add('input-hidden');\n\n\t\tlet display = document.createElement('input');\n\t\tdisplay.setAttribute('type', 'text');\n\t\tdisplay.setAttribute('part', 'input');\n\t\tdisplay.setAttribute('autocomplete', 'off');\n\t\tdisplay.setAttribute('readonly', '');\n\t\tdisplay.setAttribute('placeholder', this.placeholder || '');\n\t\tdisplay.classList.add('display-input');\n\n\t\tlet displayWrapper = document.createElement('span');\n\t\tdisplayWrapper.classList.add('display-wrapper');\n\n\t\tlet displayText = document.createElement('span');\n\t\tdisplayText.setAttribute('part', 'input selected-text');\n\t\tdisplayText.classList.add('display-text');\n\t\tdisplayText.dataset.placeholder = this.placeholder || '';\n\t\tdisplayText.toggleAttribute('data-placeholder-visible', Boolean(this.placeholder));\n\t\tdisplayText.setAttribute('aria-hidden', 'true');\n\t\tdisplayWrapper.append(display, displayText);\n\n\t\tif (this.required) {\n\t\t\tinput.setAttribute('required', '');\n\t\t\tdisplay.setAttribute('required', '');\n\t\t}\n\n\t\t// Apply initial disabled/readonly state during first render\n\t\tif (this.disabled) {\n\t\t\tinput.setAttribute('disabled', '');\n\t\t\tdisplay.setAttribute('disabled', '');\n\t\t}\n\n\t\tif (this.readonly) {\n\t\t\tinput.setAttribute('readonly', '');\n\t\t\tdisplay.setAttribute('readonly', '');\n\t\t}\n\n\t\tlet slotEnd = document.createElement('div');\n\t\tslotEnd.classList.add('slot-end');\n\n\t\tlet arrow = document.createElement('wje-icon');\n\t\tarrow.setAttribute('name', 'chevron-down');\n\t\tarrow.setAttribute('slot', 'arrow');\n\n\t\tlet chips = document.createElement('div');\n\t\tchips.classList.add('chips');\n\t\tchips.innerText = this.placeholder || '';\n\n\t\t// obalovac pre option a find\n\t\tlet optionsWrapper = document.createElement('div');\n\t\toptionsWrapper.setAttribute('part', 'options-wrapper');\n\t\toptionsWrapper.classList.add('options-wrapper');\n\t\toptionsWrapper.style.setProperty('height', this.maxHeight);\n\n\t\tlet list = document.createElement('div');\n\t\tlist.classList.add('list');\n\t\tthis._ariaListId = this.id ? `${this.id}-listbox` : `wje-select-${this._instanceId}-listbox`;\n\t\tlist.id = this._ariaListId;\n\t\tlist.setAttribute('role', 'listbox');\n\t\tif (this.hasAttribute('multiple')) list.setAttribute('aria-multiselectable', 'true');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet emptyState = document.createElement('div');\n\t\temptyState.setAttribute('part', 'empty');\n\t\temptyState.setAttribute('role', 'option');\n\t\temptyState.setAttribute('aria-disabled', 'true');\n\t\temptyState.setAttribute('aria-selected', 'false');\n\t\temptyState.classList.add('empty');\n\t\temptyState.hidden = true;\n\t\temptyState.textContent = this.localizer.translate('wj.select.empty');\n\n\t\tlet clear = document.createElement('wje-button');\n\t\tclear.setAttribute('fill', 'link');\n\t\tclear.setAttribute('part', 'clear');\n\t\tclear.setAttribute('stop-propagation', '');\n\n\t\tlet clearIcon = document.createElement('wje-icon');\n\t\tclearIcon.setAttribute('name', 'x');\n\n\t\tlet error = document.createElement('div');\n\t\terror.setAttribute('slot', 'error');\n\n\t\tlet errorSlot = document.createElement('slot');\n\t\terrorSlot.setAttribute('name', 'error');\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tconst hasRemoteOptions = optionsElement instanceof HTMLElement;\n\n\t\tif (hasRemoteOptions) {\n\t\t\tthis.#isRemoteOptionsLoading = !this.#remoteOptionsLoaded;\n\t\t} else {\n\t\t\tthis.#remoteOptionsLoaded = false;\n\t\t\tthis.#isRemoteOptionsLoading = false;\n\t\t}\n\n\t\t// vytvorime popup\n\t\tlet popup = document.createElement('wje-popup');\n\t\tpopup.setAttribute('placement', 'bottom-start');\n\t\tif (!this.noSize) {\n\t\t\tpopup.setAttribute('size', '');\n\t\t\tpopup.contentAwareSize = true;\n\t\t\tpopup.style.setProperty('--wje-popup-loader-inset', 'var(--wje-select-options-border-width, 1px)');\n\t\t}\n\t\tpopup.setAttribute('part', 'popup');\n\t\tpopup.setAttribute('offset', this.offset);\n\t\tif (this.isPortaled) {\n\t\t\tpopup.setAttribute('portal', this.portaled);\n\t\t}\n\n\t\tif ((this.lazy && !this._wasOppened) || (hasRemoteOptions && !this.#remoteOptionsLoaded)) {\n\t\t\tpopup.setAttribute('loader', '');\n\t\t} else {\n\t\t\tpopup.removeAttribute('loader');\n\t\t}\n\n\t\tif (this.disabled) {\n\t\t\tpopup.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tpopup.removeAttribute('disabled');\n\t\t}\n\n\t\tif (this.variant === 'standard') {\n\t\t\tif (this.hasAttribute('label')) native.appendChild(label);\n\t\t} else {\n\t\t\twrapper.appendChild(label);\n\t\t}\n\n\t\tinputWrapper.append(slotStart);\n\t\tinputWrapper.append(displayWrapper);\n\t\tinputWrapper.append(input);\n\n\t\tclear.append(clearIcon);\n\n\t\tif (this.hasAttribute('multiple')) inputWrapper.append(chips);\n\n\t\tif (this.hasAttribute('clearable')) inputWrapper.append(clear);\n\n\t\tinputWrapper.appendChild(slotEnd);\n\t\tinputWrapper.appendChild(arrow);\n\n\t\tlist.append(slot, emptyState);\n\n\t\tif (this.hasAttribute('find')) {\n\t\t\tlet find = document.createElement('wje-input');\n\t\t\tfind.setAttribute('variant', 'standard');\n\t\t\tfind.setAttribute('placeholder', 'Hľadať');\n\t\t\tfind.setAttribute('part', 'find');\n\t\t\tfind.clearable = true;\n\t\t\tfind.classList.add('find');\n\n\t\t\toptionsWrapper.append(find);\n\n\t\t\tthis.findEl = find;\n\t\t}\n\n\t\tlet slotFooter = document.createElement('slot');\n\t\tslotFooter.setAttribute('name', 'footer');\n\n\t\t// APPEND\n\t\toptionsWrapper.append(list);\n\t\toptionsWrapper.append(slotFooter);\n\n\t\twrapper.append(inputWrapper);\n\n\t\tpopup.append(wrapper);\n\t\tpopup.append(optionsWrapper);\n\n\t\tif (this.trigger === 'click') popup.setAttribute('manual', '');\n\n\t\tthis.append(error);\n\n\t\tnative.append(popup);\n\t\tnative.append(errorSlot);\n\n\t\tfragment.appendChild(native);\n\n\t\tthis.native = native;\n\t\tthis.popup = popup;\n\t\tthis.labelElement = label;\n\t\tthis.slotStart = slotStart;\n\t\tthis.slotEnd = slotEnd;\n\t\tthis.input = input;\n\t\tthis.displayInput = display;\n\t\tthis.displayText = displayText;\n\t\tthis.chips = chips;\n\t\tthis.clear = clear;\n\t\tthis.list = list;\n\t\tthis.emptyState = emptyState;\n\t\tthis.slotFooter = slotFooter;\n\n\t\tthis.syncAria();\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Executes post-render logic for the custom element.\n\t * This includes validation, event listener registration, managing custom attributes, and\n\t * handling options initialization for the component.\n\t * @returns {void} This method does not return any value.\n\t */\n\tafterDraw() {\n\t\tdocument.addEventListener('mousedown', this.#onMenuItemClickCapture, true);\n\n\t\tthis.validate();\n\n\t\tif (this.hasAttribute('invalid')) {\n\t\t\tthis.showInvalidMessage();\n\t\t}\n\t\tthis.syncAria();\n\n\t\tthis.getAllOptions()?.forEach((option) => {\n\t\t\toption.ownerSelect = this;\n\t\t\tthis.optionCheckSlot(option);\n\t\t});\n\n\t\tevent.addListener(this.popup, 'wje-router:rebind', null, this.#syncPortalStyles);\n\t\tevent.addListener(this.popup, 'wje-portal:restored', null, this.#restorePortaledOptions);\n\n\t\tthis.selectedOptions = this.#getSelectedOptions();\n\t\tthis.selectOptions(this.value, true);\n\n\t\tif (this.lazy) {\n\t\t\tevent.addListener(this.popup, 'wje-popup:show', null, (e) => {\n\t\t\t\tif (this._wasOppened) return;\n\t\t\t\tthis._wasOppened = true;\n\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\toptionsElement.setAttribute('lazy', '');\n\t\t\t\toptionsElement.setAttribute('attached', '');\n\t\t\t});\n\t\t}\n\n\t\tevent.addListener(this.popup, 'wje-popup:aftershow', null, () => {\n\t\t\tconst assignedElements = this.slotFooter.assignedElements();\n\n\t\t\tif (assignedElements.length > 0) {\n\t\t\t\tconst el = assignedElements[0];\n\t\t\t\tconst rect = el.getBoundingClientRect();\n\t\t\t\tlet totalHeight = 0;\n\n\t\t\t\tif(this.hasAttribute('find')) {\n\t\t\t\t\tlet style = getComputedStyle(this.findEl);\n\n\t\t\t\t\tlet height = this.findEl.offsetHeight;\n\t\t\t\t\tlet marginTop = parseFloat(style.marginTop);\n\t\t\t\t\tlet marginBottom = parseFloat(style.marginBottom);\n\n\t\t\t\t\ttotalHeight = height + marginTop + marginBottom;\n\t\t\t\t}\n\n\t\t\t\tlet subtractHeight = rect.height + totalHeight;\n\n\t\t\t\tthis.list.style.height = `calc(100% - ${subtractHeight}px)`;\n\t\t\t}\n\n\t\t\tthis.#focusFindInput();\n\t\t});\n\n\t\tthis.#htmlOptions = Array.from(this.querySelectorAll(':scope > wje-option')).map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: option.textContent.trim(),\n\t\t\t};\n\t\t})\n\n\t\tthis.input.addEventListener('focus', (e) => {\n\t\t\tthis.labelElement?.classList.add('fade');\n\t\t\tthis.native.classList.add('focused');\n\t\t});\n\n\t\tthis.input.addEventListener('blur', (e) => {\n\t\t\tthis.native.classList.remove('focused');\n\t\t\tif (!e.target.value) this.labelElement?.classList.remove('fade');\n\t\t});\n\n\t\tthis.input.addEventListener('input', (e) => {\n\t\t\tthis.propagateValidation();\n\t\t});\n\n\t\tthis.addEventListener('wje-option:change', this.optionChange);\n\t\tevent.addListener(this.popup, 'wje-popup:show', null, () => this.syncAria());\n\t\tevent.addListener(this.popup, 'wje-popup:hide', null, () => this.syncAria());\n\n\t\tthis.addEventListener('invalid', (e) => {\n\t\t\tthis.invalid = true;\n\t\t\tthis.pristine = false;\n\n\t\t\tthis.showInvalidMessage();\n\n\t\t\tif (this.customErrorDisplay) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t});\n\n\t\tthis.clear?.addEventListener('wje-button:click', (e) => {\n\t\t\tif (this.readonly || this.disabled) return;\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.clearSelections();\n\t\t});\n\n\t\tthis.list.addEventListener('wje-options:load', this.#handleOptionsLoad);\n\t\tthis.addEventListener('wje-options:load', this.#handleOptionsLoad);\n\n\t\t// skontrolujeme ci ma select atribut find\n\t\tif (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n\t\t\tevent.addListener(this.findEl, 'keyup', '', this.#applySearchFilter);\n\t\t\tevent.addListener(this.findEl, 'wje-input:clear', '', this.#applySearchFilter);\n\t\t}\n\n\t\tthis.#updateEmptyState();\n\t}\n\n\t/**\n\t * Handles the change event for an option element within a select-like component.\n\t * This method processes user interactions with options and updates the state of the component,\n\t * including selection management, validation, and UI updates. Behavior differs based on\n\t * whether the component supports multiple selections.\n\t * Key functionality:\n\t * - Prevents the default behavior, event propagation, and immediate propagation of the event.\n\t * - Retrieves all options within the component.\n\t * - If the component doesn't support multiple selection:\n\t * - Marks only the clicked option as selected and deselects others.\n\t * - Hides the option popup.\n\t * - If the component supports multiple selection:\n\t * - Processes the clicked option without deselecting others.\n\t * - Updates the selected options and triggers validation.\n\t * - Marks the form state as non-pristine.\n\t * - Propagates the validation state to other relevant parts of the component or system.\n\t * @param {Event} e The event object representing the option change interaction.\n\t */\n\toptionChange = (e) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.readonly || this.disabled) return;\n\n\t\tlet allOptions = this.getAllOptions();\n\n\t\tif (!this.hasAttribute('multiple')) {\n\t\t\tallOptions.forEach((option) => {\n\t\t\t\tif (option.value === e.target.value) {\n\t\t\t\t\tthis.processClickedOption(option);\n\t\t\t\t} else {\n\t\t\t\t\toption.selected = false;\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.popup.hide(false);\n\t\t} else {\n\t\t\tthis.processClickedOption(e.target, true);\n\t\t}\n\n\t\tthis.selections();\n\n\t\tthis.validate(this.selectedOptions);\n\n\t\tthis.pristine = false;\n\t\tthis.propagateValidation();\n\t}\n\n\t/**\n\t * Handles the logic for processing the selection state of a clicked option element.\n\t * @function processClickedOption\n\t * @param {Element} option The option element that is clicked.\n\t * @param {boolean} [multiple] A Boolean indicating whether multiple options can be selected. Defaults to false.\n\t * Changes the selected state of the passed option and updates the selected options list.\n\t * Checks if the option already has a \"selected\" attribute, toggles its state,\n\t * and updates the internal selected options.\n\t */\n\tprocessClickedOption = (option, multiple = false) => {\n\t\tconst isSelected = option.hasAttribute('selected');\n\t\toption.selected = !isSelected;\n\n\t\tthis.selectedOptions = this.#getSelectedOptions();\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Returns all the options as HTML.\n\t * @returns {NodeList} The options as HTML.\n\t */\n\tgetAllOptions() {\n\t\tconst localOptions = Array.from(this.querySelectorAll('wje-option'));\n\t\tconst portaledOptions = this.#portaledOptionRecords.map(({ option }) => option);\n\n\t\treturn Array.from(new Set([...localOptions, ...portaledOptions]));\n\t}\n\n\t/**\n\t * Handles changes in the selection for a component, updating internal values, input fields,\n\t * and visual presentation (like chips or slots) as per the given selection options.\n\t * @param {Array|null} options The collection of selected option elements. If null, no options are selected.\n\t * @param {number} length The total number of selected options.\n\t * @returns {void}\n\t */\n\tselectionChanged(options = null, length = 0) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tthis.value = options.map((el) => el.value).reverse();\n\t\t\tthis.input.value = this.value.map(a => a).join(\" \").trim();\n\n\t\t\tif (this.placeholder && length === 0) {\n\t\t\t\tthis.chips.innerHTML = this.placeholder;\n\t\t\t} else {\n\t\t\t\tif (options !== null) Array.from(options).slice(0, +this.maxOptions).forEach(option => this.chips.appendChild(this.getChip(option)));\n\t\t\t\tif (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {\n\t\t\t\t\tthis.counter();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.getAllOptions().forEach((o) => this.#syncOptionCheckbox(o));\n\t\t} else {\n\t\t\tconst option = options?.at(0);\n\n\t\t\tthis.value = options?.map((el) => el.value)?.at(0) || '';\n\t\t\tthis.input.value = this.value[0] || '';\n\t\t\tconst displayValue = options[0]?.textContent?.trim() || '';\n\t\t\tthis.displayInput.value = displayValue;\n\t\t\tthis.displayText.textContent = displayValue;\n\t\t\tthis.displayText.toggleAttribute('data-placeholder-visible', !displayValue && Boolean(this.placeholder));\n\n\t\t\tthis.slotStart.innerHTML = '';\n\t\t\tthis.slotEnd.innerHTML = '';\n\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\tlet optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n\t\t\t\tif (optionSlotStart) {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.slotStart.append(optionSlotStart.cloneNode(true));\n\t\t\t\t\t},0)\n\t\t\t\t}\n\n\t\t\t\tlet optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n\n\t\t\t\tif (optionSlotEnd && optionSlotEnd instanceof HTMLElement && optionSlotEnd.tagName !== 'WJE-DROPDOWN' && optionSlotEnd.tagName !== 'WJE-BUTTON') {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.slotEnd.append(optionSlotEnd.cloneNode(true));\n\t\t\t\t\t},0)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Handles the logic for updating selections based on the current selected options,\n\t * updating chips content, and dispatching change events if necessary.\n\t * @param {boolean} [silence] If true, suppresses the dispatch of a custom change event.\n\t * @returns {void} This method does not return a value.\n\t */\n\tselections(silence = false) {\n\t\tif (this.selectedOptions.length >= +this.maxOptions) {\n\t\t\tthis.counterEl = null;\n\t\t}\n\n\t\tif (this.chips) {\n\t\t\tthis.chips.innerHTML = '';\n\t\t}\n\n\t\tif (this.selectedOptions.length > 0) {\n\t\t\tthis.selectionChanged(this.selectedOptions, this.selectedOptions.length);\n\t\t} else {\n\t\t\tthis.selectionChanged(this.selectedOptions);\n\t\t}\n\n\t\tif (silence) return;\n\t\tevent.dispatchCustomEvent(this, 'wje-select:change');\n\t}\n\n\t/**\n\t * Updates the counter element to reflect the current state of selected values relative to the maximum allowed options.\n\t * If the maximum options are selected, the counter element is removed. If it does not already exist and needs to be displayed, it is created.\n\t * @returns {void} Does not return a value.\n\t */\n\tcounter() {\n\t\t// zmazanie counter (span)\n\t\tif (this.counterEl && this.value.length === +this.maxOptions) {\n\t\t\tthis.counterEl.remove();\n\t\t\tthis.counterEl = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// ak counter nie je, tak ho vytvorime\n\t\tif (!this.counterEl) {\n\t\t\tthis.counterEl = document.createElement('span');\n\t\t\tthis.counterEl.classList.add('counter');\n\n\t\t\tthis.chips.appendChild(this.counterEl);\n\t\t}\n\n\t\t// nastavime hodnotu counter\n\t\tthis.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n\t}\n\n\t/**\n\t * Creates and returns a chip element with specified properties and a label.\n\t * @param {object} option The configuration object for the chip. Typically includes properties such as value and textContent to set up the chip's label and data.\n\t * @returns {HTMLElement} The newly created chip element with a label and default properties.\n\t */\n\tgetChip(option) {\n\t\tlet chip = document.createElement('wje-chip');\n\t\tchip.size = 'small';\n\t\tchip.removable = !this.readonly;\n\t\tchip.round = true;\n\t\tchip.addEventListener('wje:chip-remove', this.removeChip);\n\t\tchip.option = option;\n\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.innerText = this.#htmlSelectedItem(option.value) // option.textContent.trim();\n\n\t\tchip.appendChild(label);\n\n\t\treturn chip;\n\t}\n\n\t/**\n\t * Handles the removal of a chip element from the DOM and updates the related state.\n\t * @param {Event} e The event object triggered by the chip removal action.\n\t * The target of the event is expected to be the chip element itself.\n\t */\n\tremoveChip = (e) => {\n\t\te.target.parentNode.removeChild(e.target);\n\t\tthis.processClickedOption(e.target.option, true);\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item and mapping.\n\t * @param {object} item The item to generate the option for.\n\t * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n\t * @param {string} [map.value] The property of the item to use for the option's value.\n\t * @param {string} [map.text] The property of the item to use for the option's text.\n\t * @returns {HTMLElement} The generated HTML option element.\n\t */\n\thtmlOption(item, map = { value: 'value', text: 'text' }) {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[map.value] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n\t\t}\n\n\t\tif (item[map.text] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[map.value] ?? '');\n\t\toption.innerText = item[map.text] ?? '';\n\n\t\tthis.#addedOptions.push({ [map.value]: item[map.value], [map.text]: item[map.text] });\n\t\treturn option;\n\t}\n\n\t/**\n\t * Returns the provided item.\n\t * @param {any} item The item to be returned.\n\t * @returns {any} The same item that was passed as input.\n\t */\n\thtmlSelectedItem(item) {\n\t\treturn item;\n\t}\n\n\t/**\n\t * Adds a new option to the component.\n\t * @param {object} optionData The data used to create the new option.\n\t * @param {boolean} [silent] Whether the addition should trigger events or not.\n\t * @param {object} [map] Mapping of keys to identify value and text in the optionData.\n\t * @param {string} [map.value] The key in optionData that represents the value of the option.\n\t * @param {string} [map.text] The key in optionData that represents the text of the option.\n\t * @returns {void}\n\t */\n\taddOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!optionData) return;\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tif (optionsElement) {\n\t\t\toptionsElement.addOption(optionData, silent, map);\n\t\t\tthis.#updateEmptyState();\n\t\t\treturn;\n\t\t}\n\t\tlet option = this.htmlOption(optionData, map);\n\t\tthis.appendChild(option);\n\t\tthis.#updateEmptyState();\n\t}\n\n\t/**\n\t * Adds one or more options to a collection. If the input is an array, it adds each option within the array.\n\t * Otherwise, it adds a single option.\n\t * @param {Array | object} optionsData The data representing the options to be added. It can be a single object or an array of objects.\n\t * @param {boolean} [silent] Optional flag to determine if events or notifications should be suppressed while adding options.\n\t * @param {object} [map] An optional mapping object specifying how to map data properties to value and text for the options.\n\t * @param {string} [map.value] The property in the optionsData that represents the value of the option.\n\t * @param {string} [map.text] The property in the optionsData that represents the text of the option.\n\t * @returns {void}\n\t */\n\taddOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!Array.isArray(optionsData)) {\n\t\t\tthis.addOption(optionsData, silent, map);\n\t\t} else {\n\t\t\toptionsData.forEach((item) => {\n\t\t\t\tthis.addOption(item, silent, map);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Selects an option from the available options within the component.\n\t * @param {string} value The value of the option to be selected.\n\t * @param {boolean} [silent] Determines whether the selection should trigger notification or updates. Defaults to false.\n\t * @returns {void} Does not return a value.\n\t */\n\tselectOption(value, silent = false) {\n\t\tif (!value) return;\n\n\t\tconst option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\t\tif (!option) return;\n\n\t\tif (silent) {\n\t\t\tif (!option.hasAttribute('selected')) {\n\t\t\t\toption.selected = true;\n\t\t\t}\n\t\t\tthis.selectedOptions = this.#getSelectedOptions();\n\t\t} else {\n\t\t\tthis.processClickedOption(option, this.hasAttribute('multiple'));\n\t\t}\n\n\t\tif (this.drawingStatus > this.drawingStatuses.START) {\n\t\t\tthis.selections(silent);\n\t\t}\n\t}\n\n\t/**\n\t * Selects multiple options based on the provided values. If a single value is provided, it selects that option.\n\t * If an array of values is provided, it iterates through the array and selects each option.\n\t * @param {any|any[]} values A single value or an array of values to be selected.\n\t * @param {boolean} [silent] Determines whether the selection action should occur silently without triggering other side effects or events.\n\t * @returns {void} This method does not return a value.\n\t */\n\tselectOptions(values, silent = false) {\n\t\tif (!Array.isArray(values)) {\n\t\t\tthis.selectOption(values, silent);\n\t\t} else {\n\t\t\tvalues.forEach((value) => {\n\t\t\t\tthis.selectOption(value, silent);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Clones and appends an icon with the \"check\" slot to the specified option element.\n\t * If the option already contains a custom element with slot=\"check\" (e.g. <wje-status slot=\"check\">),\n\t * it is left untouched and no template icon is added.\n\t * @param {HTMLElement} option The target HTML element to which the cloned \"check\" icon will be appended.\n\t * @returns {void} This method does not return a value, but it modifies the DOM by appending a cloned \"check\" icon to the provided option element.\n\t */\n\toptionCheckSlot(option) {\n\t\tlet existingCheckSlot = option.querySelector('[slot=\"check\"]');\n\n\t\tif (existingCheckSlot && existingCheckSlot.tagName !== 'WJE-CHECKBOX') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (existingCheckSlot && existingCheckSlot.tagName === 'WJE-CHECKBOX') {\n\t\t\tconst isSelectedExisting = option.hasAttribute('selected');\n\n\t\t\t// zosúladenie stavu\n\t\t\texistingCheckSlot.checked = isSelectedExisting;\n\t\t\tif (isSelectedExisting) {\n\t\t\t\texistingCheckSlot.setAttribute('checked', '');\n\t\t\t} else {\n\t\t\t\texistingCheckSlot.removeAttribute('checked');\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet icon = this.querySelector('template')?.content.querySelector('[slot=\"check\"]');\n\t\tif (!icon) {\n\t\t\tconsole.warn('Icon with slot \"check\" was not found.');\n\t\t\treturn;\n\t\t}\n\n\t\tlet iconClone = icon.cloneNode(true);\n\n\t\toption.append(iconClone);\n\t}\n\n\t/**\n\t * Clears all selected options and resets selections.\n\t * The method ensures that all options are deselected, updates the internal state, validates the selections,\n\t * propagates the validation status, and indicates invalid state if necessary.\n\t * @returns {void} No value is returned by this method.\n\t */\n\tclearSelections() {\n\t\tthis.selectedOptions = [];\n\n\t\tthis.getAllOptions().forEach((option) => {\n\t\t\toption.selected = false;\n\t\t});\n\t\tthis.selections();\n\n\t\tthis.validate();\n\t\tthis.propagateValidation();\n\n\t\tif (this.hasAttribute('invalid')) {\n\t\t\tthis.showInvalidMessage();\n\t\t}\n\t}\n\n\t/**\n\t * Processes the given item and retrieves the corresponding value from the selected options.\n\t * @param {string} item The key to search for in the selected options.\n\t * @returns {string} The text content associated with the selected item, or an empty string if not found.\n\t */\n\t#htmlSelectedItem(item) {\n\t\tconst keyValue = \"value\"\n\t\tconst textValue = \"textContent\";\n\n\t\tconst value = this.selectedOptions.find((option) => option[keyValue] === item)?.[textValue] ?? \"\";\n\n\t\treturn this.htmlSelectedItem(value);\n\t}\n\n\t/**\n\t * Retrieves the list of selected options within the component.\n\t * @returns {Array<Element>} An array of elements representing the options that are currently selected.\n\t */\n\t#getSelectedOptions() {\n\t\treturn this.getAllOptions().filter((option) => option.hasAttribute('selected'));\n\t}\n\n\t/**\n\t * Determines whether the select currently contains at least one visible option.\n\t * @returns {boolean} Returns true when at least one option is visible, otherwise false.\n\t */\n\t#hasVisibleOptions() {\n\t\treturn Array.from(this.getAllOptions()).some((option) => {\n\t\t\tif (option.hidden || option.hasAttribute('hidden')) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn getComputedStyle(option).display !== 'none';\n\t\t});\n\t}\n\n\t/**\n\t * Toggles the empty state message based on whether any visible options are available.\n\t * @returns {void} Does not return a value.\n\t */\n\t#updateEmptyState() {\n\t\tif (!(this.emptyState instanceof HTMLElement)) return;\n\n\t\tif (this.#isRemoteOptionsLoading) {\n\t\t\tthis.emptyState.hidden = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emptyState.hidden = this.#hasVisibleOptions();\n\t}\n\n\t/**\n\t * Filters option elements based on the search input value.\n\t * This function applies a search filter to a list of options. If a `wj-options` element exists and has\n\t * the `lazy` attribute, the search value is passed to the `wj-options` element, enabling infinite scroll\n\t * functionality to handle the filtering. If the `lazy` attribute is not present, it performs a local\n\t * search to show or hide options depending on whether their text content matches the search input.\n\t * @param {Event} e The input event containing the search input value from the user.\n\t */\n\t#applySearchFilter = (e) => {\n\t\t// contains wj-options element with options\n\t\tconst optionsElement = this.querySelector('wje-options');\n\n\t\tif (optionsElement && optionsElement.hasAttribute('lazy')) {\n\t\t\t// pass search value to wj-options element and infinite scroll will handle the rest\n\t\t\toptionsElement.setAttribute('search', e.target.value);\n\t\t} else {\n\t\t\tlet value = e.target.value.trim().toLowerCase();\n\n\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\tif (option.textContent.trim().toLowerCase().includes(value)) {\n\t\t\t\t\toption.style.display = 'block';\n\t\t\t\t} else {\n\t\t\t\t\toption.style.display = 'none';\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.#updateEmptyState();\n\t\t}\n\t}\n\n\t#handleOptionsLoad = (e) => {\n\t\tthis.#remoteOptionsLoaded = true;\n\t\tthis.#isRemoteOptionsLoading = false;\n\n\t\tthis.selectedOptions.forEach((option) => {\n\t\t\tthis.getAllOptions().forEach((el) => {\n\t\t\t\tif (el.value === option.value) {\n\t\t\t\t\tel.selected = true;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t// Ensure values from the value attribute are (re)selected after lazy-loaded pages\n\t\tconst attrValue = this.getAttribute('value')?.split(' ') || [];\n\n\t\tattrValue.forEach(val => {\n\t\t\tconst existingOption = Array.from(this.getAllOptions()).find(el => el.value === val);\n\t\t\tif (existingOption) {\n\t\t\t\texistingOption.selected = true;\n\t\t\t}\n\t\t});\n\n\t\tthis.selectedOptions = this.#getSelectedOptions();\n\t\tthis.selections(true);\n\t\tthis.#updateEmptyState();\n\t\tthis.#syncOptionOwners();\n\t\tthis.#portalOptions();\n\n\t\tthis.list.scrollTo(0, 0);\n\t\tevent.dispatchCustomEvent(this.popup, 'wje-popup:content-ready'); // Notify that the content is ready\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.#restorePortaledOptions();\n\t\tdocument.removeEventListener('mousedown', this.#onMenuItemClickCapture, true);\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tconst expanded = this.popup?.hasAttribute('active') || this.classList.contains('active');\n\t\tthis.setAriaState({\n\t\t\trole: 'combobox',\n\t\t\thaspopup: 'listbox',\n\t\t\texpanded,\n\t\t\tcontrols: this._ariaListId,\n\t\t\tdisabled: this.disabled,\n\t\t\trequired: this.required,\n\t\t\tinvalid: this.invalid || this.hasAttribute('invalid'),\n\t\t});\n\t}\n\n\t/**\n\t * Prevent closing the parent <wje-select>'s popup when a nested <wje-dropdown>\n\t * menu item is clicked. Closes only the dropdown that owns the clicked item.\n\t * This captures the event at the document level (useCapture=true) so it can\n\t * stop the global outside-click logic that would otherwise hide the select's popup.\n\t */\n\t#onMenuItemClickCapture = (e) => {\n\t\tconst target = (e.target);\n\t\tif (!target || !target.closest) return;\n\n\t\tconst menuItem = target.closest('wje-menu-item');\n\t\tif (!menuItem) return;\n\n\t\tconst dropdown = target.closest('wje-dropdown');\n\t\tif (dropdown && typeof dropdown.hide === 'function') {\n\t\t\tdropdown.hide();\n\t\t}\n\n\t\te.stopPropagation();\n\t}\n\n\t#syncPortalStyles = (e) => {\n\t\tconst container = e.detail?.container;\n\n\t\tif (!(container instanceof HTMLElement)) return;\n\n\t\tcontainer.setAttribute('data-wje-select-portal', '');\n\t\tthis.#copyPortalCustomProperties(container);\n\t\tthis.#portalOptions(container);\n\n\t\tif (container.querySelector('style[data-wje-select-portal-style]')) return;\n\n\t\tconst style = document.createElement('style');\n\t\tstyle.setAttribute('data-wje-select-portal-style', '');\n\t\tstyle.textContent = Select.portalStyles;\n\n\t\tcontainer.prepend(style);\n\t}\n\n\t#copyPortalCustomProperties(container) {\n\t\tconst style = getComputedStyle(this);\n\n\t\tfor (let i = 0; i < style.length; i++) {\n\t\t\tconst prop = style[i];\n\n\t\t\tif (prop.startsWith('--')) {\n\t\t\t\tcontainer.style.setProperty(prop, style.getPropertyValue(prop));\n\t\t\t}\n\t\t}\n\t}\n\n\t#syncOptionOwners() {\n\t\tthis.getAllOptions().forEach((option) => {\n\t\t\toption.ownerSelect = this;\n\t\t});\n\t}\n\n\t#portalOptions(container = this.popup?._portalContainer) {\n\t\tif (!(container instanceof HTMLElement)) return;\n\n\t\tconst list = container.querySelector('.list');\n\t\tif (!(list instanceof HTMLElement)) return;\n\n\t\tconst options = this.getAllOptions();\n\n\t\toptions.forEach((option) => {\n\t\t\tif (this.#portaledOptionRecords.some((record) => record.option === option)) return;\n\t\t\tif (!option.parentNode) return;\n\n\t\t\tconst placeholder = document.createComment('wje-select-portaled-option');\n\t\t\toption.parentNode.insertBefore(placeholder, option);\n\n\t\t\toption.ownerSelect = this;\n\t\t\toption.setAttribute('data-wje-select-portaled-option', '');\n\t\t\toption.addEventListener('wje-option:change', this.optionChange);\n\n\t\t\tthis.#portaledOptionRecords.push({ option, placeholder });\n\t\t\tlist.insertBefore(option, this.emptyState);\n\t\t});\n\t}\n\n\t#restorePortaledOptions = () => {\n\t\tif (this.#portaledOptionRecords.length === 0) return;\n\n\t\tthis.#portaledOptionRecords.forEach(({ option, placeholder }) => {\n\t\t\toption.removeEventListener('wje-option:change', this.optionChange);\n\t\t\toption.removeAttribute('data-wje-select-portaled-option');\n\n\t\t\tif (placeholder.parentNode) {\n\t\t\t\tplaceholder.parentNode.insertBefore(option, placeholder);\n\t\t\t\tplaceholder.remove();\n\t\t\t}\n\t\t});\n\n\t\tthis.#portaledOptionRecords = [];\n\t}\n\n\t#focusFindInput() {\n\t\tif (!this.hasAttribute('find') || !(this.findEl instanceof HTMLElement)) return;\n\n\t\trequestAnimationFrame(() => {\n\t\t\tconst input = this.findEl.input || this.findEl.shadowRoot?.querySelector('input');\n\n\t\t\tif (input instanceof HTMLElement) {\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\t#syncOptionCheckbox(option) {\n\t\tconst checkbox = option.querySelector('wje-checkbox[slot=\"check\"]');\n\t\tif (!checkbox) return;\n\n\t\tconst isSelected = option.hasAttribute('selected');\n\t\tcheckbox.checked = isSelected;\n\t\tif (isSelected) {\n\t\t\tcheckbox.setAttribute('checked', '');\n\t\t} else {\n\t\t\tcheckbox.removeAttribute('checked');\n\t\t}\n\t}\n}\n","import { Select } from \"./select.element.js\";\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;A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AC,QAAQ;AAC3B,QAAM,WAAW,OAAO,cAAc,4BAA4B;AAClE,MAAI,CAAC,SAAU;AAEf,QAAM,aAAa,OAAO,aAAa,UAAU;AACjD,WAAS,UAAU;AACnB,MAAI,YAAY;AACf,aAAS,aAAa,WAAW,EAAE;AAAA,EACpC,OAAO;AACN,aAAS,gBAAgB,SAAS;AAAA,EACnC;AACD;AArgDA,cADY,SACL,eAAc;AACrB,cAFY,SAEL,gBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAFhB,IAAM,SAAN;ACVP,OAAO,OAAO,cAAc,MAAM;"}
|
|
1
|
+
{"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\nimport { Localizer } from '../utils/localize.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\nexport class Select extends FormAssociatedElement {\n\tstatic _instanceId = 0;\n\tstatic portalStyles = `\n\t\t[data-wje-select-portal] .options-wrapper {\n\t\t\tbox-sizing: border-box;\n\t\t\tmin-width: 100%;\n\t\t\tborder-width: var(--wje-select-options-border-width, 1px);\n\t\t\tborder-style: var(--wje-select-options-border-style, solid);\n\t\t\tborder-color: var(--wje-select-options-border-color, var(--wje-border-color, #dcdfe3));\n\t\t\tborder-radius: var(--wje-select-options-border-radius, var(--wje-border-radius, 4px));\n\t\t\tmargin-top: calc(0px - var(--wje-select-border-width, 1px));\n\t\t\tbackground-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t[data-wje-select-portal] .find {\n\t\t\tmargin-block: var(--wje-select-find-margin-block, .5rem);\n\t\t\tmargin-inline: var(--wje-select-find-margin-inline, .5rem);\n\t\t\twidth: var(--wje-select-find-width, calc(100% - 1rem));\n\t\t}\n\n\t\t[data-wje-select-portal] .list {\n\t\t\toverflow: auto;\n\t\t\theight: 100%;\n\t\t\tposition: relative;\n\t\t}\n\n\t\t[data-wje-select-portal] .list:has(.empty:not([hidden])) {\n\t\t\tmin-height: 44px;\n\t\t}\n\n\t\t[data-wje-select-portal] .empty {\n\t\t\tposition: absolute;\n\t\t\tinset: 0;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tpadding: var(--wje-spacing-small, 1rem);\n\t\t\tcolor: var(--wje-select-color, inherit);\n\t\t\ttext-align: center;\n\t\t\tbackground-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n\t\t\tpointer-events: none;\n\t\t}\n\n\t\t[data-wje-select-portal] .empty[hidden] {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t[data-wje-select-portal] .options-wrapper:has(.find) .list {\n\t\t\theight: calc(100% - 32px - 2 * var(--wje-select-find-margin-block, .5rem));\n\t\t}\n\t`;\n\t#addedOptions = [];\n\t#htmlOptions = [];\n\t#portaledOptionRecords = [];\n\t#remoteOptionsLoaded = false;\n\t#isRemoteOptionsLoading = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.localizer = new Localizer(this);\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the counter element, initially null.\n\t\t * @private\n\t\t */\n\t\tthis.counterEl = null;\n\n\t\t/**\n\t\t * @type {boolean}\n\t\t * @description Tracks whether the select element was previously opened, initially false.\n\t\t * @private\n\t\t * @default {boolean} false\n\t\t */\n\t\tthis._wasOppened = false;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the native select element, initially null.\n\t\t */\n\t\tthis.native = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the popup element, initially null.\n\t\t */\n\t\tthis.popup = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the label element, initially null.\n\t\t */\n\t\tthis.labelElement = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot start element, initially null.\n\t\t */\n\t\tthis.slotStart = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot end element, initially null.\n\t\t */\n\t\tthis.slotEnd = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the input element, initially null.\n\t\t */\n\t\tthis.input = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the visible selected text element, initially null.\n\t\t */\n\t\tthis.displayText = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the chips element, initially null.\n\t\t */\n\t\tthis.chips = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the clear button element, initially null.\n\t\t */\n\t\tthis.clear = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the list element, initially null.\n\t\t */\n\t\tthis.list = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the empty state element, initially null.\n\t\t */\n\t\tthis.emptyState = null;\n\n\t\tthis._value = [];\n\t\tthis._selectedOptions = [];\n\t\tthis._instanceId = ++Select._instanceId;\n\t}\n\n\t/**\n\t * An object representing component dependencies with their respective classes.\n\t * Each property in the object maps a custom component name (as a string key)\n\t * to its corresponding class or constructor.\n\t * @typedef {{[key: string]: Function}} Dependencies\n\t * @property {Function} 'wje-button' Represents the Button component class.\n\t * @property {Function} 'wje-popup' Represents the Popup component class.\n\t * @property {Function} 'wje-icon' Represents the Icon component class.\n\t * @property {Function} 'wje-label' Represents the Label component class.\n\t * @property {Function} 'wje-chip' Represents the Chip component class.\n\t * @property {Function} 'wje-input' Represents the Input component class.\n\t * @property {Function} 'wje-option' Represents the Option component class.\n\t * @property {Function} 'wje-checkbox' Represents the Checkbox component class.\n\t */\n\tdependencies = {\n\t\t'wje-button': Button,\n\t\t'wje-popup': Popup,\n\t\t'wje-icon': Icon,\n\t\t'wje-label': Label,\n\t\t'wje-chip': Chip,\n\t\t'wje-input': Input,\n\t\t'wje-option': Option,\n\t\t'wje-options': Options,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the value for the form field. Converts the input value into a FormData object\n\t * if it is not already an array, splitting by spaces if necessary, and sets the\n\t * internal form value as well as the selected values.\n\t * @param {string|Array} value The value to be set. Can be a string (which will be\n\t * split into an array by spaces) or an array of values.\n\t */\n\tset value(value) {\n\t\tconst originalValue = value;\n\t\tconst formData = new FormData();\n\n\t\tif (value) {\n\t\t\tlet data = value;\n\t\t\tlet dataString = value;\n\n\t\t\tif (!Array.isArray(data)) {\n\t\t\t\tdata = data.split(' ');\n\t\t\t} else {\n\t\t\t\tdataString = data.join(' ');\n\t\t\t}\n\n\t\t\tdata.forEach(v => {\n\t\t\t\tformData.append(this.name, v)\n\t\t\t});\n\n\t\t\tvalue = formData;\n\n\t\t\tthis._value = data;\n\n\t\t\tthis.setAttribute('value', dataString);\n\t\t} else {\n\t\t\tformData.delete(this.name);\n\t\t\tvalue = formData;\n\t\t\tthis._value = [];\n\t\t\tthis.removeAttribute('value');\n\t\t}\n\t\tthis.internals.setFormValue(value);\n\t}\n\n\t/**\n\t * Retrieves the current value.\n\t * @returns {any} The value of the `_value` property.\n\t */\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Sets the maximum number of options allowed.\n\t * @param { number | object} value The value to set as the maximum number of options.\n\t * If null, the 'max-options' attribute will be removed.\n\t */\n\tset maxOptions(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-options', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-options');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum number of options allowed.\n\t * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n\t * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n\t * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n\t */\n\tget maxOptions() {\n\t\treturn +this.getAttribute('max-options') || 1;\n\t}\n\n\t/**\n\t * @summary Setter for the defaultValue attribute.\n\t * This method sets the 'value' attribute of the custom input element to the provided value.\n\t * The 'value' attribute represents the default value of the input element.\n\t * @param {string} value The value to set as the default value.\n\t */\n\tset defaultValue(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\t/**\n\t * @summary Getter for the defaultValue attribute.\n\t * This method retrieves the 'value' attribute of the custom input element.\n\t * The 'value' attribute represents the default value of the input element.\n\t * If the 'value' attribute is not set, it returns an empty string.\n\t * @returns {string} The default value of the input element.\n\t */\n\tget defaultValue() {\n\t\treturn this.getAttribute('value') ?? '';\n\t}\n\n\t/**\n\t * Sets or removes the `portaled` attribute on the select.\n\t * Mirrors the dropdown API so popup content can be rendered in a portal root.\n\t * @param {boolean|string} value Determines whether and where the popup should be portaled.\n\t */\n\tset portaled(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('portaled', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('portaled');\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the `portaled` attribute value.\n\t * @returns {string} The configured portal target or an empty string for the default body portal.\n\t */\n\tget portaled() {\n\t\treturn this.getAttribute('portaled') || '';\n\t}\n\n\t/**\n\t * Checks whether popup content should be portaled.\n\t * @returns {boolean} True when the `portaled` attribute is present.\n\t */\n\tget isPortaled() {\n\t\treturn this.hasAttribute('portaled');\n\t}\n\n\t/**\n\t * Sets the trigger value.\n\t * @param {string} value The trigger value to set.\n\t */\n\tset trigger(value) {\n\t\tthis.setAttribute('trigger', value);\n\t}\n\n\t/**\n\t * Returns the trigger value.\n\t * @returns {string} The trigger value.\n\t */\n\tget trigger() {\n\t\treturn this.getAttribute('trigger') || 'click';\n\t}\n\n\t/**\n\t * Sets or removes the disabled state for the associated elements.\n\t * @param {boolean} value A boolean indicating whether the elements should be disabled.\n\t * If true, the disabled attribute is added to the elements. If false, the disabled attribute is removed.\n\t */\n\tset disabled(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('disabled', '');\n\n\t\t\tthis.input?.setAttribute('disabled', '');\n\t\t\tthis.displayInput?.setAttribute('disabled', '');\n\n\t\t\tthis.popup?.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('disabled');\n\n\t\t\tthis.input?.removeAttribute('disabled');\n\t\t\tthis.displayInput?.removeAttribute('disabled');\n\n\t\t\tthis.popup?.removeAttribute('disabled');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the current state of the 'disabled' attribute.\n\t * @returns {boolean} Returns true if the 'disabled' attribute is present, otherwise false.\n\t */\n\tget disabled() {\n\t\treturn this.hasAttribute('disabled');\n\t}\n\n\t/**\n\t * Sets the readonly state of the element. When set to true,\n\t * the element and its associated inputs are marked as readonly or disabled.\n\t * When set to false, the readonly and disabled attributes are removed,\n\t * allowing user interaction.\n\t * @param {boolean} value A boolean value indicating whether to set the\n\t * element and its associated inputs to readonly (true) or not (false).\n\t */\n\tset readonly(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('readonly', '');\n\n\t\t\t// inputs nemusia existovať ešte pred draw()\n\t\t\tthis.input?.setAttribute('readonly', '');\n\t\t\tthis.displayInput?.setAttribute('readonly', '');\n\n\t\t\t// popup môže existovať, ak to toggle-uješ po renderi\n\t\t\tthis.popup?.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('readonly');\n\n\t\t\tthis.input?.removeAttribute('readonly');\n\t\t\tthis.displayInput?.removeAttribute('readonly');\n\n\t\t\tthis.popup?.removeAttribute('disabled');\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the 'readonly' attribute is present on the element.\n\t * @returns {boolean} Returns true if the 'readonly' attribute is set, otherwise false.\n\t */\n\tget readonly() {\n\t\treturn this.hasAttribute('readonly');\n\t}\n\n\t/**\n\t * Sets the maximum height value for the element.\n\t * If a value is provided, it sets the 'max-height' attribute on the element.\n\t * If no value is provided, it removes the 'max-height' attribute from the element.\n\t * @param {string|null} value The maximum height to be set. If null or undefined, the attribute is removed.\n\t */\n\tset maxHeight(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-height', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-height');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum height value, which is determined by the 'max-height' attribute.\n\t * If the attribute is not set, a default value of '200px' is returned.\n\t * @returns {string} The maximum height value as a string.\n\t */\n\tget maxHeight() {\n\t\treturn this.getAttribute('max-height') || 'auto';\n\t}\n\n\t/**\n\t * Sets the offset attribute for the element.\n\t * @param {string} value The value to assign to the offset attribute.\n\t */\n\tset offset(value) {\n\t\tthis.setAttribute('offset', value);\n\t}\n\n\t/**\n\t * Gets the value of the offset attribute of the current element.\n\t * If the offset attribute is not present, returns a default value of '0'.\n\t * @returns {string} The value of the offset attribute or the default value '0'.\n\t */\n\tget offset() {\n\t\treturn this.getAttribute('offset') || '5';\n\t}\n\n\t/**\n\t * Sets the selected options for the object.\n\t * @param {Array|object} value The new value for the selected options. It can be an array or object containing the selected options.\n\t */\n\tset selectedOptions(value) {\n\t\tthis._selectedOptions = value;\n\t}\n\n\t/**\n\t * Retrieves the selected options.\n\t * @returns {Array} An array containing the currently selected options. If no options are selected, an empty array is returned.\n\t */\n\tget selectedOptions() {\n\t\treturn this._selectedOptions || [];\n\t}\n\n\t/**\n\t * Sets the `lazy` attribute on the element. If the provided value is truthy, the `lazy` attribute is added. If the value is falsy, the `lazy` attribute is removed.\n\t * @param {boolean} value A boolean value indicating whether to add or remove the `lazy` attribute. If `true`, the attribute is added; if `false`, it is removed.\n\t */\n\tset lazy(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('lazy', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('lazy');\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the 'lazy' property.\n\t * @returns {boolean} Returns true if the 'lazy' attribute is present on the element, otherwise false.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Sets or removes the 'no-size' attribute on an element.\n\t * @param {boolean} value A boolean indicating whether to add or remove the 'no-size' attribute. If true, the attribute is added; if false, the attribute is removed.\n\t */\n\tset noSize(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('no-size', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('no-size');\n\t\t}\n\t}\n\n\t/**\n\t * Gets the value of the 'no-size' attribute for the element.\n\t * @returns {boolean} True if the 'no-size' attribute is present, otherwise false.\n\t */\n\tget noSize() {\n\t\treturn this.hasAttribute('no-size');\n\t}\n\n\t/**\n\t * Getter for the customErrorDisplay attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget customErrorDisplay() {\n\t\treturn this.hasAttribute('custom-error-display');\n\t}\n\n\t/**\n\t * Retrieves the complete list of options available for the component.\n\t * The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.\n\t * If a `wje-options` element is present within the component, its loaded options are included in the merged list.\n\t * In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.\n\t * @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.\n\t */\n\tget options() {\n\t\tif (this.querySelector('wje-options')) {\n\t\t\tconst allOptions = [...this.querySelector('wje-options').loadedOptions, ...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn allOptions\n\t\t} else {\n\t\t\tconst allOptions = [...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn Array.from(\n\t\t\t\tnew Map(allOptions.reverse().map(obj => [obj.value, obj])).values()\n\t\t\t).reverse();\n\t\t}\n\t}\n\n\tclassName = 'Select';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['active', 'disabled', 'readonly', 'portaled'];\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\tbeforeDraw() {\n\t\tif (this.hasAttribute('value')) {\n\t\t\t// If a value attribute is explicitly provided, respect it.\n\t\t\tthis.value = this.getAttribute('value');\n\t\t} else {\n\t\t\t// No explicit value – derive initial value from currently selected options.\n\t\t\tconst selectedOptions = this.#getSelectedOptions();\n\n\t\t\tif (selectedOptions.length > 0) {\n\t\t\t\tconst values = selectedOptions.map((opt) => opt.value);\n\t\t\t\tthis.value = this.hasAttribute('multiple') ? values : values[0];\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Draws the component for the select.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tthis.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n\t\t// zakladny obalovac\n\t\tlet native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.classList.add('native-select', this.variant || 'default');\n\n\t\t// wrapper pre label a inputWrapper\n\t\tlet wrapper = document.createElement('div');\n\t\twrapper.classList.add('wrapper');\n\t\twrapper.setAttribute('slot', 'anchor');\n\n\t\t// label\n\t\tlet label = document.createElement('label');\n\t\tlabel.setAttribute('part', 'label');\n\t\tlabel.innerText = this.label || '';\n\n\t\t// obalovac pre input\n\t\tlet inputWrapper = document.createElement('div');\n\t\tinputWrapper.setAttribute('part', 'input-wrapper');\n\t\tinputWrapper.classList.add('input-wrapper');\n\n\t\tlet slotStart = document.createElement('div');\n\t\tslotStart.classList.add('slot-start');\n\n\t\tlet input = document.createElement('input');\n\t\tinput.setAttribute('type', 'text');\n\t\tinput.value = this.value.join(' ').trim();\n\t\tinput.classList.add('input-hidden');\n\n\t\tlet display = document.createElement('input');\n\t\tdisplay.setAttribute('type', 'text');\n\t\tdisplay.setAttribute('part', 'input');\n\t\tdisplay.setAttribute('autocomplete', 'off');\n\t\tdisplay.setAttribute('readonly', '');\n\t\tdisplay.setAttribute('placeholder', this.placeholder || '');\n\t\tdisplay.classList.add('display-input');\n\n\t\tlet displayWrapper = document.createElement('span');\n\t\tdisplayWrapper.classList.add('display-wrapper');\n\n\t\tlet displayText = document.createElement('span');\n\t\tdisplayText.setAttribute('part', 'input selected-text');\n\t\tdisplayText.classList.add('display-text');\n\t\tdisplayText.dataset.placeholder = this.placeholder || '';\n\t\tdisplayText.toggleAttribute('data-placeholder-visible', Boolean(this.placeholder));\n\t\tdisplayText.setAttribute('aria-hidden', 'true');\n\t\tdisplayWrapper.append(display, displayText);\n\n\t\tif (this.required) {\n\t\t\tinput.setAttribute('required', '');\n\t\t\tdisplay.setAttribute('required', '');\n\t\t}\n\n\t\t// Apply initial disabled/readonly state during first render\n\t\tif (this.disabled) {\n\t\t\tinput.setAttribute('disabled', '');\n\t\t\tdisplay.setAttribute('disabled', '');\n\t\t}\n\n\t\tif (this.readonly) {\n\t\t\tinput.setAttribute('readonly', '');\n\t\t\tdisplay.setAttribute('readonly', '');\n\t\t}\n\n\t\tlet slotEnd = document.createElement('div');\n\t\tslotEnd.classList.add('slot-end');\n\n\t\tlet arrow = document.createElement('wje-icon');\n\t\tarrow.setAttribute('name', 'chevron-down');\n\t\tarrow.setAttribute('slot', 'arrow');\n\n\t\tlet chips = document.createElement('div');\n\t\tchips.classList.add('chips');\n\t\tchips.innerText = this.placeholder || '';\n\n\t\t// obalovac pre option a find\n\t\tlet optionsWrapper = document.createElement('div');\n\t\toptionsWrapper.setAttribute('part', 'options-wrapper');\n\t\toptionsWrapper.classList.add('options-wrapper');\n\t\toptionsWrapper.style.setProperty('height', this.maxHeight);\n\n\t\tlet list = document.createElement('div');\n\t\tlist.classList.add('list');\n\t\tthis._ariaListId = this.id ? `${this.id}-listbox` : `wje-select-${this._instanceId}-listbox`;\n\t\tlist.id = this._ariaListId;\n\t\tlist.setAttribute('role', 'listbox');\n\t\tif (this.hasAttribute('multiple')) list.setAttribute('aria-multiselectable', 'true');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet emptyState = document.createElement('div');\n\t\temptyState.setAttribute('part', 'empty');\n\t\temptyState.setAttribute('role', 'option');\n\t\temptyState.setAttribute('aria-disabled', 'true');\n\t\temptyState.setAttribute('aria-selected', 'false');\n\t\temptyState.classList.add('empty');\n\t\temptyState.hidden = true;\n\t\temptyState.textContent = this.localizer.translate('wj.select.empty');\n\n\t\tlet clear = document.createElement('wje-button');\n\t\tclear.setAttribute('fill', 'link');\n\t\tclear.setAttribute('part', 'clear');\n\t\tclear.setAttribute('stop-propagation', '');\n\n\t\tlet clearIcon = document.createElement('wje-icon');\n\t\tclearIcon.setAttribute('name', 'x');\n\n\t\tlet error = document.createElement('div');\n\t\terror.setAttribute('slot', 'error');\n\n\t\tlet errorSlot = document.createElement('slot');\n\t\terrorSlot.setAttribute('name', 'error');\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tconst hasRemoteOptions = optionsElement instanceof HTMLElement;\n\n\t\tif (hasRemoteOptions) {\n\t\t\tthis.#isRemoteOptionsLoading = !this.#remoteOptionsLoaded;\n\t\t} else {\n\t\t\tthis.#remoteOptionsLoaded = false;\n\t\t\tthis.#isRemoteOptionsLoading = false;\n\t\t}\n\n\t\t// vytvorime popup\n\t\tlet popup = document.createElement('wje-popup');\n\t\tpopup.setAttribute('placement', 'bottom-start');\n\t\tif (!this.noSize) {\n\t\t\tpopup.setAttribute('size', '');\n\t\t\tpopup.contentAwareSize = true;\n\t\t\tpopup.style.setProperty('--wje-popup-loader-inset', 'var(--wje-select-options-border-width, 1px)');\n\t\t}\n\t\tpopup.setAttribute('part', 'popup');\n\t\tpopup.setAttribute('offset', this.offset);\n\t\tif (this.isPortaled) {\n\t\t\tpopup.setAttribute('portal', this.portaled);\n\t\t}\n\n\t\tif ((this.lazy && !this._wasOppened) || (hasRemoteOptions && !this.#remoteOptionsLoaded)) {\n\t\t\tpopup.setAttribute('loader', '');\n\t\t} else {\n\t\t\tpopup.removeAttribute('loader');\n\t\t}\n\n\t\tif (this.disabled) {\n\t\t\tpopup.setAttribute('disabled', '');\n\t\t} else {\n\t\t\tpopup.removeAttribute('disabled');\n\t\t}\n\n\t\tif (this.variant === 'standard') {\n\t\t\tif (this.hasAttribute('label')) native.appendChild(label);\n\t\t} else {\n\t\t\twrapper.appendChild(label);\n\t\t}\n\n\t\tinputWrapper.append(slotStart);\n\t\tinputWrapper.append(displayWrapper);\n\t\tinputWrapper.append(input);\n\n\t\tclear.append(clearIcon);\n\n\t\tif (this.hasAttribute('multiple')) inputWrapper.append(chips);\n\n\t\tif (this.hasAttribute('clearable')) inputWrapper.append(clear);\n\n\t\tinputWrapper.appendChild(slotEnd);\n\t\tinputWrapper.appendChild(arrow);\n\n\t\tlist.append(slot, emptyState);\n\n\t\tif (this.hasAttribute('find')) {\n\t\t\tlet find = document.createElement('wje-input');\n\t\t\tfind.setAttribute('variant', 'standard');\n\t\t\tfind.setAttribute('placeholder', 'Hľadať');\n\t\t\tfind.setAttribute('part', 'find');\n\t\t\tfind.clearable = true;\n\t\t\tfind.classList.add('find');\n\n\t\t\toptionsWrapper.append(find);\n\n\t\t\tthis.findEl = find;\n\t\t}\n\n\t\tlet slotFooter = document.createElement('slot');\n\t\tslotFooter.setAttribute('name', 'footer');\n\n\t\t// APPEND\n\t\toptionsWrapper.append(list);\n\t\toptionsWrapper.append(slotFooter);\n\n\t\twrapper.append(inputWrapper);\n\n\t\tpopup.append(wrapper);\n\t\tpopup.append(optionsWrapper);\n\n\t\tif (this.trigger === 'click') popup.setAttribute('manual', '');\n\n\t\tthis.append(error);\n\n\t\tnative.append(popup);\n\t\tnative.append(errorSlot);\n\n\t\tfragment.appendChild(native);\n\n\t\tthis.native = native;\n\t\tthis.popup = popup;\n\t\tthis.labelElement = label;\n\t\tthis.slotStart = slotStart;\n\t\tthis.slotEnd = slotEnd;\n\t\tthis.input = input;\n\t\tthis.displayInput = display;\n\t\tthis.displayText = displayText;\n\t\tthis.chips = chips;\n\t\tthis.clear = clear;\n\t\tthis.list = list;\n\t\tthis.emptyState = emptyState;\n\t\tthis.slotFooter = slotFooter;\n\n\t\tthis.syncAria();\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Executes post-render logic for the custom element.\n\t * This includes validation, event listener registration, managing custom attributes, and\n\t * handling options initialization for the component.\n\t * @returns {void} This method does not return any value.\n\t */\n\tafterDraw() {\n\t\tdocument.addEventListener('mousedown', this.#onMenuItemClickCapture, true);\n\n\t\tthis.validate();\n\n\t\tif (this.hasAttribute('invalid')) {\n\t\t\tthis.showInvalidMessage();\n\t\t}\n\t\tthis.syncAria();\n\n\t\tthis.getAllOptions()?.forEach((option) => {\n\t\t\toption.ownerSelect = this;\n\t\t\tthis.optionCheckSlot(option);\n\t\t});\n\n\t\tevent.addListener(this.popup, 'wje-router:rebind', null, this.#syncPortalStyles);\n\t\tevent.addListener(this.popup, 'wje-portal:restored', null, this.#restorePortaledOptions);\n\n\t\tthis.selectedOptions = this.#getSelectedOptions();\n\t\tthis.selectOptions(this.value, true);\n\n\t\tif (this.lazy) {\n\t\t\tevent.addListener(this.popup, 'wje-popup:show', null, (e) => {\n\t\t\t\tif (this._wasOppened) return;\n\t\t\t\tthis._wasOppened = true;\n\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\toptionsElement.setAttribute('lazy', '');\n\t\t\t\toptionsElement.setAttribute('attached', '');\n\t\t\t});\n\t\t}\n\n\t\tevent.addListener(this.popup, 'wje-popup:aftershow', null, () => {\n\t\t\tconst assignedElements = this.slotFooter.assignedElements();\n\n\t\t\tif (assignedElements.length > 0) {\n\t\t\t\tconst el = assignedElements[0];\n\t\t\t\tconst rect = el.getBoundingClientRect();\n\t\t\t\tlet totalHeight = 0;\n\n\t\t\t\tif(this.hasAttribute('find')) {\n\t\t\t\t\tlet style = getComputedStyle(this.findEl);\n\n\t\t\t\t\tlet height = this.findEl.offsetHeight;\n\t\t\t\t\tlet marginTop = parseFloat(style.marginTop);\n\t\t\t\t\tlet marginBottom = parseFloat(style.marginBottom);\n\n\t\t\t\t\ttotalHeight = height + marginTop + marginBottom;\n\t\t\t\t}\n\n\t\t\t\tlet subtractHeight = rect.height + totalHeight;\n\n\t\t\t\tthis.list.style.height = `calc(100% - ${subtractHeight}px)`;\n\t\t\t}\n\n\t\t\tthis.#focusFindInput();\n\t\t});\n\n\t\tthis.#htmlOptions = Array.from(this.querySelectorAll(':scope > wje-option')).map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: option.textContent.trim(),\n\t\t\t};\n\t\t})\n\n\t\tthis.input.addEventListener('focus', (e) => {\n\t\t\tthis.labelElement?.classList.add('fade');\n\t\t\tthis.native.classList.add('focused');\n\t\t});\n\n\t\tthis.input.addEventListener('blur', (e) => {\n\t\t\tthis.native.classList.remove('focused');\n\t\t\tif (!e.target.value) this.labelElement?.classList.remove('fade');\n\t\t});\n\n\t\tthis.input.addEventListener('input', (e) => {\n\t\t\tthis.propagateValidation();\n\t\t});\n\n\t\tthis.addEventListener('wje-option:change', this.optionChange);\n\t\tevent.addListener(this.popup, 'wje-popup:show', null, () => this.syncAria());\n\t\tevent.addListener(this.popup, 'wje-popup:hide', null, () => this.syncAria());\n\n\t\tthis.addEventListener('invalid', (e) => {\n\t\t\tthis.invalid = true;\n\t\t\tthis.pristine = false;\n\n\t\t\tthis.showInvalidMessage();\n\n\t\t\tif (this.customErrorDisplay) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t});\n\n\t\tthis.clear?.addEventListener('wje-button:click', (e) => {\n\t\t\tif (this.readonly || this.disabled) return;\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.clearSelections();\n\t\t});\n\n\t\tthis.list.addEventListener('wje-options:load', this.#handleOptionsLoad);\n\t\tthis.addEventListener('wje-options:load', this.#handleOptionsLoad);\n\n\t\t// skontrolujeme ci ma select atribut find\n\t\tif (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n\t\t\tevent.addListener(this.findEl, 'keyup', '', this.#applySearchFilter);\n\t\t\tevent.addListener(this.findEl, 'wje-input:clear', '', this.#applySearchFilter);\n\t\t}\n\n\t\tthis.#updateEmptyState();\n\t}\n\n\t/**\n\t * Handles the change event for an option element within a select-like component.\n\t * This method processes user interactions with options and updates the state of the component,\n\t * including selection management, validation, and UI updates. Behavior differs based on\n\t * whether the component supports multiple selections.\n\t * Key functionality:\n\t * - Prevents the default behavior, event propagation, and immediate propagation of the event.\n\t * - Retrieves all options within the component.\n\t * - If the component doesn't support multiple selection:\n\t * - Marks only the clicked option as selected and deselects others.\n\t * - Hides the option popup.\n\t * - If the component supports multiple selection:\n\t * - Processes the clicked option without deselecting others.\n\t * - Updates the selected options and triggers validation.\n\t * - Marks the form state as non-pristine.\n\t * - Propagates the validation state to other relevant parts of the component or system.\n\t * @param {Event} e The event object representing the option change interaction.\n\t */\n\toptionChange = (e) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.readonly || this.disabled) return;\n\n\t\tlet allOptions = this.getAllOptions();\n\n\t\tif (!this.hasAttribute('multiple')) {\n\t\t\tallOptions.forEach((option) => {\n\t\t\t\tif (option.value === e.target.value) {\n\t\t\t\t\tthis.processClickedOption(option);\n\t\t\t\t} else {\n\t\t\t\t\toption.selected = false;\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.popup.hide(false);\n\t\t} else {\n\t\t\tthis.processClickedOption(e.target, true);\n\t\t}\n\n\t\tthis.selections();\n\n\t\tthis.validate(this.selectedOptions);\n\n\t\tthis.pristine = false;\n\t\tthis.propagateValidation();\n\t}\n\n\t/**\n\t * Handles the logic for processing the selection state of a clicked option element.\n\t * @function processClickedOption\n\t * @param {Element} option The option element that is clicked.\n\t * @param {boolean} [multiple] A Boolean indicating whether multiple options can be selected. Defaults to false.\n\t * Changes the selected state of the passed option and updates the selected options list.\n\t * Checks if the option already has a \"selected\" attribute, toggles its state,\n\t * and updates the internal selected options.\n\t */\n\tprocessClickedOption = (option, multiple = false) => {\n\t\tconst isSelected = option.hasAttribute('selected');\n\t\toption.selected = !isSelected;\n\n\t\tthis.selectedOptions = this.#getSelectedOptions(multiple ? this.selectedOptions : []);\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Returns all the options as HTML.\n\t * @returns {NodeList} The options as HTML.\n\t */\n\tgetAllOptions() {\n\t\tconst localOptions = Array.from(this.querySelectorAll('wje-option'));\n\t\tconst portaledOptions = this.#portaledOptionRecords.map(({ option }) => option);\n\n\t\treturn Array.from(new Set([...localOptions, ...portaledOptions]));\n\t}\n\n\t/**\n\t * Handles changes in the selection for a component, updating internal values, input fields,\n\t * and visual presentation (like chips or slots) as per the given selection options.\n\t * @param {Array|null} options The collection of selected option elements. If null, no options are selected.\n\t * @param {number} length The total number of selected options.\n\t * @returns {void}\n\t */\n\tselectionChanged(options = null, length = 0) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tthis.value = options.map((el) => el.value).reverse();\n\t\t\tthis.input.value = this.value.map(a => a).join(\" \").trim();\n\n\t\t\tif (this.placeholder && length === 0) {\n\t\t\t\tthis.chips.innerHTML = this.placeholder;\n\t\t\t} else {\n\t\t\t\tif (options !== null) Array.from(options).slice(0, +this.maxOptions).forEach(option => this.chips.appendChild(this.getChip(option)));\n\t\t\t\tif (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {\n\t\t\t\t\tthis.counter();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.getAllOptions().forEach((o) => this.#syncOptionCheckbox(o));\n\t\t} else {\n\t\t\tconst option = options?.at(0);\n\n\t\t\tthis.value = options?.map((el) => el.value)?.at(0) || '';\n\t\t\tthis.input.value = this.value[0] || '';\n\t\t\tconst displayValue = options[0]?.textContent?.trim() || '';\n\t\t\tthis.displayInput.value = displayValue;\n\t\t\tthis.displayText.textContent = displayValue;\n\t\t\tthis.displayText.toggleAttribute('data-placeholder-visible', !displayValue && Boolean(this.placeholder));\n\n\t\t\tthis.slotStart.innerHTML = '';\n\t\t\tthis.slotEnd.innerHTML = '';\n\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\tlet optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n\t\t\t\tif (optionSlotStart) {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.slotStart.append(optionSlotStart.cloneNode(true));\n\t\t\t\t\t},0)\n\t\t\t\t}\n\n\t\t\t\tlet optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n\n\t\t\t\tif (optionSlotEnd && optionSlotEnd instanceof HTMLElement && optionSlotEnd.tagName !== 'WJE-DROPDOWN' && optionSlotEnd.tagName !== 'WJE-BUTTON') {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.slotEnd.append(optionSlotEnd.cloneNode(true));\n\t\t\t\t\t},0)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Handles the logic for updating selections based on the current selected options,\n\t * updating chips content, and dispatching change events if necessary.\n\t * @param {boolean} [silence] If true, suppresses the dispatch of a custom change event.\n\t * @returns {void} This method does not return a value.\n\t */\n\tselections(silence = false) {\n\t\tif (this.selectedOptions.length >= +this.maxOptions) {\n\t\t\tthis.counterEl = null;\n\t\t}\n\n\t\tif (this.chips) {\n\t\t\tthis.chips.innerHTML = '';\n\t\t}\n\n\t\tif (this.selectedOptions.length > 0) {\n\t\t\tthis.selectionChanged(this.selectedOptions, this.selectedOptions.length);\n\t\t} else {\n\t\t\tthis.selectionChanged(this.selectedOptions);\n\t\t}\n\n\t\tif (silence) return;\n\t\tevent.dispatchCustomEvent(this, 'wje-select:change');\n\t}\n\n\t/**\n\t * Updates the counter element to reflect the current state of selected values relative to the maximum allowed options.\n\t * If the maximum options are selected, the counter element is removed. If it does not already exist and needs to be displayed, it is created.\n\t * @returns {void} Does not return a value.\n\t */\n\tcounter() {\n\t\t// zmazanie counter (span)\n\t\tif (this.counterEl && this.value.length === +this.maxOptions) {\n\t\t\tthis.counterEl.remove();\n\t\t\tthis.counterEl = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// ak counter nie je, tak ho vytvorime\n\t\tif (!this.counterEl) {\n\t\t\tthis.counterEl = document.createElement('span');\n\t\t\tthis.counterEl.classList.add('counter');\n\n\t\t\tthis.chips.appendChild(this.counterEl);\n\t\t}\n\n\t\t// nastavime hodnotu counter\n\t\tthis.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n\t}\n\n\t/**\n\t * Creates and returns a chip element with specified properties and a label.\n\t * @param {object} option The configuration object for the chip. Typically includes properties such as value and textContent to set up the chip's label and data.\n\t * @returns {HTMLElement} The newly created chip element with a label and default properties.\n\t */\n\tgetChip(option) {\n\t\tlet chip = document.createElement('wje-chip');\n\t\tchip.size = 'small';\n\t\tchip.removable = !this.readonly;\n\t\tchip.round = true;\n\t\tchip.addEventListener('wje:chip-remove', this.removeChip);\n\t\tchip.option = option;\n\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.innerText = this.#htmlSelectedItem(option.value) // option.textContent.trim();\n\n\t\tchip.appendChild(label);\n\n\t\treturn chip;\n\t}\n\n\t/**\n\t * Handles the removal of a chip element from the DOM and updates the related state.\n\t * @param {Event} e The event object triggered by the chip removal action.\n\t * The target of the event is expected to be the chip element itself.\n\t */\n\tremoveChip = (e) => {\n\t\te.target.parentNode.removeChild(e.target);\n\t\tthis.processClickedOption(e.target.option, true);\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item and mapping.\n\t * @param {object} item The item to generate the option for.\n\t * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n\t * @param {string} [map.value] The property of the item to use for the option's value.\n\t * @param {string} [map.text] The property of the item to use for the option's text.\n\t * @returns {HTMLElement} The generated HTML option element.\n\t */\n\thtmlOption(item, map = { value: 'value', text: 'text' }) {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[map.value] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n\t\t}\n\n\t\tif (item[map.text] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[map.value] ?? '');\n\t\toption.innerText = item[map.text] ?? '';\n\n\t\tthis.#addedOptions.push({ [map.value]: item[map.value], [map.text]: item[map.text] });\n\t\treturn option;\n\t}\n\n\t/**\n\t * Returns the provided item.\n\t * @param {any} item The item to be returned.\n\t * @returns {any} The same item that was passed as input.\n\t */\n\thtmlSelectedItem(item) {\n\t\treturn item;\n\t}\n\n\t/**\n\t * Adds a new option to the component.\n\t * @param {object} optionData The data used to create the new option.\n\t * @param {boolean} [silent] Whether the addition should trigger events or not.\n\t * @param {object} [map] Mapping of keys to identify value and text in the optionData.\n\t * @param {string} [map.value] The key in optionData that represents the value of the option.\n\t * @param {string} [map.text] The key in optionData that represents the text of the option.\n\t * @returns {void}\n\t */\n\taddOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!optionData) return;\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tif (optionsElement) {\n\t\t\toptionsElement.addOption(optionData, silent, map);\n\t\t\tthis.#updateEmptyState();\n\t\t\treturn;\n\t\t}\n\t\tlet option = this.htmlOption(optionData, map);\n\t\tthis.appendChild(option);\n\t\tthis.#updateEmptyState();\n\t}\n\n\t/**\n\t * Adds one or more options to a collection. If the input is an array, it adds each option within the array.\n\t * Otherwise, it adds a single option.\n\t * @param {Array | object} optionsData The data representing the options to be added. It can be a single object or an array of objects.\n\t * @param {boolean} [silent] Optional flag to determine if events or notifications should be suppressed while adding options.\n\t * @param {object} [map] An optional mapping object specifying how to map data properties to value and text for the options.\n\t * @param {string} [map.value] The property in the optionsData that represents the value of the option.\n\t * @param {string} [map.text] The property in the optionsData that represents the text of the option.\n\t * @returns {void}\n\t */\n\taddOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!Array.isArray(optionsData)) {\n\t\t\tthis.addOption(optionsData, silent, map);\n\t\t} else {\n\t\t\toptionsData.forEach((item) => {\n\t\t\t\tthis.addOption(item, silent, map);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Selects an option from the available options within the component.\n\t * @param {string} value The value of the option to be selected.\n\t * @param {boolean} [silent] Determines whether the selection should trigger notification or updates. Defaults to false.\n\t * @returns {void} Does not return a value.\n\t */\n\tselectOption(value, silent = false) {\n\t\tif (!value) return;\n\n\t\tconst option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\t\tif (!option) return;\n\n\t\tif (silent) {\n\t\t\tif (!option.hasAttribute('selected')) {\n\t\t\t\toption.selected = true;\n\t\t\t}\n\t\t\tthis.selectedOptions = this.#getSelectedOptions(\n\t\t\t\tthis.hasAttribute('multiple') ? this.selectedOptions : []\n\t\t\t);\n\t\t} else {\n\t\t\tthis.processClickedOption(option, this.hasAttribute('multiple'));\n\t\t}\n\n\t\tif (this.drawingStatus > this.drawingStatuses.START) {\n\t\t\tthis.selections(silent);\n\t\t}\n\t}\n\n\t/**\n\t * Selects multiple options based on the provided values. If a single value is provided, it selects that option.\n\t * If an array of values is provided, it iterates through the array and selects each option.\n\t * @param {any|any[]} values A single value or an array of values to be selected.\n\t * @param {boolean} [silent] Determines whether the selection action should occur silently without triggering other side effects or events.\n\t * @returns {void} This method does not return a value.\n\t */\n\tselectOptions(values, silent = false) {\n\t\tif (!Array.isArray(values)) {\n\t\t\tthis.selectOption(values, silent);\n\t\t} else {\n\t\t\tvalues.forEach((value) => {\n\t\t\t\tthis.selectOption(value, silent);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Clones and appends an icon with the \"check\" slot to the specified option element.\n\t * If the option already contains a custom element with slot=\"check\" (e.g. <wje-status slot=\"check\">),\n\t * it is left untouched and no template icon is added.\n\t * @param {HTMLElement} option The target HTML element to which the cloned \"check\" icon will be appended.\n\t * @returns {void} This method does not return a value, but it modifies the DOM by appending a cloned \"check\" icon to the provided option element.\n\t */\n\toptionCheckSlot(option) {\n\t\tlet existingCheckSlot = option.querySelector('[slot=\"check\"]');\n\n\t\tif (existingCheckSlot && existingCheckSlot.tagName !== 'WJE-CHECKBOX') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (existingCheckSlot && existingCheckSlot.tagName === 'WJE-CHECKBOX') {\n\t\t\tconst isSelectedExisting = option.hasAttribute('selected');\n\n\t\t\t// zosúladenie stavu\n\t\t\texistingCheckSlot.checked = isSelectedExisting;\n\t\t\tif (isSelectedExisting) {\n\t\t\t\texistingCheckSlot.setAttribute('checked', '');\n\t\t\t} else {\n\t\t\t\texistingCheckSlot.removeAttribute('checked');\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet icon = this.querySelector('template')?.content.querySelector('[slot=\"check\"]');\n\t\tif (!icon) {\n\t\t\tconsole.warn('Icon with slot \"check\" was not found.');\n\t\t\treturn;\n\t\t}\n\n\t\tlet iconClone = icon.cloneNode(true);\n\n\t\toption.append(iconClone);\n\t}\n\n\t/**\n\t * Clears all selected options and resets selections.\n\t * The method ensures that all options are deselected, updates the internal state, validates the selections,\n\t * propagates the validation status, and indicates invalid state if necessary.\n\t * @returns {void} No value is returned by this method.\n\t */\n\tclearSelections() {\n\t\tthis.selectedOptions = [];\n\n\t\tthis.getAllOptions().forEach((option) => {\n\t\t\toption.selected = false;\n\t\t});\n\t\tthis.selections();\n\n\t\tthis.validate();\n\t\tthis.propagateValidation();\n\n\t\tif (this.hasAttribute('invalid')) {\n\t\t\tthis.showInvalidMessage();\n\t\t}\n\t}\n\n\t/**\n\t * Processes the given item and retrieves the corresponding value from the selected options.\n\t * @param {string} item The key to search for in the selected options.\n\t * @returns {string} The text content associated with the selected item, or an empty string if not found.\n\t */\n\t#htmlSelectedItem(item) {\n\t\tconst keyValue = \"value\"\n\t\tconst textValue = \"textContent\";\n\n\t\tconst value = this.selectedOptions.find((option) => option[keyValue] === item)?.[textValue] ?? \"\";\n\n\t\treturn this.htmlSelectedItem(value);\n\t}\n\n\t/**\n\t * Retrieves the selected options while retaining selections that are temporarily absent from the rendered list.\n\t * Lazy search and pagination replace option elements, so the currently rendered DOM cannot be the sole source of\n\t * truth for a multiple selection. Rendered options override retained options with the same value, including when\n\t * a rendered option has been explicitly deselected.\n\t * @param {Array<Element>} [retainedOptions] Previously selected option elements that may no longer be rendered.\n\t * @returns {Array<Element>} An array of selected option elements, deduplicated by value.\n\t */\n\t#getSelectedOptions(retainedOptions = []) {\n\t\tconst renderedOptions = this.getAllOptions();\n\t\tconst renderedValues = new Set(renderedOptions.map((option) => option.value));\n\t\tconst selectedByValue = new Map(\n\t\t\trenderedOptions\n\t\t\t\t.filter((option) => option.hasAttribute('selected'))\n\t\t\t\t.map((option) => [option.value, option])\n\t\t);\n\n\t\tretainedOptions.forEach((option) => {\n\t\t\tif (option?.hasAttribute('selected') && !renderedValues.has(option.value)) {\n\t\t\t\tselectedByValue.set(option.value, option);\n\t\t\t}\n\t\t});\n\n\t\treturn Array.from(selectedByValue.values());\n\t}\n\n\t/**\n\t * Determines whether the select currently contains at least one visible option.\n\t * @returns {boolean} Returns true when at least one option is visible, otherwise false.\n\t */\n\t#hasVisibleOptions() {\n\t\treturn Array.from(this.getAllOptions()).some((option) => {\n\t\t\tif (option.hidden || option.hasAttribute('hidden')) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn getComputedStyle(option).display !== 'none';\n\t\t});\n\t}\n\n\t/**\n\t * Toggles the empty state message based on whether any visible options are available.\n\t * @returns {void} Does not return a value.\n\t */\n\t#updateEmptyState() {\n\t\tif (!(this.emptyState instanceof HTMLElement)) return;\n\n\t\tif (this.#isRemoteOptionsLoading) {\n\t\t\tthis.emptyState.hidden = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emptyState.hidden = this.#hasVisibleOptions();\n\t}\n\n\t/**\n\t * Filters option elements based on the search input value.\n\t * This function applies a search filter to a list of options. If a `wj-options` element exists and has\n\t * the `lazy` attribute, the search value is passed to the `wj-options` element, enabling infinite scroll\n\t * functionality to handle the filtering. If the `lazy` attribute is not present, it performs a local\n\t * search to show or hide options depending on whether their text content matches the search input.\n\t * @param {Event} e The input event containing the search input value from the user.\n\t */\n\t#applySearchFilter = (e) => {\n\t\t// contains wj-options element with options\n\t\tconst optionsElement = this.querySelector('wje-options');\n\n\t\tif (optionsElement && optionsElement.hasAttribute('lazy')) {\n\t\t\t// pass search value to wj-options element and infinite scroll will handle the rest\n\t\t\toptionsElement.setAttribute('search', e.target.value);\n\t\t} else {\n\t\t\tlet value = e.target.value.trim().toLowerCase();\n\n\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\tif (option.textContent.trim().toLowerCase().includes(value)) {\n\t\t\t\t\toption.style.display = 'block';\n\t\t\t\t} else {\n\t\t\t\t\toption.style.display = 'none';\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.#updateEmptyState();\n\t\t}\n\t}\n\n\t#handleOptionsLoad = (e) => {\n\t\tthis.#remoteOptionsLoaded = true;\n\t\tthis.#isRemoteOptionsLoading = false;\n\n\t\tthis.selectedOptions.forEach((option) => {\n\t\t\tthis.getAllOptions().forEach((el) => {\n\t\t\t\tif (el.value === option.value) {\n\t\t\t\t\tel.selected = true;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t// Ensure values from the value attribute are (re)selected after lazy-loaded pages\n\t\tconst attrValue = this.getAttribute('value')?.split(' ') || [];\n\n\t\tattrValue.forEach(val => {\n\t\t\tconst existingOption = Array.from(this.getAllOptions()).find(el => el.value === val);\n\t\t\tif (existingOption) {\n\t\t\t\texistingOption.selected = true;\n\t\t\t}\n\t\t});\n\n\t\tthis.selectedOptions = this.#getSelectedOptions(this.selectedOptions);\n\t\tthis.selections(true);\n\t\tthis.#updateEmptyState();\n\t\tthis.#syncOptionOwners();\n\t\tthis.#portalOptions();\n\n\t\tthis.list.scrollTo(0, 0);\n\t\tevent.dispatchCustomEvent(this.popup, 'wje-popup:content-ready'); // Notify that the content is ready\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.#restorePortaledOptions();\n\t\tdocument.removeEventListener('mousedown', this.#onMenuItemClickCapture, true);\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tconst expanded = this.popup?.hasAttribute('active') || this.classList.contains('active');\n\t\tthis.setAriaState({\n\t\t\trole: 'combobox',\n\t\t\thaspopup: 'listbox',\n\t\t\texpanded,\n\t\t\tcontrols: this._ariaListId,\n\t\t\tdisabled: this.disabled,\n\t\t\trequired: this.required,\n\t\t\tinvalid: this.invalid || this.hasAttribute('invalid'),\n\t\t});\n\t}\n\n\t/**\n\t * Prevent closing the parent <wje-select>'s popup when a nested <wje-dropdown>\n\t * menu item is clicked. Closes only the dropdown that owns the clicked item.\n\t * This captures the event at the document level (useCapture=true) so it can\n\t * stop the global outside-click logic that would otherwise hide the select's popup.\n\t */\n\t#onMenuItemClickCapture = (e) => {\n\t\tconst target = (e.target);\n\t\tif (!target || !target.closest) return;\n\n\t\tconst menuItem = target.closest('wje-menu-item');\n\t\tif (!menuItem) return;\n\n\t\tconst dropdown = target.closest('wje-dropdown');\n\t\tif (dropdown && typeof dropdown.hide === 'function') {\n\t\t\tdropdown.hide();\n\t\t}\n\n\t\te.stopPropagation();\n\t}\n\n\t#syncPortalStyles = (e) => {\n\t\tconst container = e.detail?.container;\n\n\t\tif (!(container instanceof HTMLElement)) return;\n\n\t\tcontainer.setAttribute('data-wje-select-portal', '');\n\t\tthis.#copyPortalCustomProperties(container);\n\t\tthis.#portalOptions(container);\n\n\t\tif (container.querySelector('style[data-wje-select-portal-style]')) return;\n\n\t\tconst style = document.createElement('style');\n\t\tstyle.setAttribute('data-wje-select-portal-style', '');\n\t\tstyle.textContent = Select.portalStyles;\n\n\t\tcontainer.prepend(style);\n\t}\n\n\t#copyPortalCustomProperties(container) {\n\t\tconst style = getComputedStyle(this);\n\n\t\tfor (let i = 0; i < style.length; i++) {\n\t\t\tconst prop = style[i];\n\n\t\t\tif (prop.startsWith('--')) {\n\t\t\t\tcontainer.style.setProperty(prop, style.getPropertyValue(prop));\n\t\t\t}\n\t\t}\n\t}\n\n\t#syncOptionOwners() {\n\t\tthis.getAllOptions().forEach((option) => {\n\t\t\toption.ownerSelect = this;\n\t\t});\n\t}\n\n\t#portalOptions(container = this.popup?._portalContainer) {\n\t\tif (!(container instanceof HTMLElement)) return;\n\n\t\tconst list = container.querySelector('.list');\n\t\tif (!(list instanceof HTMLElement)) return;\n\n\t\tconst options = this.getAllOptions();\n\n\t\toptions.forEach((option) => {\n\t\t\tif (this.#portaledOptionRecords.some((record) => record.option === option)) return;\n\t\t\tif (!option.parentNode) return;\n\n\t\t\tconst placeholder = document.createComment('wje-select-portaled-option');\n\t\t\toption.parentNode.insertBefore(placeholder, option);\n\n\t\t\toption.ownerSelect = this;\n\t\t\toption.setAttribute('data-wje-select-portaled-option', '');\n\t\t\toption.addEventListener('wje-option:change', this.optionChange);\n\n\t\t\tthis.#portaledOptionRecords.push({ option, placeholder });\n\t\t\tlist.insertBefore(option, this.emptyState);\n\t\t});\n\t}\n\n\t#restorePortaledOptions = () => {\n\t\tif (this.#portaledOptionRecords.length === 0) return;\n\n\t\tthis.#portaledOptionRecords.forEach(({ option, placeholder }) => {\n\t\t\toption.removeEventListener('wje-option:change', this.optionChange);\n\t\t\toption.removeAttribute('data-wje-select-portaled-option');\n\n\t\t\tif (placeholder.parentNode) {\n\t\t\t\tplaceholder.parentNode.insertBefore(option, placeholder);\n\t\t\t\tplaceholder.remove();\n\t\t\t}\n\t\t});\n\n\t\tthis.#portaledOptionRecords = [];\n\t}\n\n\t#focusFindInput() {\n\t\tif (!this.hasAttribute('find') || !(this.findEl instanceof HTMLElement)) return;\n\n\t\trequestAnimationFrame(() => {\n\t\t\tconst input = this.findEl.input || this.findEl.shadowRoot?.querySelector('input');\n\n\t\t\tif (input instanceof HTMLElement) {\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\t#syncOptionCheckbox(option) {\n\t\tconst checkbox = option.querySelector('wje-checkbox[slot=\"check\"]');\n\t\tif (!checkbox) return;\n\n\t\tconst isSelected = option.hasAttribute('selected');\n\t\tcheckbox.checked = isSelected;\n\t\tif (isSelected) {\n\t\t\tcheckbox.setAttribute('checked', '');\n\t\t} else {\n\t\t\tcheckbox.removeAttribute('checked');\n\t\t}\n\t}\n}\n","import { Select } from \"./select.element.js\";\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAM,UAAN,MAAM,gBAAe,sBAAsB;AAAA,EA0DjD,cAAc;AACb,UAAK;AA3DA;AAoDN,sCAAgB,CAAA;AAChB,qCAAe,CAAA;AACf,+CAAyB,CAAA;AACzB,6CAAuB;AACvB,gDAA0B;AAyG1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,cAAc;AAAA,MACd,eAA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