@aceshooting/lyra-ui 32.1.0 → 33.0.0

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.
Files changed (202) hide show
  1. package/CHANGELOG.md +224 -1583
  2. package/README.md +12 -1
  3. package/custom-elements.slim.json +1 -0
  4. package/dist/accent-roles.css +1 -0
  5. package/dist/cli/migrate-wa.mjs +50 -48
  6. package/dist/cli/migration-contract.json.gz +0 -0
  7. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +1 -1
  8. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +10 -0
  9. package/dist/components/conversation/code-block/code-block-base.class.d.ts +3 -1
  10. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  11. package/dist/components/conversation/code-block/code-block-core.class.d.ts +1 -1
  12. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  13. package/dist/components/conversation/code-block/code-block.class.d.ts +3 -2
  14. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  15. package/dist/components/conversation/code-block/code-grammar-registry.d.ts +35 -0
  16. package/dist/components/conversation/code-block/code-grammar-registry.js +1 -0
  17. package/dist/components/conversation/model-select/model-select.class.d.ts +8 -7
  18. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +1 -1
  19. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +1 -1
  20. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +8 -7
  21. package/dist/components/data/table/table-support.d.ts +2 -3
  22. package/dist/components/data/table/table.class.d.ts +2 -1
  23. package/dist/components/data/timeline/timeline.class.d.ts +17 -6
  24. package/dist/components/data/timeline/timeline.class.js +2 -2
  25. package/dist/components/data/timeline/timeline.styles.js +1 -1
  26. package/dist/components/forms/catalog-picker-base.d.ts +14 -1
  27. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  28. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +4 -5
  29. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +1 -1
  30. package/dist/components/forms/code-editor/code-editor.class.d.ts +14 -5
  31. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  32. package/dist/components/forms/color-picker/color-picker.class.d.ts +18 -7
  33. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  34. package/dist/components/forms/combobox/combobox-option-html.js +1 -0
  35. package/dist/components/forms/combobox/combobox.class.d.ts +30 -9
  36. package/dist/components/forms/combobox/combobox.class.js +110 -21
  37. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  38. package/dist/components/forms/country-picker/country-picker.class.d.ts +4 -5
  39. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +4 -5
  40. package/dist/components/forms/date-picker/date-input.class.d.ts +14 -5
  41. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  42. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +10 -0
  43. package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
  44. package/dist/components/forms/icon-button/icon-button.class.d.ts +2 -1
  45. package/dist/components/forms/input/input-shared.d.ts +14 -5
  46. package/dist/components/forms/input/time-input.class.d.ts +15 -6
  47. package/dist/components/forms/input/time-input.styles.js +1 -1
  48. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +8 -7
  49. package/dist/components/forms/otp-input/otp-input.class.d.ts +4 -5
  50. package/dist/components/forms/otp-input/otp-input.styles.js +1 -1
  51. package/dist/components/forms/phone-input/phone-input.class.d.ts +14 -5
  52. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  53. package/dist/components/forms/radio/radio-group.class.d.ts +4 -5
  54. package/dist/components/forms/radio/radio-group.styles.js +1 -1
  55. package/dist/components/forms/radio/radio.class.js +2 -2
  56. package/dist/components/forms/select/select.class.d.ts +5 -6
  57. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -5
  58. package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
  59. package/dist/components/forms/slider/slider.class.d.ts +6 -5
  60. package/dist/components/forms/slider/slider.styles.js +1 -1
  61. package/dist/components/forms/textarea/textarea.class.d.ts +14 -5
  62. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +4 -5
  63. package/dist/components/forms/token-input/token-input.class.d.ts +10 -10
  64. package/dist/components/forms/token-input/token-input.class.js +1 -1
  65. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  66. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +4 -5
  67. package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
  68. package/dist/components/layout/menu/menu.class.d.ts +1 -1
  69. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +1 -1
  70. package/dist/components/layout/segmented/segmented.class.d.ts +2 -2
  71. package/dist/components/layout/stepper/step.class.d.ts +14 -1
  72. package/dist/components/layout/stepper/step.class.js +2 -2
  73. package/dist/components/media/file-input/file-input.class.d.ts +2 -1
  74. package/dist/components/media/file-input/file-input.class.js +1 -1
  75. package/dist/components/media/file-input/file-input.styles.js +1 -1
  76. package/dist/components/media/lightbox/lightbox-item.class.d.ts +10 -0
  77. package/dist/components/media/lightbox/lightbox-item.class.js +1 -1
  78. package/dist/components/media/lightbox/lightbox-source.js +1 -1
  79. package/dist/components/media/lightbox/lightbox-types.d.ts +4 -1
  80. package/dist/components/media/lightbox/lightbox.class.d.ts +42 -19
  81. package/dist/components/media/lightbox/lightbox.class.js +4 -3
  82. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  83. package/dist/components/overlays/context-menu/context-menu.class.d.ts +1 -1
  84. package/dist/components/overlays/dialog/dialog.class.d.ts +19 -3
  85. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  86. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  87. package/dist/components/overlays/drawer/drawer.class.d.ts +8 -2
  88. package/dist/components/overlays/drawer/drawer.class.js +1 -1
  89. package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -1
  90. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  91. package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
  92. package/dist/components/overlays/overlay/popover.class.js +1 -1
  93. package/dist/components/overlays/overlay/tooltip.class.d.ts +5 -0
  94. package/dist/components/overlays/overlay/tooltip.class.js +2 -2
  95. package/dist/components/overlays/toast/toast-item.class.d.ts +2 -2
  96. package/dist/components/overlays/toast/toast-item.styles.js +1 -1
  97. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +1 -1
  98. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +1 -1
  99. package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -1
  100. package/dist/components/utility/copy-button/copy-button.class.js +1 -1
  101. package/dist/components/utility/export-button/export-button.class.d.ts +1 -1
  102. package/dist/components/utility/icon/icon-library-bootstrap.d.ts +50 -0
  103. package/dist/components/utility/icon/icon-library-bootstrap.js +1 -0
  104. package/dist/components/utility/icon/icon-library-font-awesome.d.ts +68 -0
  105. package/dist/components/utility/icon/icon-library-font-awesome.js +1 -0
  106. package/dist/components/utility/known-date/known-date.class.d.ts +10 -0
  107. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +1 -1
  108. package/dist/components/utility/number-ticker/number-ticker.class.d.ts +10 -2
  109. package/dist/components/utility/number-ticker/number-ticker.class.js +1 -1
  110. package/dist/components/utility/tour/tour.class.d.ts +1 -1
  111. package/dist/framework-types.d.ts +1 -1
  112. package/dist/internal/accessibility-visibility.js +1 -1
  113. package/dist/internal/autoloader-manifest.js +1 -1
  114. package/dist/internal/declarative-overlay-action.js +1 -0
  115. package/dist/internal/default-strings/forms.generated.js +1 -1
  116. package/dist/internal/document-token-css.generated.js +10 -0
  117. package/dist/internal/document-tokens.generated.js +2 -11
  118. package/dist/internal/document-tokens.js +2 -2
  119. package/dist/internal/dom-guards.js +1 -1
  120. package/dist/internal/external-label-association.js +1 -0
  121. package/dist/internal/focus-navigation.js +1 -1
  122. package/dist/internal/form-control/chrome.styles.js +1 -1
  123. package/dist/internal/form-control-labels.js +1 -1
  124. package/dist/internal/localization-runtime.js +1 -1
  125. package/dist/internal/localization-types.d.ts +1 -1
  126. package/dist/internal/localization.js +1 -1
  127. package/dist/internal/lyra-element.d.ts +11 -2
  128. package/dist/internal/lyra-element.js +2 -2
  129. package/dist/internal/package-metadata.js +1 -1
  130. package/dist/internal/theme-observation.js +1 -1
  131. package/dist/lyra.d.ts +1 -1
  132. package/dist/lyra.js +1 -1
  133. package/dist/styles/tokens-root.css +1 -1
  134. package/dist/styles/utilities.css +1 -1
  135. package/dist/theme-core.css +1 -1
  136. package/dist/theme.css +1 -1
  137. package/llms/components/lr-checkbox-group.md +2 -2
  138. package/llms/components/lr-citation-badge.md +1 -1
  139. package/llms/components/lr-code-block-core.md +3 -1
  140. package/llms/components/lr-code-block.md +14 -0
  141. package/llms/components/lr-code-editor.md +2 -2
  142. package/llms/components/lr-color-picker.md +4 -4
  143. package/llms/components/lr-combobox.md +21 -5
  144. package/llms/components/lr-context-menu.md +1 -1
  145. package/llms/components/lr-copy-button.md +4 -3
  146. package/llms/components/lr-country-picker.md +2 -2
  147. package/llms/components/lr-currency-picker.md +2 -2
  148. package/llms/components/lr-date-input.md +1 -1
  149. package/llms/components/lr-date-picker.md +1 -1
  150. package/llms/components/lr-dialog.md +30 -2
  151. package/llms/components/lr-drawer.md +7 -1
  152. package/llms/components/lr-entity-chip.md +1 -1
  153. package/llms/components/lr-export-button.md +1 -1
  154. package/llms/components/lr-file-input.md +1 -1
  155. package/llms/components/lr-icon.md +96 -0
  156. package/llms/components/lr-input.md +2 -2
  157. package/llms/components/lr-lightbox.md +43 -17
  158. package/llms/components/lr-locale-picker.md +2 -2
  159. package/llms/components/lr-mention-popover.md +1 -1
  160. package/llms/components/lr-menu.md +1 -1
  161. package/llms/components/lr-model-select.md +4 -4
  162. package/llms/components/lr-native-time-input.md +2 -2
  163. package/llms/components/lr-number-input.md +2 -2
  164. package/llms/components/lr-number-ticker.md +7 -2
  165. package/llms/components/lr-otp-input.md +2 -2
  166. package/llms/components/lr-phone-input.md +2 -2
  167. package/llms/components/lr-popover.md +1 -1
  168. package/llms/components/lr-radio-group.md +2 -2
  169. package/llms/components/lr-segmented.md +1 -1
  170. package/llms/components/lr-select.md +3 -3
  171. package/llms/components/lr-selection-toolbar.md +1 -1
  172. package/llms/components/lr-signature-pad.md +2 -2
  173. package/llms/components/lr-slider.md +1 -1
  174. package/llms/components/lr-step.md +7 -1
  175. package/llms/components/lr-textarea.md +2 -2
  176. package/llms/components/lr-time-input.md +3 -3
  177. package/llms/components/lr-time-zone-picker.md +2 -2
  178. package/llms/components/lr-timeline.md +12 -5
  179. package/llms/components/lr-toast.md +1 -1
  180. package/llms/components/lr-token-input.md +10 -9
  181. package/llms/components/lr-tool-call-chip.md +1 -1
  182. package/llms/components/lr-tooltip.md +5 -0
  183. package/llms/components/lr-unit-picker.md +2 -2
  184. package/llms/components/lr-usage-badge.md +1 -1
  185. package/llms/components/lr-voice-picker.md +4 -3
  186. package/llms/index.md +115 -115
  187. package/llms/migration.md +87 -8
  188. package/llms/peers.md +2 -2
  189. package/llms/shared/forms-and-accessibility.md +4 -1
  190. package/llms/shared/frameworks-and-ssr.md +10 -1
  191. package/llms/shared/imports-and-registration.md +8 -1
  192. package/llms/shared/localization-and-rtl.md +5 -0
  193. package/llms/shared/native-styles-and-utilities.md +34 -5
  194. package/llms/shared/styles-and-tokens.md +58 -4
  195. package/llms/shared/testing-and-utilities.md +9 -0
  196. package/llms/shared.md +128 -12
  197. package/locales.json +1 -1
  198. package/package.json +14 -5
  199. package/registrations.json +1 -1
  200. package/skills/compose-lyra-interfaces/SKILL.md +1 -1
  201. package/skills/lyra-ui/SKILL.md +1 -1
  202. package/skills/lyra-ui/commands/migrate.md +1 -1
@@ -1,65 +1,154 @@
1
- import{__decorate}from"tslib";import{requestThenCommit}from"../../../internal/request-commit.js";import{VetoWriteGuard,markVetoGuardWrite}from"../../../internal/veto-write-guard.js";import{foldSearchText,prepareNeedle}from"../../../internal/search-haystack.js";import{observeValidatorAttributes,runFormValidators}from"../../../internal/form-validator-runtime.js";import{isCatalogOptionAvailable,shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{capOptionRows}from"../../../internal/option-selection.js";import{emitValueEvents}from"../../../internal/value-events.js";import{AutocorrectState,installNativeInputModeAliases,setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{formControlSupportingState,renderFormControlHintError}from"../../../internal/form-control-template.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId,srOnly}from"../../../internal/a11y.js";import{chevronIcon,closeIcon,spinnerIcon}from"../../../internal/icons.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{finiteCount,finiteDuration}from"../../../internal/numbers.js";import{OccurrenceQueue,OptionAdornmentCache,OptionCatalogMemo,SelectedWriteQueue,resolveMultipleSelectedWrites,resolveSingleSelectedWrite}from"../../../internal/option-catalog-host.js";import{PopupController,emitPopupEvent,outsidePressHandler}from"../../../internal/popup-controller.js";import{revealRow}from"../../../internal/reveal-row.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./combobox.styles.js";import{declaredDefaultConverter,autocorrectConverter,literalSetConverter,omittedEmptyStringConverter,spellcheckConverter,blankNumberConverter}from"../../../internal/converters.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{getFormOwner,isBarredFromValidation,isLiveDisabled,setFormOwner}from"../../../internal/form-associated.js";import{tag}from"../../../internal/prefix.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{isOptionSelectedDirty,isOptionSelectedWrite,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER,isOptionElement as isLyraOptionElement,normalizeSelectionValues}from"../../../internal/option-selection.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{bdi}from"../../../internal/bidi.js";import{DEV_DIAGNOSTICS,devWarnOnce}from"../../../internal/dev-warning.js";import{LYRA_DEFAULT_comboboxCreate,LYRA_DEFAULT_comboboxLabel,LYRA_DEFAULT_comboboxLoadError,LYRA_DEFAULT_comboboxOverflow,LYRA_DEFAULT_comboboxRequired,LYRA_DEFAULT_comboboxSelectedOverflow}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_retry,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();const COMBOBOX_COMMIT=literalSetConverter(["value","text"],"value"),APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),comboboxSpellcheckConverter={...spellcheckConverter,fromAttribute:(value,type)=>value===null?void 0:spellcheckConverter.fromAttribute?.(value,type)};function adornmentContent(value){return typeof value=="string"||typeof value=="number"?html`<span>${value}</span>`:value}const MAX_SOURCE_ROWS=2e3,MAX_SOURCE_TEXT_UNITS=25e4,MAX_SOURCE_FIELD_UNITS=4096,MAX_RENDER_ROWS=1e3,MAX_DATA_SOURCE_MARKUP_UNITS=MAX_SOURCE_TEXT_UNITS*4;function isElementLike(value){return typeof value=="object"&&value!==null&&value.nodeType===1&&typeof value.getAttribute=="function"}function rowFromOptionElement(element){const own=element.label,label=typeof own=="string"&&own!==""?own:element.getAttribute("label")??(element.textContent??"").trim(),value=element.getAttribute("value")??"";return{value,label:label||value,...element.hasAttribute("disabled")?{disabled:!0}:{}}}function dataSourceResultToRows(result,owner){if(typeof result=="string"){if(result.length>MAX_DATA_SOURCE_MARKUP_UNITS)throw new TypeError("Combobox dataSource markup exceeds the size limit");const parsed=new owner.DOMParser().parseFromString(result,"text/html");return Array.from(parsed.body.children).filter(element=>element.localName==="option"||element.localName.endsWith("-option")).map(rowFromOptionElement)}return Array.isArray(result)?result.map(item=>isElementLike(item)?rowFromOptionElement(item):item):result}function isRenderable(value,nested=!1){if(typeof value=="string"||typeof value=="number")return!0;if(typeof value!="object"||value===null)return!1;if(Array.isArray(value))return!nested&&value.every(item=>isRenderable(item,!0));const{nodeType,cloneNode,strings}=value;return typeof nodeType=="number"&&typeof cloneNode=="function"||Array.isArray(strings)&&Object.hasOwn(strings,"raw")}function normalizeSourceResult(input){let candidateRows,candidateTotal;try{Array.isArray(input)?candidateRows=input:typeof input=="object"&&input!==null&&(candidateRows=input.rows,candidateTotal=input.total)}catch{throw new TypeError("Invalid combobox source result")}if(!Array.isArray(candidateRows))throw new TypeError("Invalid combobox source result");const providerTotal=typeof candidateTotal=="number"&&Number.isFinite(candidateTotal)&&candidateTotal>=0?Math.trunc(candidateTotal):candidateRows.length,rows=[];let textUnits=0;const limit=Math.min(candidateRows.length,MAX_SOURCE_ROWS);for(let index=0;index<limit;index++)try{const value=candidateRows[index]?.value,label=candidateRows[index]?.label;if(typeof value!="string"||typeof label!="string"||value.length>MAX_SOURCE_FIELD_UNITS||label.length>MAX_SOURCE_FIELD_UNITS)continue;const source=candidateRows[index],optionalText=key=>{const candidate=source[key];return typeof candidate=="string"&&candidate.length<=MAX_SOURCE_FIELD_UNITS?candidate:void 0},content=key=>{const candidate=source[key];return isRenderable(candidate)?candidate:void 0},icon=content("icon"),start=content("start"),end=content("end"),sub=optionalText("sub"),accessibleLabel=optionalText("accessibleLabel"),dotColor=optionalText("dotColor"),title=optionalText("title"),group=optionalText("group"),badgeCandidate=source.badge,badge=typeof badgeCandidate=="string"&&badgeCandidate.length<=MAX_SOURCE_FIELD_UNITS||typeof badgeCandidate=="number"&&Number.isFinite(badgeCandidate)?badgeCandidate:void 0,units=value.length+label.length+(sub?.length??0)+(accessibleLabel?.length??0)+(dotColor?.length??0)+(title?.length??0)+(group?.length??0)+(typeof badge=="string"?badge.length:0);if(textUnits+units>MAX_SOURCE_TEXT_UNITS)break;textUnits+=units,rows.push({value,label,...sub===void 0?{}:{sub},...icon===void 0?{}:{icon},...start===void 0?{}:{start},...end===void 0?{}:{end},...badge===void 0?{}:{badge},...accessibleLabel===void 0?{}:{accessibleLabel},...source.data===void 0?{}:{data:source.data},...dotColor===void 0?{}:{dotColor},...title===void 0?{}:{title},...group===void 0?{}:{group},...typeof source.disabled=="boolean"?{disabled:source.disabled}:{}})}catch{}const total=Math.max(providerTotal,candidateRows.length);return{rows,total,truncated:total>rows.length}}class LyraCombobox extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,comboboxCreate:LYRA_DEFAULT_comboboxCreate,comboboxLabel:LYRA_DEFAULT_comboboxLabel,comboboxLoadError:LYRA_DEFAULT_comboboxLoadError,comboboxOverflow:LYRA_DEFAULT_comboboxOverflow,comboboxRequired:LYRA_DEFAULT_comboboxRequired,comboboxSelectedOverflow:LYRA_DEFAULT_comboboxSelectedOverflow,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,notInCatalog:LYRA_DEFAULT_notInCatalog,removeWithContext:LYRA_DEFAULT_removeWithContext,retry:LYRA_DEFAULT_retry,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change","lr-change-request"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":Object.freeze(["data"]),"lr-change-request":Object.freeze(["data"])})}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{converter:blankNumberConverter(3),attribute:"max-options-visible",noAccessor:!0},maxRender:{converter:blankNumberConverter(200),attribute:"max-render",noAccessor:!0},sourceDelay:{converter:blankNumberConverter(200),attribute:"source-delay",noAccessor:!0},filterDebounce:{converter:blankNumberConverter(200),attribute:"filter-debounce",noAccessor:!0},minQueryLength:{converter:blankNumberConverter(0),attribute:"min-query-length",noAccessor:!0}}}get open(){return this._open}set open(next){const old=this._open;if(this._open=!!next&&!this.readonly&&!isLiveDisabled(this)&&this.meetsMinimumQuery(this.query),this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",old)}get commit(){return this._commit}set commit(next){const normalized=COMBOBOX_COMMIT.normalizeReflected(this,"commit",next),old=this._commit;old!==normalized&&(this._commit=normalized,this.commitsText&&this._selected.includes("")&&this.setValue([],!1),this.requestUpdate("commit",old))}get appearance(){return this._appearance}set appearance(next){const normalized=APPEARANCE.normalizeReflected(this,"appearance",next),old=this._appearance;this._appearance=normalized,normalized!==old&&this.requestUpdate("appearance",old)}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){this.strategy.set(next)}get dataSource(){return this.dataSourceAdapter!==null&&this.source===this.dataSourceAdapter?this._dataSource:null}set dataSource(next){if(typeof next!="function"){this.dataSourceAdapter!==null&&this.source===this.dataSourceAdapter&&(this.source=null),this._dataSource=null,this.dataSourceAdapter=null;return}const provider=next,adapter=(query2,{signal})=>{const owner=this.ownerDocument.defaultView??window;return Promise.resolve(provider({query:query2,signal})).then(result=>dataSourceResultToRows(result,owner))};this._dataSource=provider,this.dataSourceAdapter=adapter,this.source=adapter}get currentOption(){if(!this.open||this.activeIndex<0||!this.listboxRendered)return;const row=this.navigableRows(this.renderedRows.rows)[this.activeIndex];return row&&!row.createInput&&row.unknownValue===void 0?this.sourceOptionsByRow.get(row):void 0}set currentOption(next){const navigable=this.open&&this.listboxRendered&&next?this.navigableRows(this.renderedRows.rows):[];this.activeIndex=navigable.findIndex(row=>this.sourceOptionsByRow.get(row)===next)}get serverRequests(){return this.server&&!this.source}get autocorrect(){return this.autocorrectState.value}set autocorrect(next){this.autocorrectState.set(next)}get inputValue(){return this.query}set inputValue(next){this.explicitInputValue=!0,this.query=next??"",this.activeIndex=-1,(this.source||this.serverRequests)&&this.runSource(this.query),this.requestUpdate()}get query(){return this._query}set query(next){const old=this._query;next!==old&&(this._query=next,this.requestUpdate("query",old),this.enforceMinimumQuery(!0))}constructor(){super(),this.placeholder="",this.label="",this.labelDisplay="visible",this.labelPlacement="top",this.hint="",this.helpText="",this.errorText="",this.allowCreate=!1,this.allowCustomValue=!1,this._commit="value",this.withUnknownOption=!1,this.loading=!1,this._appearance="outlined",this.placement="bottom",this.strategy=new PositioningStrategyState(this,"fixed"),this.topLayer=!1,this.size="m",this.pill=!1,this.clearable=!1,this.withClear=!1,this.withLabel=!1,this.withHint=!1,this.validators=[],this.autocomplete="off",this.inputMode="",this.enterKeyHint="",this.spellcheck=!1,this.autocapitalize="",this.autocorrectState=new AutocorrectState(this,!0),this.filter=null,this.source=null,this._dataSource=null,this.dataSourceAdapter=null,this.server=!1,this._query="",this.explicitInputValue=!1,this.textEdited=!1,this.activeIndex=-1,this.options=[],this.optionsObserved=!1,this.touched=!1,this.validityRevision=0,this.slotPresence=new SlotPresenceController(this),this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.sourceErrorAnnouncements=new AnnouncementSinkController(this,{eager:["assertive"]}),this.sourceDebounce=new DebounceController(0,request=>this.runSourceRequest(request),()=>this.ownerDocument.defaultView),this.sourceToken=0,this.refreshQueued=!1,this._sourceWarmed=!1,this._selectedLabelCache=new Map,this._selectedRowCache=new Map,this._renderedRows=[],this._open=!1,this._fieldsetDisabled=!1,this.listId=nextId("combobox-list"),this.inputId=nextId("combobox-input"),this.listboxPositioned=!1,this.positioningGeneration=0,this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this.restoringOverlayFocus=!1,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="listbox"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:outsidePressHandler(this,{overlay:()=>this.overlayHandle,dismiss:()=>{this.restoreFocusOnClose=!1,this.hide()}})}),this.listboxHidden=!0,this.listboxRendered=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.closeAfterPositioningFailure=!1,this.minimumQueryClosePending=!1,this.minimumQueryCloseUnpainted=!1,this.closeCleanupPending=!1,this._selected=[],this.multiplePreferences=[],this.sourceOptionsByRow=new WeakMap,this._valueDirty=!1,this._multiple=!1,this._disabled=!1,this._required=!1,this._readonly=!1,this._defaultSelected=[],this._defaultCaptured=!1,this.explicitDefault=!1,this._restoredStateActive=!1,this._name="",this._maxOptionsVisible=3,this._maxRender=200,this._sourceDelay=200,this._minQueryLength=0,this.localDescriptionIds="",this.selectionGuard=new VetoWriteGuard,this.requestingSelection=!1,this.previousSelection=[],this.loadingRowShown=!1,this.markInteracted=()=>{this.touched||(this.touched=!0,this.updateValidity(),this.syncCustomStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.callbackRefreshEpoch=0,this.memo=new OptionCatalogMemo,this.adornments=new OptionAdornmentCache,this.selectedWrites=new SelectedWriteQueue(writes=>{if(!this.isConnected)return;const members=this.optionIndex.members;if(this.multiple){const next=resolveMultipleSelectedWrites(this._selected,this.multipleOccurrences,writes,option=>members.has(option));this.setValue(next.values,!0,void 0,next.occurrences)}else{const{value,option}=resolveSingleSelectedWrite({value:this._selected[0],option:this.singleSelectedOption},writes,candidate=>members.has(candidate));this.setValue(value===void 0?[]:value,!0,option)}}),this.optionRefreshPending=!1,this.onOptionChange=e=>{e.stopPropagation();const option=e.composedPath().find(isLyraOptionElement);if(isOptionSelectedWrite(e)&&isLyraOptionElement(option)&&this.optionIndex.members.has(option)){this._valueDirty=!0,this._restoredStateActive=!1,markVetoGuardWrite(this.selectionGuard),this.selectedWrites.record(option,{selected:option.selected,value:option.value});return}isLyraOptionElement(option)&&this.adornments.refresh(option),!this.optionRefreshPending&&(this.optionRefreshPending=!0,queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.normalizeActiveIndex()}))},this.lastRenderedRows=[],this.onInput=e=>{isLiveDisabled(this)||this.readonly||(this.explicitInputValue=!1,this.textEdited=this.commitsText,this.query=e.target.value,this.activeIndex=-1,this.show(),(this.source||this.serverRequests)&&this.runSource(this.query),this.emit("lr-filter",{value:this.query}))},this.onInputBlur=event=>{isLiveDisabled(this)||(this.touched=!0),this.syncCustomStates(),this.onComboFocusOut(event),relayNativeEvent(this,event)},this.onComboFocusOut=event=>{const trigger=this.renderRoot.querySelector('[part="combobox"]'),target=event.relatedTarget;target&&typeof target.nodeType=="number"&&trigger?.contains(target)||(this.restoreFocusOnClose=!1,this.commitsText&&this.textEdited&&!isLiveDisabled(this)&&!this.readonly&&this.commitText(this.query),this.hide())},this.onInputFocus=event=>{if(isLiveDisabled(this)){event.stopPropagation();return}this.restoringOverlayFocus||this.show(),relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.defaultPrevented||shouldIgnoreNavigationKey(e)||isLiveDisabled(this)||this.readonly)return;const navigable=["ArrowDown","ArrowUp","Enter","End"].includes(e.key)?this.navigableRows(this.renderedRows.rows):[];switch(e.key){case"ArrowDown":case"ArrowUp":if(!this.meetsMinimumQuery(this.query))return;if(e.preventDefault(),!this.open){const selected=new Set(this.committed);this.activeIndex=navigable.findIndex(row=>selected.has(row.value)),this.show();return}if(e.key==="ArrowDown"){this.activeIndex=Math.min(navigable.length-1,this.activeIndex+1);break}this.activeIndex=Math.max(0,this.activeIndex-1);break;case"Enter":{const activeRow=navigable[this.activeIndex];if(this.open&&this.activeIndex>=0&&activeRow){e.preventDefault(),this.pickRow(activeRow);break}if(this.commitsText&&this.textEdited){const wasOpen=this.open;if(this.commitText(this.query),wasOpen){e.preventDefault();break}}const create=this.createRow;if(this.open&&create){e.preventDefault(),this.createOption(create.createInput);break}if(this.open&&this.allowCustomValue&&!this.multiple&&this.query.trim()){e.preventDefault(),this.commitCustomValue(this.query.trim());break}submitOnEnter(this,e);break}case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.activeIndex=0);break;case"End":this.open&&(e.preventDefault(),this.activeIndex=navigable.length-1);break;case"Backspace":this.multiple&&!this.query&&this._selected.length&&this.removeValueAt(this._selected.length-1);break}},this.onComboMouseDown=e=>{if(!isLiveDisabled(this)){if(e.composedPath()[0]===this.inputEl){this.renderRoot.activeElement===this.inputEl&&!this.open&&!this.readonly&&this.show();return}e.target.closest("button")||(e.preventDefault(),this.inputEl?.focus(),this.show())}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),row=this._renderedRows[Number(optionEl?.dataset.index)];row&&this.pickRow(row)},this.requestUpdate("commit",void 0),this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals,new GlassScrollLayer(this,'[part="listbox"]',()=>this.open)}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}get validationTarget(){return this.validationTargetOverride??this.inputEl??void 0}set validationTarget(next){this.validationTargetOverride=next??void 0,this.validityController.refreshAnchor()}resetValidity(){this.validityController.setCustomValidity(""),this.updateValidity()}get input(){return this.inputEl??null}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value)}get selectionDirection(){return this.inputEl?.selectionDirection}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value)}get interactionBarred(){return isLiveDisabled(this)||this.readonly}focus(options){this.deferFocusUntilRendered(options)||isLiveDisabled(this)||this.inputEl?.focus(options)}blur(){this.inputEl?.blur()}click(){isLiveDisabled(this)||(this.inputEl?.focus(),this.show())}select(){this.input?.select()}setSelectionRange(start,end,direction="none"){this.input?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputEl;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.explicitInputValue=!0,this.query=input.value,this.activeIndex=-1,(this.source||this.serverRequests)&&this.runSource(this.query))}[VALIDITY_ANCHOR](){return this.validationTarget}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot.querySelector('[part="combobox-input"]');target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.updateValidity(),this.hasUpdated&&this.syncValidatorAttributeObserver(),this.hasUpdated&&queueMicrotask(()=>{this.open?this.reconnectOpenPopup():this.source&&this._selected.length&&this.asyncRows.length===0&&this.runSource("")})}adoptedCallback(){super.adoptedCallback(),this.popupController.cancel(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.listboxPositioned=!1,this.invalidateListboxPositioning(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.clearSourceTimer(),this.sourceToken+=1,this.sourceLoading=!1,this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceErrorAnnouncements.adopted()}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this.enforceMinimumQuery(!1),this.announceOpenTransition(changed),this.open?(this.listboxHidden=!1,this.listboxRendered=!0):changed.has("open")&&this.interactionBarred&&(this.listboxHidden=!0),changed.has("open")&&!this.openVetoed&&(this.listboxPositioned=!1),changed.has("open")&&this.openVetoed?this.closeCleanupPending=!1:changed.has("open")&&!this.open&&this.finalizeCloseState(),changed.has("server")&&!this.source&&changed.get("server")!==void 0&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++),changed.has("source")&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++,this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],this.multiplePreferences=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this._sourceWarmed=!1,this.source&&this.open&&this.runSource(this.query)),!this._sourceWarmed&&this.source&&(this._selected.length>0||(this.pendingSelectedRowValues?.length??0)>0)&&this.asyncRows.length===0&&(this._sourceWarmed=!0,this.runSource(""))}firstUpdated(changed){super.firstUpdated(changed);const slot=this.optionsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>{this.optionsObserved=!0,s.assignedElements({flatten:!0}).some(isLyraOptionElement)&&this.collectOptionsFromSlot(s)})})}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),this.reflectSelected(),this.syncFormValue(),this.requestUpdate("multiple",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this._disabled&&this.hide(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly;this._readonly=!!next,this.toggleAttribute("readonly",this._readonly),this._readonly&&this.hide(),this.updateValidity(),this.requestUpdate("readonly",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this.setValue(next,!0)}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){const old=this.defaultValue;this.explicitDefault=!0;const values=normalizeSelectionValues(next);this._defaultSelected=this.multiple?values:values.slice(0,1),!this._valueDirty&&!this._restoredStateActive&&this.setValue(this._defaultSelected,!1),this.requestUpdate("defaultValue",old)}setValue(next,dirty,preferred,multiplePreferences=[]){markVetoGuardWrite(this.selectionGuard),this.selectedWrites.clear();const old=this._selected;this.previousSelection=old,this.singleSelectedOption=preferred,dirty&&(this._restoredStateActive=!1,this._valueDirty=!0);const values=normalizeSelectionValues(next);this._selected=this.commitsText?values.filter(value=>value!==""):values,this.multiplePreferences=multiplePreferences;const selected=new Set(this._selected);if(selected.size>0){const rows=this.rowsByValue(selected);for(const value of selected){const row=rows.get(value);row&&this._selectedRowCache.set(value,row)}}for(const value of this._selectedRowCache.keys())selected.has(value)||this._selectedRowCache.delete(value);for(const value of this._selectedLabelCache.keys())selected.has(value)||this._selectedLabelCache.delete(value);this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get maxRender(){return this._maxRender}get sourceDelay(){return this._sourceDelay}set sourceDelay(next){const old=this._sourceDelay;this._sourceDelay=finiteDuration(next,200),this.requestUpdate("sourceDelay",old)}get filterDebounce(){return this.sourceDelay}set filterDebounce(next){this.sourceDelay=next}get minQueryLength(){return this._minQueryLength}set minQueryLength(next){const old=this._minQueryLength;this._minQueryLength=finiteCount(next),this.enforceMinimumQuery(this.open||this.explicitInputValue),this.requestUpdate("minQueryLength",old)}meetsMinimumQuery(query2){const minimum=this._minQueryLength??0;if(minimum===0)return!0;const trimmed=query2.trim();let count=0;for(let index=0;index<trimmed.length;index+=trimmed.codePointAt(index)>65535?2:1)if(++count>=minimum)return!0;return!1}enforceMinimumQuery(preserveDraft){if(this.meetsMinimumQuery(this.query))return;this.clearSourceTimer();const abort=this.sourceAbort;this.sourceAbort=void 0;const token=++this.sourceToken;this.refreshQueued=!1,this.sourceLoading=!1,this.sourceFailed=!1,this.asyncRows.length&&(this.asyncRows=[]),this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,abort?.abort(),!(token!==this.sourceToken||this.meetsMinimumQuery(this.query))&&(this.closeCleanupPending=!1,preserveDraft&&(this.explicitInputValue=!0),this.minimumQueryClosePending||=this.open,this.open=!1,this.listboxHidden=!0,this.listboxRendered=!1,this.listboxPositioned=!1,this.popupController.cancel())}set maxRender(next){const old=this._maxRender;this._maxRender=Math.min(finiteCount(next,200),MAX_RENDER_ROWS),this.requestUpdate("maxRender",old)}get sourceTotal(){return this._sourceTotal}get sourceTruncated(){return this._sourceTruncated}get selectedRows(){return this.resolveSelectedRowSlots().filter(row=>row!=null).map(row=>{const option=this.sourceOptionsByRow.get(row);return{...row,...option?this.adornments.get(option):{}}})}resolveSelectedRowSlots(values=this.committed,proposed){if(values===this._selected&&this.multiple&&proposed===void 0)return this.multipleOccurrences.map((occurrence,index)=>this.rowForOccurrence(occurrence,values[index]));let rows;return values.map(value=>proposed?.value===value?proposed:!this.source&&!this.multiple&&this.singleSelectedOption?.value===value?this.rowForOption(this.singleSelectedOption,!1):this._selectedRowCache.get(value)??(rows??=this.rowsByValue(new Set(values))).get(value))}get multipleOccurrences(){const catalog=this.source?this.asyncRows:this.options;return this.memo.get("multipleOccurrences",[catalog,this._selected,this.multiplePreferences],()=>{if(!this._selected.length)return[];const requested=new Set(this._selected),queue=new OccurrenceQueue(catalog,row=>row.value,{accept:value=>requested.has(value)}),preferred=this._selected.map((value,index)=>{const occurrence=this.multiplePreferences[index];if(occurrence?.value!==value)return;if(queue.claim(occurrence))return occurrence;if(!this.source||isLyraOptionElement(occurrence))return;const match=queue.remaining(value).find(row=>row.label===occurrence.label&&Object.is(row.data,occurrence.data));return match&&queue.claim(match),match??occurrence});return this._selected.map((value,index)=>preferred[index]??queue.take(value))})}rowForOccurrence(occurrence,value){return isLyraOptionElement(occurrence)?this.rowForOption(occurrence,!1):occurrence??this._selectedRowCache.get(value)}get committed(){return this.multiple?this._selected:this._selected.slice(0,1)}rowsByValue(values){const rows=this.source?new Map:this.localRowsByValue(values,this.options);for(const row of this.asyncRows)values.has(row.value)&&!rows.has(row.value)&&rows.set(row.value,row);return rows}localRowsByValue(values,options){const rows=new Map;if(values.size===0)return rows;for(const option of options){const value=option.value;values.has(value)&&!rows.has(value)&&rows.set(value,this.rowForOption(option,!1))}return rows}set selectedRows(next){markVetoGuardWrite(this.selectionGuard);const values=[],seen=new Set;if(Array.isArray(next))for(const candidate of next){let value;try{value=candidate?.value}catch{continue}typeof value!="string"||seen.has(value)||(seen.add(value),values.push(value))}if(values.length>0&&!this.hasSelectionSourceRows){this.pendingSelectedRowValues=values,this.source&&this.isConnected&&(this._sourceWarmed=!0,this.runSource(""));return}this.pendingSelectedRowValues=void 0,this.applySelectedRowValues(values)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidatorAttributeObserver(){this.validatorAttributeObserver?.(),this.validatorAttributeObserver=this.isConnected?observeValidatorAttributes(this,this.validators,()=>{this.updateValidity(),this.validityRevision++}):void 0}updateValidity(){if(this.barredFromValidation){this.validityController.setValidity({}),this.syncCustomStates();return}const flags={};let message="";this.required&&this._selected.length===0&&(flags.valueMissing=!0,message=()=>this.localize("comboboxRequired"));const configured=runFormValidators(this.validators,this.value,this,()=>this.localize("valueInvalid"));configured.flags&&Object.assign(flags,configured.flags),configured.message&&(message=configured.message),this.validityController.setValidity(flags,message),this.syncCustomStates()}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",this._selected.length===0),setCustomState(this.internals,"disabled",this.effectiveDisabled),this.syncLoadingStates()}syncLoadingStates(){setCustomState(this.internals,"loading",this.loading||this.sourceLoading),setCustomState(this.internals,"showing-loading-row",this.loadingRowShown)}syncFormValue(){const state2=JSON.stringify(this._selected);if(this.multiple){if(!this.name){this.internals.setFormValue(null,state2);return}const fd=new FormData;for(const v of this._selected)fd.append(this.name,v);this.internals.setFormValue(fd,state2)}else this.internals.setFormValue(this._selected[0]??"",state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this.touched=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetValues=this.explicitDefault||this._defaultSelected.length>0?this._defaultSelected:this.options.filter(option=>wasOptionInitiallySelected(option)).map(option=>option.value);this._defaultSelected.length===0&&resetValues.length>0&&(this._defaultSelected=[...resetValues]);const defaultOptions=this.explicitDefault?[]:this.options.filter(option=>option.defaultSelected||wasOptionInitiallySelected(option));this.setValue(this.multiple?resetValues:resetValues.slice(0,1),!1,defaultOptions[0],defaultOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](option.selected);this.query="",this.explicitInputValue=!1,this.textEdited=!1}formStateRestoreCallback(state2,reason){let selected=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(value=>typeof value=="string")&&(selected=parsed)}catch{}this.assignValue(this.multiple?selected:selected.slice(0,1)),this._restoredStateActive=!0}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;const wasDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,wasDisabled!==this.effectiveDisabled&&(disabled&&this.hide(),this.updateValidity(),this.requestUpdate())}checkValidity(){return this.validityController.checkValidity(()=>this.updateValidity())}reportValidity(){return this.validityController.reportValidity(()=>{this.touched=!0,this.updateValidity(),this.syncCustomStates()})}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates()}disconnectedCallback(){markVetoGuardWrite(this.selectionGuard),this.selectedWrites.clear(),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),this.listboxPositioned=!1,this.validatorAttributeObserver?.(),this.validatorAttributeObserver=void 0,super.disconnectedCallback(),this.invalidateListboxPositioning(),this.clearSourceTimer(),this.sourceToken+=1,this.sourceLoading=!1,this.sourceAbort?.abort(),this.sourceAbort=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.open=!1}collectOptionsFromSlot(slot){const previous=new Set(this.options);if(this.optionsObserved=!0,this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.adornments.clear(),this.normalizeActiveIndex(),this.applyPendingSelectedRows(),this.explicitDefault){this.reflectSelected();return}if(this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=this._restoredStateActive?[]:[...this._valueDirty?[]:newDefaults,...newLive];if(eligible.length){if(this.multiple){const occurrences=this.multipleOccurrences,selected=new Set(occurrences),additions=eligible.filter(option=>!selected.has(option));this.setValue([...this._selected,...additions.map(option=>option.value)],newLive.length>0,void 0,[...occurrences,...additions])}else{const newest=eligible[eligible.length-1];this.setValue(newest.value,newLive.length>0,newest)}return}}else{this._defaultCaptured=!0;const allDefaults=this.options.filter(option=>option.defaultSelected),allLive=this.options.filter(option=>option.selected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);this._defaultSelected=(defaults.length>0?defaults:initialLive.length>0?initialLive:live).map(option=>option.value);const fromDefaults=defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.length>0?dirtySelected.slice(-1):live:fromDefaults?defaults:live;if(initial.length&&!this._restoredStateActive&&!this._valueDirty){this.setValue(initial.map(option=>option.value),!fromDefaults||optionDirty,initial[0],initial);return}optionDirty&&(this._valueDirty=!0)}this.reflectSelected()}refreshOptionDefaults(){if(this.explicitDefault)return;const declared=this.options.filter(option=>option.defaultSelected);this._defaultSelected=(this.multiple?declared:declared.slice(0,1)).map(option=>option.value),!this._valueDirty&&!this._restoredStateActive&&this.setValue(this._defaultSelected,!1,declared[0],declared)}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}get selectedLabels(){return this.memo.get("selectedLabels",[this._selected,this.options,this.asyncRows,this.source,this.sourceEverSettled,this.optionsObserved,this.getUnknownLabel,this.loading,this.effectiveLocale,this.strings,this.callbackRefreshEpoch],()=>getListFormat(this.effectiveLocale,{type:"unit"}).format(this._selected.map((value,index)=>this.labelFor(value,index))))}get optionIndex(){return this.memo.get("index",[this.options],()=>{const values=new Map;for(const option of this.options)values.has(option.value)||values.set(option.value,option);return{values,members:new Set(this.options)}})}get asyncIndex(){return this.memo.get("asyncIndex",[this.asyncRows],()=>{const values=new Map;for(const row of this.asyncRows)values.has(row.value)||values.set(row.value,row);return values})}get searchCorpus(){return this.memo.get("corpus",[this.options,this.effectiveLocale],()=>this.options.map(option=>({label:foldSearchText(option.label,this.effectiveLocale),search:foldSearchText(option.searchText,this.effectiveLocale),value:foldSearchText(option.value,this.effectiveLocale)})))}reflectSelected(){const value=this._selected[0],first=this.multiplePreferences[0];!this.multiple&&isLyraOptionElement(first)&&first.value===value&&this.optionIndex.members.has(first)&&(this.singleSelectedOption=first),(!this.singleSelectedOption||!this.optionIndex.members.has(this.singleSelectedOption)||this.singleSelectedOption.value!==value)&&(this.singleSelectedOption=value===void 0?void 0:this.optionIndex.values.get(value));const selected=this.multiple?new Set(this._selected):void 0;for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](selected?selected.has(option.value):option===this.singleSelectedOption)}labelFor(value,occurrenceIndex){if(this.commitsText)return value;const nonBlank=label=>label!==void 0&&label.trim().length>0?label:void 0;if(this.getUnknownLabel&&this.isUnknownValue(value)){const override=nonBlank(this.getUnknownLabel(value));if(override!==void 0)return override}return(occurrenceIndex===void 0?void 0:nonBlank(this.multipleOccurrences[occurrenceIndex]?.label))??(!this.source&&!this.multiple&&this.singleSelectedOption?.value===value?nonBlank(this.singleSelectedOption.label):void 0)??nonBlank(this._selectedLabelCache.get(value))??nonBlank(this.optionIndex.values.get(value)?.label)??nonBlank(this.asyncIndex.get(value)?.label)??(this.loading||this.source&&!this.sourceEverSettled?this.statusText("loading",this.loadingText):void 0)??value}isUnknownValue(value){return this.commitsText||!this.source&&!this.optionsObserved||this.loading||this.source&&!this.sourceEverSettled?!1:!(!this.source&&!this.multiple&&this.singleSelectedOption?.value===value||this._selectedLabelCache.has(value)||this.optionIndex.values.has(value)||this.asyncIndex.has(value))}rowForOption(option,withAdornments=!0){const adornments=withAdornments?this.adornments.get(option):{},row={value:option.value,label:option.label||option.value,sub:option.sub||void 0,dotColor:option.dotColor||void 0,title:option.title||void 0,group:option.group||void 0,disabled:!isCatalogOptionAvailable(option,this),data:option.data,...adornments.start===void 0?{}:{start:adornments.start},...adornments.end===void 0?{}:{end:adornments.end}};return this.sourceOptionsByRow.set(row,option),row}get hasSelectionSourceRows(){return(this.source?this.asyncRows.length:this.options.length)>0}applySelectedRowValues(values){const requested=new Set(values),rowsByValue=this.source?this.rowsByValue(requested):this.localRowsByValue(requested,this.options),rows=values.map(value=>rowsByValue.get(value)).filter(row=>row!==void 0),limited=this.multiple?rows:rows.slice(0,1);this.assignValue(limited.map(row=>row.value));for(const row of limited)this._selectedRowCache.set(row.value,row)}applyPendingSelectedRows(acceptEmptySource=!1){if(this.pendingSelectedRowValues===void 0||!acceptEmptySource&&!this.hasSelectionSourceRows)return!1;const values=this.pendingSelectedRowValues;return this.pendingSelectedRowValues=void 0,this.applySelectedRowValues(values),!0}get unknownRows(){if(!this.withUnknownOption)return[];const locale=this.effectiveLocale,query2=prepareNeedle(this.query,locale);return this.committed.flatMap(value=>this.isUnknownValue(value)?[{value,label:this.labelFor(value),badge:this.localize("notInCatalog"),unknownValue:value}]:[]).filter(row=>!query2||foldSearchText(row.label,locale).includes(query2)||foldSearchText(row.value,locale).includes(query2))}get createRow(){if(!this.allowCreate)return;const inputValue=this.query.trim();if(!inputValue)return;const locale=this.effectiveLocale,folded=foldSearchText(inputValue,locale);if(!(this.source?this.memo.get("asyncExact",[this.asyncRows,locale],()=>new Set(this.asyncRows.flatMap(row=>[foldSearchText(row.value,locale),foldSearchText(row.label,locale)]))).has(folded):this.searchCorpus.some(row=>row.value===folded||row.label===folded)))return{value:inputValue,label:this.localize("comboboxCreate",void 0,{value:inputValue}),createInput:inputValue}}capRows(all,activeValue){const occurrences=this.multiple?this.multipleOccurrences:void 0;return this.memo.get("capRows",[all,this.maxRender,this._selected,occurrences,activeValue],()=>{const selected=new Set(this.committed),selectedOccurrences=new Set(occurrences),retained=occurrences?all.filter(row=>selectedOccurrences.has(row)):all.filter(row=>selected.has(row.value)),active=activeValue===void 0?void 0:all.find(row=>row.value===activeValue);return capOptionRows(all,this.maxRender,active?[active,...retained]:retained)})}navigableRows(rows){return this.memo.get("navigableRows",[rows],()=>rows.filter(row=>!row.disabled))}get renderedRows(){const active=this.navigableRows(this.lastRenderedRows)[this.activeIndex]?.value,result=this.memo.get("renderedRows",[this.callbackRefreshEpoch,this.options,this.asyncRows,this.source,this.query,this._selected,this.multiple,this.multiplePreferences,this.maxRender,this._sourceTotal,this.withUnknownOption,this.allowCreate,this.filter,this.server,this.getUnknownLabel,this.loading,this.sourceEverSettled,this.effectiveLocale,this.strings,active],()=>this.computeRenderedRows(active));return this.lastRenderedRows=result.rows,result}computeRenderedRows(active){let rows,overflow;if(this.source){const capped=this.capRows(this.asyncRows,active);rows=[...capped.rows],overflow=capped.overflow,overflow+=Math.max(0,this._sourceTotal-this.asyncRows.length)}else{const capped=this.capRows(this.filtered,active);rows=capped.rows.map(option=>this.rowForOption(option)),overflow=capped.overflow}const create=this.createRow;rows.push(...this.unknownRows),create&&rows.push(create);const selected=new Set(this.committed),retained=rows.filter(row=>selected.has(row.value)),activeRow=rows.find(row=>row.value===active),bounded=capOptionRows(rows,MAX_RENDER_ROWS,activeRow?[activeRow,...retained]:retained);return{rows:bounded.rows,overflow:overflow+bounded.overflow}}normalizeActiveIndex(){if(this.activeIndex<0)return;const navigableCount=this.navigableRows(this.renderedRows.rows).length,next=navigableCount>0?Math.min(this.activeIndex,navigableCount-1):-1;next!==this.activeIndex&&(this.activeIndex=next)}get filtered(){if(this.server)return this.options;const locale=this.effectiveLocale,q=this.filter?this.query.trim().toLocaleLowerCase(locale):prepareNeedle(this.query,locale),selectedLabel=this.multiple?"":this.labelFor(this._selected[0]??"")??"",foldedLabel=this.filter?selectedLabel.toLocaleLowerCase(locale):foldSearchText(selectedLabel,locale),effective=q===foldedLabel?"":q;return effective?this.memo.get("filtered",[this.options,this.filter,effective,locale,this.callbackRefreshEpoch],()=>{const filter=this.filter;if(filter)return this.options.filter(option=>filter(option,effective));const corpus=this.searchCorpus;return this.options.filter((_option,index)=>corpus[index].label.includes(effective)||corpus[index].search.includes(effective))}):this.options}get commitsText(){return this.commit==="text"&&!this.multiple}get displayValue(){return this.multiple||this.open||this.explicitInputValue?this.query:this._selected[0]?this.labelFor(this._selected[0]):""}announceOpenTransition(changed){this.openVetoed=!1,this.minimumQueryCloseUnpainted=!1;const minimumClose=this.minimumQueryClosePending;if(this.minimumQueryClosePending=!1,minimumClose&&!this.open)if(!this._isFirstUpdate&&changed.has("open")&&changed.get("open")===!0&&this.isConnected){if(emitPopupEvent(this,"lr-hide",!1),!this.open)return}else{this.minimumQueryCloseUnpainted=!0;return}const closeAfterPositioningFailure=!this.open&&this.closeAfterPositioningFailure;if(this.closeAfterPositioningFailure=!1,!(!changed.has("open")||this._isFirstUpdate||!this.open&&this.interactionBarred)){if(!this.isConnected||closeAfterPositioningFailure){emitPopupEvent(this,"lr-hide",!1);return}this.openVetoed=this.popupController.announce(this.open,()=>{this.open=!this.open})}}show(){if(this.open||this.interactionBarred)return Promise.resolve();const committedText=this._selected[0]??"";if(this.commitsText&&!this.textEdited&&!this.explicitInputValue&&this.query!==committedText&&(this.query=committedText,(this.source||this.serverRequests)&&this.runSource(this.query)),!this.meetsMinimumQuery(this.query))return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,this.open||this.popupController.release("lr-after-show"),settled}hide(){if(!this.open)return Promise.resolve();const settled=this.popupController.wait(!1);return this.closeCleanupPending=!0,this.open=!1,settled}finalizeCloseState(){if(this.closeCleanupPending&&(this.closeCleanupPending=!1,this.activeIndex=-1,!this.multiple)){const queryChanged=this.query!=="";this.query="",this.explicitInputValue=!1,this.textEdited=!1,queryChanged&&this.source&&(this.asyncRows=[],this.sourceFailed=!1,this._sourceTotal=0,this._sourceTruncated=!1)}}activateListboxOverlay(){this.invalidateListboxPositioning(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.inputEl??null}),this.popupController.bindPointer(),this.beginListboxPositioning()}beginListboxPositioning(){const anchor=this.renderRoot.querySelector('[part="combobox"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');if(anchor&&listbox){const generation=this.positioningGeneration;this.positioningReady=new Promise(resolve=>{this.resolvePositioningReady=resolve}),this.startListboxPositioning(generation,anchor,listbox)}}invalidateListboxPositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0,this.resolvePositioningReady?.(!1),this.resolvePositioningReady=void 0}resolveCurrentPositioning(positioned){const resolve=this.resolvePositioningReady;this.resolvePositioningReady=void 0,resolve?.(positioned)}async startListboxPositioning(generation,anchor,listbox){try{const runtime=await loadAnchoredOverlayRuntime(),{place}=runtime;if(generation!==this.positioningGeneration||!this.open||!this.isConnected||this.renderRoot.querySelector('[part="combobox"]')!==anchor||this.renderRoot.querySelector('[part="listbox"]')!==listbox)return;this.placedTopLayer=syncTopLayerRelease(listbox,this.placedTopLayer,this.topLayer,runtime);const cleanup=place(anchor,listbox,{placement:`${this.placement}-start`,...topLayerPlacement(this.topLayer,resolveEffectivePositioningStrategy(this,this.strategy.authored,"fixed")),sync:this.sync,onPlaced:()=>{generation===this.positioningGeneration&&(this.listboxPositioned=!0,this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveCurrentPositioning(!0)}))}});generation!==this.positioningGeneration?cleanup():this.cleanup=cleanup}catch{if(generation!==this.positioningGeneration||!this.open)return;this.resolveCurrentPositioning(!1),this.closeAfterPositioningFailure=!0,this.hide()}}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.invalidateListboxPositioning(),this.restoringOverlayFocus=restoreFocus;try{this.overlayHandle?.deactivate({restoreFocus})}finally{this.restoringOverlayFocus=!1}this.overlayHandle=void 0,this.popupController.unbindPointer(),this.restoreFocusOnClose=!0}reconnectOpenPopup(){!this.isConnected||!this.open||(this.activateListboxOverlay(),this.source&&this.asyncRows.length===0&&this.runSource(this.query))}syncVisibleOptionsCap(){const listbox=this.renderRoot?.querySelector('[part="listbox"]');if(!listbox)return;const clear=()=>{listbox.style.removeProperty("max-block-size")},requested=typeof this.visibleOptions=="number"?finiteCount(this.visibleOptions,0):0;if(requested<=0)return clear();const rows=listbox.querySelectorAll('[part="option"]');if(rows.length<=requested)return clear();const boundary=rows[requested];if(!boundary)return clear();const cap=boundary.getBoundingClientRect().top-listbox.getBoundingClientRect().top;if(!Number.isFinite(cap)||cap<=0)return clear();listbox.style.setProperty("max-block-size",`min(${Math.ceil(cap)}px, var(--lr-positioner-available-block-size, var(--lr-size-18rem)))`)}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.syncLoadingStates(),(changed.has("visibleOptions")||changed.has("open")||changed.has("query")||changed.has("options")||changed.has("asyncRows")||changed.has("maxRender")||changed.has("value")||changed.has("listboxPositioned")||changed.has("strings")||changed.has("lang")||changed.has("size")||changed.has("filter")||changed.has("allowCreate")||changed.has("withUnknownOption"))&&this.syncVisibleOptionsCap(),changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),this._isFirstUpdate||this.settleTransition("lr-after-show"),this.refreshQueued?(this.refreshQueued=!1,this.runSource(this.query)):this.source&&this.asyncRows.length===0?this.runSource(this.query):this.serverRequests&&queueMicrotask(()=>{this.open&&this.serverRequests&&this.runSource(this.query,{immediate:!0})})):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),this.interactionBarred||this.minimumQueryCloseUnpainted?this.popupController.cancel():this._isFirstUpdate||this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed&&(this.restoreFocusOnClose=!0),changed.has("topLayer")&&!changed.has("open")&&this.open&&this.isConnected&&(this.invalidateListboxPositioning(),this.beginListboxPositioning()),changed.has("name")&&this.syncFormValue(),changed.has("validators")&&(this.updateValidity(),this.syncValidatorAttributeObserver()),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("validators")||changed.has("validityRevision"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("activeIndex")||changed.has("listboxPositioned")){const listbox=this.renderRoot.querySelector('[part="listbox"]'),row=listbox?.querySelector('[part="option"][data-active]');listbox&&row&&revealRow(listbox,row)}}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{for(;this.open&&!this.listboxPositioned;){const readiness=this.positioningReady,positioned=await readiness;if(stale())return!1;if(positioned)break;if(readiness===this.positioningReady)return!1}return!0},conceal:()=>{this.listboxHidden=!0,this.listboxRendered=!1}})}emitValueEvents(rowData){const self=this,data=rowData?[...rowData]:this.resolveSelectedRowSlots().map(row=>row?.data),previousValue=this.multiple?[...this.previousSelection]:this.previousSelection[0]??"",detail={value:self.value,previousValue,data};emitValueEvents(self,"input",detail,detail2=>self.emit("lr-input",detail2)),emitValueEvents(self,"change",detail,detail2=>self.emit("lr-change",detail2))}assignValue(next){this.value=next}acceptsSelection(values,row,occurrences){if(this.requestingSelection)return!1;const self=this,{multiple,open,source,sourceToken}=this,data=(occurrences?occurrences.map((occurrence,index)=>this.rowForOccurrence(occurrence,values[index])):this.resolveSelectedRowSlots(values,row)).map(option2=>option2?.data),option=row&&this.sourceOptionsByRow.get(row);let accepted=!1;this.requestingSelection=!0;try{requestThenCommit({requestDetail:{value:multiple?values:values[0]??"",previousValue:self.value,data},emitRequest:(detail,init)=>self.emit("lr-change-request",detail,init),guard:this.selectionGuard,commit:()=>{this.interactionBarred||this.multiple!==multiple||this.open!==open||this.source!==source||this.sourceToken!==sourceToken||option&&(!this.renderRoot.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).includes(option)||!isCatalogOptionAvailable(option,this)||option.value!==row?.value||!Object.is(option.data,row?.data))||(accepted=!0)}})}finally{this.requestingSelection=!1}return accepted}createOption(inputValue){if(isLiveDisabled(this)||this.readonly||this.emit("lr-create",{inputValue},{cancelable:!0}).defaultPrevented||isLiveDisabled(this)||this.readonly||!this.allowCreate)return;const option=this.ownerDocument.createElement(tag("option"));option.setAttribute("value",inputValue),option.textContent=inputValue,this.pickRow({value:inputValue,label:inputValue},option)}commitCustomValue(inputValue){if(isLiveDisabled(this)||this.readonly||this.multiple||!inputValue)return;const selectionChanged=this._selected[0]!==inputValue;selectionChanged&&!this.acceptsSelection([inputValue])||(this.touched=!0,this._selectedLabelCache.set(inputValue,inputValue),this.assignValue(inputValue),this.query="",this.explicitInputValue=!1,this.hide(),selectionChanged&&this.emitValueEvents())}commitText(text,row){const changed=(this._selected[0]??"")!==text,values=text?[text]:[];changed&&!this.acceptsSelection(values,void 0,row&&[row])||(this.touched=!0,this.assignValue(values),this.query="",this.explicitInputValue=!1,this.textEdited=!1,this.hide(),changed&&this.emitValueEvents(row&&[row.data]))}pickRow(row,createdOption){const sourceOption=this.sourceOptionsByRow.get(row);if(isLiveDisabled(this)||this.readonly||row.disabled||sourceOption&&!isCatalogOptionAvailable(sourceOption,this))return;if(row.createInput!==void 0){this.createOption(row.createInput);return}if(this.commitsText){this.commitText(row.label,row),this.emit("lr-activate",{value:row.value});return}const values=this.multiple?[...new Set(this._selected)]:[row.value],index=this.multiple?values.indexOf(row.value):-1;let occurrences;if(this.multiple){const selected=this.multipleOccurrences,firstOccurrenceByValue=new Map;for(const[position,value]of this._selected.entries())firstOccurrenceByValue.has(value)||firstOccurrenceByValue.set(value,selected[position]);occurrences=values.map(value=>firstOccurrenceByValue.get(value)),index>=0?(values.splice(index,1),occurrences.splice(index,1)):(values.push(row.value),occurrences.push(sourceOption??row))}const changed=this.multiple||this._selected[0]!==row.value;if(!(changed&&!this.acceptsSelection(values,row,occurrences))){if(createdOption){if(!this.allowCreate)return;this.append(createdOption),occurrences&&(occurrences[occurrences.length-1]=createdOption)}this.touched=!0,index>=0&&!values.includes(row.value)?this._selectedRowCache.delete(row.value):index<0&&row.unknownValue===void 0&&(this._selectedLabelCache.set(row.value,row.label),this.multiple||this._selectedRowCache.clear(),this._selectedRowCache.set(row.value,row)),this.setValue(values,!0,sourceOption,occurrences),this.query="",this.explicitInputValue=!1,this.multiple||this.hide(),(this.source||this.serverRequests)&&this.runSource(this.query),changed&&this.emitValueEvents(),this.emit("lr-activate",{value:row.value})}}removeValueAt(index){if(isLiveDisabled(this)||this.readonly||index<0||index>=this._selected.length)return;const next=this._selected.filter((_,i)=>i!==index),occurrences=this.multipleOccurrences.filter((_,i)=>i!==index);this.acceptsSelection(next,void 0,occurrences)&&(this.touched=!0,this.setValue(next,!0,void 0,occurrences),this.emitValueEvents())}clear(){if(isLiveDisabled(this)||this.readonly)return;const hadSelection=this._selected.length>0,queryChanged=this.query!=="";!hadSelection&&!queryChanged||hadSelection&&!this.acceptsSelection([])||(hadSelection&&(this.touched=!0,this.assignValue([])),this.query="",this.explicitInputValue=!1,this.textEdited=!1,(this.source||this.serverRequests)&&this.runSource(this.query),hadSelection&&(this.emitValueEvents(),this.emit("lr-clear")),queryChanged&&this.emit("lr-filter",{value:this.query}))}refresh(){if(!(!this.source&&!this.serverRequests)){if(!this.open){this.refreshQueued=!0;return}this.refreshQueued=!1,this.runSource(this.query,{immediate:!0})}}reload(){this.refresh()}runSource(query2,options){const source=this.source;if(!source&&!this.serverRequests)return;if(!this.meetsMinimumQuery(query2)||!this.meetsMinimumQuery(this.query)){this.enforceMinimumQuery(!1);return}this.clearSourceTimer();const abort=this.sourceAbort;this.sourceAbort=void 0;const token=++this.sourceToken;if(abort?.abort(),token!==this.sourceToken||source!==this.source||!this.meetsMinimumQuery(this.query))return;const ownerWindow=this.ownerDocument.defaultView;if(!this.isConnected||!ownerWindow)return;const request={query:query2,token,owner:ownerWindow,source};if(source||(this.loading=!0),options?.immediate){this.runSourceRequest(request);return}this.sourceDebounce.delayMs=this._sourceDelay,this.sourceDebounce.push(request)}runSourceRequest({query:query2,token,owner:ownerWindow,source}){const isCurrent=()=>token===this.sourceToken&&source===this.source&&(source!==null||this.server)&&this.meetsMinimumQuery(query2)&&this.meetsMinimumQuery(this.query)&&this.isConnected&&this.ownerDocument.defaultView===ownerWindow;if(!isCurrent())return;const controller=new ownerWindow.AbortController;if(this.sourceAbort=controller,!source){Promise.resolve().then(()=>{isCurrent()&&this.emit("lr-options-request",{query:query2,signal:controller.signal})});return}this.sourceLoading=!0,this.sourceFailed=!1,Promise.resolve().then(()=>{if(isCurrent()&&(this.emit("lr-options-request",{query:query2,signal:controller.signal}),!!isCurrent()))return source(query2,{signal:controller.signal,limit:MAX_SOURCE_ROWS})}).then(result=>{if(!isCurrent())return;const normalized=normalizeSourceResult(result);this._sourceTotal=normalized.total,this._sourceTruncated=normalized.truncated,this.asyncRows=normalized.rows,this.sourceFailed=!1,this.sourceEverSettled=!0,this.normalizeActiveIndex(),this.applyPendingSelectedRows(!0);const selected=new Set(this._selected);for(const row of normalized.rows)selected.has(row.value)&&this._selectedRowCache.set(row.value,row)}).catch(err=>{isCurrent()&&(this.sourceEverSettled=!0,this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this.sourceFailed=!0,this.sourceErrorAnnouncements.announceAssertive(this.localize("comboboxLoadError")),this.emit("lr-source-error",{error:err,query:query2}),this.emit("lr-options-error",{error:err,request:{query:query2}}),DEV_DIAGNOSTICS&&devWarnOnce("lr-combobox-source-rejected","<lr-combobox> source() rejected:",err))}).finally(()=>{token===this.sourceToken&&(this.sourceLoading=!1)})}clearSourceTimer(){this.sourceDebounce.cancel()}renderRows(rows,activeId){const out=[];let currentGroup,currentGroupRows=[],groupIndex=0;const selectedSet=new Set(this.committed),flushGroup=()=>{if(currentGroupRows.length){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
1
+ import{__decorate}from"tslib";import{requestThenCommit}from"../../../internal/request-commit.js";import{VetoWriteGuard,markVetoGuardWrite}from"../../../internal/veto-write-guard.js";import{foldSearchText,prepareNeedle}from"../../../internal/search-haystack.js";import{observeValidatorAttributes,runFormValidators}from"../../../internal/form-validator-runtime.js";import{isCatalogOptionAvailable,shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{capOptionRows}from"../../../internal/option-selection.js";import{emitValueEvents}from"../../../internal/value-events.js";import{AutocorrectState,installNativeInputModeAliases,setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{formControlSupportingState,renderFormControlHintError}from"../../../internal/form-control-template.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{sanitizeComboboxOptionHtml}from"./combobox-option-html.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId,srOnly}from"../../../internal/a11y.js";import{chevronIcon,closeIcon,spinnerIcon}from"../../../internal/icons.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{finiteCount,finiteDuration}from"../../../internal/numbers.js";import{OccurrenceQueue,OptionAdornmentCache,OptionCatalogMemo,SelectedWriteQueue,resolveMultipleSelectedWrites,resolveSingleSelectedWrite}from"../../../internal/option-catalog-host.js";import{PopupController,emitPopupEvent,outsidePressHandler}from"../../../internal/popup-controller.js";import{revealRow}from"../../../internal/reveal-row.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./combobox.styles.js";import{declaredDefaultConverter,autocorrectConverter,literalSetConverter,omittedEmptyStringConverter,spellcheckConverter,blankNumberConverter}from"../../../internal/converters.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{getFormOwner,isBarredFromValidation,isLiveDisabled,setFormOwner}from"../../../internal/form-associated.js";import{tag}from"../../../internal/prefix.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{isOptionSelectedDirty,isOptionSelectedWrite,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER,isOptionElement as isLyraOptionElement,normalizeSelectionValues}from"../../../internal/option-selection.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{bdi}from"../../../internal/bidi.js";import{DEV_DIAGNOSTICS,devWarnOnce}from"../../../internal/dev-warning.js";import{LYRA_DEFAULT_comboboxCreate,LYRA_DEFAULT_comboboxLabel,LYRA_DEFAULT_comboboxLoadError,LYRA_DEFAULT_comboboxOverflow,LYRA_DEFAULT_comboboxRequired,LYRA_DEFAULT_comboboxRichContentUnavailable,LYRA_DEFAULT_comboboxSelectedOverflow}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_retry,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();const COMBOBOX_COMMIT=literalSetConverter(["value","text"],"value"),APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),comboboxSpellcheckConverter={...spellcheckConverter,fromAttribute:(value,type)=>value===null?void 0:spellcheckConverter.fromAttribute?.(value,type)};function adornmentContent(value){return typeof value=="string"||typeof value=="number"?html`<span>${value}</span>`:value}const MAX_SOURCE_ROWS=2e3,MAX_SOURCE_TEXT_UNITS=25e4,MAX_SOURCE_FIELD_UNITS=4096,MAX_RENDER_ROWS=1e3,MAX_DATA_SOURCE_MARKUP_UNITS=MAX_SOURCE_TEXT_UNITS*4;function isElementLike(value){return typeof value=="object"&&value!==null&&value.nodeType===1&&typeof value.getAttribute=="function"}function rowFromOptionElement(element){const own=element.label,label=typeof own=="string"&&own!==""?own:element.getAttribute("label")??(element.textContent??"").trim(),value=element.getAttribute("value")??"";return{value,label:label||value,...element.hasAttribute("disabled")?{disabled:!0}:{}}}function dataSourceResultToRows(result,owner){if(typeof result=="string"){if(result.length>MAX_DATA_SOURCE_MARKUP_UNITS)throw new TypeError("Combobox dataSource markup exceeds the size limit");const parsed=new owner.DOMParser().parseFromString(result,"text/html");return Array.from(parsed.body.children).filter(element=>element.localName==="option"||element.localName.endsWith("-option")).map(rowFromOptionElement)}return Array.isArray(result)?result.map(item=>isElementLike(item)?rowFromOptionElement(item):item):result}function isRenderable(value,nested=!1){if(typeof value=="string"||typeof value=="number")return!0;if(typeof value!="object"||value===null)return!1;if(Array.isArray(value))return!nested&&value.every(item=>isRenderable(item,!0));const{nodeType,cloneNode,strings}=value;return typeof nodeType=="number"&&typeof cloneNode=="function"||Array.isArray(strings)&&Object.hasOwn(strings,"raw")}function normalizeSourceResult(input){let candidateRows,candidateTotal;try{Array.isArray(input)?candidateRows=input:typeof input=="object"&&input!==null&&(candidateRows=input.rows,candidateTotal=input.total)}catch{throw new TypeError("Invalid combobox source result")}if(!Array.isArray(candidateRows))throw new TypeError("Invalid combobox source result");const providerTotal=typeof candidateTotal=="number"&&Number.isFinite(candidateTotal)&&candidateTotal>=0?Math.trunc(candidateTotal):candidateRows.length,rows=[];let textUnits=0;const limit=Math.min(candidateRows.length,MAX_SOURCE_ROWS);for(let index=0;index<limit;index++)try{const value=candidateRows[index]?.value,label=candidateRows[index]?.label;if(typeof value!="string"||typeof label!="string"||value.length>MAX_SOURCE_FIELD_UNITS||label.length>MAX_SOURCE_FIELD_UNITS)continue;const source=candidateRows[index],optionalText=key=>{const candidate=source[key];return typeof candidate=="string"&&candidate.length<=MAX_SOURCE_FIELD_UNITS?candidate:void 0},content=key=>{const candidate=source[key];return isRenderable(candidate)?candidate:void 0},icon=content("icon"),start=content("start"),end=content("end"),sub=optionalText("sub"),markup=optionalText("html"),accessibleLabel=optionalText("accessibleLabel"),dotColor=optionalText("dotColor"),title=optionalText("title"),group=optionalText("group"),badgeCandidate=source.badge,badge=typeof badgeCandidate=="string"&&badgeCandidate.length<=MAX_SOURCE_FIELD_UNITS||typeof badgeCandidate=="number"&&Number.isFinite(badgeCandidate)?badgeCandidate:void 0,units=value.length+label.length+(sub?.length??0)+(markup?.length??0)+(accessibleLabel?.length??0)+(dotColor?.length??0)+(title?.length??0)+(group?.length??0)+(typeof badge=="string"?badge.length:0);if(textUnits+units>MAX_SOURCE_TEXT_UNITS)break;textUnits+=units,rows.push({value,label,...sub===void 0?{}:{sub},...markup===void 0?{}:{html:markup},...icon===void 0?{}:{icon},...start===void 0?{}:{start},...end===void 0?{}:{end},...badge===void 0?{}:{badge},...accessibleLabel===void 0?{}:{accessibleLabel},...source.data===void 0?{}:{data:source.data},...dotColor===void 0?{}:{dotColor},...title===void 0?{}:{title},...group===void 0?{}:{group},...typeof source.disabled=="boolean"?{disabled:source.disabled}:{}})}catch{}const total=Math.max(providerTotal,candidateRows.length);return{rows,total,truncated:total>rows.length}}class LyraCombobox extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,comboboxCreate:LYRA_DEFAULT_comboboxCreate,comboboxLabel:LYRA_DEFAULT_comboboxLabel,comboboxLoadError:LYRA_DEFAULT_comboboxLoadError,comboboxOverflow:LYRA_DEFAULT_comboboxOverflow,comboboxRequired:LYRA_DEFAULT_comboboxRequired,comboboxRichContentUnavailable:LYRA_DEFAULT_comboboxRichContentUnavailable,comboboxSelectedOverflow:LYRA_DEFAULT_comboboxSelectedOverflow,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,notInCatalog:LYRA_DEFAULT_notInCatalog,removeWithContext:LYRA_DEFAULT_removeWithContext,retry:LYRA_DEFAULT_retry,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change","lr-change-request"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":Object.freeze(["data"]),"lr-change-request":Object.freeze(["data"])})}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{converter:blankNumberConverter(3),attribute:"max-options-visible",noAccessor:!0},maxRender:{converter:blankNumberConverter(200),attribute:"max-render",noAccessor:!0},sourceDelay:{converter:blankNumberConverter(200),attribute:"source-delay",noAccessor:!0},filterDebounce:{converter:blankNumberConverter(200),attribute:"filter-debounce",noAccessor:!0},minQueryLength:{converter:blankNumberConverter(0),attribute:"min-query-length",noAccessor:!0}}}get open(){return this._open}set open(next){const old=this._open;if(this._open=!!next&&!this.readonly&&!isLiveDisabled(this)&&this.meetsMinimumQuery(this.query),this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",old)}get commit(){return this._commit}set commit(next){const normalized=COMBOBOX_COMMIT.normalizeReflected(this,"commit",next),old=this._commit;old!==normalized&&(this._commit=normalized,this.commitsText&&this._selected.includes("")&&this.setValue([],!1),this.requestUpdate("commit",old))}get appearance(){return this._appearance}set appearance(next){const normalized=APPEARANCE.normalizeReflected(this,"appearance",next),old=this._appearance;this._appearance=normalized,normalized!==old&&this.requestUpdate("appearance",old)}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){this.strategy.set(next)}get dataSource(){return this.dataSourceAdapter!==null&&this.source===this.dataSourceAdapter?this._dataSource:null}set dataSource(next){if(typeof next!="function"){this.dataSourceAdapter!==null&&this.source===this.dataSourceAdapter&&(this.source=null),this._dataSource=null,this.dataSourceAdapter=null;return}const provider=next,adapter=(query2,{signal})=>{const owner=this.ownerDocument.defaultView??window;return Promise.resolve(provider({query:query2,signal})).then(result=>dataSourceResultToRows(result,owner))};this._dataSource=provider,this.dataSourceAdapter=adapter,this.source=adapter}get currentOption(){if(!this.open||this.activeIndex<0||!this.listboxRendered)return;const row=this.navigableRows(this.renderedRows.rows)[this.activeIndex];return row&&!row.createInput&&row.unknownValue===void 0?this.sourceOptionsByRow.get(row):void 0}set currentOption(next){const navigable=this.open&&this.listboxRendered&&next?this.navigableRows(this.renderedRows.rows):[];this.activeIndex=navigable.findIndex(row=>this.sourceOptionsByRow.get(row)===next)}get serverRequests(){return this.server&&!this.source}get autocorrect(){return this.autocorrectState.value}set autocorrect(next){this.autocorrectState.set(next)}get inputValue(){return this.query}set inputValue(next){this.explicitInputValue=!0,this.query=next??"",this.activeIndex=-1,(this.source||this.serverRequests)&&this.runSource(this.query),this.requestUpdate()}get query(){return this._query}set query(next){const old=this._query;next!==old&&(this._query=next,this.requestUpdate("query",old),this.enforceMinimumQuery(!0))}constructor(){super(),this.placeholder="",this.label="",this.labelDisplay="visible",this.labelPlacement="top",this.hint="",this.helpText="",this.errorText="",this.allowCreate=!1,this.allowCustomValue=!1,this._commit="value",this.withUnknownOption=!1,this.loading=!1,this._appearance="outlined",this.placement="bottom",this.strategy=new PositioningStrategyState(this,"fixed"),this.topLayer=!1,this.size="m",this.pill=!1,this.clearable=!1,this.withClear=!1,this.withLabel=!1,this.withHint=!1,this.validators=[],this.autocomplete="off",this.inputMode="",this.enterKeyHint="",this.spellcheck=!1,this.autocapitalize="",this.autocorrectState=new AutocorrectState(this,!0),this.filter=null,this.source=null,this._dataSource=null,this.dataSourceAdapter=null,this.server=!1,this._query="",this.explicitInputValue=!1,this.textEdited=!1,this.activeIndex=-1,this.options=[],this.optionsObserved=!1,this.touched=!1,this.validityRevision=0,this.slotPresence=new SlotPresenceController(this),this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.sourceErrorAnnouncements=new AnnouncementSinkController(this,{eager:["assertive"]}),this.rowHtml=new Map,this.rowHtmlUnavailable=!1,this.sourceDebounce=new DebounceController(0,request=>this.runSourceRequest(request),()=>this.ownerDocument.defaultView),this.sourceToken=0,this.refreshQueued=!1,this._sourceWarmed=!1,this._selectedLabelCache=new Map,this._selectedRowCache=new Map,this._renderedRows=[],this._open=!1,this._fieldsetDisabled=!1,this.listId=nextId("combobox-list"),this.inputId=nextId("combobox-input"),this.listboxPositioned=!1,this.positioningGeneration=0,this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this.restoringOverlayFocus=!1,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="listbox"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:outsidePressHandler(this,{overlay:()=>this.overlayHandle,dismiss:()=>{this.restoreFocusOnClose=!1,this.hide()}})}),this.listboxHidden=!0,this.listboxRendered=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.closeAfterPositioningFailure=!1,this.minimumQueryClosePending=!1,this.minimumQueryCloseUnpainted=!1,this.closeCleanupPending=!1,this._selected=[],this.multiplePreferences=[],this.sourceOptionsByRow=new WeakMap,this._valueDirty=!1,this._multiple=!1,this._disabled=!1,this._required=!1,this._readonly=!1,this._defaultSelected=[],this._defaultCaptured=!1,this.explicitDefault=!1,this._restoredStateActive=!1,this._name="",this._maxOptionsVisible=3,this._maxRender=200,this._sourceDelay=200,this._minQueryLength=0,this.localDescriptionIds="",this.selectionGuard=new VetoWriteGuard,this.requestingSelection=!1,this.previousSelection=[],this.loadingRowShown=!1,this.markInteracted=()=>{this.touched||(this.touched=!0,this.updateValidity(),this.syncCustomStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.callbackRefreshEpoch=0,this.memo=new OptionCatalogMemo,this.adornments=new OptionAdornmentCache,this.selectedWrites=new SelectedWriteQueue(writes=>{if(!this.isConnected)return;const members=this.optionIndex.members;if(this.multiple){const next=resolveMultipleSelectedWrites(this._selected,this.multipleOccurrences,writes,option=>members.has(option));this.setValue(next.values,!0,void 0,next.occurrences)}else{const{value,option}=resolveSingleSelectedWrite({value:this._selected[0],option:this.singleSelectedOption},writes,candidate=>members.has(candidate));this.setValue(value===void 0?[]:value,!0,option)}}),this.optionRefreshPending=!1,this.onOptionChange=e=>{e.stopPropagation();const option=e.composedPath().find(isLyraOptionElement);if(isOptionSelectedWrite(e)&&isLyraOptionElement(option)&&this.optionIndex.members.has(option)){this._valueDirty=!0,this._restoredStateActive=!1,markVetoGuardWrite(this.selectionGuard),this.selectedWrites.record(option,{selected:option.selected,value:option.value});return}isLyraOptionElement(option)&&this.adornments.refresh(option),!this.optionRefreshPending&&(this.optionRefreshPending=!0,queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.normalizeActiveIndex()}))},this.lastRenderedRows=[],this.onInput=e=>{isLiveDisabled(this)||this.readonly||(this.explicitInputValue=!1,this.textEdited=this.commitsText,this.query=e.target.value,this.activeIndex=-1,this.show(),(this.source||this.serverRequests)&&this.runSource(this.query),this.emit("lr-filter",{value:this.query}))},this.onInputBlur=event=>{isLiveDisabled(this)||(this.touched=!0),this.syncCustomStates(),this.onComboFocusOut(event),relayNativeEvent(this,event)},this.onComboFocusOut=event=>{const trigger=this.renderRoot.querySelector('[part="combobox"]'),target=event.relatedTarget;target&&typeof target.nodeType=="number"&&trigger?.contains(target)||(this.restoreFocusOnClose=!1,this.commitsText&&this.textEdited&&!isLiveDisabled(this)&&!this.readonly&&this.commitText(this.query),this.hide())},this.onInputFocus=event=>{if(isLiveDisabled(this)){event.stopPropagation();return}this.restoringOverlayFocus||this.show(),relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.defaultPrevented||shouldIgnoreNavigationKey(e)||isLiveDisabled(this)||this.readonly)return;const navigable=["ArrowDown","ArrowUp","Enter","End"].includes(e.key)?this.navigableRows(this.renderedRows.rows):[];switch(e.key){case"ArrowDown":case"ArrowUp":if(!this.meetsMinimumQuery(this.query))return;if(e.preventDefault(),!this.open){const selected=new Set(this.committed);this.activeIndex=navigable.findIndex(row=>selected.has(row.value)),this.show();return}if(e.key==="ArrowDown"){this.activeIndex=Math.min(navigable.length-1,this.activeIndex+1);break}this.activeIndex=Math.max(0,this.activeIndex-1);break;case"Enter":{const activeRow=navigable[this.activeIndex];if(this.open&&this.activeIndex>=0&&activeRow){e.preventDefault(),this.pickRow(activeRow);break}if(this.commitsText&&this.textEdited){const wasOpen=this.open;if(this.commitText(this.query),wasOpen){e.preventDefault();break}}const create=this.createRow;if(this.open&&create){e.preventDefault(),this.createOption(create.createInput);break}if(this.open&&this.allowCustomValue&&!this.multiple&&this.query.trim()){e.preventDefault(),this.commitCustomValue(this.query.trim());break}submitOnEnter(this,e);break}case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.activeIndex=0);break;case"End":this.open&&(e.preventDefault(),this.activeIndex=navigable.length-1);break;case"Backspace":this.multiple&&!this.query&&this._selected.length&&this.removeValueAt(this._selected.length-1);break}},this.onComboMouseDown=e=>{if(!isLiveDisabled(this)){if(e.composedPath()[0]===this.inputEl){this.renderRoot.activeElement===this.inputEl&&!this.open&&!this.readonly&&this.show();return}e.target.closest("button")||(e.preventDefault(),this.inputEl?.focus(),this.show())}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),row=this._renderedRows[Number(optionEl?.dataset.index)];row&&this.pickRow(row)},this.requestUpdate("commit",void 0),this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals,new GlassScrollLayer(this,'[part="listbox"]',()=>this.open)}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}get validationTarget(){return this.validationTargetOverride??this.inputEl??void 0}set validationTarget(next){this.validationTargetOverride=next??void 0,this.validityController.refreshAnchor()}resetValidity(){this.validityController.setCustomValidity(""),this.updateValidity()}get input(){return this.inputEl??null}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value)}get selectionDirection(){return this.inputEl?.selectionDirection}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value)}get interactionBarred(){return isLiveDisabled(this)||this.readonly}focus(options){this.deferFocusUntilRendered(options)||isLiveDisabled(this)||this.inputEl?.focus(options)}blur(){this.inputEl?.blur()}click(){isLiveDisabled(this)||(this.inputEl?.focus(),this.show())}select(){this.input?.select()}setSelectionRange(start,end,direction="none"){this.input?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputEl;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.explicitInputValue=!0,this.query=input.value,this.activeIndex=-1,(this.source||this.serverRequests)&&this.runSource(this.query))}[VALIDITY_ANCHOR](){return this.validationTarget}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot.querySelector('[part="combobox-input"]');target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.updateValidity(),this.hasUpdated&&this.syncValidatorAttributeObserver(),this.hasUpdated&&queueMicrotask(()=>{this.open?this.reconnectOpenPopup():this.source&&this._selected.length&&this.asyncRows.length===0&&this.runSource("")})}adoptedCallback(){super.adoptedCallback(),this.popupController.cancel(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.listboxPositioned=!1,this.invalidateListboxPositioning(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.clearSourceTimer(),this.sourceToken+=1,this.sourceLoading=!1,this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceErrorAnnouncements.adopted()}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this.enforceMinimumQuery(!1),this.announceOpenTransition(changed),this.open?(this.listboxHidden=!1,this.listboxRendered=!0):changed.has("open")&&this.interactionBarred&&(this.listboxHidden=!0),changed.has("open")&&!this.openVetoed&&(this.listboxPositioned=!1),changed.has("open")&&this.openVetoed?this.closeCleanupPending=!1:changed.has("open")&&!this.open&&this.finalizeCloseState(),changed.has("server")&&!this.source&&changed.get("server")!==void 0&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++),changed.has("source")&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++,this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],this.multiplePreferences=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this._sourceWarmed=!1,this.source&&this.open&&this.runSource(this.query)),!this._sourceWarmed&&this.source&&(this._selected.length>0||(this.pendingSelectedRowValues?.length??0)>0)&&this.asyncRows.length===0&&(this._sourceWarmed=!0,this.runSource(""))}firstUpdated(changed){super.firstUpdated(changed);const slot=this.optionsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>{this.optionsObserved=!0,s.assignedElements({flatten:!0}).some(isLyraOptionElement)&&this.collectOptionsFromSlot(s)})})}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),this.reflectSelected(),this.syncFormValue(),this.requestUpdate("multiple",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this._disabled&&this.hide(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly;this._readonly=!!next,this.toggleAttribute("readonly",this._readonly),this._readonly&&this.hide(),this.updateValidity(),this.requestUpdate("readonly",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this.setValue(next,!0)}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){const old=this.defaultValue;this.explicitDefault=!0;const values=normalizeSelectionValues(next);this._defaultSelected=this.multiple?values:values.slice(0,1),!this._valueDirty&&!this._restoredStateActive&&this.setValue(this._defaultSelected,!1),this.requestUpdate("defaultValue",old)}setValue(next,dirty,preferred,multiplePreferences=[]){markVetoGuardWrite(this.selectionGuard),this.selectedWrites.clear();const old=this._selected;this.previousSelection=old,this.singleSelectedOption=preferred,dirty&&(this._restoredStateActive=!1,this._valueDirty=!0);const values=normalizeSelectionValues(next);this._selected=this.commitsText?values.filter(value=>value!==""):values,this.multiplePreferences=multiplePreferences;const selected=new Set(this._selected);if(selected.size>0){const rows=this.rowsByValue(selected);for(const value of selected){const row=rows.get(value);row&&this._selectedRowCache.set(value,row)}}for(const value of this._selectedRowCache.keys())selected.has(value)||this._selectedRowCache.delete(value);for(const value of this._selectedLabelCache.keys())selected.has(value)||this._selectedLabelCache.delete(value);this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get maxRender(){return this._maxRender}get sourceDelay(){return this._sourceDelay}set sourceDelay(next){const old=this._sourceDelay;this._sourceDelay=finiteDuration(next,200),this.requestUpdate("sourceDelay",old)}get filterDebounce(){return this.sourceDelay}set filterDebounce(next){this.sourceDelay=next}get minQueryLength(){return this._minQueryLength}set minQueryLength(next){const old=this._minQueryLength;this._minQueryLength=finiteCount(next),this.enforceMinimumQuery(this.open||this.explicitInputValue),this.requestUpdate("minQueryLength",old)}meetsMinimumQuery(query2){const minimum=this._minQueryLength??0;if(minimum===0)return!0;const trimmed=query2.trim();let count=0;for(let index=0;index<trimmed.length;index+=trimmed.codePointAt(index)>65535?2:1)if(++count>=minimum)return!0;return!1}enforceMinimumQuery(preserveDraft){if(this.meetsMinimumQuery(this.query))return;this.clearSourceTimer();const abort=this.sourceAbort;this.sourceAbort=void 0;const token=++this.sourceToken;this.refreshQueued=!1,this.sourceLoading=!1,this.sourceFailed=!1,this.asyncRows.length&&(this.asyncRows=[]),this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,abort?.abort(),!(token!==this.sourceToken||this.meetsMinimumQuery(this.query))&&(this.closeCleanupPending=!1,preserveDraft&&(this.explicitInputValue=!0),this.minimumQueryClosePending||=this.open,this.open=!1,this.listboxHidden=!0,this.listboxRendered=!1,this.listboxPositioned=!1,this.popupController.cancel())}set maxRender(next){const old=this._maxRender;this._maxRender=Math.min(finiteCount(next,200),MAX_RENDER_ROWS),this.requestUpdate("maxRender",old)}get sourceTotal(){return this._sourceTotal}get sourceTruncated(){return this._sourceTruncated}get selectedRows(){return this.resolveSelectedRowSlots().filter(row=>row!=null).map(row=>{const option=this.sourceOptionsByRow.get(row);return{...row,...option?this.adornments.get(option):{}}})}resolveSelectedRowSlots(values=this.committed,proposed){if(values===this._selected&&this.multiple&&proposed===void 0)return this.multipleOccurrences.map((occurrence,index)=>this.rowForOccurrence(occurrence,values[index]));let rows;return values.map(value=>proposed?.value===value?proposed:!this.source&&!this.multiple&&this.singleSelectedOption?.value===value?this.rowForOption(this.singleSelectedOption,!1):this._selectedRowCache.get(value)??(rows??=this.rowsByValue(new Set(values))).get(value))}get multipleOccurrences(){const catalog=this.source?this.asyncRows:this.options;return this.memo.get("multipleOccurrences",[catalog,this._selected,this.multiplePreferences],()=>{if(!this._selected.length)return[];const requested=new Set(this._selected),queue=new OccurrenceQueue(catalog,row=>row.value,{accept:value=>requested.has(value)}),preferred=this._selected.map((value,index)=>{const occurrence=this.multiplePreferences[index];if(occurrence?.value!==value)return;if(queue.claim(occurrence))return occurrence;if(!this.source||isLyraOptionElement(occurrence))return;const match=queue.remaining(value).find(row=>row.label===occurrence.label&&Object.is(row.data,occurrence.data));return match&&queue.claim(match),match??occurrence});return this._selected.map((value,index)=>preferred[index]??queue.take(value))})}rowForOccurrence(occurrence,value){return isLyraOptionElement(occurrence)?this.rowForOption(occurrence,!1):occurrence??this._selectedRowCache.get(value)}get committed(){return this.multiple?this._selected:this._selected.slice(0,1)}rowsByValue(values){const rows=this.source?new Map:this.localRowsByValue(values,this.options);for(const row of this.asyncRows)values.has(row.value)&&!rows.has(row.value)&&rows.set(row.value,row);return rows}localRowsByValue(values,options){const rows=new Map;if(values.size===0)return rows;for(const option of options){const value=option.value;values.has(value)&&!rows.has(value)&&rows.set(value,this.rowForOption(option,!1))}return rows}set selectedRows(next){markVetoGuardWrite(this.selectionGuard);const values=[],seen=new Set;if(Array.isArray(next))for(const candidate of next){let value;try{value=candidate?.value}catch{continue}typeof value!="string"||seen.has(value)||(seen.add(value),values.push(value))}if(values.length>0&&!this.hasSelectionSourceRows){this.pendingSelectedRowValues=values,this.source&&this.isConnected&&(this._sourceWarmed=!0,this.runSource(""));return}this.pendingSelectedRowValues=void 0,this.applySelectedRowValues(values)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidatorAttributeObserver(){this.validatorAttributeObserver?.(),this.validatorAttributeObserver=this.isConnected?observeValidatorAttributes(this,this.validators,()=>{this.updateValidity(),this.validityRevision++}):void 0}updateValidity(){if(this.barredFromValidation){this.validityController.setValidity({}),this.syncCustomStates();return}const flags={};let message="";this.required&&this._selected.length===0&&(flags.valueMissing=!0,message=()=>this.localize("comboboxRequired"));const configured=runFormValidators(this.validators,this.value,this,()=>this.localize("valueInvalid"));configured.flags&&Object.assign(flags,configured.flags),configured.message&&(message=configured.message),this.validityController.setValidity(flags,message),this.syncCustomStates()}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",this._selected.length===0),setCustomState(this.internals,"disabled",this.effectiveDisabled),this.syncLoadingStates()}syncLoadingStates(){setCustomState(this.internals,"loading",this.loading||this.sourceLoading),setCustomState(this.internals,"showing-loading-row",this.loadingRowShown)}syncFormValue(){const state2=JSON.stringify(this._selected);if(this.multiple){if(!this.name){this.internals.setFormValue(null,state2);return}const fd=new FormData;for(const v of this._selected)fd.append(this.name,v);this.internals.setFormValue(fd,state2)}else this.internals.setFormValue(this._selected[0]??"",state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this.touched=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetValues=this.explicitDefault||this._defaultSelected.length>0?this._defaultSelected:this.options.filter(option=>wasOptionInitiallySelected(option)).map(option=>option.value);this._defaultSelected.length===0&&resetValues.length>0&&(this._defaultSelected=[...resetValues]);const defaultOptions=this.explicitDefault?[]:this.options.filter(option=>option.defaultSelected||wasOptionInitiallySelected(option));this.setValue(this.multiple?resetValues:resetValues.slice(0,1),!1,defaultOptions[0],defaultOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](option.selected);this.query="",this.explicitInputValue=!1,this.textEdited=!1}formStateRestoreCallback(state2,reason){let selected=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(value=>typeof value=="string")&&(selected=parsed)}catch{}this.assignValue(this.multiple?selected:selected.slice(0,1)),this._restoredStateActive=!0}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;const wasDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,wasDisabled!==this.effectiveDisabled&&(disabled&&this.hide(),this.updateValidity(),this.requestUpdate())}checkValidity(){return this.validityController.checkValidity(()=>this.updateValidity())}reportValidity(){return this.validityController.reportValidity(()=>{this.touched=!0,this.updateValidity(),this.syncCustomStates()})}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates()}disconnectedCallback(){markVetoGuardWrite(this.selectionGuard),this.selectedWrites.clear(),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),this.listboxPositioned=!1,this.validatorAttributeObserver?.(),this.validatorAttributeObserver=void 0,super.disconnectedCallback(),this.invalidateListboxPositioning(),this.clearSourceTimer(),this.sourceToken+=1,this.sourceLoading=!1,this.sourceAbort?.abort(),this.sourceAbort=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.popupController.unbindPointer(),this.open=!1}collectOptionsFromSlot(slot){const previous=new Set(this.options);if(this.optionsObserved=!0,this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.adornments.clear(),this.normalizeActiveIndex(),this.applyPendingSelectedRows(),this.explicitDefault){this.reflectSelected();return}if(this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=this._restoredStateActive?[]:[...this._valueDirty?[]:newDefaults,...newLive];if(eligible.length){if(this.multiple){const occurrences=this.multipleOccurrences,selected=new Set(occurrences),additions=eligible.filter(option=>!selected.has(option));this.setValue([...this._selected,...additions.map(option=>option.value)],newLive.length>0,void 0,[...occurrences,...additions])}else{const newest=eligible[eligible.length-1];this.setValue(newest.value,newLive.length>0,newest)}return}}else{this._defaultCaptured=!0;const allDefaults=this.options.filter(option=>option.defaultSelected),allLive=this.options.filter(option=>option.selected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);this._defaultSelected=(defaults.length>0?defaults:initialLive.length>0?initialLive:live).map(option=>option.value);const fromDefaults=defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.length>0?dirtySelected.slice(-1):live:fromDefaults?defaults:live;if(initial.length&&!this._restoredStateActive&&!this._valueDirty){this.setValue(initial.map(option=>option.value),!fromDefaults||optionDirty,initial[0],initial);return}optionDirty&&(this._valueDirty=!0)}this.reflectSelected()}refreshOptionDefaults(){if(this.explicitDefault)return;const declared=this.options.filter(option=>option.defaultSelected);this._defaultSelected=(this.multiple?declared:declared.slice(0,1)).map(option=>option.value),!this._valueDirty&&!this._restoredStateActive&&this.setValue(this._defaultSelected,!1,declared[0],declared)}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}get selectedLabels(){return this.memo.get("selectedLabels",[this._selected,this.options,this.asyncRows,this.source,this.sourceEverSettled,this.optionsObserved,this.getUnknownLabel,this.loading,this.effectiveLocale,this.strings,this.callbackRefreshEpoch],()=>getListFormat(this.effectiveLocale,{type:"unit"}).format(this._selected.map((value,index)=>this.labelFor(value,index))))}get optionIndex(){return this.memo.get("index",[this.options],()=>{const values=new Map;for(const option of this.options)values.has(option.value)||values.set(option.value,option);return{values,members:new Set(this.options)}})}get asyncIndex(){return this.memo.get("asyncIndex",[this.asyncRows],()=>{const values=new Map;for(const row of this.asyncRows)values.has(row.value)||values.set(row.value,row);return values})}get searchCorpus(){return this.memo.get("corpus",[this.options,this.effectiveLocale],()=>this.options.map(option=>({label:foldSearchText(option.label,this.effectiveLocale),search:foldSearchText(option.searchText,this.effectiveLocale),value:foldSearchText(option.value,this.effectiveLocale)})))}reflectSelected(){const value=this._selected[0],first=this.multiplePreferences[0];!this.multiple&&isLyraOptionElement(first)&&first.value===value&&this.optionIndex.members.has(first)&&(this.singleSelectedOption=first),(!this.singleSelectedOption||!this.optionIndex.members.has(this.singleSelectedOption)||this.singleSelectedOption.value!==value)&&(this.singleSelectedOption=value===void 0?void 0:this.optionIndex.values.get(value));const selected=this.multiple?new Set(this._selected):void 0;for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](selected?selected.has(option.value):option===this.singleSelectedOption)}labelFor(value,occurrenceIndex){if(this.commitsText)return value;const nonBlank=label=>label!==void 0&&label.trim().length>0?label:void 0;if(this.getUnknownLabel&&this.isUnknownValue(value)){const override=nonBlank(this.getUnknownLabel(value));if(override!==void 0)return override}return(occurrenceIndex===void 0?void 0:nonBlank(this.multipleOccurrences[occurrenceIndex]?.label))??(!this.source&&!this.multiple&&this.singleSelectedOption?.value===value?nonBlank(this.singleSelectedOption.label):void 0)??nonBlank(this._selectedLabelCache.get(value))??nonBlank(this.optionIndex.values.get(value)?.label)??nonBlank(this.asyncIndex.get(value)?.label)??(this.loading||this.source&&!this.sourceEverSettled?this.statusText("loading",this.loadingText):void 0)??value}isUnknownValue(value){return this.commitsText||!this.source&&!this.optionsObserved||this.loading||this.source&&!this.sourceEverSettled?!1:!(!this.source&&!this.multiple&&this.singleSelectedOption?.value===value||this._selectedLabelCache.has(value)||this.optionIndex.values.has(value)||this.asyncIndex.has(value))}rowForOption(option,withAdornments=!0){const adornments=withAdornments?this.adornments.get(option):{},row={value:option.value,label:option.label||option.value,sub:option.sub||void 0,dotColor:option.dotColor||void 0,title:option.title||void 0,group:option.group||void 0,disabled:!isCatalogOptionAvailable(option,this),data:option.data,...adornments.start===void 0?{}:{start:adornments.start},...adornments.end===void 0?{}:{end:adornments.end}};return this.sourceOptionsByRow.set(row,option),row}get hasSelectionSourceRows(){return(this.source?this.asyncRows.length:this.options.length)>0}applySelectedRowValues(values){const requested=new Set(values),rowsByValue=this.source?this.rowsByValue(requested):this.localRowsByValue(requested,this.options),rows=values.map(value=>rowsByValue.get(value)).filter(row=>row!==void 0),limited=this.multiple?rows:rows.slice(0,1);this.assignValue(limited.map(row=>row.value));for(const row of limited)this._selectedRowCache.set(row.value,row)}applyPendingSelectedRows(acceptEmptySource=!1){if(this.pendingSelectedRowValues===void 0||!acceptEmptySource&&!this.hasSelectionSourceRows)return!1;const values=this.pendingSelectedRowValues;return this.pendingSelectedRowValues=void 0,this.applySelectedRowValues(values),!0}get unknownRows(){if(!this.withUnknownOption)return[];const locale=this.effectiveLocale,query2=prepareNeedle(this.query,locale);return this.committed.flatMap(value=>this.isUnknownValue(value)?[{value,label:this.labelFor(value),badge:this.localize("notInCatalog"),unknownValue:value}]:[]).filter(row=>!query2||foldSearchText(row.label,locale).includes(query2)||foldSearchText(row.value,locale).includes(query2))}get createRow(){if(!this.allowCreate)return;const inputValue=this.query.trim();if(!inputValue)return;const locale=this.effectiveLocale,folded=foldSearchText(inputValue,locale);if(!(this.source?this.memo.get("asyncExact",[this.asyncRows,locale],()=>new Set(this.asyncRows.flatMap(row=>[foldSearchText(row.value,locale),foldSearchText(row.label,locale)]))).has(folded):this.searchCorpus.some(row=>row.value===folded||row.label===folded)))return{value:inputValue,label:this.localize("comboboxCreate",void 0,{value:inputValue}),createInput:inputValue}}capRows(all,activeValue){const occurrences=this.multiple?this.multipleOccurrences:void 0;return this.memo.get("capRows",[all,this.maxRender,this._selected,occurrences,activeValue],()=>{const selected=new Set(this.committed),selectedOccurrences=new Set(occurrences),retained=occurrences?all.filter(row=>selectedOccurrences.has(row)):all.filter(row=>selected.has(row.value)),active=activeValue===void 0?void 0:all.find(row=>row.value===activeValue);return capOptionRows(all,this.maxRender,active?[active,...retained]:retained)})}navigableRows(rows){return this.memo.get("navigableRows",[rows],()=>rows.filter(row=>!row.disabled))}get renderedRows(){const active=this.navigableRows(this.lastRenderedRows)[this.activeIndex]?.value,result=this.memo.get("renderedRows",[this.callbackRefreshEpoch,this.options,this.asyncRows,this.source,this.query,this._selected,this.multiple,this.multiplePreferences,this.maxRender,this._sourceTotal,this.withUnknownOption,this.allowCreate,this.filter,this.server,this.getUnknownLabel,this.loading,this.sourceEverSettled,this.effectiveLocale,this.strings,active],()=>this.computeRenderedRows(active));return this.lastRenderedRows=result.rows,result}computeRenderedRows(active){let rows,overflow;if(this.source){const capped=this.capRows(this.asyncRows,active);rows=[...capped.rows],overflow=capped.overflow,overflow+=Math.max(0,this._sourceTotal-this.asyncRows.length)}else{const capped=this.capRows(this.filtered,active);rows=capped.rows.map(option=>this.rowForOption(option)),overflow=capped.overflow}const create=this.createRow;rows.push(...this.unknownRows),create&&rows.push(create);const selected=new Set(this.committed),retained=rows.filter(row=>selected.has(row.value)),activeRow=rows.find(row=>row.value===active),bounded=capOptionRows(rows,MAX_RENDER_ROWS,activeRow?[activeRow,...retained]:retained);return{rows:bounded.rows,overflow:overflow+bounded.overflow}}normalizeActiveIndex(){if(this.activeIndex<0)return;const navigableCount=this.navigableRows(this.renderedRows.rows).length,next=navigableCount>0?Math.min(this.activeIndex,navigableCount-1):-1;next!==this.activeIndex&&(this.activeIndex=next)}get filtered(){if(this.server)return this.options;const locale=this.effectiveLocale,q=this.filter?this.query.trim().toLocaleLowerCase(locale):prepareNeedle(this.query,locale),selectedLabel=this.multiple?"":this.labelFor(this._selected[0]??"")??"",foldedLabel=this.filter?selectedLabel.toLocaleLowerCase(locale):foldSearchText(selectedLabel,locale),effective=q===foldedLabel?"":q;return effective?this.memo.get("filtered",[this.options,this.filter,effective,locale,this.callbackRefreshEpoch],()=>{const filter=this.filter;if(filter)return this.options.filter(option=>filter(option,effective));const corpus=this.searchCorpus;return this.options.filter((_option,index)=>corpus[index].label.includes(effective)||corpus[index].search.includes(effective))}):this.options}get commitsText(){return this.commit==="text"&&!this.multiple}get displayValue(){return this.multiple||this.open||this.explicitInputValue?this.query:this._selected[0]?this.labelFor(this._selected[0]):""}announceOpenTransition(changed){this.openVetoed=!1,this.minimumQueryCloseUnpainted=!1;const minimumClose=this.minimumQueryClosePending;if(this.minimumQueryClosePending=!1,minimumClose&&!this.open)if(!this._isFirstUpdate&&changed.has("open")&&changed.get("open")===!0&&this.isConnected){if(emitPopupEvent(this,"lr-hide",!1),!this.open)return}else{this.minimumQueryCloseUnpainted=!0;return}const closeAfterPositioningFailure=!this.open&&this.closeAfterPositioningFailure;if(this.closeAfterPositioningFailure=!1,!(!changed.has("open")||this._isFirstUpdate||!this.open&&this.interactionBarred)){if(!this.isConnected||closeAfterPositioningFailure){emitPopupEvent(this,"lr-hide",!1);return}this.openVetoed=this.popupController.announce(this.open,()=>{this.open=!this.open})}}show(){if(this.open||this.interactionBarred)return Promise.resolve();const committedText=this._selected[0]??"";if(this.commitsText&&!this.textEdited&&!this.explicitInputValue&&this.query!==committedText&&(this.query=committedText,(this.source||this.serverRequests)&&this.runSource(this.query)),!this.meetsMinimumQuery(this.query))return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,this.open||this.popupController.release("lr-after-show"),settled}hide(){if(!this.open)return Promise.resolve();const settled=this.popupController.wait(!1);return this.closeCleanupPending=!0,this.open=!1,settled}finalizeCloseState(){if(this.closeCleanupPending&&(this.closeCleanupPending=!1,this.activeIndex=-1,!this.multiple)){const queryChanged=this.query!=="";this.query="",this.explicitInputValue=!1,this.textEdited=!1,queryChanged&&this.source&&(this.asyncRows=[],this.sourceFailed=!1,this._sourceTotal=0,this._sourceTruncated=!1)}}activateListboxOverlay(){this.invalidateListboxPositioning(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.inputEl??null}),this.popupController.bindPointer(),this.beginListboxPositioning()}beginListboxPositioning(){const anchor=this.renderRoot.querySelector('[part="combobox"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');if(anchor&&listbox){const generation=this.positioningGeneration;this.positioningReady=new Promise(resolve=>{this.resolvePositioningReady=resolve}),this.startListboxPositioning(generation,anchor,listbox)}}invalidateListboxPositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0,this.resolvePositioningReady?.(!1),this.resolvePositioningReady=void 0}resolveCurrentPositioning(positioned){const resolve=this.resolvePositioningReady;this.resolvePositioningReady=void 0,resolve?.(positioned)}async startListboxPositioning(generation,anchor,listbox){try{const runtime=await loadAnchoredOverlayRuntime(),{place}=runtime;if(generation!==this.positioningGeneration||!this.open||!this.isConnected||this.renderRoot.querySelector('[part="combobox"]')!==anchor||this.renderRoot.querySelector('[part="listbox"]')!==listbox)return;this.placedTopLayer=syncTopLayerRelease(listbox,this.placedTopLayer,this.topLayer,runtime);const cleanup=place(anchor,listbox,{placement:`${this.placement}-start`,...topLayerPlacement(this.topLayer,resolveEffectivePositioningStrategy(this,this.strategy.authored,"fixed")),sync:this.sync,onPlaced:()=>{generation===this.positioningGeneration&&(this.listboxPositioned=!0,this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveCurrentPositioning(!0)}))}});generation!==this.positioningGeneration?cleanup():this.cleanup=cleanup}catch{if(generation!==this.positioningGeneration||!this.open)return;this.resolveCurrentPositioning(!1),this.closeAfterPositioningFailure=!0,this.hide()}}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.invalidateListboxPositioning(),this.restoringOverlayFocus=restoreFocus;try{this.overlayHandle?.deactivate({restoreFocus})}finally{this.restoringOverlayFocus=!1}this.overlayHandle=void 0,this.popupController.unbindPointer(),this.restoreFocusOnClose=!0}reconnectOpenPopup(){!this.isConnected||!this.open||(this.activateListboxOverlay(),this.source&&this.asyncRows.length===0&&this.runSource(this.query))}syncVisibleOptionsCap(){const listbox=this.renderRoot?.querySelector('[part="listbox"]');if(!listbox)return;const clear=()=>{listbox.style.removeProperty("max-block-size")},requested=typeof this.visibleOptions=="number"?finiteCount(this.visibleOptions,0):0;if(requested<=0)return clear();const rows=listbox.querySelectorAll('[part="option"]');if(rows.length<=requested)return clear();const boundary=rows[requested];if(!boundary)return clear();const cap=boundary.getBoundingClientRect().top-listbox.getBoundingClientRect().top;if(!Number.isFinite(cap)||cap<=0)return clear();listbox.style.setProperty("max-block-size",`min(${Math.ceil(cap)}px, var(--lr-positioner-available-block-size, var(--lr-size-18rem)))`)}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.syncLoadingStates(),(changed.has("visibleOptions")||changed.has("open")||changed.has("query")||changed.has("options")||changed.has("asyncRows")||changed.has("maxRender")||changed.has("value")||changed.has("listboxPositioned")||changed.has("strings")||changed.has("lang")||changed.has("size")||changed.has("filter")||changed.has("allowCreate")||changed.has("withUnknownOption"))&&this.syncVisibleOptionsCap(),changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),this._isFirstUpdate||this.settleTransition("lr-after-show"),this.refreshQueued?(this.refreshQueued=!1,this.runSource(this.query)):this.source&&this.asyncRows.length===0?this.runSource(this.query):this.serverRequests&&queueMicrotask(()=>{this.open&&this.serverRequests&&this.runSource(this.query,{immediate:!0})})):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),this.interactionBarred||this.minimumQueryCloseUnpainted?this.popupController.cancel():this._isFirstUpdate||this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed&&(this.restoreFocusOnClose=!0),changed.has("topLayer")&&!changed.has("open")&&this.open&&this.isConnected&&(this.invalidateListboxPositioning(),this.beginListboxPositioning()),changed.has("name")&&this.syncFormValue(),changed.has("validators")&&(this.updateValidity(),this.syncValidatorAttributeObserver()),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("validators")||changed.has("validityRevision"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("activeIndex")||changed.has("listboxPositioned")){const listbox=this.renderRoot.querySelector('[part="listbox"]'),row=listbox?.querySelector('[part="option"][data-active]');listbox&&row&&revealRow(listbox,row)}}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{for(;this.open&&!this.listboxPositioned;){const readiness=this.positioningReady,positioned=await readiness;if(stale())return!1;if(positioned)break;if(readiness===this.positioningReady)return!1}return!0},conceal:()=>{this.listboxHidden=!0,this.listboxRendered=!1}})}emitValueEvents(rowData){const self=this,data=rowData?[...rowData]:this.resolveSelectedRowSlots().map(row=>row?.data),previousValue=this.multiple?[...this.previousSelection]:this.previousSelection[0]??"",detail={value:self.value,previousValue,data};emitValueEvents(self,"input",detail,detail2=>self.emit("lr-input",detail2)),emitValueEvents(self,"change",detail,detail2=>self.emit("lr-change",detail2))}assignValue(next){this.value=next}acceptsSelection(values,row,occurrences){if(this.requestingSelection)return!1;const self=this,{multiple,open,source,sourceToken}=this,data=(occurrences?occurrences.map((occurrence,index)=>this.rowForOccurrence(occurrence,values[index])):this.resolveSelectedRowSlots(values,row)).map(option2=>option2?.data),option=row&&this.sourceOptionsByRow.get(row);let accepted=!1;this.requestingSelection=!0;try{requestThenCommit({requestDetail:{value:multiple?values:values[0]??"",previousValue:self.value,data},emitRequest:(detail,init)=>self.emit("lr-change-request",detail,init),guard:this.selectionGuard,commit:()=>{this.interactionBarred||this.multiple!==multiple||this.open!==open||this.source!==source||this.sourceToken!==sourceToken||option&&(!this.renderRoot.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).includes(option)||!isCatalogOptionAvailable(option,this)||option.value!==row?.value||!Object.is(option.data,row?.data))||(accepted=!0)}})}finally{this.requestingSelection=!1}return accepted}createOption(inputValue){if(isLiveDisabled(this)||this.readonly||this.emit("lr-create",{inputValue},{cancelable:!0}).defaultPrevented||isLiveDisabled(this)||this.readonly||!this.allowCreate)return;const option=this.ownerDocument.createElement(tag("option"));option.setAttribute("value",inputValue),option.textContent=inputValue,this.pickRow({value:inputValue,label:inputValue},option)}commitCustomValue(inputValue){if(isLiveDisabled(this)||this.readonly||this.multiple||!inputValue)return;const selectionChanged=this._selected[0]!==inputValue;selectionChanged&&!this.acceptsSelection([inputValue])||(this.touched=!0,this._selectedLabelCache.set(inputValue,inputValue),this.assignValue(inputValue),this.query="",this.explicitInputValue=!1,this.hide(),selectionChanged&&this.emitValueEvents())}commitText(text,row){const changed=(this._selected[0]??"")!==text,values=text?[text]:[];changed&&!this.acceptsSelection(values,void 0,row&&[row])||(this.touched=!0,this.assignValue(values),this.query="",this.explicitInputValue=!1,this.textEdited=!1,this.hide(),changed&&this.emitValueEvents(row&&[row.data]))}pickRow(row,createdOption){const sourceOption=this.sourceOptionsByRow.get(row);if(isLiveDisabled(this)||this.readonly||row.disabled||sourceOption&&!isCatalogOptionAvailable(sourceOption,this))return;if(row.createInput!==void 0){this.createOption(row.createInput);return}if(this.commitsText){this.commitText(row.label,row),this.emit("lr-activate",{value:row.value});return}const values=this.multiple?[...new Set(this._selected)]:[row.value],index=this.multiple?values.indexOf(row.value):-1;let occurrences;if(this.multiple){const selected=this.multipleOccurrences,firstOccurrenceByValue=new Map;for(const[position,value]of this._selected.entries())firstOccurrenceByValue.has(value)||firstOccurrenceByValue.set(value,selected[position]);occurrences=values.map(value=>firstOccurrenceByValue.get(value)),index>=0?(values.splice(index,1),occurrences.splice(index,1)):(values.push(row.value),occurrences.push(sourceOption??row))}const changed=this.multiple||this._selected[0]!==row.value;if(!(changed&&!this.acceptsSelection(values,row,occurrences))){if(createdOption){if(!this.allowCreate)return;this.append(createdOption),occurrences&&(occurrences[occurrences.length-1]=createdOption)}this.touched=!0,index>=0&&!values.includes(row.value)?this._selectedRowCache.delete(row.value):index<0&&row.unknownValue===void 0&&(this._selectedLabelCache.set(row.value,row.label),this.multiple||this._selectedRowCache.clear(),this._selectedRowCache.set(row.value,row)),this.setValue(values,!0,sourceOption,occurrences),this.query="",this.explicitInputValue=!1,this.multiple||this.hide(),(this.source||this.serverRequests)&&this.runSource(this.query),changed&&this.emitValueEvents(),this.emit("lr-activate",{value:row.value})}}removeValueAt(index){if(isLiveDisabled(this)||this.readonly||index<0||index>=this._selected.length)return;const next=this._selected.filter((_,i)=>i!==index),occurrences=this.multipleOccurrences.filter((_,i)=>i!==index);this.acceptsSelection(next,void 0,occurrences)&&(this.touched=!0,this.setValue(next,!0,void 0,occurrences),this.emitValueEvents())}clear(){if(isLiveDisabled(this)||this.readonly)return;const hadSelection=this._selected.length>0,queryChanged=this.query!=="";!hadSelection&&!queryChanged||hadSelection&&!this.acceptsSelection([])||(hadSelection&&(this.touched=!0,this.assignValue([])),this.query="",this.explicitInputValue=!1,this.textEdited=!1,(this.source||this.serverRequests)&&this.runSource(this.query),hadSelection&&(this.emitValueEvents(),this.emit("lr-clear")),queryChanged&&this.emit("lr-filter",{value:this.query}))}refresh(){if(!(!this.source&&!this.serverRequests)){if(!this.open){this.refreshQueued=!0;return}this.refreshQueued=!1,this.runSource(this.query,{immediate:!0})}}reload(){this.refresh()}runSource(query2,options){const source=this.source;if(!source&&!this.serverRequests)return;if(!this.meetsMinimumQuery(query2)||!this.meetsMinimumQuery(this.query)){this.enforceMinimumQuery(!1);return}this.clearSourceTimer();const abort=this.sourceAbort;this.sourceAbort=void 0;const token=++this.sourceToken;if(abort?.abort(),token!==this.sourceToken||source!==this.source||!this.meetsMinimumQuery(this.query))return;const ownerWindow=this.ownerDocument.defaultView;if(!this.isConnected||!ownerWindow)return;const request={query:query2,token,owner:ownerWindow,source};if(source||(this.loading=!0),options?.immediate){this.runSourceRequest(request);return}this.sourceDebounce.delayMs=this._sourceDelay,this.sourceDebounce.push(request)}runSourceRequest({query:query2,token,owner:ownerWindow,source}){const isCurrent=()=>token===this.sourceToken&&source===this.source&&(source!==null||this.server)&&this.meetsMinimumQuery(query2)&&this.meetsMinimumQuery(this.query)&&this.isConnected&&this.ownerDocument.defaultView===ownerWindow;if(!isCurrent())return;const controller=new ownerWindow.AbortController;if(this.sourceAbort=controller,!source){Promise.resolve().then(()=>{isCurrent()&&this.emit("lr-options-request",{query:query2,signal:controller.signal})});return}this.sourceLoading=!0,this.sourceFailed=!1,Promise.resolve().then(()=>{if(isCurrent()&&(this.emit("lr-options-request",{query:query2,signal:controller.signal}),!!isCurrent()))return source(query2,{signal:controller.signal,limit:MAX_SOURCE_ROWS})}).then(result=>{if(!isCurrent())return;const normalized=normalizeSourceResult(result);this._sourceTotal=normalized.total,this._sourceTruncated=normalized.truncated,this.asyncRows=normalized.rows,this.sanitizeRowHtml(normalized.rows,isCurrent),this.sourceFailed=!1,this.sourceEverSettled=!0,this.normalizeActiveIndex(),this.applyPendingSelectedRows(!0);const selected=new Set(this._selected);for(const row of normalized.rows)selected.has(row.value)&&this._selectedRowCache.set(row.value,row)}).catch(err=>{isCurrent()&&(this.sourceEverSettled=!0,this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this.sourceFailed=!0,this.sourceErrorAnnouncements.announceAssertive(this.localize("comboboxLoadError")),this.emit("lr-source-error",{error:err,query:query2}),this.emit("lr-options-error",{error:err,request:{query:query2}}),DEV_DIAGNOSTICS&&devWarnOnce("lr-combobox-source-rejected","<lr-combobox> source() rejected:",err))}).finally(()=>{token===this.sourceToken&&(this.sourceLoading=!1)})}async sanitizeRowHtml(rows,isCurrent){this.rowHtml=new Map;const pending=rows.filter(row=>row.html!==void 0);if(pending.length===0){this.rowHtmlUnavailable=!1;return}const isStale=()=>!isCurrent()||this.asyncRows!==rows;let next=null;try{const result=await sanitizeComboboxOptionHtml(pending,this.ownerDocument,isStale);if(result==="stale")return;next=result}catch{next=null}if(!isStale()){if(next){this.rowHtml=next,this.rowHtmlUnavailable=!1;return}this.rowHtmlUnavailable||this.sourceErrorAnnouncements.announcePolite(this.localize("comboboxRichContentUnavailable")),this.rowHtmlUnavailable=!0}}clearSourceTimer(){this.sourceDebounce.cancel()}renderRows(rows,activeId){const out=[];let currentGroup,currentGroupRows=[],groupIndex=0;const selectedSet=new Set(this.committed),flushGroup=()=>{if(currentGroupRows.length){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
2
2
  <div id=${labelId} part="group-label" class="group-label">${currentGroup}</div>
3
3
  ${currentGroupRows}
4
- </div>`)}else out.push(...currentGroupRows);currentGroupRows=[]}};return rows.forEach((o,i)=>{o.group!==currentGroup&&(flushGroup(),currentGroup=o.group);const id=`${this.listId}-opt-${i}`,sourceOption=this.sourceOptionsByRow.get(o),selected=this.multiple||this.source||o.unknownValue!==void 0?selectedSet.has(o.value):this.singleSelectedOption!==void 0&&sourceOption===this.singleSelectedOption;selected&&!this.multiple&&selectedSet.delete(o.value),currentGroupRows.push(html`<div part="option" id=${id} role="option" data-index=${i} data-value=${o.value} ?data-create=${o.createInput!==void 0} ?data-unknown-value=${o.unknownValue!==void 0} title=${o.title||nothing} aria-selected=${selected?"true":"false"} aria-disabled=${o.disabled?"true":"false"} aria-label=${o.accessibleLabel||nothing} ?data-active=${id===activeId} >
4
+ </div>`)}else out.push(...currentGroupRows);currentGroupRows=[]}};return rows.forEach((o,i)=>{o.group!==currentGroup&&(flushGroup(),currentGroup=o.group);const id=`${this.listId}-opt-${i}`,sourceOption=this.sourceOptionsByRow.get(o),richHtml=this.rowHtml.get(o),selected=this.multiple||this.source||o.unknownValue!==void 0?selectedSet.has(o.value):this.singleSelectedOption!==void 0&&sourceOption===this.singleSelectedOption;selected&&!this.multiple&&selectedSet.delete(o.value),currentGroupRows.push(html`<div
5
+ part="option"
6
+ id=${id}
7
+ role="option"
8
+ data-index=${i}
9
+ data-value=${o.value}
10
+ ?data-create=${o.createInput!==void 0}
11
+ ?data-unknown-value=${o.unknownValue!==void 0}
12
+ title=${o.title||nothing}
13
+ aria-selected=${selected?"true":"false"}
14
+ aria-disabled=${o.disabled?"true":"false"}
15
+ aria-label=${o.accessibleLabel||nothing}
16
+ ?data-active=${id===activeId}
17
+ >
5
18
  ${o.start?renderInertPresentation(adornmentContent(o.start),{part:"option-start"}):""}
6
19
  ${o.icon?renderInertPresentation(o.icon,{part:"option-icon"}):""}
7
- ${o.dotColor?html`<span part="option-dot" style=${"background:"+(sanitizeCssColor(o.dotColor)??"transparent")+";"} ></span>`:""}
20
+ ${o.dotColor?html`<span
21
+ part="option-dot"
22
+ style=${"background:"+(sanitizeCssColor(o.dotColor)??"transparent")+";"}
23
+ ></span>`:""}
8
24
  <span part="option-label">
9
- <span>${bdi(o.label)}</span>
25
+ ${richHtml===void 0?html`<span>${bdi(o.label)}</span>`:html`<span class="sr-only">${bdi(o.label)}</span
26
+ ><span part="option-html" aria-hidden="true" dir="auto">${unsafeHTML(richHtml)}</span>`}
10
27
  ${o.sub?html`<span part="option-sub">${bdi(o.sub)}</span>`:""}
11
28
  </span>
12
29
  ${o.badge!=null?html`<span part="option-badge">${o.badge}</span>`:""}
13
30
  ${o.end?renderInertPresentation(adornmentContent(o.end),{part:"option-end"}):""}
14
31
  </div>`)}),flushGroup(),out}renderTag(value,index){const occurrence=this.multipleOccurrences[index],option=isLyraOptionElement(occurrence)?occurrence:this.optionIndex.values.get(value);if(this.getTag&&option)return this.getTag(option,index);const label=this.labelFor(value,index),unknown=this.isUnknownValue(value);return html`<span part="tag" title=${option?.title||nothing} ?data-unknown-value=${unknown}>
15
- <span part="tag-label" ><span part="tag__content" aria-hidden="true">${label}</span
32
+ <span part="tag-label"
33
+ ><span part="tag__content" aria-hidden="true">${label}</span
16
34
  >${unknown?html`<span part="unknown-value">${this.localize("notInCatalog")}</span>`:""}</span
17
35
  >
18
- <button part="tag__remove-button tag__remove-button__button" type="button" ?disabled=${this.effectiveDisabled||this.readonly} aria-label=${this.localize("removeWithContext",void 0,{label})} @click=${event=>{event.stopPropagation(),this._selected[index]===value&&this.removeValueAt(index)}} >
36
+ <button
37
+ part="tag__remove-button tag__remove-button__button"
38
+ type="button"
39
+ ?disabled=${this.effectiveDisabled||this.readonly}
40
+ aria-label=${this.localize("removeWithContext",void 0,{label})}
41
+ @click=${event=>{event.stopPropagation(),this._selected[index]===value&&this.removeValueAt(index)}}
42
+ >
19
43
  <span part="tag__remove-button__base">${closeIcon()}</span>
20
44
  </button>
21
45
  </span>`}statusText(key,override,values){return override==null?this.localize(key,void 0,values):values===void 0?override:override.replace(/\{(\w+)\}/g,(match,name)=>{const value=values[name];return typeof value=="string"||typeof value=="number"?String(value):match})}render(){const{rows,overflow}=this.listboxRendered?this.renderedRows:{rows:[],overflow:0};this._renderedRows=rows;const navigable=rows.filter(r=>!r.disabled),active=this.activeIndex>=0?navigable[this.activeIndex]:void 0,activeId=active?`${this.listId}-opt-${rows.indexOf(active)}`:"",shownTags=this.multiple?this._selected.slice(0,this.maxOptionsVisible):[],extra=this.multiple?this._selected.length-shownTags.length:0,hasValue=this._selected.length>0,singleValueUnknown=!this.multiple&&!this.open&&!this.explicitInputValue&&hasValue&&this.isUnknownValue(this._selected[0]),hasVisibleQuery=this.query!==""&&(this.open||this.multiple),supporting=formControlSupportingState({presence:this.slotPresence,idPrefix:"combobox",hint:this.hint,errorText:this.errorText,withHint:this.withHint,helpText:this.helpText}),hasLabel=this.withLabel||this.slotPresence.has("label")||(this.label??"").length>0,describedBy=this.localDescriptionIds=[this.multiple&&hasValue?"combobox-value":"",supporting.describedBy].filter(Boolean).join(" "),invalid=supporting.hasError||this.touched&&!this.internals.validity.valid,pending=this.loading||this.sourceLoading,showLoadingRow=pending&&!(this.serverRequests&&rows.length>0);return this.loadingRowShown=this.listboxRendered&&this.open&&showLoadingRow,html`
22
46
  <div part="form-control">
23
- <label part="form-control-label" for=${this.inputId} ?hidden=${!hasLabel} >
47
+ <label
48
+ part="form-control-label"
49
+ for=${this.inputId}
50
+ ?hidden=${!hasLabel}
51
+ >
24
52
  <span part="label">${this.label}<slot name="label"></slot></span>
25
53
  </label>
26
- <div part="combobox" @mousedown=${this.onComboMouseDown} @focusout=${this.onComboFocusOut} >
54
+ <div
55
+ part="combobox"
56
+ @mousedown=${this.onComboMouseDown}
57
+ @focusout=${this.onComboFocusOut}
58
+ >
27
59
  <span part="form-control-input" class="control-contents">
28
60
  <span part="start" ?hidden=${!this.slotPresence.has("start")}>
29
61
  <slot name="start"></slot>
30
62
  </span>
31
63
  <div part="tags">
32
64
  ${shownTags.map((value,index)=>this.renderTag(value,index))}
33
- ${extra>0?html`<span part="tag tag-overflow" aria-hidden="true" >${this.localize("comboboxSelectedOverflow",void 0,{n:getNumberFormat(this.effectiveLocale).format(extra)})}</span
65
+ ${extra>0?html`<span part="tag tag-overflow" aria-hidden="true"
66
+ >${this.localize("comboboxSelectedOverflow",void 0,{n:getNumberFormat(this.effectiveLocale).format(extra)})}</span
34
67
  >`:""}
35
68
  </div>
36
- ${this.multiple&&hasValue?html`<span id="combobox-value" class="sr-only" >${this.selectedLabels}</span
69
+ ${this.multiple&&hasValue?html`<span id="combobox-value" class="sr-only"
70
+ >${this.selectedLabels}</span
37
71
  >`:""}
38
- <input id=${this.inputId} part="combobox-input" role="combobox" aria-label=${hostAriaLabel(this)??(hasLabel?nothing:this.placeholder||this.localize("comboboxLabel"))} aria-describedby=${describedBy||nothing} aria-expanded=${this.open?"true":"false"} aria-controls=${this.listId} aria-haspopup=${this.sourceFailed?"dialog":nothing} aria-activedescendant=${this.sourceFailed?nothing:activeId||nothing} aria-autocomplete="list" aria-required=${this.required?"true":"false"} aria-invalid=${invalid?"true":"false"} autocomplete=${this.autocomplete||nothing} inputmode=${this.inputMode||nothing} enterkeyhint=${this.enterKeyHint||nothing} spellcheck=${this.spellcheck} autocapitalize=${this.autocapitalize||nothing} autocorrect=${nativeAutocorrectAttribute(this,this.autocorrect)} .value=${this.displayValue} placeholder=${hasValue&&!this.multiple?"":this.placeholder} ?disabled=${this.effectiveDisabled} ?readonly=${this.readonly} ?data-unknown-value=${singleValueUnknown} @input=${this.onInput} @keydown=${this.onKeyDown} @focus=${this.onInputFocus} @blur=${this.onInputBlur} />
72
+ <input
73
+ id=${this.inputId}
74
+ part="combobox-input"
75
+ role="combobox"
76
+ aria-label=${hostAriaLabel(this)??(hasLabel?nothing:this.placeholder||this.localize("comboboxLabel"))}
77
+ aria-describedby=${describedBy||nothing}
78
+ aria-expanded=${this.open?"true":"false"}
79
+ aria-controls=${this.listId}
80
+ aria-haspopup=${this.sourceFailed?"dialog":nothing}
81
+ aria-activedescendant=${this.sourceFailed?nothing:activeId||nothing}
82
+ aria-autocomplete="list"
83
+ aria-required=${this.required?"true":"false"}
84
+ aria-invalid=${invalid?"true":"false"}
85
+ autocomplete=${this.autocomplete||nothing}
86
+ inputmode=${this.inputMode||nothing}
87
+ enterkeyhint=${this.enterKeyHint||nothing}
88
+ spellcheck=${this.spellcheck}
89
+ autocapitalize=${this.autocapitalize||nothing}
90
+ autocorrect=${nativeAutocorrectAttribute(this,this.autocorrect)}
91
+ .value=${this.displayValue}
92
+ placeholder=${hasValue&&!this.multiple?"":this.placeholder}
93
+ ?disabled=${this.effectiveDisabled}
94
+ ?readonly=${this.readonly}
95
+ ?data-unknown-value=${singleValueUnknown}
96
+ @input=${this.onInput}
97
+ @keydown=${this.onKeyDown}
98
+ @focus=${this.onInputFocus}
99
+ @blur=${this.onInputBlur}
100
+ />
39
101
  ${singleValueUnknown?html`<span part="unknown-value">${this.localize("notInCatalog")}</span>`:""}
40
- ${(this.clearable||this.withClear)&&(hasValue||hasVisibleQuery)?html`<button part="clear-button" type="button" ?disabled=${this.effectiveDisabled||this.readonly} aria-label=${this.localize("clear")} @mousedown=${e=>e.preventDefault()} @click=${e=>{e.stopPropagation(),this.clear();const restoringFocus=this.restoringOverlayFocus;this.restoringOverlayFocus=!0;try{this.inputEl?.focus()}finally{this.restoringOverlayFocus=restoringFocus}}} >
41
- <span aria-hidden="true" inert ><slot name="clear-icon">${closeIcon()}</slot></span
102
+ ${(this.clearable||this.withClear)&&(hasValue||hasVisibleQuery)?html`<button
103
+ part="clear-button"
104
+ type="button"
105
+ ?disabled=${this.effectiveDisabled||this.readonly}
106
+ aria-label=${this.localize("clear")}
107
+ @mousedown=${e=>e.preventDefault()}
108
+ @click=${e=>{e.stopPropagation(),this.clear();const restoringFocus=this.restoringOverlayFocus;this.restoringOverlayFocus=!0;try{this.inputEl?.focus()}finally{this.restoringOverlayFocus=restoringFocus}}}
109
+ >
110
+ <span aria-hidden="true" inert
111
+ ><slot name="clear-icon">${closeIcon()}</slot></span
42
112
  >
43
113
  </button>`:""}
44
114
  ${pending&&!this.loadingRowShown?html`<span part="spinner" aria-hidden="true" inert>${spinnerIcon()}</span>`:""}
45
115
  <span part="end" ?hidden=${!this.slotPresence.has("end")}>
46
116
  <slot name="end"></slot>
47
117
  </span>
48
- <span part="expand-icon" aria-hidden="true" inert ><slot name="expand-icon">${chevronIcon()}</slot></span
118
+ <span part="expand-icon" aria-hidden="true" inert
119
+ ><slot name="expand-icon">${chevronIcon()}</slot></span
49
120
  >
50
121
  </span>
51
122
  </div>
52
- <div part="listbox" ?hidden=${this.listboxHidden} ?data-positioned=${this.listboxPositioned} id=${this.listId} role=${this.sourceFailed?"dialog":"listbox"} aria-label=${this.sourceFailed?this.localize("comboboxLoadError"):nothing} aria-multiselectable=${this.sourceFailed?nothing:this.multiple?"true":"false"} @mousedown=${this.onListboxMouseDown} @click=${this.onListboxClick} >
123
+ <div
124
+ part="listbox"
125
+ ?hidden=${this.listboxHidden}
126
+ ?data-positioned=${this.listboxPositioned}
127
+ id=${this.listId}
128
+ role=${this.sourceFailed?"dialog":"listbox"}
129
+ aria-label=${this.sourceFailed?this.localize("comboboxLoadError"):nothing}
130
+ aria-multiselectable=${this.sourceFailed?nothing:this.multiple?"true":"false"}
131
+ @mousedown=${this.onListboxMouseDown}
132
+ @click=${this.onListboxClick}
133
+ >
53
134
  <span class="glass-scroll-layer" aria-hidden="true"></span>
54
- ${this.listboxRendered?showLoadingRow?html`<div class="loading" part="status loading" role="option" aria-selected="false" aria-disabled="true" ><slot name="loading">${this.statusText("loading",this.loadingText)}</slot></div
135
+ ${this.listboxRendered?showLoadingRow?html`<div class="loading" part="status loading" role="option" aria-selected="false" aria-disabled="true"
136
+ ><slot name="loading">${this.statusText("loading",this.loadingText)}</slot></div
55
137
  >`:this.sourceFailed?html`<div class="source-error" part="source-error-row" role="presentation">
56
138
  ${renderDataState(this,{loading:!1,error:!0,empty:!1,errorHeading:this.localize("comboboxLoadError"),compact:!0,headingLevel:"none",onRetry:()=>this.refresh(),emitRetryRequest:(detail,init)=>this.emit("lr-retry-request",detail,init),slotNames:{error:"source-error"}},{error:"source-error"},"lr-retry-request")}
57
- </div>`:rows.length===0?this.query===""?html`<div class="empty" part="status empty" role="option" aria-selected="false" aria-disabled="true" ><slot name="empty">${this.statusText("noMatches",this.emptyText)}</slot></div
58
- >`:html`<div class="empty" part="status no-results" role="option" aria-selected="false" aria-disabled="true" ><slot name="no-results">${this.statusText("noMatches",this.emptyText)}</slot></div
139
+ </div>`:rows.length===0?this.query===""?html`<div class="empty" part="status empty" role="option" aria-selected="false" aria-disabled="true"
140
+ ><slot name="empty">${this.statusText("noMatches",this.emptyText)}</slot></div
141
+ >`:html`<div class="empty" part="status no-results" role="option" aria-selected="false" aria-disabled="true"
142
+ ><slot name="no-results">${this.statusText("noMatches",this.emptyText)}</slot></div
59
143
  >`:html`${this.renderRows(rows,activeId)}
60
- ${overflow>0?html`<div part="option-overflow">${this.statusText("comboboxOverflow",this.overflowText,{n:getNumberFormat(this.effectiveLocale).format(overflow)})}</div>`:""}`:nothing}
144
+ ${overflow>0?html`<div part="option-overflow">${this.statusText("comboboxOverflow",this.overflowText,{n:getNumberFormat(this.effectiveLocale).format(overflow)})}</div>`:""}
145
+ ${this.rowHtmlUnavailable&&rows.some(row=>row.html!==void 0)?html`<div part="option-html-fallback">${this.localize("comboboxRichContentUnavailable")}</div>`:""}`:nothing}
61
146
  </div>
62
147
  ${renderFormControlHintError({...supporting,idPrefix:"combobox",hint:this.hint||this.helpText,errorText:this.errorText,helpTextSlot:!0})}
63
148
  </div>
64
- <slot @slotchange=${this.collectOptions} @lr-option-change=${this.onOptionChange} hidden ></slot>
65
- `}}__decorate([property()],LyraCombobox.prototype,"placeholder",void 0),__decorate([property()],LyraCombobox.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraCombobox.prototype,"labelDisplay",void 0),__decorate([property({attribute:"label-placement",reflect:!0})],LyraCombobox.prototype,"labelPlacement",void 0),__decorate([property()],LyraCombobox.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraCombobox.prototype,"helpText",void 0),__decorate([property({attribute:"error-text"})],LyraCombobox.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"open",null),__decorate([property({type:Boolean,attribute:"allow-create"})],LyraCombobox.prototype,"allowCreate",void 0),__decorate([property({type:Boolean,attribute:"allow-custom-value"})],LyraCombobox.prototype,"allowCustomValue",void 0),__decorate([property({converter:COMBOBOX_COMMIT,reflect:!0})],LyraCombobox.prototype,"commit",null),__decorate([property({type:Boolean,attribute:"with-unknown-option",reflect:!0})],LyraCombobox.prototype,"withUnknownOption",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"getUnknownLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"loading",void 0),__decorate([property({converter:APPEARANCE,reflect:!0})],LyraCombobox.prototype,"appearance",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("bottom")})],LyraCombobox.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:positioningStrategyConverter})],LyraCombobox.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraCombobox.prototype,"topLayer",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"pill",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"clearable",void 0),__decorate([property({type:Boolean,attribute:"with-clear"})],LyraCombobox.prototype,"withClear",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraCombobox.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraCombobox.prototype,"withHint",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"getTag",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"validators",void 0),__decorate([property({useDefault:!0})],LyraCombobox.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraCombobox.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraCombobox.prototype,"enterKeyHint",void 0),__decorate([property({converter:comboboxSpellcheckConverter,useDefault:!0})],LyraCombobox.prototype,"spellcheck",void 0),__decorate([property()],LyraCombobox.prototype,"autocapitalize",void 0),__decorate([property({attribute:"empty-text"})],LyraCombobox.prototype,"emptyText",void 0),__decorate([property({attribute:"loading-text"})],LyraCombobox.prototype,"loadingText",void 0),__decorate([property({attribute:"overflow-text"})],LyraCombobox.prototype,"overflowText",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"filter",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"source",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"dataSource",null),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"server",void 0),__decorate([property({converter:autocorrectConverter})],LyraCombobox.prototype,"autocorrect",null),__decorate([state()],LyraCombobox.prototype,"query",null),__decorate([state()],LyraCombobox.prototype,"activeIndex",void 0),__decorate([state()],LyraCombobox.prototype,"options",void 0),__decorate([state()],LyraCombobox.prototype,"optionsObserved",void 0),__decorate([state()],LyraCombobox.prototype,"touched",void 0),__decorate([state()],LyraCombobox.prototype,"validityRevision",void 0),__decorate([state()],LyraCombobox.prototype,"sourceLoading",void 0),__decorate([state()],LyraCombobox.prototype,"sourceFailed",void 0),__decorate([state()],LyraCombobox.prototype,"sourceEverSettled",void 0),__decorate([state()],LyraCombobox.prototype,"asyncRows",void 0),__decorate([query('[part="combobox-input"]')],LyraCombobox.prototype,"inputEl",void 0),__decorate([query("slot:not([name])")],LyraCombobox.prototype,"optionsSlot",void 0),__decorate([state()],LyraCombobox.prototype,"listboxPositioned",void 0),__decorate([state()],LyraCombobox.prototype,"listboxHidden",void 0),__decorate([state()],LyraCombobox.prototype,"listboxRendered",void 0),__decorate([property({converter:blankNumberConverter(void 0),attribute:"visible-options"})],LyraCombobox.prototype,"visibleOptions",void 0),installNativeInputModeAliases(LyraCombobox.prototype);export{LyraCombobox};
149
+ <slot
150
+ @slotchange=${this.collectOptions}
151
+ @lr-option-change=${this.onOptionChange}
152
+ hidden
153
+ ></slot>
154
+ `}}__decorate([property()],LyraCombobox.prototype,"placeholder",void 0),__decorate([property()],LyraCombobox.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraCombobox.prototype,"labelDisplay",void 0),__decorate([property({attribute:"label-placement",reflect:!0})],LyraCombobox.prototype,"labelPlacement",void 0),__decorate([property()],LyraCombobox.prototype,"hint",void 0),__decorate([property({attribute:"help-text"})],LyraCombobox.prototype,"helpText",void 0),__decorate([property({attribute:"error-text"})],LyraCombobox.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"open",null),__decorate([property({type:Boolean,attribute:"allow-create"})],LyraCombobox.prototype,"allowCreate",void 0),__decorate([property({type:Boolean,attribute:"allow-custom-value"})],LyraCombobox.prototype,"allowCustomValue",void 0),__decorate([property({converter:COMBOBOX_COMMIT,reflect:!0})],LyraCombobox.prototype,"commit",null),__decorate([property({type:Boolean,attribute:"with-unknown-option",reflect:!0})],LyraCombobox.prototype,"withUnknownOption",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"getUnknownLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"loading",void 0),__decorate([property({converter:APPEARANCE,reflect:!0})],LyraCombobox.prototype,"appearance",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("bottom")})],LyraCombobox.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:positioningStrategyConverter})],LyraCombobox.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraCombobox.prototype,"topLayer",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"pill",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"clearable",void 0),__decorate([property({type:Boolean,attribute:"with-clear"})],LyraCombobox.prototype,"withClear",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraCombobox.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraCombobox.prototype,"withHint",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"getTag",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"validators",void 0),__decorate([property({useDefault:!0})],LyraCombobox.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraCombobox.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraCombobox.prototype,"enterKeyHint",void 0),__decorate([property({converter:comboboxSpellcheckConverter,useDefault:!0})],LyraCombobox.prototype,"spellcheck",void 0),__decorate([property()],LyraCombobox.prototype,"autocapitalize",void 0),__decorate([property({attribute:"empty-text"})],LyraCombobox.prototype,"emptyText",void 0),__decorate([property({attribute:"loading-text"})],LyraCombobox.prototype,"loadingText",void 0),__decorate([property({attribute:"overflow-text"})],LyraCombobox.prototype,"overflowText",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"filter",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"source",void 0),__decorate([property({attribute:!1})],LyraCombobox.prototype,"dataSource",null),__decorate([property({type:Boolean,reflect:!0})],LyraCombobox.prototype,"server",void 0),__decorate([property({converter:autocorrectConverter})],LyraCombobox.prototype,"autocorrect",null),__decorate([state()],LyraCombobox.prototype,"query",null),__decorate([state()],LyraCombobox.prototype,"activeIndex",void 0),__decorate([state()],LyraCombobox.prototype,"options",void 0),__decorate([state()],LyraCombobox.prototype,"optionsObserved",void 0),__decorate([state()],LyraCombobox.prototype,"touched",void 0),__decorate([state()],LyraCombobox.prototype,"validityRevision",void 0),__decorate([state()],LyraCombobox.prototype,"sourceLoading",void 0),__decorate([state()],LyraCombobox.prototype,"sourceFailed",void 0),__decorate([state()],LyraCombobox.prototype,"sourceEverSettled",void 0),__decorate([state()],LyraCombobox.prototype,"asyncRows",void 0),__decorate([state()],LyraCombobox.prototype,"rowHtml",void 0),__decorate([state()],LyraCombobox.prototype,"rowHtmlUnavailable",void 0),__decorate([query('[part="combobox-input"]')],LyraCombobox.prototype,"inputEl",void 0),__decorate([query("slot:not([name])")],LyraCombobox.prototype,"optionsSlot",void 0),__decorate([state()],LyraCombobox.prototype,"listboxPositioned",void 0),__decorate([state()],LyraCombobox.prototype,"listboxHidden",void 0),__decorate([state()],LyraCombobox.prototype,"listboxRendered",void 0),__decorate([property({converter:blankNumberConverter(void 0),attribute:"visible-options"})],LyraCombobox.prototype,"visibleOptions",void 0),installNativeInputModeAliases(LyraCombobox.prototype);export{LyraCombobox};
@@ -1 +1 @@
1
- import{forcedColorsSelected}from"../../../internal/forced-colors.styles.js";import{activeFill,activeTint,disabledControl,focusRing,iconHitTarget,interactiveTransition}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{formControlFocusHalo,formControlFieldTransition,formControlInvalidBorder,formControlRequiredMarker,formControlTextWrap,formControlTouchFontFloor}from"../../../internal/form-control.styles.js";import{formControlChrome,formControlLabelPlacement}from"../../../internal/form-control/chrome.styles.js";import{overlaySurface,overlaySurfaceControlEdge}from"../../../internal/overlay-surface.styles.js";import{dataStateRetryStyles}from"../../../internal/data-state-renderer.styles.js";const styles=css` :host{display:block;--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-s);--_lr-combobox-trigger-min-height:var(--lr-form-control-height);--_lr-combobox-font-size:var(--lr-form-control-font-size);--_lr-combobox-tag-padding:var(--lr-size-0-1rem) var(--lr-size-0-4rem);--_lr-combobox-tag-font-size:var(--lr-font-size-sm);--_lr-combobox-expand-size:min( var(--lr-size-1-75rem), max(0px, calc(var(--lr-form-control-height) - 2 * var(--lr-form-control-padding-block) - 2 * var(--lr-border-width-thin))) );--_lr-combobox-gap:var(--lr-space-xs);--_lr-combobox-radius:var(--lr-form-control-radius);--_lr-combobox-fill:var(--lr-color-surface);--_lr-combobox-border-color:var(--lr-color-border);--_lr-combobox-text-color:inherit;--_lr-form-control-focus-shadow:var(--lr-form-control-focus-shadow, none);--_lr-form-control-transition:var(--lr-form-control-transition, none)}:host([pill]){--_lr-combobox-radius:var(--lr-radius-pill)}:host([appearance=filled]){--_lr-combobox-fill:var(--lr-color-surface-raised);--_lr-combobox-border-color:transparent}:host([appearance=filled-outlined]){--_lr-combobox-fill:var(--lr-color-surface-raised)}:host([appearance=plain]){--_lr-combobox-fill:transparent;--_lr-combobox-border-color:transparent}:host([appearance=accent]){--_lr-combobox-fill:var(--lr-color-brand);--_lr-combobox-border-color:transparent;--_lr-combobox-text-color:var(--lr-color-on-brand)}:host([appearance=accent]) [part=start],:host([appearance=accent]) [part=end],:host([appearance=accent]) [part=expand-icon],:host([appearance=accent]) [part=combobox-input]::placeholder{color:inherit}:host([appearance=accent]) [part~=tag]{background:color-mix(in srgb,currentColor 20%,transparent);color:inherit}:host([size="2xs"]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-2xs);--_lr-combobox-tag-padding:0 var(--lr-size-0-25rem);--_lr-combobox-tag-font-size:var(--lr-font-size-2xs);--_lr-combobox-expand-size:var(--lr-size-1rem)}:host([size=xs]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-xs);--_lr-combobox-tag-padding:0 var(--lr-size-0-25rem);--_lr-combobox-tag-font-size:var(--lr-font-size-2xs);--_lr-combobox-expand-size:var(--lr-size-1rem)}:host([size=s]),:host([size=small]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-xs);--_lr-combobox-tag-padding:var(--lr-size-0-05rem) var(--lr-size-0-3125rem);--_lr-combobox-tag-font-size:var(--lr-font-size-xs);--_lr-combobox-expand-size:var(--lr-size-1-25rem)}:host([size=l]),:host([size=large]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-m);--_lr-combobox-tag-padding:var(--lr-size-0-15rem) var(--lr-size-0-5rem);--_lr-combobox-tag-font-size:var(--lr-font-size-md-sm)}:host([size=xl]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-l);--_lr-combobox-tag-padding:var(--lr-size-0-25rem) var(--lr-size-0-625rem);--_lr-combobox-tag-font-size:var(--lr-font-size-m)}${formControlChrome} ${formControlLabelPlacement} ${formControlRequiredMarker} [part=combobox]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--lr-combobox-gap,var(--_lr-combobox-gap));inline-size:100%;min-block-size:var(--lr-combobox-trigger-height,var(--lr-combobox-trigger-min-height,var(--_lr-combobox-trigger-min-height)));box-sizing:border-box;block-size:var(--lr-combobox-trigger-height,auto);padding:var(--lr-combobox-trigger-padding,var(--_lr-combobox-trigger-padding));border:var(--lr-border-width-thin) solid var(--lr-combobox-border-color,var(--_lr-combobox-border-color));border-radius:var(--lr-combobox-radius,var(--_lr-combobox-radius));background:var(--lr-combobox-fill,var(--_lr-combobox-fill));color:var(--lr-combobox-color,var(--_lr-combobox-text-color));font-size:var(--lr-combobox-font-size,var(--_lr-combobox-font-size));cursor:text}[part=combobox]{${formControlFieldTransition}}@media (prefers-reduced-motion:reduce){:host{--_lr-form-control-transition:none}}[part=combobox]:focus-within{border-color:var(--lr-combobox-open-border-color,var(--lr-color-brand));outline:var(--lr-border-width-medium) solid transparent;${formControlFocusHalo}}:host(:disabled) [part=combobox]{${disabledControl}}[part=start],[part=end]{flex:0 0 auto;display:inline-flex;align-items:center;color:var(--lr-color-text-quiet)}.control-contents{display:contents}[part=start][hidden],[part=end][hidden]{display:none}[part=tags]{display:contents}[part~=tag]{display:inline-flex;min-inline-size:0;max-inline-size:min(100%,var(--tag-max-size,var(--lr-size-12rem)));align-items:center;gap:var(--lr-space-xs);padding:var(--lr-combobox-tag-padding,var(--_lr-combobox-tag-padding));font-size:var(--lr-combobox-tag-font-size,var(--_lr-combobox-tag-font-size));background:var(--lr-combobox-tag-bg,var(--lr-color-brand-quiet));color:var(--lr-combobox-tag-color,var(--lr-color-text));border-radius:var(--lr-combobox-tag-radius,var(--lr-radius))}[part~=tag-overflow]{color:var(--lr-color-text-quiet);white-space:nowrap}[part=tag-label]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=combobox-input][data-unknown-value]{font-style:italic}[part=tag][data-unknown-value] [part=tag__content]{font-style:italic}[part=tag][data-unknown-value]{border:var(--lr-border-width-thin) var(--lr-combobox-unknown-value-border-style,dashed) var(--lr-combobox-unknown-value-border-color,var(--lr-color-border))}[part~=option][data-unknown-value] [part=option-label]{font-style:italic}[part~=option][data-unknown-value]{border:var(--lr-border-width-thin) var(--lr-combobox-unknown-value-border-style,dashed) var(--lr-combobox-unknown-value-border-color,var(--lr-color-border))}[part=unknown-value]{flex:0 0 auto;margin-inline-start:var(--lr-space-2xs);font-size:var(--lr-size-0-6875rem);font-style:normal;font-weight:var(--lr-font-weight-normal);color:var(--lr-color-text-quiet);white-space:nowrap}[part~=tag__remove-button]{display:inline-flex;align-items:center;justify-content:center;${iconHitTarget} margin:calc((var(--lr-icon-button-size) - var(--lr-size-1rem)) / -2);border:none;background:none;cursor:pointer;color:inherit;padding:0;font:inherit;line-height:var(--lr-line-height-none);font-size:var(--lr-font-size-m);${interactiveTransition}}[part=combobox-input]{flex:1 1 var(--lr-size-6ch);min-inline-size:var(--lr-size-4ch);padding-block:0;border:none;outline:none;background:transparent;color:inherit;font:inherit}[part=combobox-input]::placeholder{color:var(--lr-color-text-quiet)}[part=clear-button],[part=expand-icon]{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;border:none;background:none;cursor:pointer;color:var(--lr-color-text-quiet);padding:var(--lr-space-xs);line-height:var(--lr-line-height-none)}[part=expand-icon]{box-sizing:border-box;min-inline-size:min(var(--lr-icon-button-size),var(--lr-combobox-expand-size,var(--_lr-combobox-expand-size)));min-block-size:min(var(--lr-icon-button-size),var(--lr-combobox-expand-size,var(--_lr-combobox-expand-size)));padding:0}[part=clear-button]{font:inherit;min-inline-size:max(var(--lr-size-24px),min(var(--lr-icon-button-size),var(--lr-form-control-height)));min-block-size:max(var(--lr-size-24px),min(var(--lr-icon-button-size),var(--lr-form-control-height)));line-height:var(--lr-line-height-none)}[part=expand-icon] svg{transform:rotate(90deg)}[part=spinner]{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;inline-size:var(--lr-size-1em);block-size:var(--lr-size-1em);color:var(--lr-color-text-quiet);animation:lr-combobox-spin var(--lr-duration-ambient) var(--lr-easing-linear) infinite}[part=spinner] svg{inline-size:100%;block-size:100%}@keyframes lr-combobox-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part=spinner]{animation:none}}[part=clear-button]:hover{color:var(--lr-color-text)}[part=clear-button]:active{background: ${activeFill("var(--lr-color-surface)")};border-radius:var(--lr-radius)}[part~=tag__remove-button]:hover{background:color-mix(in srgb,currentColor 16%,transparent)}[part~=tag__remove-button]:active{background: ${activeTint("currentColor")}}[part=clear-button]:focus-visible,[part~=tag__remove-button]:focus-visible{${focusRing}}[part=listbox][hidden]{display:none}[part=listbox]{position:fixed;z-index:var(--lr-overlay-stack-index,var(--lr-layer-dropdown));box-sizing:border-box;max-block-size:min(var(--lr-size-18rem),var(--lr-positioner-available-block-size,var(--lr-size-18rem)));overflow-y:auto;overflow-x:hidden;scrollbar-width:var(--lr-theme-scrollbar-width,auto);scrollbar-gutter:var(--lr-theme-scrollbar-gutter,auto);scrollbar-color:var(--lr-theme-scrollbar-color,auto);inline-size:max-content;padding:var(--lr-space-xs);${overlaySurface} ${overlaySurfaceControlEdge} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m));visibility:hidden;opacity:0;transform:translateY(var(--lr-size-neg-0-25rem));transition:opacity var(--hide-duration,var(--lr-transition-fast)),transform var(--hide-duration,var(--lr-transition-fast)),visibility var(--hide-duration,var(--lr-transition-fast))}:host(:not([sync=width]):not([sync=both])) [part=listbox]{min-inline-size:min(var(--lr-size-12rem),var(--lr-positioner-available-inline-size,var(--lr-size-12rem)));max-inline-size:min(var(--lr-popover-viewport-clamp),var(--lr-size-28rem),var(--lr-positioner-available-inline-size,100vw))}:host([sync=width]) [part=listbox],:host([sync=both]) [part=listbox]{max-inline-size:var(--lr-positioner-available-inline-size,100vw)}[part=option],.group-label,.loading,.empty,.source-error{min-inline-size:0;overflow-wrap:anywhere}:host([open]) [part=listbox][data-positioned]{visibility:visible;opacity:1;transform:translateY(0);transition-duration:var(--_lr-motion-duration,var(--show-duration,var(--lr-transition-fast)))}@media (prefers-reduced-motion:reduce){[part=listbox]{transition:none!important}}[part=option]{display:flex;align-items:center;gap:var(--lr-space-xs);inline-size:100%;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid transparent;border-radius:var(--lr-radius);background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}[part=option][aria-selected=true]{background:var(--lr-combobox-option-selected-bg,transparent);border-color:var(--lr-combobox-option-selected-border-color,var(--lr-color-brand));color:var(--lr-combobox-option-selected-color,var(--lr-color-brand));font-weight:var(--lr-combobox-option-selected-font-weight,var(--lr-font-weight-semibold))}[part=option]:where(:not([aria-disabled=true])):hover,[part=option][data-active]{background:var(--lr-combobox-option-active-bg,var(--lr-color-brand-quiet))}[part=option]:where(:not([aria-disabled=true])):active{background: ${activeFill("var(--lr-combobox-option-active-bg, var(--lr-color-brand-quiet))")}}[part=option][aria-disabled=true]{${disabledControl}}[part=option-dot]{inline-size:var(--lr-size-0-5rem);block-size:var(--lr-size-0-5rem);border-radius:50%;flex:0 0 auto}[part=option-icon]{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--lr-color-text-quiet)}[part=option-start],[part=option-end]{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;max-inline-size:40%;overflow:hidden}[part=option-start]>*,[part=option-end]>*{min-inline-size:0;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=option-label]{display:flex;flex-direction:column;flex:1 1 auto;min-inline-size:0}[part=option-sub]{font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet)}[part=option-badge]{flex:0 0 auto;padding:0 var(--lr-space-xs);border-radius:var(--lr-radius-pill);background:var(--lr-combobox-option-badge-bg,var(--lr-color-brand-quiet));color:var(--lr-color-text);font-size:var(--lr-font-size-xs)}[part=option-overflow],.loading{padding:var(--lr-space-s) var(--lr-space-m);font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet)}.group-label{padding:var(--lr-space-xs) var(--lr-space-s) 0;font-size:var(--lr-size-0-6875rem);font-weight:var(--lr-font-weight-bold);text-transform:uppercase;letter-spacing:var(--lr-size-0-04em);color:var(--lr-color-text-quiet)}.empty{padding:var(--lr-space-m);color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm)}[part=source-error-row]{padding:var(--lr-space-xs) var(--lr-space-s)}${dataStateRetryStyles} [part=form-control],[part=form-control-label],[part~=hint],[part=error]{${formControlTextWrap}}${glassScrollLayerStyles} ${glassIndependentRootStyles} ${glassSurface('[part="listbox"]',css`var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-high)))`,void 0,!0)} ${forcedColorsSelected} ${formControlInvalidBorder(css`[part="combobox"]`)} ${formControlTouchFontFloor(css`[part="combobox-input"]`)} `;export{styles};
1
+ import{forcedColorsSelected}from"../../../internal/forced-colors.styles.js";import{activeFill,activeTint,disabledControl,focusRing,iconHitTarget,interactiveTransition}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{formControlFocusHalo,formControlFieldTransition,formControlInvalidBorder,formControlRequiredMarker,formControlTextWrap,formControlTouchFontFloor}from"../../../internal/form-control.styles.js";import{formControlChrome,formControlLabelPlacement}from"../../../internal/form-control/chrome.styles.js";import{overlaySurface,overlaySurfaceControlEdge}from"../../../internal/overlay-surface.styles.js";import{dataStateRetryStyles}from"../../../internal/data-state-renderer.styles.js";const styles=css` :host{display:block;--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-s);--_lr-combobox-trigger-min-height:var(--lr-form-control-height);--_lr-combobox-font-size:var(--lr-form-control-font-size);--_lr-combobox-tag-padding:var(--lr-size-0-1rem) var(--lr-size-0-4rem);--_lr-combobox-tag-font-size:var(--lr-font-size-sm);--_lr-combobox-expand-size:min( var(--lr-size-1-75rem), max(0px, calc(var(--lr-form-control-height) - 2 * var(--lr-form-control-padding-block) - 2 * var(--lr-border-width-thin))) );--_lr-combobox-gap:var(--lr-space-xs);--_lr-combobox-radius:var(--lr-form-control-radius);--_lr-combobox-fill:var(--lr-color-surface);--_lr-combobox-border-color:var(--lr-color-border);--_lr-combobox-text-color:inherit;--_lr-form-control-focus-shadow:var(--lr-form-control-focus-shadow, none);--_lr-form-control-transition:var(--lr-form-control-transition, none)}:host([pill]){--_lr-combobox-radius:var(--lr-radius-pill)}:host([appearance=filled]){--_lr-combobox-fill:var(--lr-color-surface-raised);--_lr-combobox-border-color:transparent}:host([appearance=filled-outlined]){--_lr-combobox-fill:var(--lr-color-surface-raised)}:host([appearance=plain]){--_lr-combobox-fill:transparent;--_lr-combobox-border-color:transparent}:host([appearance=accent]){--_lr-combobox-fill:var(--lr-color-brand);--_lr-combobox-border-color:transparent;--_lr-combobox-text-color:var(--lr-color-on-brand)}:host([appearance=accent]) [part=start],:host([appearance=accent]) [part=end],:host([appearance=accent]) [part=expand-icon],:host([appearance=accent]) [part=combobox-input]::placeholder{color:inherit}:host([appearance=accent]) [part~=tag]{background:color-mix(in srgb,currentColor 20%,transparent);color:inherit}:host([size="2xs"]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-2xs);--_lr-combobox-tag-padding:0 var(--lr-size-0-25rem);--_lr-combobox-tag-font-size:var(--lr-font-size-2xs);--_lr-combobox-expand-size:var(--lr-size-1rem)}:host([size=xs]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-xs);--_lr-combobox-tag-padding:0 var(--lr-size-0-25rem);--_lr-combobox-tag-font-size:var(--lr-font-size-2xs);--_lr-combobox-expand-size:var(--lr-size-1rem)}:host([size=s]),:host([size=small]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-xs);--_lr-combobox-tag-padding:var(--lr-size-0-05rem) var(--lr-size-0-3125rem);--_lr-combobox-tag-font-size:var(--lr-font-size-xs);--_lr-combobox-expand-size:var(--lr-size-1-25rem)}:host([size=l]),:host([size=large]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-m);--_lr-combobox-tag-padding:var(--lr-size-0-15rem) var(--lr-size-0-5rem);--_lr-combobox-tag-font-size:var(--lr-font-size-md-sm)}:host([size=xl]){--_lr-combobox-trigger-padding:var(--lr-form-control-padding-block) var(--lr-space-l);--_lr-combobox-tag-padding:var(--lr-size-0-25rem) var(--lr-size-0-625rem);--_lr-combobox-tag-font-size:var(--lr-font-size-m)}${formControlChrome} ${formControlLabelPlacement} ${formControlRequiredMarker} [part=combobox]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--lr-combobox-gap,var(--_lr-combobox-gap));inline-size:100%;min-block-size:var(--lr-combobox-trigger-height,var(--lr-combobox-trigger-min-height,var(--_lr-combobox-trigger-min-height)));box-sizing:border-box;block-size:var(--lr-combobox-trigger-height,auto);padding:var(--lr-combobox-trigger-padding,var(--_lr-combobox-trigger-padding));border:var(--lr-border-width-thin) solid var(--lr-combobox-border-color,var(--_lr-combobox-border-color));border-radius:var(--lr-combobox-radius,var(--_lr-combobox-radius));background:var(--lr-combobox-fill,var(--_lr-combobox-fill));color:var(--lr-combobox-color,var(--_lr-combobox-text-color));font-size:var(--lr-combobox-font-size,var(--_lr-combobox-font-size));cursor:text}[part=combobox]{${formControlFieldTransition}}@media (prefers-reduced-motion:reduce){:host{--_lr-form-control-transition:none}}[part=combobox]:focus-within{border-color:var(--lr-combobox-open-border-color,var(--lr-color-brand));outline:var(--lr-border-width-medium) solid transparent;${formControlFocusHalo}}:host(:disabled) [part=combobox]{${disabledControl}}[part=start],[part=end]{flex:0 0 auto;display:inline-flex;align-items:center;color:var(--lr-color-text-quiet)}.control-contents{display:contents}[part=start][hidden],[part=end][hidden]{display:none}[part=tags]{display:contents}[part~=tag]{display:inline-flex;min-inline-size:0;max-inline-size:min(100%,var(--tag-max-size,var(--lr-size-12rem)));align-items:center;gap:var(--lr-space-xs);padding:var(--lr-combobox-tag-padding,var(--_lr-combobox-tag-padding));font-size:var(--lr-combobox-tag-font-size,var(--_lr-combobox-tag-font-size));background:var(--lr-combobox-tag-bg,var(--lr-color-brand-quiet));color:var(--lr-combobox-tag-color,var(--lr-color-text));border-radius:var(--lr-combobox-tag-radius,var(--lr-radius))}[part~=tag-overflow]{color:var(--lr-color-text-quiet);white-space:nowrap}[part=tag-label]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=combobox-input][data-unknown-value]{font-style:italic}[part=tag][data-unknown-value] [part=tag__content]{font-style:italic}[part=tag][data-unknown-value]{border:var(--lr-border-width-thin) var(--lr-combobox-unknown-value-border-style,dashed) var(--lr-combobox-unknown-value-border-color,var(--lr-color-border))}[part~=option][data-unknown-value] [part=option-label]{font-style:italic}[part~=option][data-unknown-value]{border:var(--lr-border-width-thin) var(--lr-combobox-unknown-value-border-style,dashed) var(--lr-combobox-unknown-value-border-color,var(--lr-color-border))}[part=unknown-value]{flex:0 0 auto;margin-inline-start:var(--lr-space-2xs);font-size:var(--lr-size-0-6875rem);font-style:normal;font-weight:var(--lr-font-weight-normal);color:var(--lr-color-text-quiet);white-space:nowrap}[part~=tag__remove-button]{display:inline-flex;align-items:center;justify-content:center;${iconHitTarget} margin:calc((var(--lr-icon-button-size) - var(--lr-size-1rem)) / -2);border:none;background:none;cursor:pointer;color:inherit;padding:0;font:inherit;line-height:var(--lr-line-height-none);font-size:var(--lr-font-size-m);${interactiveTransition}}[part=combobox-input]{flex:1 1 var(--lr-size-6ch);min-inline-size:var(--lr-size-4ch);padding-block:0;border:none;outline:none;background:transparent;color:inherit;font:inherit}[part=combobox-input]::placeholder{color:var(--lr-color-text-quiet)}[part=clear-button],[part=expand-icon]{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;border:none;background:none;cursor:pointer;color:var(--lr-color-text-quiet);padding:var(--lr-space-xs);line-height:var(--lr-line-height-none)}[part=expand-icon]{box-sizing:border-box;min-inline-size:min(var(--lr-icon-button-size),var(--lr-combobox-expand-size,var(--_lr-combobox-expand-size)));min-block-size:min(var(--lr-icon-button-size),var(--lr-combobox-expand-size,var(--_lr-combobox-expand-size)));padding:0}[part=clear-button]{font:inherit;min-inline-size:max(var(--lr-size-24px),min(var(--lr-icon-button-size),var(--lr-form-control-height)));min-block-size:max(var(--lr-size-24px),min(var(--lr-icon-button-size),var(--lr-form-control-height)));line-height:var(--lr-line-height-none)}[part=expand-icon] svg{transform:rotate(90deg)}[part=spinner]{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;inline-size:var(--lr-size-1em);block-size:var(--lr-size-1em);color:var(--lr-color-text-quiet);animation:lr-combobox-spin var(--lr-duration-ambient) var(--lr-easing-linear) infinite}[part=spinner] svg{inline-size:100%;block-size:100%}@keyframes lr-combobox-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part=spinner]{animation:none}}[part=clear-button]:hover{color:var(--lr-color-text)}[part=clear-button]:active{background: ${activeFill("var(--lr-color-surface)")};border-radius:var(--lr-radius)}[part~=tag__remove-button]:hover{background:color-mix(in srgb,currentColor 16%,transparent)}[part~=tag__remove-button]:active{background: ${activeTint("currentColor")}}[part=clear-button]:focus-visible,[part~=tag__remove-button]:focus-visible{${focusRing}}[part=listbox][hidden]{display:none}[part=listbox]{position:fixed;z-index:var(--lr-overlay-stack-index,var(--lr-layer-dropdown));box-sizing:border-box;max-block-size:min(var(--lr-size-18rem),var(--lr-positioner-available-block-size,var(--lr-size-18rem)));overflow-y:auto;overflow-x:hidden;scrollbar-width:var(--lr-theme-scrollbar-width,auto);scrollbar-gutter:var(--lr-theme-scrollbar-gutter,auto);scrollbar-color:var(--lr-theme-scrollbar-color,auto);inline-size:max-content;padding:var(--lr-space-xs);${overlaySurface} ${overlaySurfaceControlEdge} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m));visibility:hidden;opacity:0;transform:translateY(var(--lr-size-neg-0-25rem));transition:opacity var(--hide-duration,var(--lr-transition-fast)),transform var(--hide-duration,var(--lr-transition-fast)),visibility var(--hide-duration,var(--lr-transition-fast))}:host(:not([sync=width]):not([sync=both])) [part=listbox]{min-inline-size:min(var(--lr-size-12rem),var(--lr-positioner-available-inline-size,var(--lr-size-12rem)));max-inline-size:min(var(--lr-popover-viewport-clamp),var(--lr-size-28rem),var(--lr-positioner-available-inline-size,100vw))}:host([sync=width]) [part=listbox],:host([sync=both]) [part=listbox]{max-inline-size:var(--lr-positioner-available-inline-size,100vw)}[part=option],.group-label,.loading,.empty,.source-error{min-inline-size:0;overflow-wrap:anywhere}:host([open]) [part=listbox][data-positioned]{visibility:visible;opacity:1;transform:translateY(0);transition-duration:var(--_lr-motion-duration,var(--show-duration,var(--lr-transition-fast)))}@media (prefers-reduced-motion:reduce){[part=listbox]{transition:none!important}}[part=option]{display:flex;align-items:center;gap:var(--lr-space-xs);inline-size:100%;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid transparent;border-radius:var(--lr-radius);background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}[part=option][aria-selected=true]{background:var(--lr-combobox-option-selected-bg,transparent);border-color:var(--lr-combobox-option-selected-border-color,var(--lr-color-brand));color:var(--lr-combobox-option-selected-color,var(--lr-color-brand));font-weight:var(--lr-combobox-option-selected-font-weight,var(--lr-font-weight-semibold))}[part=option]:where(:not([aria-disabled=true])):hover,[part=option][data-active]{background:var(--lr-combobox-option-active-bg,var(--lr-color-brand-quiet))}[part=option]:where(:not([aria-disabled=true])):active{background: ${activeFill("var(--lr-combobox-option-active-bg, var(--lr-color-brand-quiet))")}}[part=option][aria-disabled=true]{${disabledControl}}[part=option-dot]{inline-size:var(--lr-size-0-5rem);block-size:var(--lr-size-0-5rem);border-radius:50%;flex:0 0 auto}[part=option-icon]{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--lr-color-text-quiet)}[part=option-start],[part=option-end]{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;max-inline-size:40%;overflow:hidden}[part=option-start]>*,[part=option-end]>*{min-inline-size:0;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=option-label]{display:flex;flex-direction:column;flex:1 1 auto;min-inline-size:0}[part=option-sub]{font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet)}[part=option-badge]{flex:0 0 auto;padding:0 var(--lr-space-xs);border-radius:var(--lr-radius-pill);background:var(--lr-combobox-option-badge-bg,var(--lr-color-brand-quiet));color:var(--lr-color-text);font-size:var(--lr-font-size-xs)}[part=option-overflow],[part=option-html-fallback],.loading{padding:var(--lr-space-s) var(--lr-space-m);font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet)}.group-label{padding:var(--lr-space-xs) var(--lr-space-s) 0;font-size:var(--lr-size-0-6875rem);font-weight:var(--lr-font-weight-bold);text-transform:uppercase;letter-spacing:var(--lr-size-0-04em);color:var(--lr-color-text-quiet)}.empty{padding:var(--lr-space-m);color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm)}[part=source-error-row]{padding:var(--lr-space-xs) var(--lr-space-s)}${dataStateRetryStyles} [part=form-control],[part=form-control-label],[part~=hint],[part=error]{${formControlTextWrap}}${glassScrollLayerStyles} ${glassIndependentRootStyles} ${glassSurface('[part="listbox"]',css`var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-high)))`,void 0,!0)} ${forcedColorsSelected} ${formControlInvalidBorder(css`[part="combobox"]`)} ${formControlTouchFontFloor(css`[part="combobox-input"]`)} `;export{styles};