@aceshooting/lyra-ui 30.4.0 → 30.7.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 (203) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +2 -3
  3. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.d.ts +7 -4
  4. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.js +5 -5
  5. package/dist/components/conversation/code-block/onig.provenance.json +1 -1
  6. package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
  7. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  8. package/dist/components/conversation/markdown/markdown-core.class.d.ts +11 -1
  9. package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
  10. package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
  11. package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
  12. package/dist/components/conversation/markdown/markdown-shared.js +3 -3
  13. package/dist/components/conversation/markdown/markdown.class.d.ts +11 -1
  14. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  15. package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
  16. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  17. package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
  18. package/dist/components/conversation/model-select/model-select.class.d.ts +8 -1
  19. package/dist/components/conversation/model-select/model-select.class.js +2 -2
  20. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +5 -0
  21. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  22. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
  23. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
  24. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
  25. package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
  26. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +6 -0
  27. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  28. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +9 -2
  29. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -2
  30. package/dist/components/conversation/widget-renderer/default-registry.js +1 -1
  31. package/dist/components/conversation/widget-renderer/registry.d.ts +1 -27
  32. package/dist/components/conversation/widget-renderer/registry.js +1 -1
  33. package/dist/components/conversation/widget-renderer/resolve.d.ts +1 -29
  34. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  35. package/dist/components/conversation/widget-renderer/widget-renderer.class.d.ts +1 -1
  36. package/dist/components/conversation/widget-renderer/widget-renderer.class.js +1 -1
  37. package/dist/components/forms/catalog-picker-base.d.ts +3 -1
  38. package/dist/components/forms/catalog-picker-base.js +3 -3
  39. package/dist/components/forms/combobox/combobox.class.d.ts +9 -2
  40. package/dist/components/forms/combobox/combobox.class.js +2 -2
  41. package/dist/components/forms/date-picker/date-input.class.d.ts +9 -2
  42. package/dist/components/forms/date-picker/date-input.class.js +2 -2
  43. package/dist/components/forms/input/input-shared.d.ts +9 -2
  44. package/dist/components/forms/input/input-shared.js +2 -2
  45. package/dist/components/forms/input/time-input.class.d.ts +9 -2
  46. package/dist/components/forms/input/time-input.class.js +2 -2
  47. package/dist/components/forms/input/time-input.styles.js +1 -1
  48. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +18 -3
  49. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  50. package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -2
  51. package/dist/components/forms/phone-input/phone-input.class.js +2 -2
  52. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  53. package/dist/components/forms/select/select.class.d.ts +9 -2
  54. package/dist/components/forms/select/select.class.js +2 -2
  55. package/dist/components/forms/textarea/textarea.class.d.ts +9 -2
  56. package/dist/components/forms/textarea/textarea.class.js +2 -2
  57. package/dist/components/forms/token-input/token-input.class.d.ts +9 -2
  58. package/dist/components/forms/token-input/token-input.class.js +2 -2
  59. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  60. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +5 -2
  61. package/dist/components/layout/dock-panel/dock-panel.styles.js +1 -1
  62. package/dist/components/layout/menu/menu-item.class.d.ts +7 -4
  63. package/dist/components/layout/menu/menu-item.class.js +3 -2
  64. package/dist/components/layout/multi-split/multi-split.class.d.ts +73 -6
  65. package/dist/components/layout/multi-split/multi-split.class.js +4 -4
  66. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  67. package/dist/components/layout/page/page.class.d.ts +7 -0
  68. package/dist/components/layout/page/page.styles.js +1 -1
  69. package/dist/components/media/flag/language-map.js +1 -1
  70. package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +1 -5
  71. package/dist/components/media/image-viewer/image-viewer-panorama.js +1 -8
  72. package/dist/components/media/image-viewer/image-viewer.class.d.ts +1 -1
  73. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  74. package/dist/components/media/map/map-control-options.d.ts +19 -5
  75. package/dist/components/media/map/map-control-options.js +1 -1
  76. package/dist/components/media/map/map-controls-lifecycle.js +1 -1
  77. package/dist/components/media/map/map-feature-loader.js +1 -1
  78. package/dist/components/media/map/map-loader.d.ts +10 -4
  79. package/dist/components/media/map/map-loader.js +1 -1
  80. package/dist/components/media/map/map-scene-admission.js +1 -0
  81. package/dist/components/media/map/map-scene-completion-adapter.js +1 -0
  82. package/dist/components/media/map/map-scene-completion-camera.js +1 -0
  83. package/dist/components/media/map/map-scene-configuration-controller.js +1 -0
  84. package/dist/components/media/map/map-scene-configuration.d.ts +15 -0
  85. package/dist/components/media/map/map-scene-configuration.js +1 -0
  86. package/dist/components/media/map/map-scene-controls.js +1 -0
  87. package/dist/components/media/map/map-scene-errors.js +1 -0
  88. package/dist/components/media/map/map-scene-line-layer.js +1 -0
  89. package/dist/components/media/map/map-scene-lines.js +1 -0
  90. package/dist/components/media/map/map-scene-owner.js +1 -0
  91. package/dist/components/media/map/map-scene-position-registry.js +1 -0
  92. package/dist/components/media/map/map-scene-render-controller.js +1 -0
  93. package/dist/components/media/map/map-scene-render-input.js +1 -0
  94. package/dist/components/media/map/map-scene-source-snapshot.js +1 -0
  95. package/dist/components/media/map/map-scene-status.js +1 -0
  96. package/dist/components/media/map/map-scene-types.d.ts +55 -0
  97. package/dist/components/media/map/map.class.d.ts +105 -18
  98. package/dist/components/media/map/map.class.js +32 -15
  99. package/dist/components/media/map/map.styles.js +1 -1
  100. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +1 -1
  101. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  102. package/dist/components/media/video/video.class.d.ts +1 -1
  103. package/dist/components/media/video/video.class.js +1 -1
  104. package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -1
  105. package/dist/components/retrieval/graph/graph-curvature.js +1 -0
  106. package/dist/components/retrieval/graph/graph-engine-columns.js +1 -1
  107. package/dist/components/retrieval/graph/graph-model.d.ts +4 -0
  108. package/dist/components/retrieval/graph/graph-node-renderer.d.ts +13 -0
  109. package/dist/components/retrieval/graph/graph-node-renderer.js +1 -0
  110. package/dist/components/retrieval/graph/graph-source-controller.js +1 -1
  111. package/dist/components/retrieval/graph/graph-spatial-controller.js +3 -1
  112. package/dist/components/retrieval/graph/graph-spatial.js +1 -1
  113. package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -1
  114. package/dist/components/retrieval/graph/graph.class.d.ts +11 -3
  115. package/dist/components/retrieval/graph/graph.class.js +4 -4
  116. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +8 -2
  117. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +4 -2
  118. package/dist/events.d.ts +41 -1
  119. package/dist/framework-types.d.ts +1 -1
  120. package/dist/internal/collection-policy.js +1 -0
  121. package/dist/internal/collection-snapshot.js +1 -1
  122. package/dist/internal/default-strings/media.generated.js +1 -1
  123. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  124. package/dist/internal/engine-3d-loader.d.ts +8 -2
  125. package/dist/internal/engine-3d-loader.js +1 -1
  126. package/dist/internal/form-control.styles.js +1 -1
  127. package/dist/internal/locale-loaders.generated.js +1 -1
  128. package/dist/internal/localization-runtime.js +1 -1
  129. package/dist/internal/localization-types.d.ts +1 -1
  130. package/dist/internal/localization.js +1 -1
  131. package/dist/internal/map-camera-follow-controller.d.ts +9 -0
  132. package/dist/internal/map-camera-follow-controller.js +1 -0
  133. package/dist/internal/map-camera-follow-data.js +1 -0
  134. package/dist/internal/map-camera-follow-scene.js +1 -0
  135. package/dist/internal/map-camera-session-controller.d.ts +59 -0
  136. package/dist/internal/map-camera-session-controller.js +1 -0
  137. package/dist/internal/map-camera-session-data.d.ts +16 -0
  138. package/dist/internal/map-camera-session-data.js +1 -0
  139. package/dist/internal/map-camera-session.js +1 -0
  140. package/dist/internal/map-scene-session.js +1 -0
  141. package/dist/internal/media-panorama.d.ts +5 -0
  142. package/dist/internal/media-panorama.js +8 -0
  143. package/dist/internal/package-metadata.js +1 -1
  144. package/dist/internal/sequence-playback-binding.js +1 -0
  145. package/dist/internal/typed-columns.d.ts +3 -1
  146. package/dist/internal/typed-columns.js +1 -1
  147. package/dist/internal/variants.d.ts +7 -0
  148. package/dist/internal/widget-default-registry.js +1 -0
  149. package/dist/internal/widget-document.d.ts +29 -0
  150. package/dist/internal/widget-document.js +1 -0
  151. package/dist/internal/widget-type-registry.d.ts +27 -0
  152. package/dist/internal/widget-type-registry.js +1 -0
  153. package/dist/lyra.d.ts +1 -1
  154. package/dist/lyra.js +1 -1
  155. package/dist/map-camera-session.d.ts +10 -0
  156. package/dist/map-camera-session.js +1 -0
  157. package/dist/sequence-time-binding.d.ts +3 -0
  158. package/dist/sequence-time-binding.js +1 -0
  159. package/dist/simulation-clock.d.ts +3 -0
  160. package/dist/simulation-clock.js +1 -0
  161. package/dist/time-index.d.ts +3 -0
  162. package/dist/time-index.js +1 -0
  163. package/llms/components/lr-artifact-panel.md +8 -3
  164. package/llms/components/lr-combobox.md +2 -0
  165. package/llms/components/lr-country-picker.md +2 -0
  166. package/llms/components/lr-currency-picker.md +2 -0
  167. package/llms/components/lr-date-picker.md +2 -0
  168. package/llms/components/lr-dock-panel.md +5 -2
  169. package/llms/components/lr-graph.md +121 -3
  170. package/llms/components/lr-input.md +2 -0
  171. package/llms/components/lr-knowledge-graph-explorer.md +6 -1
  172. package/llms/components/lr-locale-picker.md +8 -1
  173. package/llms/components/lr-map.md +365 -13
  174. package/llms/components/lr-markdown-core.md +2 -1
  175. package/llms/components/lr-markdown.md +12 -1
  176. package/llms/components/lr-menu.md +5 -2
  177. package/llms/components/lr-model-select.md +2 -0
  178. package/llms/components/lr-multi-split.md +53 -4
  179. package/llms/components/lr-native-time-input.md +2 -0
  180. package/llms/components/lr-number-input.md +2 -0
  181. package/llms/components/lr-page.md +9 -1
  182. package/llms/components/lr-phone-input.md +2 -0
  183. package/llms/components/lr-select.md +2 -0
  184. package/llms/components/lr-sequence-playback.md +44 -0
  185. package/llms/components/lr-streaming-text-core.md +3 -2
  186. package/llms/components/lr-streaming-text.md +4 -1
  187. package/llms/components/lr-suggestion-chips.md +6 -2
  188. package/llms/components/lr-textarea.md +2 -0
  189. package/llms/components/lr-time-input.md +2 -0
  190. package/llms/components/lr-time-zone-picker.md +2 -0
  191. package/llms/components/lr-token-input.md +2 -0
  192. package/llms/components/lr-unit-picker.md +2 -0
  193. package/llms/components/lr-voice-picker.md +2 -0
  194. package/llms/peers.md +7 -7
  195. package/llms/shared/imports-and-registration.md +1 -1
  196. package/llms/shared/localization-and-rtl.md +15 -1
  197. package/llms/shared/testing-and-utilities.md +184 -0
  198. package/llms/shared.md +200 -2
  199. package/locales.json +1 -1
  200. package/package.json +39 -23
  201. package/registrations.json +1 -1
  202. package/skills/lyra-ui/lyra-gen.md +18 -0
  203. /package/dist/{components/media/image-viewer/image-viewer-panorama.styles.js → internal/media-panorama.styles.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{capOptionRows}from"../../../internal/option-selection.js";import{emitValueEvents}from"../../../internal/value-events.js";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{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{styleMap}from"lit/directives/style-map.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}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{PopupController,emitPopupEvent}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{autocorrectConverter,literalSetConverter,omittedEmptyStringConverter,optionalLiteralSetConverter,spellcheckConverter}from"../../../internal/converters.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{getFormOwner,isBarredFromValidation,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}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{relayNativeEvent}from"../../../internal/native-event-relay.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_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_restore,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}function normalizeSelectionValues(next){return Array.isArray(next)?next.filter(value=>typeof value=="string"):typeof next=="string"?[next]:[]}const POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]),APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]),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}function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}const MAX_SOURCE_ROWS=2e3,MAX_SOURCE_TEXT_UNITS=25e4,MAX_SOURCE_FIELD_UNITS=4096,MAX_RENDER_ROWS=1e3;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,collapse:LYRA_DEFAULT_collapse,comboboxCreate:LYRA_DEFAULT_comboboxCreate,comboboxLabel:LYRA_DEFAULT_comboboxLabel,comboboxLoadError:LYRA_DEFAULT_comboboxLoadError,comboboxOverflow:LYRA_DEFAULT_comboboxOverflow,comboboxRequired:LYRA_DEFAULT_comboboxRequired,comboboxSelectedOverflow:LYRA_DEFAULT_comboboxSelectedOverflow,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,notInCatalog:LYRA_DEFAULT_notInCatalog,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,removeWithContext:LYRA_DEFAULT_removeWithContext,restore:LYRA_DEFAULT_restore,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":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},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},maxRender:{type:Number,attribute:"max-render",noAccessor:!0},sourceDelay:{type:Number,attribute:"source-delay",noAccessor:!0}}}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!this.readonly&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",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._positioningStrategy??"fixed"}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??"fixed",old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&this.requestUpdate("positioningStrategy",old)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=!!next,this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get inputValue(){return this.query}set inputValue(next){this.explicitInputValue=!0,this.query=next??"",this.activeIndex=-1,this.source&&this.runSource(this.query),this.requestUpdate()}constructor(){super(),this.placeholder="",this.label="",this.hint="",this.errorText="",this.allowCreate=!1,this.allowCustomValue=!1,this.withUnknownOption=!1,this.loading=!1,this._appearance="outlined",this.placement="bottom",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.autocorrectValue=!0,this.filter=null,this.source=null,this.query="",this.explicitInputValue=!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:event=>this.onDocPointer(event)}),this.listboxHidden=!0,this.listboxRendered=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.closeAfterPositioningFailure=!1,this.closeCleanupPending=!1,this._selected=[],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._restoredStateActive=!1,this._name="",this._maxOptionsVisible=3,this._maxRender=200,this._sourceDelay=200,this.localDescriptionIds="",this.previousSelection=[],this.markInteracted=()=>{this.touched||(this.touched=!0,this.updateValidity(),this.syncCustomStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.callbackRefreshEpoch=0,this.optionMemo=new Map,this.pendingSelectedWrites=new Map,this.selectedWritesQueued=!1,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,this.pendingSelectedWrites.delete(option),this.pendingSelectedWrites.set(option,{selected:option.selected,value:option.value}),this.selectedWritesQueued||(this.selectedWritesQueued=!0,queueMicrotask(()=>this.flushSelectedWrites()));return}if(isLyraOptionElement(option)){const cached=this.adornmentClones.get(option);cached&&cached.markup!==this.adornmentMarkup(option)&&this.adornmentClones.delete(option)}this.optionRefreshPending||(this.optionRefreshPending=!0,queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.normalizeActiveIndex()}))},this.adornmentClones=new WeakMap,this.lastRenderedRows=[],this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.onInput=e=>{this.liveDisabled||this.readonly||(this.explicitInputValue=!1,this.query=e.target.value,this.activeIndex=-1,this.show(),this.source&&this.runSource(this.query),this.emit("lr-filter",{value:this.query}))},this.onInputBlur=event=>{this.liveDisabled||(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.hide())},this.onInputFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.restoringOverlayFocus||this.show(),relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.isComposing||e.keyCode===229||this.liveDisabled||this.readonly)return;const navigable=["ArrowDown","ArrowUp","Enter","End"].includes(e.key)?this.renderedRows.rows.filter(r=>!r.disabled):[];switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.open){this.activeIndex=navigable.findIndex(row=>this.committed.includes(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}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=>{this.liveDisabled||e.composedPath()[0]!==this.inputEl&&(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.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 liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}get interactionBarred(){return this.liveDisabled||this.readonly}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){this.inputEl?.blur()}click(){this.liveDisabled||(this.inputEl?.focus(),this.show())}select(){this.inputEl?.select()}setSelectionRange(start,end,direction){this.inputEl?.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.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.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceErrorAnnouncements.adopted()}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,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("source")&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++,this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],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)}setValue(next,dirty,preferred){this.pendingSelectedWrites.clear();const old=this._selected;this.previousSelection=old,this.singleSelectedOption=preferred,dirty&&(this._restoredStateActive=!1,this._valueDirty=!0),this._selected=normalizeSelectionValues(next);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)}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.adornmentsFor(option):{}}})}resolveSelectedRowSlots(){let rows;return this.committed.map(value=>this._selectedRowCache.get(value)??(rows??=this.rowsByValue(new Set(this.committed))).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){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)}validatorResult(){const self=this,current=self.value;for(const validator of Array.isArray(this.validators)?this.validators:[]){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("valueInvalid")}}result=typeof validator=="function"?validator(current,self):validator?.validate(current,self)}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}if(!(result===void 0||result===!0)){if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("valueInvalid")};if(result&&typeof result=="object"&&Object.values(result).some(Boolean))return{flags:result,message:this.localize("valueInvalid")}}}return{}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;for(const validator of Array.isArray(this.validators)?this.validators:[]){if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;let observed;try{observed=validator.observedAttributes}catch{continue}if(Array.isArray(observed))for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}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=this.validatorResult();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)}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._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 defaults=new Set(resetValues);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option.value));this.setValue(this.multiple?[...resetValues]:resetValues.slice(0,1),!1),this.query="",this.explicitInputValue=!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.syncConstraints(),this.touched=!0,this.updateValidity(),this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates()}disconnectedCallback(){this.pendingSelectedWrites.clear(),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),this.listboxPositioned=!1,this.disconnectValidatorAttributeObserver(),super.disconnectedCallback(),this.invalidateListboxPositioning(),this.clearSourceTimer(),this.sourceToken+=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.adornmentClones=new WeakMap,this.normalizeActiveIndex(),this.applyPendingSelectedRows(),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:[],...this._restoredStateActive?[]:newLive];if(eligible.length){const values=eligible.map(option=>option.value),next=this.multiple?[...new Set([...this._selected,...values])]:values[values.length-1];newLive.length>0?this.assignValue(next):this.setValue(next,!1);return}}else{this._defaultCaptured=!0;const allDefaults=this.options.filter(option=>option.defaultSelected).map(option=>option.value),allLive=this.options.filter(option=>option.selected).map(option=>option.value),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)).map(option=>option.value),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtyValues=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected).map(option=>option.value);this._defaultSelected=[...defaults.length>0?defaults:initialLive.length>0?initialLive:live];const fromDefaults=defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtyValues.slice(-1)[0]?dirtyValues.slice(-1):live:fromDefaults?defaults:live;if(initial.length&&!this._restoredStateActive&&!this._valueDirty){const next=this.multiple?initial:initial[0];fromDefaults&&!optionDirty?this.setValue(next,!1):this.assignValue(next);return}optionDirty&&(this._valueDirty=!0)}this.reflectSelected()}refreshOptionDefaults(){const declared=this.options.filter(option=>option.defaultSelected).map(option=>option.value);this._defaultSelected=this.multiple?declared:declared.slice(0,1),!this._valueDirty&&!this._restoredStateActive&&this.setValue([...this._defaultSelected],!1)}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}memoOption(key,inputs,compute){const previous=this.optionMemo.get(key);if(previous&&previous.inputs.length===inputs.length&&previous.inputs.every((input,index)=>Object.is(input,inputs[index])))return previous.value;const value=compute();return this.optionMemo.set(key,{inputs,value}),value}get optionIndex(){return this.memoOption("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.memoOption("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.memoOption("corpus",[this.options,this.effectiveLocale],()=>this.options.map(option=>({label:option.label.toLocaleLowerCase(this.effectiveLocale),search:option.searchText.toLocaleLowerCase(this.effectiveLocale),value:option.value.toLocaleLowerCase(this.effectiveLocale)})))}flushSelectedWrites(){this.selectedWritesQueued=!1;const writes=[...this.pendingSelectedWrites];if(this.pendingSelectedWrites.clear(),!(!this.isConnected||writes.length===0))if(this.multiple){const values=new Set(this._selected);for(const[option,write]of writes)this.optionIndex.members.has(option)&&(write.selected?values.add(write.value):values.delete(write.value));this.setValue([...values],!0)}else{let value=this._selected[0],option=this.singleSelectedOption;for(const[candidate,write]of writes)this.optionIndex.members.has(candidate)&&(write.selected?(value=write.value,option=candidate):candidate===option&&(value=void 0,option=void 0));this.setValue(value===void 0?[]:value,!0,option)}}reflectSelected(){const value=this._selected[0];(!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=new Set(this._selected);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](this.multiple?selected.has(option.value):option===this.singleSelectedOption)}labelFor(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(!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.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))}adornmentMarkup(option){return Array.from(option.children).filter(child=>["start","end","prefix","suffix"].includes(child.getAttribute("slot")??"")).map(child=>child.outerHTML).join("")}adornmentsFor(option){const cached=this.adornmentClones.get(option);if(cached)return cached;const cloneSlot=selector=>{const nodes=Array.from(option.querySelectorAll(selector));if(nodes.length!==0)return nodes.map(node=>node.cloneNode(!0))},resolved={markup:this.adornmentMarkup(option),start:cloneSlot(':scope > [slot="start"], :scope > [slot="prefix"]'),end:cloneSlot(':scope > [slot="end"], :scope > [slot="suffix"]')};return this.adornmentClones.set(option,resolved),resolved}rowForOption(option,withAdornments=!0){const adornments=withAdornments?this.adornmentsFor(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:option.disabled||option.inert||option.closest("[inert]")!==null,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=this.query.trim().toLocaleLowerCase(locale);return this.committed.filter(value=>this.isUnknownValue(value)).map(value=>({value,label:this.labelFor(value),badge:this.localize("notInCatalog"),unknownValue:value})).filter(row=>!query2||row.label.toLocaleLowerCase(locale).includes(query2)||row.value.toLocaleLowerCase(locale).includes(query2))}get createRow(){if(!this.allowCreate)return;const inputValue=this.query.trim();if(!inputValue)return;const locale=this.effectiveLocale,folded=inputValue.toLocaleLowerCase(locale);if(!(this.source?this.memoOption("asyncExact",[this.asyncRows,locale],()=>new Set(this.asyncRows.flatMap(row=>[row.value.toLocaleLowerCase(locale),row.label.toLocaleLowerCase(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){return this.memoOption("capRows",[all,this.maxRender,this._selected,this.multiple,activeValue],()=>{const selected=new Set(this.committed),retained=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)})}get renderedRows(){const active=this.lastRenderedRows.filter(row=>!row.disabled)[this.activeIndex]?.value,result=this.memoOption("renderedRows",[this.callbackRefreshEpoch,this.options,this.asyncRows,this.source,this.query,this._selected,this.multiple,this.maxRender,this._sourceTotal,this.withUnknownOption,this.allowCreate,this.filter,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}rows=[...rows];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.renderedRows.rows.filter(row=>!row.disabled).length,next=navigableCount>0?Math.min(this.activeIndex,navigableCount-1):-1;next!==this.activeIndex&&(this.activeIndex=next)}get filtered(){const locale=this.effectiveLocale,q=this.query.trim().toLocaleLowerCase(locale),selectedLabel=this.multiple?"":this.labelFor(this._selected[0]??"")??"",effective=q&&q===selectedLabel.toLocaleLowerCase(locale)?"":q;return effective?this.memoOption("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 displayValue(){return this.multiple||this.open||this.explicitInputValue?this.query:this._selected[0]?this.labelFor(this._selected[0]):""}announceOpenTransition(changed){this.openVetoed=!1;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 settled=this.popupController.wait(!0);return this.open=!0,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,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._positioningStrategy,"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(),(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.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),this.interactionBarred?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(){const self=this,data=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}createOption(inputValue){if(this.liveDisabled||this.readonly||this.emit("lr-create",{inputValue},{cancelable:!0}).defaultPrevented)return;const option=this.ownerDocument.createElement(tag("option"));option.setAttribute("value",inputValue),option.textContent=inputValue,this.append(option),this.pickRow({value:inputValue,label:inputValue})}commitCustomValue(inputValue){if(this.liveDisabled||this.readonly||this.multiple||!inputValue)return;const selectionChanged=this._selected[0]!==inputValue;this.touched=!0,this._selectedLabelCache.set(inputValue,inputValue),this.assignValue(inputValue),this.query="",this.explicitInputValue=!1,this.hide(),selectionChanged&&this.emitValueEvents()}pickRow(row){const sourceOption=this.sourceOptionsByRow.get(row);if(this.liveDisabled||this.readonly||row.disabled||sourceOption&&(sourceOption.disabled||sourceOption.closest("[inert]")))return;if(row.createInput!==void 0){this.createOption(row.createInput);return}this.touched=!0;const synthetic=row.unknownValue!==void 0,selectionChanged=this.multiple||this._selected[0]!==row.value;if(this.multiple){const set=new Set(this._selected);set.has(row.value)?(set.delete(row.value),this._selectedRowCache.delete(row.value)):(set.add(row.value),synthetic||(this._selectedLabelCache.set(row.value,row.label),this._selectedRowCache.set(row.value,row))),this.assignValue([...set]),this.query="",this.explicitInputValue=!1}else synthetic||(this._selectedLabelCache.set(row.value,row.label),this._selectedRowCache.clear(),this._selectedRowCache.set(row.value,row)),this.setValue(row.value,!0,sourceOption),this.query="",this.explicitInputValue=!1,this.hide();this.source&&this.runSource(this.query),selectionChanged&&this.emitValueEvents(),this.emit("lr-activate",{value:row.value})}removeValueAt(index){if(this.liveDisabled||this.readonly||index<0||index>=this._selected.length)return;const next=this._selected.filter((_,i)=>i!==index);this.touched=!0,this.assignValue(next),this.emitValueEvents()}clear(){if(this.liveDisabled||this.readonly)return;const hadSelection=this._selected.length>0,queryChanged=this.query!=="";!hadSelection&&!queryChanged||(hadSelection&&(this.touched=!0,this.assignValue([])),this.query="",this.explicitInputValue=!1,this.source&&this.runSource(this.query),hadSelection&&(this.emitValueEvents(),this.emit("lr-clear")),queryChanged&&this.emit("lr-filter",{value:this.query}))}refresh(){if(this.source){if(!this.open){this.refreshQueued=!0;return}this.refreshQueued=!1,this.runSource(this.query,{immediate:!0})}}runSource(query2,options){const source=this.source;if(!source)return;this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0;const token=++this.sourceToken,ownerWindow=this.ownerDocument.defaultView;if(!this.isConnected||!ownerWindow)return;const request={query:query2,token,owner:ownerWindow,source};if(options?.immediate){this.runSourceRequest(request);return}this.sourceDebounce.delayMs=this._sourceDelay,this.sourceDebounce.push(request)}runSourceRequest({query:query2,token,owner:ownerWindow,source}){if(token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow)return;const controller=new ownerWindow.AbortController;this.sourceAbort=controller,this.sourceLoading=!0,this.sourceFailed=!1,Promise.resolve().then(()=>source(query2,{signal:controller.signal,limit:MAX_SOURCE_ROWS})).then(result=>{if(token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow)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=>{token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||typeof err=="object"&&err!==null&&"name"in err&&err.name==="AbortError"||(this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this.sourceFailed=!0,this.sourceEverSettled=!0,this.sourceErrorAnnouncements.announceAssertive(this.localize("comboboxLoadError")),this.emit("lr-source-error",{error:err,query:query2}),console.warn("<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{capOptionRows}from"../../../internal/option-selection.js";import{emitValueEvents}from"../../../internal/value-events.js";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{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{styleMap}from"lit/directives/style-map.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}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{PopupController,emitPopupEvent}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{autocorrectConverter,literalSetConverter,omittedEmptyStringConverter,optionalLiteralSetConverter,spellcheckConverter}from"../../../internal/converters.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{getFormOwner,isBarredFromValidation,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}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{relayNativeEvent}from"../../../internal/native-event-relay.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_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_notInCatalog,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_restore,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}function normalizeSelectionValues(next){return Array.isArray(next)?next.filter(value=>typeof value=="string"):typeof next=="string"?[next]:[]}const POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]),APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]),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}function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}const MAX_SOURCE_ROWS=2e3,MAX_SOURCE_TEXT_UNITS=25e4,MAX_SOURCE_FIELD_UNITS=4096,MAX_RENDER_ROWS=1e3;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,collapse:LYRA_DEFAULT_collapse,comboboxCreate:LYRA_DEFAULT_comboboxCreate,comboboxLabel:LYRA_DEFAULT_comboboxLabel,comboboxLoadError:LYRA_DEFAULT_comboboxLoadError,comboboxOverflow:LYRA_DEFAULT_comboboxOverflow,comboboxRequired:LYRA_DEFAULT_comboboxRequired,comboboxSelectedOverflow:LYRA_DEFAULT_comboboxSelectedOverflow,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,notInCatalog:LYRA_DEFAULT_notInCatalog,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,removeWithContext:LYRA_DEFAULT_removeWithContext,restore:LYRA_DEFAULT_restore,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-input":Object.freeze(["data"]),"lr-change":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},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},maxRender:{type:Number,attribute:"max-render",noAccessor:!0},sourceDelay:{type:Number,attribute:"source-delay",noAccessor:!0}}}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!this.readonly&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",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._positioningStrategy??"fixed"}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??"fixed",old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&this.requestUpdate("positioningStrategy",old)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=!!next,this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get inputValue(){return this.query}set inputValue(next){this.explicitInputValue=!0,this.query=next??"",this.activeIndex=-1,this.source&&this.runSource(this.query),this.requestUpdate()}constructor(){super(),this.placeholder="",this.label="",this.labelDisplay="visible",this.hint="",this.errorText="",this.allowCreate=!1,this.allowCustomValue=!1,this.withUnknownOption=!1,this.loading=!1,this._appearance="outlined",this.placement="bottom",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.autocorrectValue=!0,this.filter=null,this.source=null,this.query="",this.explicitInputValue=!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:event=>this.onDocPointer(event)}),this.listboxHidden=!0,this.listboxRendered=!1,this._isFirstUpdate=!0,this.openVetoed=!1,this.closeAfterPositioningFailure=!1,this.closeCleanupPending=!1,this._selected=[],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._restoredStateActive=!1,this._name="",this._maxOptionsVisible=3,this._maxRender=200,this._sourceDelay=200,this.localDescriptionIds="",this.previousSelection=[],this.markInteracted=()=>{this.touched||(this.touched=!0,this.updateValidity(),this.syncCustomStates())},this.collectOptions=e=>{this.collectOptionsFromSlot(e.target)},this.callbackRefreshEpoch=0,this.optionMemo=new Map,this.pendingSelectedWrites=new Map,this.selectedWritesQueued=!1,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,this.pendingSelectedWrites.delete(option),this.pendingSelectedWrites.set(option,{selected:option.selected,value:option.value}),this.selectedWritesQueued||(this.selectedWritesQueued=!0,queueMicrotask(()=>this.flushSelectedWrites()));return}if(isLyraOptionElement(option)){const cached=this.adornmentClones.get(option);cached&&cached.markup!==this.adornmentMarkup(option)&&this.adornmentClones.delete(option)}this.optionRefreshPending||(this.optionRefreshPending=!0,queueMicrotask(()=>{this.optionRefreshPending=!1,this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.normalizeActiveIndex()}))},this.adornmentClones=new WeakMap,this.lastRenderedRows=[],this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.onInput=e=>{this.liveDisabled||this.readonly||(this.explicitInputValue=!1,this.query=e.target.value,this.activeIndex=-1,this.show(),this.source&&this.runSource(this.query),this.emit("lr-filter",{value:this.query}))},this.onInputBlur=event=>{this.liveDisabled||(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.hide())},this.onInputFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.restoringOverlayFocus||this.show(),relayNativeEvent(this,event)},this.onKeyDown=e=>{if(e.isComposing||e.keyCode===229||this.liveDisabled||this.readonly)return;const navigable=["ArrowDown","ArrowUp","Enter","End"].includes(e.key)?this.renderedRows.rows.filter(r=>!r.disabled):[];switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.open){this.activeIndex=navigable.findIndex(row=>this.committed.includes(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}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=>{this.liveDisabled||e.composedPath()[0]!==this.inputEl&&(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.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 liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}get interactionBarred(){return this.liveDisabled||this.readonly}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){this.inputEl?.blur()}click(){this.liveDisabled||(this.inputEl?.focus(),this.show())}select(){this.inputEl?.select()}setSelectionRange(start,end,direction){this.inputEl?.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.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.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceErrorAnnouncements.adopted()}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,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("source")&&(this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0,this.sourceToken++,this.sourceLoading=!1,this.sourceFailed=!1,this.sourceEverSettled=!1,this.asyncRows=[],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)}setValue(next,dirty,preferred){this.pendingSelectedWrites.clear();const old=this._selected;this.previousSelection=old,this.singleSelectedOption=preferred,dirty&&(this._restoredStateActive=!1,this._valueDirty=!0),this._selected=normalizeSelectionValues(next);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)}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.adornmentsFor(option):{}}})}resolveSelectedRowSlots(){let rows;return this.committed.map(value=>this._selectedRowCache.get(value)??(rows??=this.rowsByValue(new Set(this.committed))).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){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)}validatorResult(){const self=this,current=self.value;for(const validator of Array.isArray(this.validators)?this.validators:[]){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("valueInvalid")}}result=typeof validator=="function"?validator(current,self):validator?.validate(current,self)}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}if(!(result===void 0||result===!0)){if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("valueInvalid")};if(result&&typeof result=="object"&&Object.values(result).some(Boolean))return{flags:result,message:this.localize("valueInvalid")}}}return{}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;for(const validator of Array.isArray(this.validators)?this.validators:[]){if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;let observed;try{observed=validator.observedAttributes}catch{continue}if(Array.isArray(observed))for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}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=this.validatorResult();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)}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._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 defaults=new Set(resetValues);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option.value));this.setValue(this.multiple?[...resetValues]:resetValues.slice(0,1),!1),this.query="",this.explicitInputValue=!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.syncConstraints(),this.touched=!0,this.updateValidity(),this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates()}disconnectedCallback(){this.pendingSelectedWrites.clear(),this.listboxHidden=!0,this.releaseExternalDescription(),this.popupController.cancel(),this.listboxPositioned=!1,this.disconnectValidatorAttributeObserver(),super.disconnectedCallback(),this.invalidateListboxPositioning(),this.clearSourceTimer(),this.sourceToken+=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.adornmentClones=new WeakMap,this.normalizeActiveIndex(),this.applyPendingSelectedRows(),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:[],...this._restoredStateActive?[]:newLive];if(eligible.length){const values=eligible.map(option=>option.value),next=this.multiple?[...new Set([...this._selected,...values])]:values[values.length-1];newLive.length>0?this.assignValue(next):this.setValue(next,!1);return}}else{this._defaultCaptured=!0;const allDefaults=this.options.filter(option=>option.defaultSelected).map(option=>option.value),allLive=this.options.filter(option=>option.selected).map(option=>option.value),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)).map(option=>option.value),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtyValues=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected).map(option=>option.value);this._defaultSelected=[...defaults.length>0?defaults:initialLive.length>0?initialLive:live];const fromDefaults=defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtyValues.slice(-1)[0]?dirtyValues.slice(-1):live:fromDefaults?defaults:live;if(initial.length&&!this._restoredStateActive&&!this._valueDirty){const next=this.multiple?initial:initial[0];fromDefaults&&!optionDirty?this.setValue(next,!1):this.assignValue(next);return}optionDirty&&(this._valueDirty=!0)}this.reflectSelected()}refreshOptionDefaults(){const declared=this.options.filter(option=>option.defaultSelected).map(option=>option.value);this._defaultSelected=this.multiple?declared:declared.slice(0,1),!this._valueDirty&&!this._restoredStateActive&&this.setValue([...this._defaultSelected],!1)}requestUpdate(...args){args[0]===void 0&&(this.callbackRefreshEpoch=(this.callbackRefreshEpoch??0)+1),super.requestUpdate(...args)}memoOption(key,inputs,compute){const previous=this.optionMemo.get(key);if(previous&&previous.inputs.length===inputs.length&&previous.inputs.every((input,index)=>Object.is(input,inputs[index])))return previous.value;const value=compute();return this.optionMemo.set(key,{inputs,value}),value}get optionIndex(){return this.memoOption("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.memoOption("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.memoOption("corpus",[this.options,this.effectiveLocale],()=>this.options.map(option=>({label:option.label.toLocaleLowerCase(this.effectiveLocale),search:option.searchText.toLocaleLowerCase(this.effectiveLocale),value:option.value.toLocaleLowerCase(this.effectiveLocale)})))}flushSelectedWrites(){this.selectedWritesQueued=!1;const writes=[...this.pendingSelectedWrites];if(this.pendingSelectedWrites.clear(),!(!this.isConnected||writes.length===0))if(this.multiple){const values=new Set(this._selected);for(const[option,write]of writes)this.optionIndex.members.has(option)&&(write.selected?values.add(write.value):values.delete(write.value));this.setValue([...values],!0)}else{let value=this._selected[0],option=this.singleSelectedOption;for(const[candidate,write]of writes)this.optionIndex.members.has(candidate)&&(write.selected?(value=write.value,option=candidate):candidate===option&&(value=void 0,option=void 0));this.setValue(value===void 0?[]:value,!0,option)}}reflectSelected(){const value=this._selected[0];(!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=new Set(this._selected);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](this.multiple?selected.has(option.value):option===this.singleSelectedOption)}labelFor(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(!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.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))}adornmentMarkup(option){return Array.from(option.children).filter(child=>["start","end","prefix","suffix"].includes(child.getAttribute("slot")??"")).map(child=>child.outerHTML).join("")}adornmentsFor(option){const cached=this.adornmentClones.get(option);if(cached)return cached;const cloneSlot=selector=>{const nodes=Array.from(option.querySelectorAll(selector));if(nodes.length!==0)return nodes.map(node=>node.cloneNode(!0))},resolved={markup:this.adornmentMarkup(option),start:cloneSlot(':scope > [slot="start"], :scope > [slot="prefix"]'),end:cloneSlot(':scope > [slot="end"], :scope > [slot="suffix"]')};return this.adornmentClones.set(option,resolved),resolved}rowForOption(option,withAdornments=!0){const adornments=withAdornments?this.adornmentsFor(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:option.disabled||option.inert||option.closest("[inert]")!==null,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=this.query.trim().toLocaleLowerCase(locale);return this.committed.filter(value=>this.isUnknownValue(value)).map(value=>({value,label:this.labelFor(value),badge:this.localize("notInCatalog"),unknownValue:value})).filter(row=>!query2||row.label.toLocaleLowerCase(locale).includes(query2)||row.value.toLocaleLowerCase(locale).includes(query2))}get createRow(){if(!this.allowCreate)return;const inputValue=this.query.trim();if(!inputValue)return;const locale=this.effectiveLocale,folded=inputValue.toLocaleLowerCase(locale);if(!(this.source?this.memoOption("asyncExact",[this.asyncRows,locale],()=>new Set(this.asyncRows.flatMap(row=>[row.value.toLocaleLowerCase(locale),row.label.toLocaleLowerCase(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){return this.memoOption("capRows",[all,this.maxRender,this._selected,this.multiple,activeValue],()=>{const selected=new Set(this.committed),retained=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)})}get renderedRows(){const active=this.lastRenderedRows.filter(row=>!row.disabled)[this.activeIndex]?.value,result=this.memoOption("renderedRows",[this.callbackRefreshEpoch,this.options,this.asyncRows,this.source,this.query,this._selected,this.multiple,this.maxRender,this._sourceTotal,this.withUnknownOption,this.allowCreate,this.filter,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}rows=[...rows];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.renderedRows.rows.filter(row=>!row.disabled).length,next=navigableCount>0?Math.min(this.activeIndex,navigableCount-1):-1;next!==this.activeIndex&&(this.activeIndex=next)}get filtered(){const locale=this.effectiveLocale,q=this.query.trim().toLocaleLowerCase(locale),selectedLabel=this.multiple?"":this.labelFor(this._selected[0]??"")??"",effective=q&&q===selectedLabel.toLocaleLowerCase(locale)?"":q;return effective?this.memoOption("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 displayValue(){return this.multiple||this.open||this.explicitInputValue?this.query:this._selected[0]?this.labelFor(this._selected[0]):""}announceOpenTransition(changed){this.openVetoed=!1;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 settled=this.popupController.wait(!0);return this.open=!0,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,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._positioningStrategy,"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(),(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.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),this.interactionBarred?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(){const self=this,data=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}createOption(inputValue){if(this.liveDisabled||this.readonly||this.emit("lr-create",{inputValue},{cancelable:!0}).defaultPrevented)return;const option=this.ownerDocument.createElement(tag("option"));option.setAttribute("value",inputValue),option.textContent=inputValue,this.append(option),this.pickRow({value:inputValue,label:inputValue})}commitCustomValue(inputValue){if(this.liveDisabled||this.readonly||this.multiple||!inputValue)return;const selectionChanged=this._selected[0]!==inputValue;this.touched=!0,this._selectedLabelCache.set(inputValue,inputValue),this.assignValue(inputValue),this.query="",this.explicitInputValue=!1,this.hide(),selectionChanged&&this.emitValueEvents()}pickRow(row){const sourceOption=this.sourceOptionsByRow.get(row);if(this.liveDisabled||this.readonly||row.disabled||sourceOption&&(sourceOption.disabled||sourceOption.closest("[inert]")))return;if(row.createInput!==void 0){this.createOption(row.createInput);return}this.touched=!0;const synthetic=row.unknownValue!==void 0,selectionChanged=this.multiple||this._selected[0]!==row.value;if(this.multiple){const set=new Set(this._selected);set.has(row.value)?(set.delete(row.value),this._selectedRowCache.delete(row.value)):(set.add(row.value),synthetic||(this._selectedLabelCache.set(row.value,row.label),this._selectedRowCache.set(row.value,row))),this.assignValue([...set]),this.query="",this.explicitInputValue=!1}else synthetic||(this._selectedLabelCache.set(row.value,row.label),this._selectedRowCache.clear(),this._selectedRowCache.set(row.value,row)),this.setValue(row.value,!0,sourceOption),this.query="",this.explicitInputValue=!1,this.hide();this.source&&this.runSource(this.query),selectionChanged&&this.emitValueEvents(),this.emit("lr-activate",{value:row.value})}removeValueAt(index){if(this.liveDisabled||this.readonly||index<0||index>=this._selected.length)return;const next=this._selected.filter((_,i)=>i!==index);this.touched=!0,this.assignValue(next),this.emitValueEvents()}clear(){if(this.liveDisabled||this.readonly)return;const hadSelection=this._selected.length>0,queryChanged=this.query!=="";!hadSelection&&!queryChanged||(hadSelection&&(this.touched=!0,this.assignValue([])),this.query="",this.explicitInputValue=!1,this.source&&this.runSource(this.query),hadSelection&&(this.emitValueEvents(),this.emit("lr-clear")),queryChanged&&this.emit("lr-filter",{value:this.query}))}refresh(){if(this.source){if(!this.open){this.refreshQueued=!0;return}this.refreshQueued=!1,this.runSource(this.query,{immediate:!0})}}runSource(query2,options){const source=this.source;if(!source)return;this.clearSourceTimer(),this.sourceAbort?.abort(),this.sourceAbort=void 0;const token=++this.sourceToken,ownerWindow=this.ownerDocument.defaultView;if(!this.isConnected||!ownerWindow)return;const request={query:query2,token,owner:ownerWindow,source};if(options?.immediate){this.runSourceRequest(request);return}this.sourceDebounce.delayMs=this._sourceDelay,this.sourceDebounce.push(request)}runSourceRequest({query:query2,token,owner:ownerWindow,source}){if(token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow)return;const controller=new ownerWindow.AbortController;this.sourceAbort=controller,this.sourceLoading=!0,this.sourceFailed=!1,Promise.resolve().then(()=>source(query2,{signal:controller.signal,limit:MAX_SOURCE_ROWS})).then(result=>{if(token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow)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=>{token!==this.sourceToken||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||typeof err=="object"&&err!==null&&"name"in err&&err.name==="AbortError"||(this.asyncRows=[],this._sourceTotal=0,this._sourceTruncated=!1,this.activeIndex=-1,this.sourceFailed=!0,this.sourceEverSettled=!0,this.sourceErrorAnnouncements.announceAssertive(this.localize("comboboxLoadError")),this.emit("lr-source-error",{error:err,query:query2}),console.warn("<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}>
2
2
  <div id=${labelId} part="group-label" class="group-label">${currentGroup}</div>
3
3
  ${currentGroupRows}
4
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}`,selected=this.multiple||this.source?selectedSet.has(o.value):this.singleSelectedOption!==void 0&&this.sourceOptionsByRow.get(o)===this.singleSelectedOption;selected&&!this.multiple&&selectedSet.delete(o.value),currentGroupRows.push(html`<div
@@ -146,4 +146,4 @@ import{__decorate}from"tslib";import{capOptionRows}from"../../../internal/option
146
146
  @lr-option-change=${this.onOptionChange}
147
147
  hidden
148
148
  ></slot>
149
- `}}__decorate([property()],LyraCombobox.prototype,"placeholder",void 0),__decorate([property()],LyraCombobox.prototype,"label",void 0),__decorate([property()],LyraCombobox.prototype,"hint",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({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})],LyraCombobox.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],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()],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({converter:autocorrectConverter})],LyraCombobox.prototype,"autocorrect",null),__decorate([state()],LyraCombobox.prototype,"query",void 0),__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({type:Number,attribute:"visible-options"})],LyraCombobox.prototype,"visibleOptions",void 0);export{LyraCombobox};
149
+ `}}__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()],LyraCombobox.prototype,"hint",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({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})],LyraCombobox.prototype,"placement",void 0),__decorate([property({reflect:!0})],LyraCombobox.prototype,"sync",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],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()],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({converter:autocorrectConverter})],LyraCombobox.prototype,"autocorrect",null),__decorate([state()],LyraCombobox.prototype,"query",void 0),__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({type:Number,attribute:"visible-options"})],LyraCombobox.prototype,"visibleOptions",void 0);export{LyraCombobox};
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type WeekdayFormat}from'./calendar-core.js';import type{LyraAppearance,LyraSize}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import{type DateRange,type LyraDatePickerDayContent,type LyraDatePickerDisabledDates,type LyraDatePickerFirstDayOfWeek,type LyraDatePickerPageBy,type LyraDateRangePreset}from'./date-picker.class.js';import'./date-picker.class.js';export type LyraDateInputSelectionDirection=LyraSelectionDirection;export type LyraDateInputPlacement='top'|'top-start'|'top-end'|'right'|'right-start'|'right-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end';
1
+ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type WeekdayFormat}from'./calendar-core.js';import type{LyraAppearance,LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import{type DateRange,type LyraDatePickerDayContent,type LyraDatePickerDisabledDates,type LyraDatePickerFirstDayOfWeek,type LyraDatePickerPageBy,type LyraDateRangePreset}from'./date-picker.class.js';import'./date-picker.class.js';export type LyraDateInputSelectionDirection=LyraSelectionDirection;export type LyraDateInputPlacement='top'|'top-start'|'top-end'|'right'|'right-start'|'right-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end';
2
2
  /** Source-compatible date-input name for the shared picker weekday vocabulary.*/
3
3
  export type LyraDateInputFirstDayOfWeek=LyraDatePickerFirstDayOfWeek;export type LyraDateInputValidatorResult=void|boolean|string|ValidityStateFlags;
4
4
  /** Result shape accepted from object validators used by the upstream form-control contract.*/
@@ -169,7 +169,14 @@ size:LyraSize;
169
169
  /** Rounds the input row's corners to a full pill, mirroring `lr-input`'s own `pill`. It is a
170
170
  * single override of `--lr-date-input-radius`, so a consumer setting that property directly
171
171
  * still wins for a bespoke shape. */
172
- pill:boolean;label:string;hint:string;errorText:string;placeholder:string;
172
+ pill:boolean;label:string;
173
+ /**
174
+ * Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
175
+ * removes it visually (compact toolbars, table cells); hint, error and required semantics are
176
+ * unaffected. Reflected so styles and `[label-display]` selectors match.
177
+ * @attr label-display
178
+ */
179
+ labelDisplay:LyraLabelDisplay;hint:string;errorText:string;placeholder:string;
173
180
  /** Forwarded to the internal `<input>`'s own `spellcheck`. Defaults to `true`, matching the
174
181
  * native element's own default. Uses {@link spellcheckConverter} rather than Lit's default
175
182
  * presence-based `type: Boolean` converter -- see that converter's doc comment. A bare
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeText}from"../../../internal/native-text-control.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{observeReactivePropertyWrites}from"../../../internal/reactive-property-writes.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{deferredPlaceReady as place,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{PopupController,emitPopupEvent}from"../../../internal/popup-controller.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon,calendarIcon,chevronIcon}from"../../../internal/icons.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{finiteCount,finiteNumber}from"../../../internal/numbers.js";import{isDateObject}from"../../../internal/dom-guards.js";import{localeDateOrder,normalizeLocaleDigits,stripBidiFormattingMarks}from"../../../internal/locale-date.js";import{dateTimeFormat,parseISO,formatISO,localDate,utcDate,normalizeCalendarMonths,normalizeWeekdayFormat}from"./calendar-core.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./date-input.styles.js";import{inclusiveDayCount,parseDisabledWeekdays,projectDisabledDateKeys}from"./date-picker.class.js";import"./date-picker.class.js";import{autocorrectConverter,literalSetConverter,normalizeAutocorrect,spellcheckFromAttributeConverter as spellcheckConverter}from"../../../internal/converters.js";import{isImplicitSubmission,submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_chooseDate,LYRA_DEFAULT_dateInputFutureDisabled,LYRA_DEFAULT_dateInputPastDisabled,LYRA_DEFAULT_openCalendar}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_date,LYRA_DEFAULT_dateInputInvalid,LYRA_DEFAULT_dateInputMaxMessage,LYRA_DEFAULT_dateInputMinMessage,LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings/shared.generated.js";const DASH_CLASS="[-\\u2010-\\u2015\\u2212~\\u301c\\uff5e]",DASH_LIKE=new RegExp(DASH_CLASS,"u");function literalPattern(literal){const visible=Array.from(literal.replace(/\s+/gu,""));return visible.length?`\\s*${visible.map(char=>DASH_LIKE.test(char)?DASH_CLASS:char.replace(/[.*+?^${}()|[\]\\/]/gu,"\\$&")).join("\\s*")}\\s*`:literal?"\\s+":""}function compileDatePattern(parts){const fields=[],pieces=[];for(const part of parts)part.type==="day"||part.type==="month"||part.type==="year"?(fields.push([part.source==="startRange"?1:part.source==="endRange"?2:0,part.type]),pieces.push("(\\d{1,4})")):pieces.push(literalPattern(stripBidiFormattingMarks(part.value)));for(const owner of[1,2])for(const type of["day","month","year"])if(fields.filter(([o,t])=>t===type&&(o===0||o===owner)).length!==1)return null;const first=pieces.indexOf("(\\d{1,4})"),last=pieces.lastIndexOf("(\\d{1,4})"),optional=source2=>source2?`(?:${source2})?`:"",source=optional(pieces.slice(0,first).join(""))+pieces.slice(first,last+1).join("")+optional(pieces.slice(last+1).join(""));return{regex:new RegExp(`^\\s*${source}\\s*$`,"iu"),fields}}function localeDatePatterns(locale){const formatter=dateTimeFormat(locale,{year:"numeric",month:"numeric",day:"numeric"});let letters="";const compile=parts=>{for(const part of parts)part.type==="literal"&&(letters+=(part.value.match(/\p{L}/gu)??[]).join(""));return compileDatePattern(parts)};let single=null;try{single=compile(formatter.formatToParts(localDate(2026,0,2)))}catch{}const ranges=[];for(const[from,to]of[[localDate(2026,0,2),localDate(2026,0,3)],[localDate(2026,0,2),localDate(2026,1,3)],[localDate(2025,0,2),localDate(2026,1,3)]])try{const pattern=compile(formatter.formatRangeToParts(from,to));pattern&&ranges.push(pattern)}catch{}return{single,ranges,letters:letters.toLowerCase()}}function dateFromFields({day,month,year}){if(!day||!month||!year)return null;const fullYear=year.length<=2?2e3+Number(year):Number(year);return parseISO(`${String(fullYear).padStart(4,"0")}-${String(Number(month)).padStart(2,"0")}-${String(Number(day)).padStart(2,"0")}`)}function matchDatePattern(pattern,text){const match=pattern?.regex.exec(text);if(!pattern||!match)return null;const start={},end={};pattern.fields.forEach(([owner,type],index)=>{owner!==2&&(start[type]=match[index+1]),owner!==1&&(end[type]=match[index+1])});const from=dateFromFields(start),to=dateFromFields(end);return from&&to?[from,to]:null}function hasForeignLetters(text,letters){return(text.match(/\p{L}/gu)??[]).some(letter=>!letters.includes(letter.toLowerCase()))}function normalizeLocalizedDateText(raw,locale){return normalizeLocaleDigits(raw,locale).trim()}const monthsConverter={fromAttribute:normalizeCalendarMonths,toAttribute:normalizeCalendarMonths},weekdayFormatConverter={fromAttribute:normalizeWeekdayFormat,toAttribute:normalizeWeekdayFormat},APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),placements=new Set(["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"]);function normalizeDateInputPlacement(value){return typeof value=="string"&&placements.has(value)?value:"bottom-start"}const placementConverter={fromAttribute:normalizeDateInputPlacement,toAttribute:normalizeDateInputPlacement};function normalizeDateInputPageBy(value){return value==="single"?"single":"months"}const pageByConverter={fromAttribute:normalizeDateInputPageBy,toAttribute:normalizeDateInputPageBy},VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]);function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}class LyraDateInputBase extends LyraElement{}class LyraDateInput extends FormAssociated(LyraDateInputBase){static{this.defaultStrings={...super.defaultStrings,chooseDate:LYRA_DEFAULT_chooseDate,clear:LYRA_DEFAULT_clear,date:LYRA_DEFAULT_date,dateInputFutureDisabled:LYRA_DEFAULT_dateInputFutureDisabled,dateInputInvalid:LYRA_DEFAULT_dateInputInvalid,dateInputMaxMessage:LYRA_DEFAULT_dateInputMaxMessage,dateInputMinMessage:LYRA_DEFAULT_dateInputMinMessage,dateInputPastDisabled:LYRA_DEFAULT_dateInputPastDisabled,fieldRequired:LYRA_DEFAULT_fieldRequired,openCalendar:LYRA_DEFAULT_openCalendar}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={mode:{reflect:!0,noAccessor:!0},min:{reflect:!0,noAccessor:!0},max:{reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},disablePast:{type:Boolean,attribute:"disable-past",reflect:!0,noAccessor:!0},disableFuture:{type:Boolean,attribute:"disable-future",reflect:!0,noAccessor:!0}}}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 open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!this.readonly&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",old)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get appliedPreset(){return this._appliedPreset}static get observedAttributes(){const attributes=super.observedAttributes;return observeReactivePropertyWrites(this.prototype,["clearLabel","openLabel","dialogLabel"],(instance,name,value)=>{const authored=value!=null;let ownershipChanged=!1;switch(name){case"clearLabel":if(instance.clearLabelAuthored===void 0)return;ownershipChanged=authored!==instance.clearLabelAuthored,instance.clearLabelAuthored=authored;break;case"openLabel":if(instance.openLabelAuthored===void 0)return;ownershipChanged=authored!==instance.openLabelAuthored,instance.openLabelAuthored=authored;break;case"dialogLabel":if(instance.dialogLabelAuthored===void 0)return;ownershipChanged=authored!==instance.dialogLabelAuthored,instance.dialogLabelAuthored=authored;break}ownershipChanged&&instance.requestUpdate()}),attributes}constructor(){super(),this._appearance="outlined",this.clearable=!1,this.withClear=!1,this.withHint=!1,this.withLabel=!1,this.size="m",this.pill=!1,this.label="",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.accessibleLabel=null,this.locale="",this.months=1,this.firstDayOfWeek="auto",this.weekdayFormat="short",this.presets=Object.freeze([]),this.withOutsideDays=!1,this.withWeekNumbers=!1,this.disabledDates="",this.disabledDaysOfWeek="",this.minRange=0,this.maxRange=0,this.pageBy="months",this.today="",this.distance=0,this.placement="bottom-start",this.assumeInteractionOn=["input"],this.validators=[],this.clearLabel="",this.clearLabelAuthored=!1,this.openLabel="",this.openLabelAuthored=!1,this.dialogLabel="Choose date",this.dialogLabelAuthored=!1,this.enterCommittedText=null,this.committingTypedText=!1,this.forcingClose=!1,this.inputRelayedSinceCommit=!1,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="popup"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:event=>this.onDocPointer(event)}),this.restorePopupFocusOnClose=!1,this.popupHidden=!0,this.popupPositioned=!1,this.interactionListeners=new Map,this.renderedDaySlots="",this.localDescriptionIds="",this.inputId=nextId("date-input"),this.popupId=nextId("date-popup"),this.touched=!1,this.slotPresence=new SlotPresenceController(this),this.validityRevision=0,this._mode="single",this._min="",this._max="",this._open=!1,this._readonly=!1,this._disablePast=!1,this._disableFuture=!1,this.typedBadInput=!1,this.now=()=>new Date,this.onVisibilityChange=()=>{this.ownerDocument.visibilityState==="visible"&&(this.updateValidity(),this.validityRevision++)},this.onDocPointer=e=>{e.composedPath().includes(this)||this.hide(!1)},this.onClearClick=()=>{this.clear(),this.inputElement?.focus()},this.onInputChange=e=>{e.stopPropagation(),!this.liveDisabled&&this.commitInputChange(e.target.value,e)},this.onInput=event=>{if(event.stopPropagation(),this.liveDisabled)return;this.enterCommittedText=null,this.inputRelayedSinceCommit=!0;const value=this.value;relayNativeEvent(this,event),this.emit("lr-input",{value})},this.onInputKey=e=>{if(e.altKey&&e.key==="ArrowDown"){e.preventDefault(),this.show();return}if(this.liveDisabled||this.readonly||!isImplicitSubmission(e))return;const input=this.inputElement;if(input&&input.value!==this.displayText){const raw=input.value;if(this.applyTypedText(raw)){const value=this.value;this.inputRelayedSinceCommit||(dispatchNativeInputEvent(this,{inputType:"insertReplacementText"}),this.emit("lr-input",{value})),this.inputRelayedSinceCommit=!1,dispatchNativeEvent(this,"change"),this.emit("lr-change",{value})}else this.inputRelayedSinceCommit=!1;this.enterCommittedText=raw}submitOnEnter(this,e)},this.onInputBlur=event=>{!this.liveDisabled&&this.inputRelayedSinceCommit&&this.inputElement&&this.commitInputChange(this.inputElement.value),this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onInputFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onPickerInput=e=>{if(e.stopPropagation(),this.liveDisabled)return;const picker=e.target;this.value=picker.value,this._appliedPreset=picker.appliedPreset,this.inputRelayedSinceCommit=!1;const value=this.value;relayNativeEvent(this,e),this.emit("lr-input",{value})},this.onPickerChange=e=>{if(e.stopPropagation(),this.liveDisabled)return;const picker=e.target;this.value=picker.value,this._appliedPreset=picker.appliedPreset;const value=this.value;relayNativeEvent(this,e),this.emit("lr-change",{value}),this.hide(!0)},new GlassScrollLayer(this,'[part="popup"]',()=>this.open),this.addEventListener("invalid",()=>{this.touched=!0})}get hasHintSlot(){return this.slotPresence.has("hint")}get hasErrorSlot(){return this.slotPresence.has("error")}get hasLabelSlot(){return this.slotPresence.has("label")}get hasStartSlot(){return this.slotPresence.has("start")}get hasEndSlot(){return this.slotPresence.has("end")}get mode(){return this._mode}set mode(next){const old=this._mode;this._mode=next==="range"?"range":"single",this.internals.setFormValue(this.isIncompleteRangeValue(this.value)?"":this.value),this.updateValidity(),this.syncCustomStates(),this.requestUpdate("mode",old)}get min(){return this._min}set min(next){const old=this._min;this._min=next??"",this.updateValidity(),this.requestUpdate("min",old)}get max(){return this._max}set max(next){const old=this._max;this._max=next??"",this.updateValidity(),this.requestUpdate("max",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly;this._readonly=!!next,this.toggleAttribute("readonly",this._readonly),this._readonly&&this.forceClose(),this.updateValidity(),this.requestUpdate("readonly",old)}get disabled(){return super.disabled}set disabled(next){super.disabled=next,next&&this.forceClose(),this.syncCustomStates()}get disablePast(){return this._disablePast}set disablePast(next){const old=this._disablePast;this._disablePast=!!next,this.updateValidity(),this.requestUpdate("disablePast",old)}get disableFuture(){return this._disableFuture}set disableFuture(next){const old=this._disableFuture;this._disableFuture=!!next,this.updateValidity(),this.requestUpdate("disableFuture",old)}get input(){return this.inputElement}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection??null}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}get value(){return super.value}set value(next){this.setTypedBadInput(!1);const old=super.value,normalized=this.normalizeCommittedValue(next??"");super.value=normalized,this.internals.setFormValue(this.isIncompleteRangeValue(normalized)?"":normalized),this.syncCustomStates(),normalized!==old&&this.valueReplaced()}valueReplaced(){this.enterCommittedText=null,this.committingTypedText||(this.inputRelayedSinceCommit=!1,this.inputElement&&(this.inputElement.value=this.displayText))}get valueAsDate(){return this.mode==="single"?this.parseStrictISO(this.value):null}set valueAsDate(next){this.value=isDateObject(next)&&Number.isFinite(next.getTime())?formatISO(next):""}get valueAsLocalDate(){return this.valueAsDate}set valueAsLocalDate(next){this.valueAsDate=next}get valueAsUTCDate(){const local=this.valueAsDate;return local?utcDate(local.getFullYear(),local.getMonth(),local.getDate()):null}set valueAsUTCDate(next){this.valueAsDate=isDateObject(next)?localDate(next.getUTCFullYear(),next.getUTCMonth(),next.getUTCDate()):null}get valueAsRange(){if(this.mode!=="range")return{from:null,to:null};const[from="",to=""]=this.value.split("/");return{from:this.parseStrictISO(from),to:this.parseStrictISO(to)}}set valueAsRange(next){let from=isDateObject(next?.from)&&Number.isFinite(next.from.getTime())?next.from:null,to=isDateObject(next?.to)&&Number.isFinite(next.to.getTime())?next.to:null;from&&to&&to<from&&([from,to]=[to,from]),this.value=from?to?`${formatISO(from)}/${formatISO(to)}`:formatISO(from):""}get validationTarget(){return this.validationTargetOverride??this.inputElement}set validationTarget(next){const old=this.validationTarget;this.validationTargetOverride=next??void 0,this.requestUpdate("validationTarget",old)}[VALIDITY_ANCHOR](){return this.validationTarget}resetValidity(){this.setCustomValidity(""),this.updateValidity()}setTypedBadInput(next){const old=this.typedBadInput;this.typedBadInput=next,old!==next&&this.requestUpdate("typedBadInput",old)}parseStrictISO(value){return/^\d{4}-\d{2}-\d{2}$/.test(value)?parseISO(value):null}normalizeCommittedValue(value){if(value==="")return"";const parts=value.split("/");if(parts.length!==1&&parts.length!==2)return"";const dates=parts.map(part=>this.parseStrictISO(part));return dates.some(date=>date===null)?"":parts.length===2&&dates[0]>dates[1]?`${parts[1]}/${parts[0]}`:value}isIncompleteRangeValue(value){return this.mode==="range"&&value!==""&&!value.includes("/")}valueDates(value){const parts=value.split("/"),expectedParts=this.mode==="range"&&parts.length===2?2:1;if(parts.length!==expectedParts)return null;const dates=parts.map(part=>this.parseStrictISO(part));return dates.some(date=>date===null)?null:dates}get disabledDateKeys(){const source=this.disabledDates;return(!this.disabledDateKeysCache||this.disabledDateKeysCache[0]!==source)&&(this.disabledDateKeysCache=[source,new Set(projectDisabledDateKeys(source))]),this.disabledDateKeysCache[1]}validatorResult(){for(const validator of Array.isArray(this.validators)?this.validators:[]){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("dateInputInvalid")}}result=typeof validator=="function"?validator(this.value,this):validator?.validate(this.value,this)}catch{return{flags:{customError:!0},message:this.localize("dateInputInvalid")}}if(!(result===void 0||result===!0)){if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("dateInputInvalid")};if(result&&typeof result=="object"&&Object.values(result).some(Boolean))return{flags:result,message:this.localize("dateInputInvalid")}}}return{}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let underflowMessage="",overflowMessage="";const incompleteRange=this.isIncompleteRangeValue(this.value);if(this.required&&(this.value===""||incompleteRange)&&(flags.valueMissing=!0),this.typedBadInput&&(flags.badInput=!0),this.value!==""){const dates=this.valueDates(this.value);if(!dates)flags.badInput=!0;else{const min=this.parseStrictISO(this.min),max=this.parseStrictISO(this.max),now=this.parseStrictISO(this.today)??this.now(),today=localDate(now.getFullYear(),now.getMonth(),now.getDate());min!==null&&dates.some(date=>date<min)&&(flags.rangeUnderflow=!0,underflowMessage=this.localize("dateInputMinMessage",void 0,{min:this.displayDate(min)})),this.disablePast&&dates.some(date=>date<today)&&(flags.rangeUnderflow=!0,underflowMessage||=this.localize("dateInputPastDisabled")),max!==null&&dates.some(date=>date>max)&&(flags.rangeOverflow=!0,overflowMessage=this.localize("dateInputMaxMessage",void 0,{max:this.displayDate(max)})),this.disableFuture&&dates.some(date=>date>today)&&(flags.rangeOverflow=!0,overflowMessage||=this.localize("dateInputFutureDisabled"));const disabledDates=this.disabledDateKeys,disabledWeekdays=parseDisabledWeekdays(this.disabledDaysOfWeek);let configuredDisabled=dates.some(date=>disabledDates.has(formatISO(date))||disabledWeekdays.has(date.getDay()));if(!configuredDisabled&&this.isDateDisabled)try{configuredDisabled=dates.some(date=>!!this.isDateDisabled?.(new Date(date.getTime())))}catch{configuredDisabled=!1}if(configuredDisabled&&(flags.customError=!0),this.mode==="range"&&dates.length===2){const length=inclusiveDayCount(dates[0],dates[1]),minimum=finiteCount(this.minRange,0),maximum=finiteCount(this.maxRange,0);minimum>0&&length<minimum&&(flags.rangeUnderflow=!0,underflowMessage||=this.localize("dateInputInvalid")),maximum>0&&length>maximum&&(flags.rangeOverflow=!0,overflowMessage||=this.localize("dateInputInvalid"))}}}const configured=this.validatorResult();configured.flags&&Object.assign(flags,configured.flags);let message="";configured.message?message=configured.message:flags.badInput||flags.customError?message=this.localize("dateInputInvalid"):flags.rangeUnderflow?message=underflowMessage:flags.rangeOverflow?message=overflowMessage:flags.valueMissing&&(message=this.localize("fieldRequired")),this[SET_ANCHORED_VALIDITY](flags,message)}checkValidity(){return this.updateValidity(),super.checkValidity()}reportValidity(){return this.updateValidity(),super.reportValidity()}bindVisibilityListener(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.visibilityListenerDocument===ownerDocument&&this.visibilityListener)return;this.unbindVisibilityListener();const listener=()=>{this.visibilityListener!==listener||this.visibilityListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onVisibilityChange()};this.visibilityListenerDocument=ownerDocument,this.visibilityListener=listener,ownerDocument.addEventListener("visibilitychange",listener)}unbindVisibilityListener(){this.visibilityListenerDocument&&this.visibilityListener&&this.visibilityListenerDocument.removeEventListener("visibilitychange",this.visibilityListener),this.visibilityListenerDocument=void 0,this.visibilityListener=void 0}displayDate(date){return dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"}).format(date)}get displayText(){const parts=this.value.split("/"),from=parseISO(parts[0]),to=parseISO(parts[1]??"");if(!from)return"";const formatter=dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"}),fmt=d=>formatter.format(d);if(this.mode!=="range"||!to)return fmt(from);try{return formatter.formatRange(from,to)}catch{return`${fmt(from)} – ${fmt(to)}`}}willUpdate(changed){super.willUpdate(changed),changed.has("open")&&(this.open&&this.isConnected?this.popupController.bindPointer():this.popupController.unbindPointer(),this.popupPositioned=!1),this.open&&(this.popupHidden=!1)}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}show(){if(this.open||this.liveDisabled||this.readonly||this.emit("lr-show",null,{cancelable:!0}).defaultPrevented)return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,this.settleTransition("lr-after-show"),settled}hide(restoreFocus=!1){if(!this.open||this.emit("lr-hide",null,{cancelable:!this.forcingClose}).defaultPrevented)return Promise.resolve();const settled=this.popupController.wait(!1);return this.restorePopupFocusOnClose||=restoreFocus,this.open=!1,this.settleTransition("lr-after-hide"),settled}forceClose(){this.forcingClose=!0;try{this.hide()}finally{this.forcingClose=!1}}reconnectOpenPopup(){if(!this.isConnected||!this.open)return;this.popupController.bindPointer(),this.cleanupFn?.();const anchor=this.renderRoot.querySelector('[part="input-wrapper"]'),popup=this.renderRoot.querySelector('[part="popup"]');if(!(!anchor||!popup)){this.cleanupFn=place(anchor,popup,{placement:normalizeDateInputPlacement(this.placement),offset:finiteNumber(this.distance,0),strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")});{const operation=this.cleanupFn;operation.ready.then(positioned=>{positioned&&this.cleanupFn===operation&&this.open&&this.isConnected&&(this.popupPositioned=!0)})}this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="popup"]'),onEscape:()=>{this.hide(!0)}})}}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{const positioned=await waitForDeferredPlacement(()=>this.cleanupFn);return stale()||!this.open?!1:positioned?!0:(this.popupController.release("lr-after-show"),this.open=!1,!1)},conceal:()=>{this.popupHidden=!0}})}connectedCallback(){super.connectedCallback(),this.observeDaySlots(),this.syncExternalDescription(),this.bindVisibilityListener(),this.syncInteractionListeners(),this.syncValidatorAttributeObserver(),this.syncCustomStates(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}daySlotNames(){return[...new Set(Array.from(this.children??[]).map(child=>child.getAttribute("slot")??"").filter(name=>/^day-\d{4}-\d{2}-\d{2}$/.test(name)))]}observeDaySlots(){const Observer=this.ownerDocument.defaultView?.MutationObserver;this.daySlotObserver||!Observer||(this.daySlotObserver=new Observer(()=>{this.daySlotNames().join(" ")!==this.renderedDaySlots&&this.requestUpdate()}),this.daySlotObserver.observe(this,{childList:!0,subtree:!0,attributeFilter:["slot"]}))}clear(){!this.value||this.liveDisabled||this.readonly||(this.touched=!0,this._appliedPreset=void 0,this.value="",this.inputRelayedSinceCommit=!1,dispatchNativeInputEvent(this,{inputType:"deleteContentBackward"}),this.emit("lr-input",{value:""}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:""}),this.emit("lr-clear"))}syncInteractionListeners(){const requested=new Set((Array.isArray(this.assumeInteractionOn)?this.assumeInteractionOn:[]).filter(name=>typeof name=="string"&&name.length>0));for(const[name,listener]of this.interactionListeners)requested.has(name)||(this.removeEventListener(name,listener),this.interactionListeners.delete(name));for(const name of requested){if(this.interactionListeners.has(name))continue;const listener=()=>{this.touched=!0,this.syncCustomStates()};this.addEventListener(name,listener),this.interactionListeners.set(name,listener)}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;for(const validator of Array.isArray(this.validators)?this.validators:[]){if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;let observed;try{observed=validator.observedAttributes}catch{continue}if(Array.isArray(observed))for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}syncCustomStates(){setCustomState(this.internals,"blank",this.value===""),setCustomState(this.internals,"disabled",this.effectiveDisabled),setCustomState(this.internals,"open",this.open),setCustomState(this.internals,"range",this.mode==="range")}disconnectedCallback(){this.popupHidden=!0,this.daySlotObserver?.disconnect(),this.daySlotObserver=void 0,this.externalDescription?.release(),this.externalDescription=void 0,this.popupController.cancel(),this.cleanupFn?.(),this.cleanupFn=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindVisibilityListener(),this.popupController.unbindPointer(),this.disconnectValidatorAttributeObserver(),this.restorePopupFocusOnClose=!1;for(const[name,listener]of this.interactionListeners)this.removeEventListener(name,listener);this.interactionListeners.clear(),this.enterCommittedText=null,this.inputRelayedSinceCommit=!1,this.open=!1,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.externalDescription?.release(),this.externalDescription=void 0,this.syncExternalDescription(),this.cleanupFn?.(),this.cleanupFn=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindVisibilityListener(),this.popupController.unbindPointer(),this.disconnectValidatorAttributeObserver()}syncExternalDescription(){if(!this.isConnected)return;const input=this.renderRoot?.querySelector("input")??null;this.externalDescription?this.externalDescription.update(input):this.externalDescription=acquireNativeControlDescription(this,input,()=>this.localDescriptionIds)}updated(changed){if(super.updated(changed),this.syncExternalDescription(),(changed.has("disabledDates")||changed.has("disabledDaysOfWeek")||changed.has("isDateDisabled")||changed.has("minRange")||changed.has("maxRange")||changed.has("today")||changed.has("validators"))&&this.updateValidity(),(changed.has("open")||this.open&&(changed.has("placement")||changed.has("distance")))&&(this.cleanupFn?.(),this.cleanupFn=void 0,this.open&&this.isConnected)){const anchor=this.renderRoot.querySelector('[part="input-wrapper"]'),popup=this.renderRoot.querySelector('[part="popup"]');if(anchor&&popup){this.cleanupFn=place(anchor,popup,{placement:normalizeDateInputPlacement(this.placement),offset:finiteNumber(this.distance,0),strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")});const operation=this.cleanupFn;operation.ready.then(positioned=>{positioned&&this.cleanupFn===operation&&this.open&&this.isConnected&&(this.popupPositioned=!0)})}}if(changed.has("open")){if(this.open&&this.isConnected)this.renderRoot.querySelector('[part="popup"]')&&(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="popup"]'),onEscape:()=>{this.hide(!0)}}));else if(!this.open){const popup=this.renderRoot.querySelector('[part="popup"]'),focusWasInsidePopup=popup!==null&&composedContains(popup,deepActiveElement(this.ownerDocument));this.overlayHandle?.deactivate({restoreFocus:this.restorePopupFocusOnClose||focusWasInsidePopup}),this.overlayHandle=void 0,this.restorePopupFocusOnClose=!1}}changed.has("assumeInteractionOn")&&this.syncInteractionListeners(),changed.has("validators")&&this.syncValidatorAttributeObserver(),this.syncCustomStates(),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("mode")||changed.has("min")||changed.has("max")||changed.has("readonly")||changed.has("disablePast")||changed.has("disableFuture")||changed.has("disabledDates")||changed.has("disabledDaysOfWeek")||changed.has("minRange")||changed.has("maxRange")||changed.has("validators")||changed.has("typedBadInput")||changed.has("validityRevision"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commitTypedValue(next){this.committingTypedText=!0;try{this.value=next}finally{this.committingTypedText=!1}}applyTypedText(raw){this.enterCommittedText=null;const trimmed=raw.trim();if(!trimmed)return this.value!==""&&(this._appliedPreset=void 0),this.commitTypedValue(""),!0;const parsed=this.mode==="range"?this.parseRangeText(trimmed):this.parseSingleText(trimmed);return parsed?(parsed!==this.value&&(this._appliedPreset=void 0),this.commitTypedValue(parsed),!0):(this.inputElement&&(this.inputElement.value=this.displayText),this.setTypedBadInput(!0),this.updateValidity(),!1)}commitInputChange(raw,source){if(this.enterCommittedText!==null&&(raw===this.enterCommittedText||raw===this.displayText))return;if(this.enterCommittedText=null,this.applyTypedText(raw)){const value=this.value;this.inputRelayedSinceCommit||(dispatchNativeInputEvent(this,{inputType:"insertReplacementText"}),this.emit("lr-input",{value})),this.inputRelayedSinceCommit=!1,source?relayNativeEvent(this,source):dispatchNativeEvent(this,"change"),this.emit("lr-change",{value})}else this.inputRelayedSinceCommit=!1}numericDate(groups){if(groups.length!==3)return null;const order=groups[0].length===4?["year","month","day"]:localeDateOrder(this.effectiveLocale,"gregory"),fields={};return order.forEach((type,index)=>{fields[type]=groups[index]}),dateFromFields(fields)}parseOneDate(raw){const text=normalizeLocalizedDateText(raw,this.effectiveLocale),patterns=localeDatePatterns(this.effectiveLocale),own=matchDatePattern(patterns.single,text);if(own)return own[0];if(/^\d{4}-\d{2}-\d{2}$/.test(text))return parseISO(text);const groups=text.match(/\d+/g)??[];if(!hasForeignLetters(text,patterns.letters))return this.numericDate(groups);if(groups.length===3)return null;const timestamp=Date.parse(text);return Number.isNaN(timestamp)?null:new Date(timestamp)}parseSingleText(raw){const parsed=this.parseOneDate(raw);return parsed?formatISO(parsed):null}localizedRangeSeparator(){const formatter=dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"});try{const parts=formatter.formatRangeToParts(localDate(2026,0,2),localDate(2026,0,3)),firstEnd=parts.findIndex(part=>part.source==="endRange");let lastStart=-1;for(let index=0;index<firstEnd;index++)parts[index]?.source==="startRange"&&(lastStart=index);const separator=parts.slice(lastStart+1,firstEnd).map(part=>part.value).join("");return normalizeLocalizedDateText(separator,this.effectiveLocale)||"–"}catch{return"–"}}parseRangeText(raw){if(raw=normalizeLocalizedDateText(raw,this.effectiveLocale),raw===normalizeLocalizedDateText(this.displayText,this.effectiveLocale)&&this.value.includes("/"))return this.normalizeCommittedValue(this.value);if(/^\d{4}-\d{2}-\d{2}\/\d{4}-\d{2}-\d{2}$/.test(raw)){const[a,b]=raw.split("/"),from2=parseISO(a),to2=parseISO(b);return!from2||!to2?null:from2<=to2?raw:`${b}/${a}`}const patterns=localeDatePatterns(this.effectiveLocale);let pair=null;for(const pattern of[...patterns.ranges,patterns.single])pair??=matchDatePattern(pattern,raw);if(!pair){const groups=raw.match(/\d+/g)??[];if(hasForeignLetters(raw,patterns.letters)){const separator=this.localizedRangeSeparator(),idx=raw.indexOf(separator);if(idx===-1)return null;const from2=this.parseOneDate(raw.slice(0,idx).trim()),to2=this.parseOneDate(raw.slice(idx+separator.length).trim());pair=from2&&to2?[from2,to2]:null}else{if(groups.length!==6)return null;const from2=this.numericDate(groups.slice(0,3)),to2=this.numericDate(groups.slice(3));pair=from2&&to2?[from2,to2]:null}}if(!pair)return null;const[from,to]=pair[0]<=pair[1]?pair:[pair[1],pair[0]],start=formatISO(from),end=formatISO(to);return start&&end?`${start}/${end}`:null}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.applyTypedText(input.value))}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formResetCallback(){super.formResetCallback(),this.valueReplaced(),this.touched=!1,this._appliedPreset=void 0}formDisabledCallback(disabled){super.formDisabledCallback(disabled),disabled&&this.forceClose(),this.syncCustomStates()}render(){const hasValue=this.value.length>0,hasHint=this.withHint||this.hasHintSlot||(this.hint??"").length>0,hasError=this.hasErrorSlot||(this.errorText??"").length>0,hasLabel=this.withLabel||this.hasLabelSlot||(this.label??"").length>0,invalid=hasError||this.touched&&!this.internals.validity.valid,describedBy=this.localDescriptionIds=[hasError?"date-input-error":"",hasHint?"date-input-hint":""].filter(Boolean).join(" "),dynamicDaySlots=this.daySlotNames();return this.renderedDaySlots=dynamicDaySlots.join(" "),html`
1
+ import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeText}from"../../../internal/native-text-control.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{observeReactivePropertyWrites}from"../../../internal/reactive-property-writes.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{deferredPlaceReady as place,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{PopupController,emitPopupEvent}from"../../../internal/popup-controller.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon,calendarIcon,chevronIcon}from"../../../internal/icons.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{finiteCount,finiteNumber}from"../../../internal/numbers.js";import{isDateObject}from"../../../internal/dom-guards.js";import{localeDateOrder,normalizeLocaleDigits,stripBidiFormattingMarks}from"../../../internal/locale-date.js";import{dateTimeFormat,parseISO,formatISO,localDate,utcDate,normalizeCalendarMonths,normalizeWeekdayFormat}from"./calendar-core.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./date-input.styles.js";import{inclusiveDayCount,parseDisabledWeekdays,projectDisabledDateKeys}from"./date-picker.class.js";import"./date-picker.class.js";import{autocorrectConverter,literalSetConverter,normalizeAutocorrect,spellcheckFromAttributeConverter as spellcheckConverter}from"../../../internal/converters.js";import{isImplicitSubmission,submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_chooseDate,LYRA_DEFAULT_dateInputFutureDisabled,LYRA_DEFAULT_dateInputPastDisabled,LYRA_DEFAULT_openCalendar}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_date,LYRA_DEFAULT_dateInputInvalid,LYRA_DEFAULT_dateInputMaxMessage,LYRA_DEFAULT_dateInputMinMessage,LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings/shared.generated.js";const DASH_CLASS="[-\\u2010-\\u2015\\u2212~\\u301c\\uff5e]",DASH_LIKE=new RegExp(DASH_CLASS,"u");function literalPattern(literal){const visible=Array.from(literal.replace(/\s+/gu,""));return visible.length?`\\s*${visible.map(char=>DASH_LIKE.test(char)?DASH_CLASS:char.replace(/[.*+?^${}()|[\]\\/]/gu,"\\$&")).join("\\s*")}\\s*`:literal?"\\s+":""}function compileDatePattern(parts){const fields=[],pieces=[];for(const part of parts)part.type==="day"||part.type==="month"||part.type==="year"?(fields.push([part.source==="startRange"?1:part.source==="endRange"?2:0,part.type]),pieces.push("(\\d{1,4})")):pieces.push(literalPattern(stripBidiFormattingMarks(part.value)));for(const owner of[1,2])for(const type of["day","month","year"])if(fields.filter(([o,t])=>t===type&&(o===0||o===owner)).length!==1)return null;const first=pieces.indexOf("(\\d{1,4})"),last=pieces.lastIndexOf("(\\d{1,4})"),optional=source2=>source2?`(?:${source2})?`:"",source=optional(pieces.slice(0,first).join(""))+pieces.slice(first,last+1).join("")+optional(pieces.slice(last+1).join(""));return{regex:new RegExp(`^\\s*${source}\\s*$`,"iu"),fields}}function localeDatePatterns(locale){const formatter=dateTimeFormat(locale,{year:"numeric",month:"numeric",day:"numeric"});let letters="";const compile=parts=>{for(const part of parts)part.type==="literal"&&(letters+=(part.value.match(/\p{L}/gu)??[]).join(""));return compileDatePattern(parts)};let single=null;try{single=compile(formatter.formatToParts(localDate(2026,0,2)))}catch{}const ranges=[];for(const[from,to]of[[localDate(2026,0,2),localDate(2026,0,3)],[localDate(2026,0,2),localDate(2026,1,3)],[localDate(2025,0,2),localDate(2026,1,3)]])try{const pattern=compile(formatter.formatRangeToParts(from,to));pattern&&ranges.push(pattern)}catch{}return{single,ranges,letters:letters.toLowerCase()}}function dateFromFields({day,month,year}){if(!day||!month||!year)return null;const fullYear=year.length<=2?2e3+Number(year):Number(year);return parseISO(`${String(fullYear).padStart(4,"0")}-${String(Number(month)).padStart(2,"0")}-${String(Number(day)).padStart(2,"0")}`)}function matchDatePattern(pattern,text){const match=pattern?.regex.exec(text);if(!pattern||!match)return null;const start={},end={};pattern.fields.forEach(([owner,type],index)=>{owner!==2&&(start[type]=match[index+1]),owner!==1&&(end[type]=match[index+1])});const from=dateFromFields(start),to=dateFromFields(end);return from&&to?[from,to]:null}function hasForeignLetters(text,letters){return(text.match(/\p{L}/gu)??[]).some(letter=>!letters.includes(letter.toLowerCase()))}function normalizeLocalizedDateText(raw,locale){return normalizeLocaleDigits(raw,locale).trim()}const monthsConverter={fromAttribute:normalizeCalendarMonths,toAttribute:normalizeCalendarMonths},weekdayFormatConverter={fromAttribute:normalizeWeekdayFormat,toAttribute:normalizeWeekdayFormat},APPEARANCE=literalSetConverter(["accent","filled","outlined","filled-outlined","plain"],"outlined"),placements=new Set(["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"]);function normalizeDateInputPlacement(value){return typeof value=="string"&&placements.has(value)?value:"bottom-start"}const placementConverter={fromAttribute:normalizeDateInputPlacement,toAttribute:normalizeDateInputPlacement};function normalizeDateInputPageBy(value){return value==="single"?"single":"months"}const pageByConverter={fromAttribute:normalizeDateInputPageBy,toAttribute:normalizeDateInputPageBy},VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]);function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}class LyraDateInputBase extends LyraElement{}class LyraDateInput extends FormAssociated(LyraDateInputBase){static{this.defaultStrings={...super.defaultStrings,chooseDate:LYRA_DEFAULT_chooseDate,clear:LYRA_DEFAULT_clear,date:LYRA_DEFAULT_date,dateInputFutureDisabled:LYRA_DEFAULT_dateInputFutureDisabled,dateInputInvalid:LYRA_DEFAULT_dateInputInvalid,dateInputMaxMessage:LYRA_DEFAULT_dateInputMaxMessage,dateInputMinMessage:LYRA_DEFAULT_dateInputMinMessage,dateInputPastDisabled:LYRA_DEFAULT_dateInputPastDisabled,fieldRequired:LYRA_DEFAULT_fieldRequired,openCalendar:LYRA_DEFAULT_openCalendar}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={mode:{reflect:!0,noAccessor:!0},min:{reflect:!0,noAccessor:!0},max:{reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},disablePast:{type:Boolean,attribute:"disable-past",reflect:!0,noAccessor:!0},disableFuture:{type:Boolean,attribute:"disable-future",reflect:!0,noAccessor:!0}}}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 open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!this.readonly&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.requestUpdate("open",old)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get inputmode(){return this.inputMode}set inputmode(next){this.inputMode=next??""}get enterkeyhint(){return this.enterKeyHint}set enterkeyhint(next){this.enterKeyHint=next??""}get appliedPreset(){return this._appliedPreset}static get observedAttributes(){const attributes=super.observedAttributes;return observeReactivePropertyWrites(this.prototype,["clearLabel","openLabel","dialogLabel"],(instance,name,value)=>{const authored=value!=null;let ownershipChanged=!1;switch(name){case"clearLabel":if(instance.clearLabelAuthored===void 0)return;ownershipChanged=authored!==instance.clearLabelAuthored,instance.clearLabelAuthored=authored;break;case"openLabel":if(instance.openLabelAuthored===void 0)return;ownershipChanged=authored!==instance.openLabelAuthored,instance.openLabelAuthored=authored;break;case"dialogLabel":if(instance.dialogLabelAuthored===void 0)return;ownershipChanged=authored!==instance.dialogLabelAuthored,instance.dialogLabelAuthored=authored;break}ownershipChanged&&instance.requestUpdate()}),attributes}constructor(){super(),this._appearance="outlined",this.clearable=!1,this.withClear=!1,this.withHint=!1,this.withLabel=!1,this.size="m",this.pill=!1,this.label="",this.labelDisplay="visible",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.accessibleLabel=null,this.locale="",this.months=1,this.firstDayOfWeek="auto",this.weekdayFormat="short",this.presets=Object.freeze([]),this.withOutsideDays=!1,this.withWeekNumbers=!1,this.disabledDates="",this.disabledDaysOfWeek="",this.minRange=0,this.maxRange=0,this.pageBy="months",this.today="",this.distance=0,this.placement="bottom-start",this.assumeInteractionOn=["input"],this.validators=[],this.clearLabel="",this.clearLabelAuthored=!1,this.openLabel="",this.openLabelAuthored=!1,this.dialogLabel="Choose date",this.dialogLabelAuthored=!1,this.enterCommittedText=null,this.committingTypedText=!1,this.forcingClose=!1,this.inputRelayedSinceCommit=!1,this.popupController=new PopupController({host:this,popup:()=>this.renderRoot.querySelector('[part="popup"]'),emit:(name,cancelable)=>emitPopupEvent(this,name,cancelable),onPointer:event=>this.onDocPointer(event)}),this.restorePopupFocusOnClose=!1,this.popupHidden=!0,this.popupPositioned=!1,this.interactionListeners=new Map,this.renderedDaySlots="",this.localDescriptionIds="",this.inputId=nextId("date-input"),this.popupId=nextId("date-popup"),this.touched=!1,this.slotPresence=new SlotPresenceController(this),this.validityRevision=0,this._mode="single",this._min="",this._max="",this._open=!1,this._readonly=!1,this._disablePast=!1,this._disableFuture=!1,this.typedBadInput=!1,this.now=()=>new Date,this.onVisibilityChange=()=>{this.ownerDocument.visibilityState==="visible"&&(this.updateValidity(),this.validityRevision++)},this.onDocPointer=e=>{e.composedPath().includes(this)||this.hide(!1)},this.onClearClick=()=>{this.clear(),this.inputElement?.focus()},this.onInputChange=e=>{e.stopPropagation(),!this.liveDisabled&&this.commitInputChange(e.target.value,e)},this.onInput=event=>{if(event.stopPropagation(),this.liveDisabled)return;this.enterCommittedText=null,this.inputRelayedSinceCommit=!0;const value=this.value;relayNativeEvent(this,event),this.emit("lr-input",{value})},this.onInputKey=e=>{if(e.altKey&&e.key==="ArrowDown"){e.preventDefault(),this.show();return}if(this.liveDisabled||this.readonly||!isImplicitSubmission(e))return;const input=this.inputElement;if(input&&input.value!==this.displayText){const raw=input.value;if(this.applyTypedText(raw)){const value=this.value;this.inputRelayedSinceCommit||(dispatchNativeInputEvent(this,{inputType:"insertReplacementText"}),this.emit("lr-input",{value})),this.inputRelayedSinceCommit=!1,dispatchNativeEvent(this,"change"),this.emit("lr-change",{value})}else this.inputRelayedSinceCommit=!1;this.enterCommittedText=raw}submitOnEnter(this,e)},this.onInputBlur=event=>{!this.liveDisabled&&this.inputRelayedSinceCommit&&this.inputElement&&this.commitInputChange(this.inputElement.value),this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onInputFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onPickerInput=e=>{if(e.stopPropagation(),this.liveDisabled)return;const picker=e.target;this.value=picker.value,this._appliedPreset=picker.appliedPreset,this.inputRelayedSinceCommit=!1;const value=this.value;relayNativeEvent(this,e),this.emit("lr-input",{value})},this.onPickerChange=e=>{if(e.stopPropagation(),this.liveDisabled)return;const picker=e.target;this.value=picker.value,this._appliedPreset=picker.appliedPreset;const value=this.value;relayNativeEvent(this,e),this.emit("lr-change",{value}),this.hide(!0)},new GlassScrollLayer(this,'[part="popup"]',()=>this.open),this.addEventListener("invalid",()=>{this.touched=!0})}get hasHintSlot(){return this.slotPresence.has("hint")}get hasErrorSlot(){return this.slotPresence.has("error")}get hasLabelSlot(){return this.slotPresence.has("label")}get hasStartSlot(){return this.slotPresence.has("start")}get hasEndSlot(){return this.slotPresence.has("end")}get mode(){return this._mode}set mode(next){const old=this._mode;this._mode=next==="range"?"range":"single",this.internals.setFormValue(this.isIncompleteRangeValue(this.value)?"":this.value),this.updateValidity(),this.syncCustomStates(),this.requestUpdate("mode",old)}get min(){return this._min}set min(next){const old=this._min;this._min=next??"",this.updateValidity(),this.requestUpdate("min",old)}get max(){return this._max}set max(next){const old=this._max;this._max=next??"",this.updateValidity(),this.requestUpdate("max",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly;this._readonly=!!next,this.toggleAttribute("readonly",this._readonly),this._readonly&&this.forceClose(),this.updateValidity(),this.requestUpdate("readonly",old)}get disabled(){return super.disabled}set disabled(next){super.disabled=next,next&&this.forceClose(),this.syncCustomStates()}get disablePast(){return this._disablePast}set disablePast(next){const old=this._disablePast;this._disablePast=!!next,this.updateValidity(),this.requestUpdate("disablePast",old)}get disableFuture(){return this._disableFuture}set disableFuture(next){const old=this._disableFuture;this._disableFuture=!!next,this.updateValidity(),this.requestUpdate("disableFuture",old)}get input(){return this.inputElement}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection??null}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}get value(){return super.value}set value(next){this.setTypedBadInput(!1);const old=super.value,normalized=this.normalizeCommittedValue(next??"");super.value=normalized,this.internals.setFormValue(this.isIncompleteRangeValue(normalized)?"":normalized),this.syncCustomStates(),normalized!==old&&this.valueReplaced()}valueReplaced(){this.enterCommittedText=null,this.committingTypedText||(this.inputRelayedSinceCommit=!1,this.inputElement&&(this.inputElement.value=this.displayText))}get valueAsDate(){return this.mode==="single"?this.parseStrictISO(this.value):null}set valueAsDate(next){this.value=isDateObject(next)&&Number.isFinite(next.getTime())?formatISO(next):""}get valueAsLocalDate(){return this.valueAsDate}set valueAsLocalDate(next){this.valueAsDate=next}get valueAsUTCDate(){const local=this.valueAsDate;return local?utcDate(local.getFullYear(),local.getMonth(),local.getDate()):null}set valueAsUTCDate(next){this.valueAsDate=isDateObject(next)?localDate(next.getUTCFullYear(),next.getUTCMonth(),next.getUTCDate()):null}get valueAsRange(){if(this.mode!=="range")return{from:null,to:null};const[from="",to=""]=this.value.split("/");return{from:this.parseStrictISO(from),to:this.parseStrictISO(to)}}set valueAsRange(next){let from=isDateObject(next?.from)&&Number.isFinite(next.from.getTime())?next.from:null,to=isDateObject(next?.to)&&Number.isFinite(next.to.getTime())?next.to:null;from&&to&&to<from&&([from,to]=[to,from]),this.value=from?to?`${formatISO(from)}/${formatISO(to)}`:formatISO(from):""}get validationTarget(){return this.validationTargetOverride??this.inputElement}set validationTarget(next){const old=this.validationTarget;this.validationTargetOverride=next??void 0,this.requestUpdate("validationTarget",old)}[VALIDITY_ANCHOR](){return this.validationTarget}resetValidity(){this.setCustomValidity(""),this.updateValidity()}setTypedBadInput(next){const old=this.typedBadInput;this.typedBadInput=next,old!==next&&this.requestUpdate("typedBadInput",old)}parseStrictISO(value){return/^\d{4}-\d{2}-\d{2}$/.test(value)?parseISO(value):null}normalizeCommittedValue(value){if(value==="")return"";const parts=value.split("/");if(parts.length!==1&&parts.length!==2)return"";const dates=parts.map(part=>this.parseStrictISO(part));return dates.some(date=>date===null)?"":parts.length===2&&dates[0]>dates[1]?`${parts[1]}/${parts[0]}`:value}isIncompleteRangeValue(value){return this.mode==="range"&&value!==""&&!value.includes("/")}valueDates(value){const parts=value.split("/"),expectedParts=this.mode==="range"&&parts.length===2?2:1;if(parts.length!==expectedParts)return null;const dates=parts.map(part=>this.parseStrictISO(part));return dates.some(date=>date===null)?null:dates}get disabledDateKeys(){const source=this.disabledDates;return(!this.disabledDateKeysCache||this.disabledDateKeysCache[0]!==source)&&(this.disabledDateKeysCache=[source,new Set(projectDisabledDateKeys(source))]),this.disabledDateKeysCache[1]}validatorResult(){for(const validator of Array.isArray(this.validators)?this.validators:[]){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("dateInputInvalid")}}result=typeof validator=="function"?validator(this.value,this):validator?.validate(this.value,this)}catch{return{flags:{customError:!0},message:this.localize("dateInputInvalid")}}if(!(result===void 0||result===!0)){if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("dateInputInvalid")};if(result&&typeof result=="object"&&Object.values(result).some(Boolean))return{flags:result,message:this.localize("dateInputInvalid")}}}return{}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let underflowMessage="",overflowMessage="";const incompleteRange=this.isIncompleteRangeValue(this.value);if(this.required&&(this.value===""||incompleteRange)&&(flags.valueMissing=!0),this.typedBadInput&&(flags.badInput=!0),this.value!==""){const dates=this.valueDates(this.value);if(!dates)flags.badInput=!0;else{const min=this.parseStrictISO(this.min),max=this.parseStrictISO(this.max),now=this.parseStrictISO(this.today)??this.now(),today=localDate(now.getFullYear(),now.getMonth(),now.getDate());min!==null&&dates.some(date=>date<min)&&(flags.rangeUnderflow=!0,underflowMessage=this.localize("dateInputMinMessage",void 0,{min:this.displayDate(min)})),this.disablePast&&dates.some(date=>date<today)&&(flags.rangeUnderflow=!0,underflowMessage||=this.localize("dateInputPastDisabled")),max!==null&&dates.some(date=>date>max)&&(flags.rangeOverflow=!0,overflowMessage=this.localize("dateInputMaxMessage",void 0,{max:this.displayDate(max)})),this.disableFuture&&dates.some(date=>date>today)&&(flags.rangeOverflow=!0,overflowMessage||=this.localize("dateInputFutureDisabled"));const disabledDates=this.disabledDateKeys,disabledWeekdays=parseDisabledWeekdays(this.disabledDaysOfWeek);let configuredDisabled=dates.some(date=>disabledDates.has(formatISO(date))||disabledWeekdays.has(date.getDay()));if(!configuredDisabled&&this.isDateDisabled)try{configuredDisabled=dates.some(date=>!!this.isDateDisabled?.(new Date(date.getTime())))}catch{configuredDisabled=!1}if(configuredDisabled&&(flags.customError=!0),this.mode==="range"&&dates.length===2){const length=inclusiveDayCount(dates[0],dates[1]),minimum=finiteCount(this.minRange,0),maximum=finiteCount(this.maxRange,0);minimum>0&&length<minimum&&(flags.rangeUnderflow=!0,underflowMessage||=this.localize("dateInputInvalid")),maximum>0&&length>maximum&&(flags.rangeOverflow=!0,overflowMessage||=this.localize("dateInputInvalid"))}}}const configured=this.validatorResult();configured.flags&&Object.assign(flags,configured.flags);let message="";configured.message?message=configured.message:flags.badInput||flags.customError?message=this.localize("dateInputInvalid"):flags.rangeUnderflow?message=underflowMessage:flags.rangeOverflow?message=overflowMessage:flags.valueMissing&&(message=this.localize("fieldRequired")),this[SET_ANCHORED_VALIDITY](flags,message)}checkValidity(){return this.updateValidity(),super.checkValidity()}reportValidity(){return this.updateValidity(),super.reportValidity()}bindVisibilityListener(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.visibilityListenerDocument===ownerDocument&&this.visibilityListener)return;this.unbindVisibilityListener();const listener=()=>{this.visibilityListener!==listener||this.visibilityListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onVisibilityChange()};this.visibilityListenerDocument=ownerDocument,this.visibilityListener=listener,ownerDocument.addEventListener("visibilitychange",listener)}unbindVisibilityListener(){this.visibilityListenerDocument&&this.visibilityListener&&this.visibilityListenerDocument.removeEventListener("visibilitychange",this.visibilityListener),this.visibilityListenerDocument=void 0,this.visibilityListener=void 0}displayDate(date){return dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"}).format(date)}get displayText(){const parts=this.value.split("/"),from=parseISO(parts[0]),to=parseISO(parts[1]??"");if(!from)return"";const formatter=dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"}),fmt=d=>formatter.format(d);if(this.mode!=="range"||!to)return fmt(from);try{return formatter.formatRange(from,to)}catch{return`${fmt(from)} – ${fmt(to)}`}}willUpdate(changed){super.willUpdate(changed),changed.has("open")&&(this.open&&this.isConnected?this.popupController.bindPointer():this.popupController.unbindPointer(),this.popupPositioned=!1),this.open&&(this.popupHidden=!1)}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}show(){if(this.open||this.liveDisabled||this.readonly||this.emit("lr-show",null,{cancelable:!0}).defaultPrevented)return Promise.resolve();const settled=this.popupController.wait(!0);return this.open=!0,this.settleTransition("lr-after-show"),settled}hide(restoreFocus=!1){if(!this.open||this.emit("lr-hide",null,{cancelable:!this.forcingClose}).defaultPrevented)return Promise.resolve();const settled=this.popupController.wait(!1);return this.restorePopupFocusOnClose||=restoreFocus,this.open=!1,this.settleTransition("lr-after-hide"),settled}forceClose(){this.forcingClose=!0;try{this.hide()}finally{this.forcingClose=!1}}reconnectOpenPopup(){if(!this.isConnected||!this.open)return;this.popupController.bindPointer(),this.cleanupFn?.();const anchor=this.renderRoot.querySelector('[part="input-wrapper"]'),popup=this.renderRoot.querySelector('[part="popup"]');if(!(!anchor||!popup)){this.cleanupFn=place(anchor,popup,{placement:normalizeDateInputPlacement(this.placement),offset:finiteNumber(this.distance,0),strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")});{const operation=this.cleanupFn;operation.ready.then(positioned=>{positioned&&this.cleanupFn===operation&&this.open&&this.isConnected&&(this.popupPositioned=!0)})}this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="popup"]'),onEscape:()=>{this.hide(!0)}})}}settleTransition(event){return this.popupController.settle(event,{waitForPosition:async stale=>{const positioned=await waitForDeferredPlacement(()=>this.cleanupFn);return stale()||!this.open?!1:positioned?!0:(this.popupController.release("lr-after-show"),this.open=!1,!1)},conceal:()=>{this.popupHidden=!0}})}connectedCallback(){super.connectedCallback(),this.observeDaySlots(),this.syncExternalDescription(),this.bindVisibilityListener(),this.syncInteractionListeners(),this.syncValidatorAttributeObserver(),this.syncCustomStates(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}daySlotNames(){return[...new Set(Array.from(this.children??[]).map(child=>child.getAttribute("slot")??"").filter(name=>/^day-\d{4}-\d{2}-\d{2}$/.test(name)))]}observeDaySlots(){const Observer=this.ownerDocument.defaultView?.MutationObserver;this.daySlotObserver||!Observer||(this.daySlotObserver=new Observer(()=>{this.daySlotNames().join(" ")!==this.renderedDaySlots&&this.requestUpdate()}),this.daySlotObserver.observe(this,{childList:!0,subtree:!0,attributeFilter:["slot"]}))}clear(){!this.value||this.liveDisabled||this.readonly||(this.touched=!0,this._appliedPreset=void 0,this.value="",this.inputRelayedSinceCommit=!1,dispatchNativeInputEvent(this,{inputType:"deleteContentBackward"}),this.emit("lr-input",{value:""}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:""}),this.emit("lr-clear"))}syncInteractionListeners(){const requested=new Set((Array.isArray(this.assumeInteractionOn)?this.assumeInteractionOn:[]).filter(name=>typeof name=="string"&&name.length>0));for(const[name,listener]of this.interactionListeners)requested.has(name)||(this.removeEventListener(name,listener),this.interactionListeners.delete(name));for(const name of requested){if(this.interactionListeners.has(name))continue;const listener=()=>{this.touched=!0,this.syncCustomStates()};this.addEventListener(name,listener),this.interactionListeners.set(name,listener)}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;for(const validator of Array.isArray(this.validators)?this.validators:[]){if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;let observed;try{observed=validator.observedAttributes}catch{continue}if(Array.isArray(observed))for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}syncCustomStates(){setCustomState(this.internals,"blank",this.value===""),setCustomState(this.internals,"disabled",this.effectiveDisabled),setCustomState(this.internals,"open",this.open),setCustomState(this.internals,"range",this.mode==="range")}disconnectedCallback(){this.popupHidden=!0,this.daySlotObserver?.disconnect(),this.daySlotObserver=void 0,this.externalDescription?.release(),this.externalDescription=void 0,this.popupController.cancel(),this.cleanupFn?.(),this.cleanupFn=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindVisibilityListener(),this.popupController.unbindPointer(),this.disconnectValidatorAttributeObserver(),this.restorePopupFocusOnClose=!1;for(const[name,listener]of this.interactionListeners)this.removeEventListener(name,listener);this.interactionListeners.clear(),this.enterCommittedText=null,this.inputRelayedSinceCommit=!1,this.open=!1,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.externalDescription?.release(),this.externalDescription=void 0,this.syncExternalDescription(),this.cleanupFn?.(),this.cleanupFn=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindVisibilityListener(),this.popupController.unbindPointer(),this.disconnectValidatorAttributeObserver()}syncExternalDescription(){if(!this.isConnected)return;const input=this.renderRoot?.querySelector("input")??null;this.externalDescription?this.externalDescription.update(input):this.externalDescription=acquireNativeControlDescription(this,input,()=>this.localDescriptionIds)}updated(changed){if(super.updated(changed),this.syncExternalDescription(),(changed.has("disabledDates")||changed.has("disabledDaysOfWeek")||changed.has("isDateDisabled")||changed.has("minRange")||changed.has("maxRange")||changed.has("today")||changed.has("validators"))&&this.updateValidity(),(changed.has("open")||this.open&&(changed.has("placement")||changed.has("distance")))&&(this.cleanupFn?.(),this.cleanupFn=void 0,this.open&&this.isConnected)){const anchor=this.renderRoot.querySelector('[part="input-wrapper"]'),popup=this.renderRoot.querySelector('[part="popup"]');if(anchor&&popup){this.cleanupFn=place(anchor,popup,{placement:normalizeDateInputPlacement(this.placement),offset:finiteNumber(this.distance,0),strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")});const operation=this.cleanupFn;operation.ready.then(positioned=>{positioned&&this.cleanupFn===operation&&this.open&&this.isConnected&&(this.popupPositioned=!0)})}}if(changed.has("open")){if(this.open&&this.isConnected)this.renderRoot.querySelector('[part="popup"]')&&(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="popup"]'),onEscape:()=>{this.hide(!0)}}));else if(!this.open){const popup=this.renderRoot.querySelector('[part="popup"]'),focusWasInsidePopup=popup!==null&&composedContains(popup,deepActiveElement(this.ownerDocument));this.overlayHandle?.deactivate({restoreFocus:this.restorePopupFocusOnClose||focusWasInsidePopup}),this.overlayHandle=void 0,this.restorePopupFocusOnClose=!1}}changed.has("assumeInteractionOn")&&this.syncInteractionListeners(),changed.has("validators")&&this.syncValidatorAttributeObserver(),this.syncCustomStates(),(changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("mode")||changed.has("min")||changed.has("max")||changed.has("readonly")||changed.has("disablePast")||changed.has("disableFuture")||changed.has("disabledDates")||changed.has("disabledDaysOfWeek")||changed.has("minRange")||changed.has("maxRange")||changed.has("validators")||changed.has("typedBadInput")||changed.has("validityRevision"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commitTypedValue(next){this.committingTypedText=!0;try{this.value=next}finally{this.committingTypedText=!1}}applyTypedText(raw){this.enterCommittedText=null;const trimmed=raw.trim();if(!trimmed)return this.value!==""&&(this._appliedPreset=void 0),this.commitTypedValue(""),!0;const parsed=this.mode==="range"?this.parseRangeText(trimmed):this.parseSingleText(trimmed);return parsed?(parsed!==this.value&&(this._appliedPreset=void 0),this.commitTypedValue(parsed),!0):(this.inputElement&&(this.inputElement.value=this.displayText),this.setTypedBadInput(!0),this.updateValidity(),!1)}commitInputChange(raw,source){if(this.enterCommittedText!==null&&(raw===this.enterCommittedText||raw===this.displayText))return;if(this.enterCommittedText=null,this.applyTypedText(raw)){const value=this.value;this.inputRelayedSinceCommit||(dispatchNativeInputEvent(this,{inputType:"insertReplacementText"}),this.emit("lr-input",{value})),this.inputRelayedSinceCommit=!1,source?relayNativeEvent(this,source):dispatchNativeEvent(this,"change"),this.emit("lr-change",{value})}else this.inputRelayedSinceCommit=!1}numericDate(groups){if(groups.length!==3)return null;const order=groups[0].length===4?["year","month","day"]:localeDateOrder(this.effectiveLocale,"gregory"),fields={};return order.forEach((type,index)=>{fields[type]=groups[index]}),dateFromFields(fields)}parseOneDate(raw){const text=normalizeLocalizedDateText(raw,this.effectiveLocale),patterns=localeDatePatterns(this.effectiveLocale),own=matchDatePattern(patterns.single,text);if(own)return own[0];if(/^\d{4}-\d{2}-\d{2}$/.test(text))return parseISO(text);const groups=text.match(/\d+/g)??[];if(!hasForeignLetters(text,patterns.letters))return this.numericDate(groups);if(groups.length===3)return null;const timestamp=Date.parse(text);return Number.isNaN(timestamp)?null:new Date(timestamp)}parseSingleText(raw){const parsed=this.parseOneDate(raw);return parsed?formatISO(parsed):null}localizedRangeSeparator(){const formatter=dateTimeFormat(this.effectiveLocale,{year:"numeric",month:"numeric",day:"numeric"});try{const parts=formatter.formatRangeToParts(localDate(2026,0,2),localDate(2026,0,3)),firstEnd=parts.findIndex(part=>part.source==="endRange");let lastStart=-1;for(let index=0;index<firstEnd;index++)parts[index]?.source==="startRange"&&(lastStart=index);const separator=parts.slice(lastStart+1,firstEnd).map(part=>part.value).join("");return normalizeLocalizedDateText(separator,this.effectiveLocale)||"–"}catch{return"–"}}parseRangeText(raw){if(raw=normalizeLocalizedDateText(raw,this.effectiveLocale),raw===normalizeLocalizedDateText(this.displayText,this.effectiveLocale)&&this.value.includes("/"))return this.normalizeCommittedValue(this.value);if(/^\d{4}-\d{2}-\d{2}\/\d{4}-\d{2}-\d{2}$/.test(raw)){const[a,b]=raw.split("/"),from2=parseISO(a),to2=parseISO(b);return!from2||!to2?null:from2<=to2?raw:`${b}/${a}`}const patterns=localeDatePatterns(this.effectiveLocale);let pair=null;for(const pattern of[...patterns.ranges,patterns.single])pair??=matchDatePattern(pattern,raw);if(!pair){const groups=raw.match(/\d+/g)??[];if(hasForeignLetters(raw,patterns.letters)){const separator=this.localizedRangeSeparator(),idx=raw.indexOf(separator);if(idx===-1)return null;const from2=this.parseOneDate(raw.slice(0,idx).trim()),to2=this.parseOneDate(raw.slice(idx+separator.length).trim());pair=from2&&to2?[from2,to2]:null}else{if(groups.length!==6)return null;const from2=this.numericDate(groups.slice(0,3)),to2=this.numericDate(groups.slice(3));pair=from2&&to2?[from2,to2]:null}}if(!pair)return null;const[from,to]=pair[0]<=pair[1]?pair:[pair[1],pair[0]],start=formatISO(from),end=formatISO(to);return start&&end?`${start}/${end}`:null}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.applyTypedText(input.value))}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formResetCallback(){super.formResetCallback(),this.valueReplaced(),this.touched=!1,this._appliedPreset=void 0}formDisabledCallback(disabled){super.formDisabledCallback(disabled),disabled&&this.forceClose(),this.syncCustomStates()}render(){const hasValue=this.value.length>0,hasHint=this.withHint||this.hasHintSlot||(this.hint??"").length>0,hasError=this.hasErrorSlot||(this.errorText??"").length>0,hasLabel=this.withLabel||this.hasLabelSlot||(this.label??"").length>0,invalid=hasError||this.touched&&!this.internals.validity.valid,describedBy=this.localDescriptionIds=[hasError?"date-input-error":"",hasHint?"date-input-hint":""].filter(Boolean).join(" "),dynamicDaySlots=this.daySlotNames();return this.renderedDaySlots=dynamicDaySlots.join(" "),html`
2
2
  <div part="date-input">
3
3
  <div part="base">
4
4
  <div part="form-control">
@@ -147,4 +147,4 @@ import{__decorate}from"tslib";import{nativeAutocorrectAttribute,setNativeRangeTe
147
147
  </div>
148
148
  </div>
149
149
  </div>
150
- `}}__decorate([property({converter:APPEARANCE,reflect:!0})],LyraDateInput.prototype,"appearance",null),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"open",null),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"clearable",void 0),__decorate([property({type:Boolean,attribute:"with-clear"})],LyraDateInput.prototype,"withClear",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraDateInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraDateInput.prototype,"withLabel",void 0),__decorate([property({reflect:!0})],LyraDateInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"pill",void 0),__decorate([property()],LyraDateInput.prototype,"label",void 0),__decorate([property()],LyraDateInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraDateInput.prototype,"errorText",void 0),__decorate([property()],LyraDateInput.prototype,"placeholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraDateInput.prototype,"spellcheck",void 0),__decorate([property()],LyraDateInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraDateInput.prototype,"autocorrect",null),__decorate([property()],LyraDateInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraDateInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraDateInput.prototype,"enterKeyHint",void 0),__decorate([property({attribute:"aria-label"})],LyraDateInput.prototype,"accessibleLabel",void 0),__decorate([property()],LyraDateInput.prototype,"locale",void 0),__decorate([property({converter:monthsConverter,reflect:!0})],LyraDateInput.prototype,"months",void 0),__decorate([property({attribute:"first-day-of-week",reflect:!0})],LyraDateInput.prototype,"firstDayOfWeek",void 0),__decorate([property({attribute:"weekday-format",converter:weekdayFormatConverter,reflect:!0})],LyraDateInput.prototype,"weekdayFormat",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"presets",void 0),__decorate([property({type:Boolean,attribute:"with-outside-days",reflect:!0})],LyraDateInput.prototype,"withOutsideDays",void 0),__decorate([property({type:Boolean,attribute:"with-week-numbers",reflect:!0})],LyraDateInput.prototype,"withWeekNumbers",void 0),__decorate([property({attribute:"disabled-dates"})],LyraDateInput.prototype,"disabledDates",void 0),__decorate([property({attribute:"disabled-days-of-week"})],LyraDateInput.prototype,"disabledDaysOfWeek",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"isDateDisabled",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"dayContent",void 0),__decorate([property({type:Number,attribute:"min-range",reflect:!0})],LyraDateInput.prototype,"minRange",void 0),__decorate([property({type:Number,attribute:"max-range",reflect:!0})],LyraDateInput.prototype,"maxRange",void 0),__decorate([property({converter:pageByConverter,attribute:"page-by",reflect:!0})],LyraDateInput.prototype,"pageBy",void 0),__decorate([property({reflect:!0})],LyraDateInput.prototype,"today",void 0),__decorate([property({type:Number,reflect:!0})],LyraDateInput.prototype,"distance",void 0),__decorate([property({converter:placementConverter,reflect:!0})],LyraDateInput.prototype,"placement",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"assumeInteractionOn",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"validators",void 0),__decorate([property({attribute:"clear-label"})],LyraDateInput.prototype,"clearLabel",void 0),__decorate([property({attribute:"open-label"})],LyraDateInput.prototype,"openLabel",void 0),__decorate([property({attribute:"dialog-label"})],LyraDateInput.prototype,"dialogLabel",void 0),__decorate([query('input[part="input"]')],LyraDateInput.prototype,"inputElement",void 0),__decorate([state()],LyraDateInput.prototype,"popupHidden",void 0),__decorate([state()],LyraDateInput.prototype,"popupPositioned",void 0),__decorate([state()],LyraDateInput.prototype,"touched",void 0),__decorate([state()],LyraDateInput.prototype,"validityRevision",void 0);export{LyraDateInput};
150
+ `}}__decorate([property({converter:APPEARANCE,reflect:!0})],LyraDateInput.prototype,"appearance",null),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"open",null),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"clearable",void 0),__decorate([property({type:Boolean,attribute:"with-clear"})],LyraDateInput.prototype,"withClear",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraDateInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraDateInput.prototype,"withLabel",void 0),__decorate([property({reflect:!0})],LyraDateInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDateInput.prototype,"pill",void 0),__decorate([property()],LyraDateInput.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraDateInput.prototype,"labelDisplay",void 0),__decorate([property()],LyraDateInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraDateInput.prototype,"errorText",void 0),__decorate([property()],LyraDateInput.prototype,"placeholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraDateInput.prototype,"spellcheck",void 0),__decorate([property()],LyraDateInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraDateInput.prototype,"autocorrect",null),__decorate([property()],LyraDateInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraDateInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraDateInput.prototype,"enterKeyHint",void 0),__decorate([property({attribute:"aria-label"})],LyraDateInput.prototype,"accessibleLabel",void 0),__decorate([property()],LyraDateInput.prototype,"locale",void 0),__decorate([property({converter:monthsConverter,reflect:!0})],LyraDateInput.prototype,"months",void 0),__decorate([property({attribute:"first-day-of-week",reflect:!0})],LyraDateInput.prototype,"firstDayOfWeek",void 0),__decorate([property({attribute:"weekday-format",converter:weekdayFormatConverter,reflect:!0})],LyraDateInput.prototype,"weekdayFormat",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"presets",void 0),__decorate([property({type:Boolean,attribute:"with-outside-days",reflect:!0})],LyraDateInput.prototype,"withOutsideDays",void 0),__decorate([property({type:Boolean,attribute:"with-week-numbers",reflect:!0})],LyraDateInput.prototype,"withWeekNumbers",void 0),__decorate([property({attribute:"disabled-dates"})],LyraDateInput.prototype,"disabledDates",void 0),__decorate([property({attribute:"disabled-days-of-week"})],LyraDateInput.prototype,"disabledDaysOfWeek",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"isDateDisabled",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"dayContent",void 0),__decorate([property({type:Number,attribute:"min-range",reflect:!0})],LyraDateInput.prototype,"minRange",void 0),__decorate([property({type:Number,attribute:"max-range",reflect:!0})],LyraDateInput.prototype,"maxRange",void 0),__decorate([property({converter:pageByConverter,attribute:"page-by",reflect:!0})],LyraDateInput.prototype,"pageBy",void 0),__decorate([property({reflect:!0})],LyraDateInput.prototype,"today",void 0),__decorate([property({type:Number,reflect:!0})],LyraDateInput.prototype,"distance",void 0),__decorate([property({converter:placementConverter,reflect:!0})],LyraDateInput.prototype,"placement",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"assumeInteractionOn",void 0),__decorate([property({attribute:!1})],LyraDateInput.prototype,"validators",void 0),__decorate([property({attribute:"clear-label"})],LyraDateInput.prototype,"clearLabel",void 0),__decorate([property({attribute:"open-label"})],LyraDateInput.prototype,"openLabel",void 0),__decorate([property({attribute:"dialog-label"})],LyraDateInput.prototype,"dialogLabel",void 0),__decorate([query('input[part="input"]')],LyraDateInput.prototype,"inputElement",void 0),__decorate([state()],LyraDateInput.prototype,"popupHidden",void 0),__decorate([state()],LyraDateInput.prototype,"popupPositioned",void 0),__decorate([state()],LyraDateInput.prototype,"touched",void 0),__decorate([state()],LyraDateInput.prototype,"validityRevision",void 0);export{LyraDateInput};
@@ -1,4 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraMatchTarget}from'../../../internal/match-constraint.js';import type{LyraAppearance,LyraSize}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import{type LyraFormValidator}from'../form-validator.js';export type LyraInputType='text'|'password'|'email'|'number'|'time'|'search'|'date'|'datetime-local'|'tel'|'url';export interface LyraInputEventMap{input:InputEvent;change:Event;'lr-input':CustomEvent<{value:string;}>;'lr-change':CustomEvent<{value:string;}>;'lr-clear':CustomEvent<null>;'lr-input-settled':CustomEvent<{value:string;}>;blur:FocusEvent;focus:FocusEvent;'lr-invalid':CustomEvent<null>;}declare class LyraInputBase extends LyraElement<LyraInputEventMap>{}declare const LyraInputShared_base:typeof LyraInputBase&(new(...args:any[])=>import("../../../lyra.js").FormAssociatedInterface<string> &import("../../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
1
+ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraMatchTarget}from'../../../internal/match-constraint.js';import type{LyraAppearance,LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import{type LyraFormValidator}from'../form-validator.js';export type LyraInputType='text'|'password'|'email'|'number'|'time'|'search'|'date'|'datetime-local'|'tel'|'url';export interface LyraInputEventMap{input:InputEvent;change:Event;'lr-input':CustomEvent<{value:string;}>;'lr-change':CustomEvent<{value:string;}>;'lr-clear':CustomEvent<null>;'lr-input-settled':CustomEvent<{value:string;}>;blur:FocusEvent;focus:FocusEvent;'lr-invalid':CustomEvent<null>;}declare class LyraInputBase extends LyraElement<LyraInputEventMap>{}declare const LyraInputShared_base:typeof LyraInputBase&(new(...args:any[])=>import("../../../lyra.js").FormAssociatedInterface<string> &import("../../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
2
2
  /**
3
3
  * Shared native input implementation.
4
4
  *
@@ -148,7 +148,14 @@ withClear:boolean;
148
148
  * programmatic `value` write that changes the value -- a same-value write does not disturb it. */
149
149
  debounce?:number;
150
150
  /** Forwards native read-only behavior to the internal input and disables the clear action.*/
151
- readonly:boolean;label:string;hint:string;
151
+ readonly:boolean;label:string;
152
+ /**
153
+ * Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
154
+ * removes it visually (compact toolbars, table cells); hint, error and required semantics are
155
+ * unaffected. Reflected so styles and `[label-display]` selectors match.
156
+ * @attr label-display
157
+ */
158
+ labelDisplay:LyraLabelDisplay;hint:string;
152
159
  /** Shoelace alias for {@link hint}. `hint` wins when both are supplied.*/
153
160
  helpText:string;
154
161
  /** SSR slot-presence hint for label content that cannot be inspected before hydration.*/