@nordhealth/components 5.0.0 → 5.0.1

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 (114) hide show
  1. package/custom-elements.json +19411 -19267
  2. package/lib/Autocomplete.js +1 -1
  3. package/lib/Autocomplete.js.map +1 -1
  4. package/lib/Button.js +1 -1
  5. package/lib/Button.js.map +1 -1
  6. package/lib/Calendar.js +1 -1
  7. package/lib/Combobox.js +1 -1
  8. package/lib/Combobox.js.map +1 -1
  9. package/lib/ComboboxBase.js +1 -1
  10. package/lib/ComboboxBase.js.map +1 -1
  11. package/lib/CommandMenu.js +1 -1
  12. package/lib/CommandMenu.js.map +1 -1
  13. package/lib/DatePicker.js +1 -1
  14. package/lib/DatePicker.js.map +1 -1
  15. package/lib/DateRangePicker.js +1 -1
  16. package/lib/DateRangePicker.js.map +1 -1
  17. package/lib/Dropdown.js +1 -1
  18. package/lib/Dropdown.js.map +1 -1
  19. package/lib/DropdownSubmenu.js +1 -1
  20. package/lib/FilterAddButton.js +1 -1
  21. package/lib/FilterAddButton.js.map +1 -1
  22. package/lib/FilterDateRange.js +1 -1
  23. package/lib/FilterDateRange.js.map +1 -1
  24. package/lib/FilterDropdown.js +1 -1
  25. package/lib/FilterDropdown.js.map +1 -1
  26. package/lib/FilterField.js +1 -1
  27. package/lib/FilterField.js.map +1 -1
  28. package/lib/FilterInput.js +1 -1
  29. package/lib/FilterInput.js.map +1 -1
  30. package/lib/FilterResetButton.js +1 -1
  31. package/lib/FilterResetButton.js.map +1 -1
  32. package/lib/Item.js +1 -1
  33. package/lib/Item.js.map +1 -1
  34. package/lib/Layout.js +1 -1
  35. package/lib/Layout.js.map +1 -1
  36. package/lib/LocalizeController.js +1 -1
  37. package/lib/LocalizeController.js.map +1 -1
  38. package/lib/Message.js +1 -1
  39. package/lib/Message.js.map +1 -1
  40. package/lib/Modal.js +1 -1
  41. package/lib/Modal.js.map +1 -1
  42. package/lib/NavGroup.js +1 -1
  43. package/lib/NavGroup.js.map +1 -1
  44. package/lib/NavItem.js +1 -1
  45. package/lib/NavItem.js.map +1 -1
  46. package/lib/NavToggle-ROsuaJkW.js +2 -0
  47. package/lib/{NavToggle-BY83xpx0.js.map → NavToggle-ROsuaJkW.js.map} +1 -1
  48. package/lib/NavToggle.js +1 -1
  49. package/lib/Notification.js +1 -1
  50. package/lib/Notification.js.map +1 -1
  51. package/lib/NumberField.js +1 -1
  52. package/lib/NumberField.js.map +1 -1
  53. package/lib/OtpField.js +1 -1
  54. package/lib/OtpField.js.map +1 -1
  55. package/lib/Outline.js +1 -1
  56. package/lib/Outline.js.map +1 -1
  57. package/lib/Pagination.js +1 -1
  58. package/lib/Pagination.js.map +1 -1
  59. package/lib/Popout-B6Hirj3y.js +2 -0
  60. package/lib/{Popout-CFtFoCaA.js.map → Popout-B6Hirj3y.js.map} +1 -1
  61. package/lib/Popout.js +1 -1
  62. package/lib/Tag.js +1 -1
  63. package/lib/Tag.js.map +1 -1
  64. package/lib/Textarea.js +1 -1
  65. package/lib/Textarea.js.map +1 -1
  66. package/lib/TimePicker.js +1 -1
  67. package/lib/TimePicker.js.map +1 -1
  68. package/lib/bundle.js +9 -9
  69. package/lib/bundle.js.map +1 -1
  70. package/lib/en-us.js +1 -1
  71. package/lib/en-us.js.map +1 -1
  72. package/lib/fi-fi.js +1 -1
  73. package/lib/fi-fi.js.map +1 -1
  74. package/lib/index.js +1 -1
  75. package/lib/localization13.js +1 -1
  76. package/lib/localization13.js.map +1 -1
  77. package/lib/localization14.js +1 -1
  78. package/lib/localization14.js.map +1 -1
  79. package/lib/localization15.js +1 -1
  80. package/lib/localization15.js.map +1 -1
  81. package/lib/localization16.js +1 -1
  82. package/lib/localization16.js.map +1 -1
  83. package/lib/localization17.js +1 -1
  84. package/lib/localization17.js.map +1 -1
  85. package/lib/localization18.js +1 -1
  86. package/lib/localization18.js.map +1 -1
  87. package/lib/localization19.js +1 -1
  88. package/lib/localization19.js.map +1 -1
  89. package/lib/localization20.js +1 -1
  90. package/lib/localization20.js.map +1 -1
  91. package/lib/localization21.js +1 -1
  92. package/lib/localization21.js.map +1 -1
  93. package/lib/localization22.js +1 -1
  94. package/lib/localization22.js.map +1 -1
  95. package/lib/localization23.js +1 -1
  96. package/lib/localization23.js.map +1 -1
  97. package/lib/localization24.js +2 -0
  98. package/lib/localization24.js.map +1 -0
  99. package/lib/nav-context.js +2 -0
  100. package/lib/nav-context.js.map +1 -0
  101. package/lib/src/button/Button.d.ts +1 -0
  102. package/lib/src/dropdown/Dropdown.d.ts +3 -0
  103. package/lib/src/layout/Layout.d.ts +12 -0
  104. package/lib/src/layout/localization.d.ts +5 -0
  105. package/lib/src/localization/en-us.d.ts +4 -0
  106. package/lib/src/localization/translation.d.ts +4 -0
  107. package/lib/src/nav-group/NavGroup.d.ts +1 -0
  108. package/lib/src/nav-group/nav-context.d.ts +11 -0
  109. package/lib/src/nav-item/NavItem.d.ts +23 -0
  110. package/lib/translation.js +1 -1
  111. package/lib/translation.js.map +1 -1
  112. package/package.json +4 -4
  113. package/lib/NavToggle-BY83xpx0.js +0 -2
  114. package/lib/Popout-CFtFoCaA.js +0 -2
@@ -1,2 +1,2 @@
1
- import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{c as e,A as i}from"./ActiveDescendantController-BnMqM79O.js";import{c as s}from"./interface-close-small-CnpAFMO3.js";import{d as n}from"./interface-dropdown-small-CYvgxudU.js";import{nothing as o,isServer as r,html as l,unsafeCSS as a,LitElement as h}from"lit";import{query as c,property as d,state as u}from"lit/decorators.js";import{classMap as p}from"lit/directives/class-map.js";import{ifDefined as m}from"lit/directives/if-defined.js";import{createRef as f,ref as v}from"lit/directives/ref.js";import{repeat as g}from"lit/directives/repeat.js";import{styleMap as b}from"lit/directives/style-map.js";import{unsafeHTML as S}from"lit/directives/unsafe-html.js";import{g as y}from"./collection-Dvg2XbxV.js";import{F as x}from"./FormDataController-OUt5L5uC.js";import{L as O}from"./LightDismissController-wcL1ziJa.js";import{R as z}from"./ResizeController-14PUwRQy.js";import{S as I}from"./StateAttributesController-BIh96sXZ.js";import{o as w}from"./observe-D0n0zOfU.js";import{c as C}from"./cond-CI1KbneT.js";import{N as E}from"./events-Bv6wNHwJ.js";import{A}from"./AutocompleteMixin-D8eiOxvO.js";import{D as M}from"./DraftComponentMixin-4qug5Rky.js";import{F as j}from"./FieldControlMixin-BXNZJXu9.js";import{F as T}from"./Popout-CFtFoCaA.js";import{I as $}from"./InputMixin-LetXsCyv.js";import{S as k}from"./SizeMixin-CU9cLbLC.js";import D from"./Icon.js";import{LocalizeController as _}from"./LocalizeController.js";import"./Spinner.js";import"./number-Dg2vCfGd.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"./context-consumer-BJVUulGf.js";import"./context-request-event-CCRlXoeR.js";import"./field-context.js";import"./create-context-CJ69ntlY.js";import"./SlotController-Z6eG7LSZ.js";import"./light-dom-styles-DXsbiKU9.js";import"./VisuallyHidden.js";import"./positioning-D-K8Mueq.js";import"./DirectionController-ChvNGESZ.js";import"./ScrollbarController-BFC67Y2x.js";import"./Component-BJ5O5n8k.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";function R(t,e,i){let s,n=i.initialDeps??[],o=!0;function r(){const r=t();return r.length!==n.length||r.some(((t,e)=>n[e]!==t))?(n=r,s=e(...r),!(null==i?void 0:i.onChange)||o&&i.skipInitialOnChange||i.onChange(s),o=!1,s):s}return r.updateDeps=t=>{n=t},r}function F(t,e){if(void 0===t)throw new Error("Unexpected undefined");return t}const V=(t,e,i)=>{let s;return function(...n){t.clearTimeout(s),s=t.setTimeout((()=>e.apply(this,n)),i)}};let L;const W=()=>{if(void 0!==L)return L;if("undefined"==typeof navigator)return L=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return L=!0;const t=navigator.maxTouchPoints;return L="MacIntel"===navigator.platform&&void 0!==t&&t>0},P=t=>{const{offsetWidth:e,offsetHeight:i}=t;return{width:e,height:i}},q=t=>t,H=t=>{const e=Math.max(t.startIndex-t.overscan,0),i=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,s=new Array(i);for(let t=0;t<i;t++)s[t]=e+t;return s},K=(t,e)=>{const i=t.scrollElement;if(!i)return;const s=t.targetWindow;if(!s)return;const n=t=>{const{width:i,height:s}=t;e({width:Math.round(i),height:Math.round(s)})};if(n(P(i)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver((e=>{const s=()=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void n({width:e.inlineSize,height:e.blockSize})}n(P(i))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()}));return o.observe(i,{box:"border-box"}),()=>{o.unobserve(i)}},B={passive:!0},U="undefined"==typeof window||"onscrollend"in window,N=(t,e)=>((t,e,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const o=t.options.useScrollendEvent&&U;let r=0;const l=o?null:V(n,(()=>e(r,!1)),t.options.isScrollingResetDelay),a=t=>()=>{r=i(s),null==l||l(),e(r,t)},h=a(!0),c=a(!1);return s.addEventListener("scroll",h,B),o&&s.addEventListener("scrollend",c,B),()=>{s.removeEventListener("scroll",h),o&&s.removeEventListener("scrollend",c)}})(t,e,(e=>{const{horizontal:i,isRtl:s}=t.options;return i?e.scrollLeft*(s?-1:1):e.scrollTop})),J=(t,e,i)=>{if(i.options.useCachedMeasurements){const e=i.indexFromElement(t),s=i.options.getItemKey(e);return i.itemSizeCache.get(s)??i.options.estimateSize(e)}if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t){return Math.round(t[i.options.horizontal?"inlineSize":"blockSize"])}}if(!e){const e=i.indexFromElement(t),s=i.options.getItemKey(e),n=i.itemSizeCache.get(s);if(void 0!==n)return n}return t[i.options.horizontal?"offsetWidth":"offsetHeight"]},G=(t,{adjustments:e=0,behavior:i},s)=>{var n,o;null==(o=null==(n=s.scrollElement)?void 0:n.scrollTo)||o.call(n,{[s.options.horizontal?"left":"top"]:t+e,behavior:i})};class Q{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,e,i;return(null==(i=null==(e=null==(t=this.targetWindow)?void 0:t.performance)?void 0:e.now)?void 0:i.call(e))??Date.now()},this.observer=(()=>{let t=null;const e=()=>t||(this.targetWindow&&this.targetWindow.ResizeObserver?t=new this.targetWindow.ResizeObserver((t=>{t.forEach((t=>{const e=()=>{const e=t.target,i=this.indexFromElement(e);if(e.isConnected)this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(e,t,this));else{this.observer.unobserve(e);for(const[t,i]of this.elementsCache)if(i===e){this.elementsCache.delete(t);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(e):e()}))})):null);return{disconnect:()=>{var i;null==(i=e())||i.disconnect(),t=null},observe:t=>{var i;return null==(i=e())?void 0:i.observe(t,{box:"border-box"})},unobserve:t=>{var i;return null==(i=e())?void 0:i.unobserve(t)}}})(),this.range=null,this.setOptions=t=>{var e,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:q,rangeExtractor:H,onChange:()=>{},measureElement:J,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const e in t){const i=t[e];void 0!==i&&(s[e]=i)}const n=this.options;let o=null,r=null,l=!1;if(void 0!==n&&n.enabled&&s.enabled&&"end"===s.anchorTo&&null!==this.scrollElement){const t=n.count,a=s.count,h=this.getMeasurements(),c=t>0?(null==(e=h[0])?void 0:e.key)??n.getItemKey(0):null,d=t>0?(null==(i=h[t-1])?void 0:i.key)??n.getItemKey(t-1):null;if(a!==t||t>0&&a>0&&(s.getItemKey(0)!==c||s.getItemKey(a-1)!==d)){l=!0;const e=t>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;e&&(o=[e.key,this.getScrollOffset()-e.start]);const i=!0===s.followOnAppend?"auto":s.followOnAppend||null;i&&a>t&&this.isAtEnd(n.scrollEndThreshold)&&(0===t||s.getItemKey(a-1)!==d)&&(r=i)}}this.options=s,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let a=!1,h=0;if(o&&null!==this.scrollOffset){const[t,e]=o,i=this.getMeasurements(),{count:s,getItemKey:n}=this.options;let r=0;for(;r<s&&n(r)!==t;)r++;if(r<s){const t=i[r];if(t){const i=t.start+e;i!==this.scrollOffset&&(h=i-this.scrollOffset,this.scrollOffset=i,a=!0)}}}(a||r)&&(this.pendingScrollAnchor=[a?o[0]:null,a?o[1]:0,r,h])},this.notify=t=>{var e,i;null==(i=(e=this.options).onChange)||i.call(e,this,t)},this.maybeNotify=R((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(t=>{this.notify(t)}),{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((t=>t())),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(t=this.scrollElement)?void 0:t.window)??null,this.elementsCache.forEach((t=>{this.observer.observe(t)})),this.unsubs.push(this.options.observeElementRect(this,(t=>{this.scrollRect=t,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((t,e)=>{null!==this._intendedScrollOffset&&Math.abs(t-this._intendedScrollOffset)<1.5&&(t=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=e?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=e,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()}))),"addEventListener"in this.scrollElement){const t=this.scrollElement,e=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},i=()=>{this._iosTouching=!1,W()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout((()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()}),150))};t.addEventListener("touchstart",e,B),t.addEventListener("touchend",i,B),this.unsubs.push((()=>{t.removeEventListener("touchstart",e),t.removeEventListener("touchend",i),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)}))}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[t,e,s,n]=i;null===t||s||(W()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==n&&(this._iosDeferredAdjustment+=n):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const t=this.getScrollOffset(),e=this.getMaxScrollOffset();if(t<0||t>e)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,e)=>{const i=new Map,s=new Map;for(let n=e-1;n>=0;n--){const e=t[n];if(i.has(e.lane))continue;const o=s.get(e.lane);if(null==o||e.end>o.end?s.set(e.lane,e):e.end<o.end&&i.set(e.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort(((t,e)=>t.end===e.end?t.index-e.index:t.end-e.end))[0]:void 0},this.getMeasurementOptions=R((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode]),((t,e,i,s,n,o,r)=>(void 0!==this.prevLanes&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:e,scrollMargin:i,getItemKey:s,enabled:n,lanes:o,laneAssignmentMode:r})),{key:!1}),this.getMeasurements=R((()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion]),(({count:t,paddingStart:e,scrollMargin:i,getItemKey:s,enabled:n,lanes:o,laneAssignmentMode:r},l)=>{const a=this.itemSizeCache;if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const e of this.laneAssignments.keys())e>=t&&this.laneAssignments.delete(e);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((t=>{this.itemSizeCache.set(t.key,t.size)})));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),1===o){const n=this.options.gap,o=2*t;let r,l=this._flatMeasurements;if(!l||l.length<o){const t=new Float64Array(o);l&&h>0&&t.set(l.subarray(0,2*h)),l=t,this._flatMeasurements=l}if(0===h)r=e+i;else{const t=h-1;r=l[2*t]+l[2*t+1]+n}for(let e=h;e<t;e++){const t=s(e),i=a.get(t),o="number"==typeof i?i:this.options.estimateSize(e);l[2*e]=r,l[2*e+1]=o,r+=o+n}const c=function(t,e,i){const s=new Array(t);return new Proxy(s,{get(s,n,o){if("string"==typeof n){const o=n.charCodeAt(0);if(o>=48&&o<=57){const o=+n;if(Number.isInteger(o)&&o>=0&&o<t){let t=s[o];if(!t){const n=e[2*o];t=s[o]={index:o,key:i(o),start:n,size:e[2*o+1],end:n+e[2*o+1],lane:0}}return t}}if("length"===n)return t}return Reflect.get(s,n,o)}})}(t,l,s);return this.measurementsCache=c,c}const c=this.measurementsCache.slice(0,h),d=new Array(o).fill(void 0);for(let t=0;t<h;t++){const e=c[t];e&&(d[e.lane]=t)}for(let n=h;n<t;n++){const t=s(n),o=this.laneAssignments.get(n);let l,h;const u="estimate"===r||a.has(t);if(void 0!==o&&this.options.lanes>1){l=o;const t=d[l],s=void 0!==t?c[t]:void 0;h=s?s.end+this.options.gap:e+i}else{const t=1===this.options.lanes?c[n-1]:this.getFurthestMeasurement(c,n);h=t?t.end+this.options.gap:e+i,l=t?t.lane:n%this.options.lanes,this.options.lanes>1&&u&&this.laneAssignments.set(n,l)}const p=a.get(t),m="number"==typeof p?p:this.options.estimateSize(n),f=h+m;c[n]={index:n,start:h,size:m,end:f,key:t,lane:l},d[l]=n}return this.measurementsCache=c,c}),{key:!1,debug:()=>this.options.debug}),this.calculateRange=R((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((t,e,i,s)=>this.range=t.length>0&&e>0?function({measurements:t,outerSize:e,scrollOffset:i,lanes:s,flat:n}){const o=t.length-1,r=n?t=>n[2*t]:e=>t[e].start,l=n?t=>n[2*t]+n[2*t+1]:e=>t[e].end;if(t.length<=s)return{startIndex:0,endIndex:o};let a=Y(0,o,r,i),h=a;if(1===s)for(;h<o&&l(h)<i+e;)h++;else if(s>1){const n=Array(s).fill(0);for(;h<o&&n.some((t=>t<i+e));){const e=t[h];n[e.lane]=e.end,h++}const r=Array(s).fill(i+e);for(;a>=0&&r.some((t=>t>=i));){const e=t[a];r[e.lane]=e.start,a--}a=Math.max(0,a-a%s),h=Math.min(o,h+(s-1-h%s))}return{startIndex:a,endIndex:h}}({measurements:t,outerSize:e,scrollOffset:i,lanes:s,flat:1===s&&null!=this._flatMeasurements?this._flatMeasurements:null}):null),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=R((()=>{let t=null,e=null;const i=this.calculateRange();return i&&(t=i.startIndex,e=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,e]}),((t,e,i,s,n)=>null===s||null===n?[]:t({startIndex:s,endIndex:n,overscan:e,count:i})),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const e=this.options.indexAttribute,i=t.getAttribute(e);return i?parseInt(i,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var e;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const i=this.scrollState.index??(null==(e=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:e.index);if(void 0!==i&&this.range){const e=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,i-e),n=Math.min(this.options.count-1,i+e);return t>=s&&t<=n}return!0},this.measureElement=t=>{if(!t)return void this.elementsCache.forEach(((t,e)=>{t.isConnected||(this.observer.unobserve(t),this.elementsCache.delete(e))}));const e=this.indexFromElement(t),i=this.options.getItemKey(e),s=this.elementsCache.get(i);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i,t)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(e)||this.resizeItem(e,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,e)=>{var i,s;if(t<0||t>=this.options.count)return;let n,o,r;const l=this._flatMeasurements;if(1===this.options.lanes&&null!==l)r=this.options.getItemKey(t),o=l[2*t],n=l[2*t+1];else{const e=this.measurementsCache[t];if(!e)return;r=e.key,o=e.start,n=e.size}const a=e-(this.itemSizeCache.get(r)??n);if(0!==a){const l="end"===this.options.anchorTo&&"smooth"!==(null==(i=this.scrollState)?void 0:i.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,h=l?this.getTotalSize():0,c="smooth"!==(null==(s=this.scrollState)?void 0:s.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:r,start:o,size:n,end:o+n,lane:0},a,this):o<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(r)||"backward"!==this.scrollDirection));(null===this.pendingMin||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(r,e),this.itemSizeCacheVersion++,l?this.applyScrollAdjustment(this.getTotalSize()-h):c&&this.applyScrollAdjustment(a),this.notify(!1)}},this.getVirtualItems=R((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((t,e)=>{const i=[];for(let s=0,n=t.length;s<n;s++){const n=e[t[s]];i.push(n)}return i}),{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const e=this.getMeasurements();if(0===e.length)return;const i=this._flatMeasurements,s=1===this.options.lanes&&null!=i,n=Y(0,e.length-1,s?t=>i[2*t]:t=>F(e[t]).start,t);return F(e[n])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,e,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),n=this.getScrollOffset();"auto"===e&&(e=t>=n+s?"end":"start"),"center"===e?t+=(i-s)/2:"end"===e&&(t-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),n=this.measurementsCache[t];if(!n)return;if("auto"===e)if(n.end>=s+i-this.options.scrollPaddingEnd)e="end";else{if(!(n.start<=s+this.options.scrollPaddingStart))return[s,e];e="start"}if("end"===e&&t===this.options.count-1)return[this.getMaxScrollOffset(),e];const o="end"===e?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,e,n.size),e]},this.scrollToOffset=(t,{align:e="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(t,e),n=this.now();this.scrollState={index:null,align:e,behavior:i,startedAt:n,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:e="auto",behavior:i="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getOffsetForIndex(t,e);if(!s)return;const[n,o]=s,r=this.now();this.scrollState={index:t,align:o,behavior:i,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:e="auto"}={})=>{const i=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:e,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:t}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const e=this.getMeasurements();let i;if(0===e.length)i=this.options.paddingStart;else if(1===this.options.lanes){const s=e.length-1,n=this._flatMeasurements;i=null!=n?n[2*s]+n[2*s+1]:(null==(t=e[s])?void 0:t.end)??0}else{const t=Array(this.options.lanes).fill(null);let s=e.length-1;for(;s>=0&&t.some((t=>null===t));){const i=e[s];null===t[i.lane]&&(t[i.lane]=i.end),s--}i=Math.max(...t.filter((t=>null!==t)))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(0===this.itemSizeCache.size)return t;const e=this.getMeasurements();for(const i of e)i&&this.itemSizeCache.has(i.key)&&t.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return t},this._scrollToOffset=(t,{adjustments:e,behavior:i})=>{this._intendedScrollOffset=t+(e??0),this.options.scrollToFn(t,{behavior:i,adjustments:e},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){0!==t&&(W()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}))}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame((()=>{this.rafId=null,this.reconcileScroll()}))):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const t=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=t?t[0]:this.scrollState.lastTargetOffset,i=e!==this.scrollState.lastTargetOffset;if(!i&&(s=e,n=this.getScrollOffset(),Math.abs(s-n)<1.01)){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1)return this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,i){const t=this.getSize()||600,i=Math.abs(e-this.getScrollOffset()),s="smooth"===this.scrollState.behavior&&i>t;this.scrollState.lastTargetOffset=e,s||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:s?"smooth":"auto"})}var s,n;this.scheduleScrollReconcile()}}const Y=(t,e,i,s)=>{for(;t<=e;){const n=(t+e)/2|0,o=i(n);if(o<s)t=n+1;else{if(!(o>s))return n;e=n-1}}return t>0?t-1:0};class Z{constructor(t,e){this.cleanup=()=>{};const i={...e,onChange:(t,i)=>{var s;this.host.updateComplete.then((()=>this.host.requestUpdate())),null==(s=e.onChange)||s.call(e,t,i)}};this.virtualizer=new Q(i),(this.host=t).addController(this)}getVirtualizer(){return this.virtualizer}hostConnected(){this.cleanup=this.virtualizer._didMount()}hostUpdated(){this.virtualizer._willUpdate()}hostDisconnected(){this.cleanup()}}class X extends Z{constructor(t,e){super(t,{observeElementRect:K,observeElementOffset:N,scrollToFn:G,...e})}}D.registerIcon(e),D.registerIcon(s),D.registerIcon(n);let tt=1;const et=t=>t?`${t}px`:void 0;function it(t,e){return a(t.cssText.replace(/nord-combobox/g,e))}class st extends(M(k(A(j($(T(h))))))){constructor(){super(...arguments),this.comboboxId=`${this.localName||"nord-combobox"}-${tt++}`,this.inputId=`${this.comboboxId}-input`,this.inputRef=f(),this.formData=new x(this,{value:()=>this.formValue}),this.labelCache=new Map,this.localize=new _(this),this.dismiss=new O(this,{isOpen:()=>this.open,onDismiss:()=>this.hide(),isDismissible:t=>t!==this}),this.stateAttributes=new I(this,(()=>({invalid:this.invalid})),{trackFocus:!0}),this.options=[],this.externalFiltering=!1,this.loading=!1,this.autoHighlight=!1,this.invalid=!1,this.readonly=!1,this.openOnInputClick=!0,this.virtualized=!1,this.search="",this.queryDirty=!1,this.activeDescendant=new i(this,{count:()=>this.rowCount,isEnabled:t=>{var e;return!(null===(e=this.filteredOptions[t])||void 0===e?void 0:e.disabled)},optionId:t=>-1!==this.createIndex&&t===this.createIndex?this.createId:this.optionId(t)}),this.startObserver=new z(this,(()=>this.startSlot)),this.endObserver=new z(this,(()=>this.endSlot)),this.scrollActivePending=!1,this.virtualizer=new X(this,{count:0,overscan:st.VIRTUAL_OVERSCAN,estimateSize:()=>{var t;return null!==(t=this.measuredRowSize)&&void 0!==t?t:st.VIRTUAL_ROW_ESTIMATE},getScrollElement:()=>{var t;return null!==(t=this.listboxEl)&&void 0!==t?t:null},getItemKey:t=>{var e,i;return null!==(i=null===(e=this.filteredOptions[t])||void 0===e?void 0:e.value)&&void 0!==i?i:t}}),this.navigated=!1}get ownInvalid(){return this.invalid||super.ownInvalid}get showsQueryInInput(){return this.queryDirty}get displayValue(){return this.showsQueryInInput?this.search:!this.value||Array.isArray(this.value)?"":this.labelFor(this.value)}get inputPlaceholder(){return this.placeholder}get filterQuery(){return this.search}isSelected(t){return this.values.includes(t.value)}get formValue(){const{value:t}=this;return Array.isArray(t)?t.length?t.join(","):void 0:t||void 0}get hasValue(){return this.values.length>0}get createIndex(){return-1}get canCreate(){return!1}renderLeadingControl(){return o}get ariaAutocomplete(){return"list"}selectOption(t){t.disabled||(this.labelCache.set(t.value,t.label),this.value=t.value,this.search="",this.queryDirty=!1,this.commit(),this.hide(),this.focus())}handleEnter(t){return!1}onKeydown(t){}onBlur(){}afterUpdate(){}onOptionHover(){}onMove(){}get values(){const{value:t}=this;return Array.isArray(t)?t:t?[t]:[]}cacheLabels(t){for(const e of t)e.value&&this.labelCache.set(e.value,e.label);if(this.labelCache.size<=st.labelCacheLimit)return;const e=new Set(this.values);for(const t of this.labelCache.keys()){if(this.labelCache.size<=st.labelCacheLimit)break;e.has(t)||this.labelCache.delete(t)}}get resolvedOptions(){return this.options}get filtered(){const t=this.resolvedOptions,e=this.filterQuery,i=this.externalFiltering,s=this.filteredCache;if(s&&s.options===t&&s.query===e&&s.external===i)return s;s&&s.options===t||this.cacheLabels(t);const n=e.toLocaleLowerCase(),o=i||!e?t:t.filter((t=>t.label.toLocaleLowerCase().includes(n))),r=o.some((t=>t.group)),l=r?Array.from(y(o,"group"),(([,t])=>t)).flat():o;return this.filteredCache={options:t,query:e,external:i,result:l,hasGroups:r,groups:r?y(l,"group"):void 0},this.filteredCache}get filteredOptions(){return this.filtered.result}get rowCount(){return this.filteredOptions.length+(this.canCreate?1:0)}get activeOption(){return this.filteredOptions[this.activeDescendant.activeIndex]}get isVirtual(){if(!this.virtualized)return!1;const{result:t,hasGroups:e}=this.filtered;return t.length>0&&!e}connectedCallback(){var t,e,i;super.connectedCallback(),null!==(t=this.ariaObserver)&&void 0!==t||(this.ariaObserver=new MutationObserver((()=>this.requestUpdate()))),this.ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-labelledby"]}),null!==(e=this.widthObserver)&&void 0!==e||(this.widthObserver=new ResizeObserver((()=>this.syncAnchorInlineSize()))),this.widthObserver.observe(this),this.syncAnchorInlineSize(),null!==(i=this.slotObserver)&&void 0!==i||(this.slotObserver=new MutationObserver((()=>this.requestUpdate()))),this.slotObserver.observe(this,{childList:!0})}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.ariaObserver)||void 0===t||t.disconnect(),this.ariaObserver=void 0,null===(e=this.widthObserver)||void 0===e||e.disconnect(),this.widthObserver=void 0,null===(i=this.slotObserver)||void 0===i||i.disconnect(),this.slotObserver=void 0}relocateSlots(){if(r)return;const t=(t,e)=>{if(e)for(const i of Array.from(this.children))i.getAttribute("slot")===t&&i.parentElement!==e&&e.appendChild(i)};t("start",this.startSlot),t("end",this.endSlot)}syncAnchorInlineSize(){const t=this.offsetWidth;t&&this.style.setProperty("--_n-combobox-anchor-inline-size",`${t}px`)}createRenderRoot(){if(r)return this;const t=document.createElement("div");return t.className="n-render-root",this.appendChild(t),t}show(){if(this.open||this.disabled||this.readonly)return;this.dispatchEvent(new E("open",{cancelable:!0}))&&(this.open=!0)}hide(){this.open&&(this.open=!1,this.onHide(),this.dispatchEvent(new E("close")))}onHide(){this.search="",this.queryDirty=!1}focus(t){var e;null===(e=this.inputRef.value)||void 0===e||e.focus(t)}handleOpenChange(){var t,e;this.open?(null===(t=this.popout)||void 0===t||t.show(),this.resetActiveIndex()):null===(e=this.popout)||void 0===e||e.hide(!1)}handleDisabledChange(){this.disabled&&this.open&&this.hide()}resetRowSample(){this.measuredRowSize=void 0}updated(t){super.updated(t),this.relocateSlots(),this.afterUpdate(),this.sampleRowSize(),this.scrollActivePending&&(this.scrollActivePending=!1,this.scrollActiveIntoView())}willUpdate(t){if(super.willUpdate(t),this.isVirtual){const t=this.virtualizer.getVirtualizer(),e=this.filteredOptions.length;t.options.count!==e&&t.setOptions({...t.options,count:e})}}scrollActiveIntoView(){var t;const e=this.listboxEl;if(!e)return;const i=this.activeDescendant.activeIndex;this.isVirtual&&i>=0&&i!==this.createIndex?this.virtualizer.getVirtualizer().scrollToIndex(i,{align:"auto"}):null===(t=e.querySelector(".n-option.is-active"))||void 0===t||t.scrollIntoView({block:"nearest"})}handlePopoutClose(t){t.stopPropagation(),this.open&&this.hide()}handlePopoutOpen(t){t.stopPropagation()}resetActiveIndex(){this.autoHighlight?this.activeDescendant.setActiveIndex(this.activeDescendant.nextEnabledIndex(0,1)):-1!==this.createIndex&&this.filteredOptions.every((t=>t.disabled))?this.activeDescendant.setActiveIndex(this.createIndex):this.activeDescendant.reset(),this.navigated=!1,this.scrollActivePending=!0}handleInput(t){if(t.stopPropagation(),this.readonly)return;const e=t.target;this.search=e.value,this.queryDirty=!0,this.open||this.show(),this.dispatchEvent(new E("input")),this.onInput(e)}onInput(t){}handleBlur(){this.onBlur()}handleKeydown(t){if(!this.readonly)switch(this.onKeydown(t),t.key){case"ArrowDown":if(t.preventDefault(),!this.open)return void this.show();this.move(1);break;case"ArrowUp":if(t.preventDefault(),!this.open)return void this.show();this.move(-1);break;case"End":this.open&&(t.preventDefault(),this.activeDescendant.last()&&(this.navigated=!0,this.scrollActivePending=!0));break;case"Home":this.open&&(t.preventDefault(),this.activeDescendant.first()&&(this.navigated=!0,this.scrollActivePending=!0));break;case"Enter":if(!this.open)break;if(this.handleEnter(t))break;if(-1!==this.createIndex&&this.activeDescendant.activeIndex===this.createIndex){t.preventDefault(),this.emitCreate();break}(this.navigated||this.autoHighlight)&&this.activeOption&&(t.preventDefault(),this.selectOption(this.activeOption));break;case"Escape":this.open&&(t.preventDefault(),this.hide());break;default:this.onUnhandledKeydown(t)}}onUnhandledKeydown(t){}emitCreate(){}move(t){0!==this.rowCount&&(this.onMove(),this.activeDescendant.move(t)&&(this.navigated=!0,this.scrollActivePending=!0))}commit(){this.requestUpdate(),this.dispatchEvent(new E("change"))}labelFor(t){var e,i;const s=this.resolvedOptions.find((e=>e.value===t));return null!==(i=null!==(e=null==s?void 0:s.label)&&void 0!==e?e:this.labelCache.get(t))&&void 0!==i?i:t}render(){const{result:t,hasGroups:e,groups:i}=this.filtered,s=this.virtualized&&!e&&t.length>0,n=s?this.virtualizer.getVirtualizer().getVirtualItems():void 0,r=e?new Map(t.map(((t,e)=>[t.value,e]))):void 0,a=this.activeDescendant.activeIndex,h=this.activeOption,c=!n||a===this.createIndex||n.some((t=>t.index===a)),d=-1!==this.createIndex&&a===this.createIndex?`${this.comboboxId}-create`:h&&c?this.optionId(a):void 0,u=`${this.comboboxId}-list`,f=`${this.comboboxId}-anchor`,S=this.showClear,y=this.controlAriaLabel,x=this.controlAriaLabelledby,O=this.controlAriaDescribedby,z=l`<input ${v(this.inputRef)} class="n-input" type="text" id="${this.comboboxId}-input" role="combobox" .value="${this.displayValue}" placeholder="${m(this.inputPlaceholder)}" ?disabled="${this.effectiveDisabled}" ?readonly="${this.readonly}" ?required="${this.required}" autocomplete="off" autocapitalize="off" spellcheck="false" aria-label="${m(y)}" aria-labelledby="${m(x)}" aria-describedby="${m(O)}" aria-autocomplete="${this.ariaAutocomplete}" aria-haspopup="listbox" aria-controls="${u}" aria-expanded="${this.open?"true":"false"}" aria-activedescendant="${m(this.open?d:void 0)}" aria-invalid="${m(this.controlAriaInvalid)}" @input="${this.handleInput}" @blur="${this.handleBlur}" @keydown="${this.handleKeydown}">`,I=this.renderLeadingControl();return l`${this.renderLabel()}<div class="n-combobox" id="${f}"><div class="${p({"n-control":!0,"is-invalid":this.effectiveInvalid})}" style="${b({"--_n-combobox-start-inline-size":et(this.startObserver.inlineSize),"--_n-combobox-end-inline-size":et(this.endObserver.inlineSize)})}" @click="${this.handleControlClick}"><span class="n-slot n-slot-start"></span> ${I===o?z:l`<div class="n-tags">${I}${z}</div>`} <span class="n-slot n-slot-end"></span> ${this.loading?l`<nord-spinner class="n-loading" size="s"></nord-spinner>`:o} ${S?l`<button class="n-clear" type="button" aria-label="${this.localize.term("clearLabel")}" ?disabled="${this.disabled||this.readonly}" @click="${this.handleClearClick}"><nord-icon name="interface-close-small"></nord-icon></button> ${this.showToggle?l`<span class="n-divider" aria-hidden="true"></span>`:o}`:o} ${this.showToggle?l`<button class="n-toggle" type="button" tabindex="-1" aria-hidden="true" ?disabled="${this.disabled||this.readonly}" @click="${this.handleToggleClick}"><nord-icon name="interface-dropdown-small"></nord-icon></button>`:o}</div><nord-popout id="${this.comboboxId}-popout" anchor="${f}" align="${m(this.align)}" position="${m(this.position)}" always-floating @open="${this.handlePopoutOpen}" @close="${this.handlePopoutClose}"><div id="${u}" class="n-listbox" role="${m(this.rowCount?"listbox":void 0)}" aria-label="${m(this.rowCount?y:void 0)}" aria-labelledby="${m(this.rowCount?x:void 0)}" aria-multiselectable="${m(this.rowCount?this.ariaMultiselectable:void 0)}">${0!==t.length||this.canCreate?e&&i&&r?Array.from(i,(([t,e])=>this.renderGroup(t,e,r))):s&&n?this.renderVirtualOptions(t,n):g(t,(t=>t.value),((t,e)=>this.renderListOption(t,e))):this.renderEmpty()} ${this.canCreate?this.renderCreate():o}</div></nord-popout></div>${this.renderError()} ${this.isHintBelow?this.renderHint():o}`}get showClear(){return!1}get showToggle(){return!this.readonly}get ariaMultiselectable(){return"false"}renderGroup(t,e,i){const s=`${this.comboboxId}-group-${t}`;return l`<div role="group" aria-labelledby="${C(t,s)}">${t?l`<div class="n-group-label" role="presentation" id="${s}">${t}</div>`:o} ${g(e,(t=>t.value),(t=>{var e;return this.renderListOption(t,null!==(e=i.get(t.value))&&void 0!==e?e:0)}))}</div>`}optionContent(t){return this.renderOption?this.renderOption(t):t.html?S(t.html):t.label}sampleRowSize(){var t;if(!this.isVirtual||void 0!==this.measuredRowSize)return;const e=null===(t=this.listboxEl)||void 0===t?void 0:t.querySelector(".n-virtual-row .n-option"),i=null==e?void 0:e.getBoundingClientRect().height;i&&i>0&&(this.measuredRowSize=i,this.virtualizer.getVirtualizer().measure())}renderVirtualOptions(t,e){const i=t.length,s=this.virtualizer.getVirtualizer().getTotalSize(),n=void 0!==this.measuredRowSize;return l`<div class="n-virtual-sizer" style="block-size:${s}">${g(e,(t=>t.key),(e=>l`<div class="n-virtual-row" data-index="${e.index}" style="${n?`block-size:${e.size}px; transform: translateY(${e.start}px)`:`transform: translateY(${e.start}px)`}">${this.renderListOption(t[e.index],e.index,i)}</div>`))}</div>`}renderListOption(t,e,i){const s=this.isSelected(t);return l`<div id="${this.optionId(e)}" class="${p({"n-option":!0,"is-active":e===this.activeDescendant.activeIndex,"is-disabled":Boolean(t.disabled)})}" role="option" aria-selected="${this.optionAriaSelected(s)}" aria-disabled="${t.disabled?"true":o}" aria-setsize="${m(i)}" aria-posinset="${m(void 0===i?void 0:e+1)}" @click="${()=>this.selectOption(t)}" @mousemove="${()=>this.handleOptionHover(e)}">${this.rendersCheck?l`<span class="n-option-check">${this.showCheck(s)?l`<nord-icon name="interface-checked" size="s"></nord-icon>`:o}</span>`:o} <span class="n-option-label">${this.optionContent(t)}</span></div>`}optionAriaSelected(t){return t?"true":"false"}showCheck(t){return t}get rendersCheck(){return!0}renderCreate(){return o}renderEmpty(){return this.loading?l`<div class="n-empty" role="status"><nord-spinner size="s"></nord-spinner></div>`:l`<div class="n-empty" role="status">${this.noResultsText||this.localize.term("noResults")}</div>`}optionId(t){return`${this.comboboxId}-option-${t}`}get createId(){return`${this.comboboxId}-create`}handleOptionHover(t){this.onOptionHover(),this.activeDescendant.setActiveIndex(t)}handleControlClick(){this.disabled||(!this.open&&this.openOnInputClick&&this.show(),this.focus())}handleClearClick(t){t.stopPropagation(),this.disabled||this.readonly||this.clear()}clear(){}handleToggleClick(t){t.stopPropagation(),this.disabled||this.readonly||(this.open?this.hide():this.show(),this.focus())}}st.VIRTUAL_ROW_ESTIMATE=36,st.VIRTUAL_OVERSCAN=6,st.labelCacheLimit=500,t([c("nord-popout",!0)],st.prototype,"popout",void 0),t([d({attribute:!1})],st.prototype,"options",void 0),t([d({reflect:!0})],st.prototype,"placeholder",void 0),t([d({reflect:!0,type:Boolean,attribute:"external-filtering"})],st.prototype,"externalFiltering",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"loading",void 0),t([d({reflect:!0,type:Boolean,attribute:"auto-highlight"})],st.prototype,"autoHighlight",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"invalid",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"readonly",void 0),t([d({reflect:!0,type:Boolean,attribute:"open-on-input-click"})],st.prototype,"openOnInputClick",void 0),t([d({reflect:!0,attribute:"no-results-text"})],st.prototype,"noResultsText",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"virtualized",void 0),t([d({attribute:!1})],st.prototype,"renderOption",void 0),t([u()],st.prototype,"search",void 0),t([u()],st.prototype,"queryDirty",void 0),t([c(".n-listbox")],st.prototype,"listboxEl",void 0),t([c(".n-slot-start")],st.prototype,"startSlot",void 0),t([c(".n-slot-end")],st.prototype,"endSlot",void 0),t([w("open","updated")],st.prototype,"handleOpenChange",null),t([w("disabled")],st.prototype,"handleDisabledChange",null),t([w("size")],st.prototype,"resetRowSample",null),t([w("search")],st.prototype,"resetActiveIndex",null);export{st as default,it as retagComboboxStyles};
1
+ import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{c as e,A as i}from"./ActiveDescendantController-BnMqM79O.js";import{c as s}from"./interface-close-small-CnpAFMO3.js";import{d as n}from"./interface-dropdown-small-CYvgxudU.js";import{nothing as o,isServer as r,html as l,unsafeCSS as a,LitElement as h}from"lit";import{query as c,property as d,state as u}from"lit/decorators.js";import{classMap as p}from"lit/directives/class-map.js";import{ifDefined as m}from"lit/directives/if-defined.js";import{createRef as f,ref as v}from"lit/directives/ref.js";import{repeat as g}from"lit/directives/repeat.js";import{styleMap as b}from"lit/directives/style-map.js";import{unsafeHTML as S}from"lit/directives/unsafe-html.js";import{g as y}from"./collection-Dvg2XbxV.js";import{F as x}from"./FormDataController-OUt5L5uC.js";import{L as O}from"./LightDismissController-wcL1ziJa.js";import{R as z}from"./ResizeController-14PUwRQy.js";import{S as I}from"./StateAttributesController-BIh96sXZ.js";import{o as w}from"./observe-D0n0zOfU.js";import{c as C}from"./cond-CI1KbneT.js";import{N as E}from"./events-Bv6wNHwJ.js";import{A}from"./AutocompleteMixin-D8eiOxvO.js";import{D as M}from"./DraftComponentMixin-4qug5Rky.js";import{F as j}from"./FieldControlMixin-BXNZJXu9.js";import{F as T}from"./Popout-B6Hirj3y.js";import{I as $}from"./InputMixin-LetXsCyv.js";import{S as k}from"./SizeMixin-CU9cLbLC.js";import D from"./Icon.js";import{LocalizeController as _}from"./LocalizeController.js";import"./Spinner.js";import"./number-Dg2vCfGd.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"./context-consumer-BJVUulGf.js";import"./context-request-event-CCRlXoeR.js";import"./field-context.js";import"./create-context-CJ69ntlY.js";import"./SlotController-Z6eG7LSZ.js";import"./light-dom-styles-DXsbiKU9.js";import"./VisuallyHidden.js";import"./positioning-D-K8Mueq.js";import"./DirectionController-ChvNGESZ.js";import"./ScrollbarController-BFC67Y2x.js";import"./Component-BJ5O5n8k.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";import"./localization24.js";function R(t,e,i){let s,n=i.initialDeps??[],o=!0;function r(){const r=t();return r.length!==n.length||r.some(((t,e)=>n[e]!==t))?(n=r,s=e(...r),!(null==i?void 0:i.onChange)||o&&i.skipInitialOnChange||i.onChange(s),o=!1,s):s}return r.updateDeps=t=>{n=t},r}function F(t,e){if(void 0===t)throw new Error("Unexpected undefined");return t}const V=(t,e,i)=>{let s;return function(...n){t.clearTimeout(s),s=t.setTimeout((()=>e.apply(this,n)),i)}};let L;const W=()=>{if(void 0!==L)return L;if("undefined"==typeof navigator)return L=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return L=!0;const t=navigator.maxTouchPoints;return L="MacIntel"===navigator.platform&&void 0!==t&&t>0},P=t=>{const{offsetWidth:e,offsetHeight:i}=t;return{width:e,height:i}},q=t=>t,H=t=>{const e=Math.max(t.startIndex-t.overscan,0),i=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,s=new Array(i);for(let t=0;t<i;t++)s[t]=e+t;return s},K=(t,e)=>{const i=t.scrollElement;if(!i)return;const s=t.targetWindow;if(!s)return;const n=t=>{const{width:i,height:s}=t;e({width:Math.round(i),height:Math.round(s)})};if(n(P(i)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver((e=>{const s=()=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void n({width:e.inlineSize,height:e.blockSize})}n(P(i))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()}));return o.observe(i,{box:"border-box"}),()=>{o.unobserve(i)}},B={passive:!0},U="undefined"==typeof window||"onscrollend"in window,N=(t,e)=>((t,e,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const o=t.options.useScrollendEvent&&U;let r=0;const l=o?null:V(n,(()=>e(r,!1)),t.options.isScrollingResetDelay),a=t=>()=>{r=i(s),null==l||l(),e(r,t)},h=a(!0),c=a(!1);return s.addEventListener("scroll",h,B),o&&s.addEventListener("scrollend",c,B),()=>{s.removeEventListener("scroll",h),o&&s.removeEventListener("scrollend",c)}})(t,e,(e=>{const{horizontal:i,isRtl:s}=t.options;return i?e.scrollLeft*(s?-1:1):e.scrollTop})),J=(t,e,i)=>{if(i.options.useCachedMeasurements){const e=i.indexFromElement(t),s=i.options.getItemKey(e);return i.itemSizeCache.get(s)??i.options.estimateSize(e)}if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t){return Math.round(t[i.options.horizontal?"inlineSize":"blockSize"])}}if(!e){const e=i.indexFromElement(t),s=i.options.getItemKey(e),n=i.itemSizeCache.get(s);if(void 0!==n)return n}return t[i.options.horizontal?"offsetWidth":"offsetHeight"]},G=(t,{adjustments:e=0,behavior:i},s)=>{var n,o;null==(o=null==(n=s.scrollElement)?void 0:n.scrollTo)||o.call(n,{[s.options.horizontal?"left":"top"]:t+e,behavior:i})};class Q{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,e,i;return(null==(i=null==(e=null==(t=this.targetWindow)?void 0:t.performance)?void 0:e.now)?void 0:i.call(e))??Date.now()},this.observer=(()=>{let t=null;const e=()=>t||(this.targetWindow&&this.targetWindow.ResizeObserver?t=new this.targetWindow.ResizeObserver((t=>{t.forEach((t=>{const e=()=>{const e=t.target,i=this.indexFromElement(e);if(e.isConnected)this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(e,t,this));else{this.observer.unobserve(e);for(const[t,i]of this.elementsCache)if(i===e){this.elementsCache.delete(t);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(e):e()}))})):null);return{disconnect:()=>{var i;null==(i=e())||i.disconnect(),t=null},observe:t=>{var i;return null==(i=e())?void 0:i.observe(t,{box:"border-box"})},unobserve:t=>{var i;return null==(i=e())?void 0:i.unobserve(t)}}})(),this.range=null,this.setOptions=t=>{var e,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:q,rangeExtractor:H,onChange:()=>{},measureElement:J,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const e in t){const i=t[e];void 0!==i&&(s[e]=i)}const n=this.options;let o=null,r=null,l=!1;if(void 0!==n&&n.enabled&&s.enabled&&"end"===s.anchorTo&&null!==this.scrollElement){const t=n.count,a=s.count,h=this.getMeasurements(),c=t>0?(null==(e=h[0])?void 0:e.key)??n.getItemKey(0):null,d=t>0?(null==(i=h[t-1])?void 0:i.key)??n.getItemKey(t-1):null;if(a!==t||t>0&&a>0&&(s.getItemKey(0)!==c||s.getItemKey(a-1)!==d)){l=!0;const e=t>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;e&&(o=[e.key,this.getScrollOffset()-e.start]);const i=!0===s.followOnAppend?"auto":s.followOnAppend||null;i&&a>t&&this.isAtEnd(n.scrollEndThreshold)&&(0===t||s.getItemKey(a-1)!==d)&&(r=i)}}this.options=s,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let a=!1,h=0;if(o&&null!==this.scrollOffset){const[t,e]=o,i=this.getMeasurements(),{count:s,getItemKey:n}=this.options;let r=0;for(;r<s&&n(r)!==t;)r++;if(r<s){const t=i[r];if(t){const i=t.start+e;i!==this.scrollOffset&&(h=i-this.scrollOffset,this.scrollOffset=i,a=!0)}}}(a||r)&&(this.pendingScrollAnchor=[a?o[0]:null,a?o[1]:0,r,h])},this.notify=t=>{var e,i;null==(i=(e=this.options).onChange)||i.call(e,this,t)},this.maybeNotify=R((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(t=>{this.notify(t)}),{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((t=>t())),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(t=this.scrollElement)?void 0:t.window)??null,this.elementsCache.forEach((t=>{this.observer.observe(t)})),this.unsubs.push(this.options.observeElementRect(this,(t=>{this.scrollRect=t,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((t,e)=>{null!==this._intendedScrollOffset&&Math.abs(t-this._intendedScrollOffset)<1.5&&(t=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=e?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=e,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()}))),"addEventListener"in this.scrollElement){const t=this.scrollElement,e=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},i=()=>{this._iosTouching=!1,W()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout((()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()}),150))};t.addEventListener("touchstart",e,B),t.addEventListener("touchend",i,B),this.unsubs.push((()=>{t.removeEventListener("touchstart",e),t.removeEventListener("touchend",i),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)}))}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[t,e,s,n]=i;null===t||s||(W()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==n&&(this._iosDeferredAdjustment+=n):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const t=this.getScrollOffset(),e=this.getMaxScrollOffset();if(t<0||t>e)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,e)=>{const i=new Map,s=new Map;for(let n=e-1;n>=0;n--){const e=t[n];if(i.has(e.lane))continue;const o=s.get(e.lane);if(null==o||e.end>o.end?s.set(e.lane,e):e.end<o.end&&i.set(e.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort(((t,e)=>t.end===e.end?t.index-e.index:t.end-e.end))[0]:void 0},this.getMeasurementOptions=R((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode]),((t,e,i,s,n,o,r)=>(void 0!==this.prevLanes&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:e,scrollMargin:i,getItemKey:s,enabled:n,lanes:o,laneAssignmentMode:r})),{key:!1}),this.getMeasurements=R((()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion]),(({count:t,paddingStart:e,scrollMargin:i,getItemKey:s,enabled:n,lanes:o,laneAssignmentMode:r},l)=>{const a=this.itemSizeCache;if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const e of this.laneAssignments.keys())e>=t&&this.laneAssignments.delete(e);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((t=>{this.itemSizeCache.set(t.key,t.size)})));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),1===o){const n=this.options.gap,o=2*t;let r,l=this._flatMeasurements;if(!l||l.length<o){const t=new Float64Array(o);l&&h>0&&t.set(l.subarray(0,2*h)),l=t,this._flatMeasurements=l}if(0===h)r=e+i;else{const t=h-1;r=l[2*t]+l[2*t+1]+n}for(let e=h;e<t;e++){const t=s(e),i=a.get(t),o="number"==typeof i?i:this.options.estimateSize(e);l[2*e]=r,l[2*e+1]=o,r+=o+n}const c=function(t,e,i){const s=new Array(t);return new Proxy(s,{get(s,n,o){if("string"==typeof n){const o=n.charCodeAt(0);if(o>=48&&o<=57){const o=+n;if(Number.isInteger(o)&&o>=0&&o<t){let t=s[o];if(!t){const n=e[2*o];t=s[o]={index:o,key:i(o),start:n,size:e[2*o+1],end:n+e[2*o+1],lane:0}}return t}}if("length"===n)return t}return Reflect.get(s,n,o)}})}(t,l,s);return this.measurementsCache=c,c}const c=this.measurementsCache.slice(0,h),d=new Array(o).fill(void 0);for(let t=0;t<h;t++){const e=c[t];e&&(d[e.lane]=t)}for(let n=h;n<t;n++){const t=s(n),o=this.laneAssignments.get(n);let l,h;const u="estimate"===r||a.has(t);if(void 0!==o&&this.options.lanes>1){l=o;const t=d[l],s=void 0!==t?c[t]:void 0;h=s?s.end+this.options.gap:e+i}else{const t=1===this.options.lanes?c[n-1]:this.getFurthestMeasurement(c,n);h=t?t.end+this.options.gap:e+i,l=t?t.lane:n%this.options.lanes,this.options.lanes>1&&u&&this.laneAssignments.set(n,l)}const p=a.get(t),m="number"==typeof p?p:this.options.estimateSize(n),f=h+m;c[n]={index:n,start:h,size:m,end:f,key:t,lane:l},d[l]=n}return this.measurementsCache=c,c}),{key:!1,debug:()=>this.options.debug}),this.calculateRange=R((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((t,e,i,s)=>this.range=t.length>0&&e>0?function({measurements:t,outerSize:e,scrollOffset:i,lanes:s,flat:n}){const o=t.length-1,r=n?t=>n[2*t]:e=>t[e].start,l=n?t=>n[2*t]+n[2*t+1]:e=>t[e].end;if(t.length<=s)return{startIndex:0,endIndex:o};let a=Y(0,o,r,i),h=a;if(1===s)for(;h<o&&l(h)<i+e;)h++;else if(s>1){const n=Array(s).fill(0);for(;h<o&&n.some((t=>t<i+e));){const e=t[h];n[e.lane]=e.end,h++}const r=Array(s).fill(i+e);for(;a>=0&&r.some((t=>t>=i));){const e=t[a];r[e.lane]=e.start,a--}a=Math.max(0,a-a%s),h=Math.min(o,h+(s-1-h%s))}return{startIndex:a,endIndex:h}}({measurements:t,outerSize:e,scrollOffset:i,lanes:s,flat:1===s&&null!=this._flatMeasurements?this._flatMeasurements:null}):null),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=R((()=>{let t=null,e=null;const i=this.calculateRange();return i&&(t=i.startIndex,e=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,e]}),((t,e,i,s,n)=>null===s||null===n?[]:t({startIndex:s,endIndex:n,overscan:e,count:i})),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const e=this.options.indexAttribute,i=t.getAttribute(e);return i?parseInt(i,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var e;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const i=this.scrollState.index??(null==(e=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:e.index);if(void 0!==i&&this.range){const e=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,i-e),n=Math.min(this.options.count-1,i+e);return t>=s&&t<=n}return!0},this.measureElement=t=>{if(!t)return void this.elementsCache.forEach(((t,e)=>{t.isConnected||(this.observer.unobserve(t),this.elementsCache.delete(e))}));const e=this.indexFromElement(t),i=this.options.getItemKey(e),s=this.elementsCache.get(i);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i,t)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(e)||this.resizeItem(e,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,e)=>{var i,s;if(t<0||t>=this.options.count)return;let n,o,r;const l=this._flatMeasurements;if(1===this.options.lanes&&null!==l)r=this.options.getItemKey(t),o=l[2*t],n=l[2*t+1];else{const e=this.measurementsCache[t];if(!e)return;r=e.key,o=e.start,n=e.size}const a=e-(this.itemSizeCache.get(r)??n);if(0!==a){const l="end"===this.options.anchorTo&&"smooth"!==(null==(i=this.scrollState)?void 0:i.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,h=l?this.getTotalSize():0,c="smooth"!==(null==(s=this.scrollState)?void 0:s.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:r,start:o,size:n,end:o+n,lane:0},a,this):o<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(r)||"backward"!==this.scrollDirection));(null===this.pendingMin||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(r,e),this.itemSizeCacheVersion++,l?this.applyScrollAdjustment(this.getTotalSize()-h):c&&this.applyScrollAdjustment(a),this.notify(!1)}},this.getVirtualItems=R((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((t,e)=>{const i=[];for(let s=0,n=t.length;s<n;s++){const n=e[t[s]];i.push(n)}return i}),{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const e=this.getMeasurements();if(0===e.length)return;const i=this._flatMeasurements,s=1===this.options.lanes&&null!=i,n=Y(0,e.length-1,s?t=>i[2*t]:t=>F(e[t]).start,t);return F(e[n])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,e,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),n=this.getScrollOffset();"auto"===e&&(e=t>=n+s?"end":"start"),"center"===e?t+=(i-s)/2:"end"===e&&(t-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),n=this.measurementsCache[t];if(!n)return;if("auto"===e)if(n.end>=s+i-this.options.scrollPaddingEnd)e="end";else{if(!(n.start<=s+this.options.scrollPaddingStart))return[s,e];e="start"}if("end"===e&&t===this.options.count-1)return[this.getMaxScrollOffset(),e];const o="end"===e?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,e,n.size),e]},this.scrollToOffset=(t,{align:e="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(t,e),n=this.now();this.scrollState={index:null,align:e,behavior:i,startedAt:n,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:e="auto",behavior:i="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getOffsetForIndex(t,e);if(!s)return;const[n,o]=s,r=this.now();this.scrollState={index:t,align:o,behavior:i,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:e="auto"}={})=>{const i=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:e,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:t}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const e=this.getMeasurements();let i;if(0===e.length)i=this.options.paddingStart;else if(1===this.options.lanes){const s=e.length-1,n=this._flatMeasurements;i=null!=n?n[2*s]+n[2*s+1]:(null==(t=e[s])?void 0:t.end)??0}else{const t=Array(this.options.lanes).fill(null);let s=e.length-1;for(;s>=0&&t.some((t=>null===t));){const i=e[s];null===t[i.lane]&&(t[i.lane]=i.end),s--}i=Math.max(...t.filter((t=>null!==t)))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(0===this.itemSizeCache.size)return t;const e=this.getMeasurements();for(const i of e)i&&this.itemSizeCache.has(i.key)&&t.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return t},this._scrollToOffset=(t,{adjustments:e,behavior:i})=>{this._intendedScrollOffset=t+(e??0),this.options.scrollToFn(t,{behavior:i,adjustments:e},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){0!==t&&(W()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}))}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame((()=>{this.rafId=null,this.reconcileScroll()}))):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const t=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=t?t[0]:this.scrollState.lastTargetOffset,i=e!==this.scrollState.lastTargetOffset;if(!i&&(s=e,n=this.getScrollOffset(),Math.abs(s-n)<1.01)){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1)return this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,i){const t=this.getSize()||600,i=Math.abs(e-this.getScrollOffset()),s="smooth"===this.scrollState.behavior&&i>t;this.scrollState.lastTargetOffset=e,s||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:s?"smooth":"auto"})}var s,n;this.scheduleScrollReconcile()}}const Y=(t,e,i,s)=>{for(;t<=e;){const n=(t+e)/2|0,o=i(n);if(o<s)t=n+1;else{if(!(o>s))return n;e=n-1}}return t>0?t-1:0};class Z{constructor(t,e){this.cleanup=()=>{};const i={...e,onChange:(t,i)=>{var s;this.host.updateComplete.then((()=>this.host.requestUpdate())),null==(s=e.onChange)||s.call(e,t,i)}};this.virtualizer=new Q(i),(this.host=t).addController(this)}getVirtualizer(){return this.virtualizer}hostConnected(){this.cleanup=this.virtualizer._didMount()}hostUpdated(){this.virtualizer._willUpdate()}hostDisconnected(){this.cleanup()}}class X extends Z{constructor(t,e){super(t,{observeElementRect:K,observeElementOffset:N,scrollToFn:G,...e})}}D.registerIcon(e),D.registerIcon(s),D.registerIcon(n);let tt=1;const et=t=>t?`${t}px`:void 0;function it(t,e){return a(t.cssText.replace(/nord-combobox/g,e))}class st extends(M(k(A(j($(T(h))))))){constructor(){super(...arguments),this.comboboxId=`${this.localName||"nord-combobox"}-${tt++}`,this.inputId=`${this.comboboxId}-input`,this.inputRef=f(),this.formData=new x(this,{value:()=>this.formValue}),this.labelCache=new Map,this.localize=new _(this),this.dismiss=new O(this,{isOpen:()=>this.open,onDismiss:()=>this.hide(),isDismissible:t=>t!==this}),this.stateAttributes=new I(this,(()=>({invalid:this.invalid})),{trackFocus:!0}),this.options=[],this.externalFiltering=!1,this.loading=!1,this.autoHighlight=!1,this.invalid=!1,this.readonly=!1,this.openOnInputClick=!0,this.virtualized=!1,this.search="",this.queryDirty=!1,this.activeDescendant=new i(this,{count:()=>this.rowCount,isEnabled:t=>{var e;return!(null===(e=this.filteredOptions[t])||void 0===e?void 0:e.disabled)},optionId:t=>-1!==this.createIndex&&t===this.createIndex?this.createId:this.optionId(t)}),this.startObserver=new z(this,(()=>this.startSlot)),this.endObserver=new z(this,(()=>this.endSlot)),this.scrollActivePending=!1,this.virtualizer=new X(this,{count:0,overscan:st.VIRTUAL_OVERSCAN,estimateSize:()=>{var t;return null!==(t=this.measuredRowSize)&&void 0!==t?t:st.VIRTUAL_ROW_ESTIMATE},getScrollElement:()=>{var t;return null!==(t=this.listboxEl)&&void 0!==t?t:null},getItemKey:t=>{var e,i;return null!==(i=null===(e=this.filteredOptions[t])||void 0===e?void 0:e.value)&&void 0!==i?i:t}}),this.navigated=!1}get ownInvalid(){return this.invalid||super.ownInvalid}get showsQueryInInput(){return this.queryDirty}get displayValue(){return this.showsQueryInInput?this.search:!this.value||Array.isArray(this.value)?"":this.labelFor(this.value)}get inputPlaceholder(){return this.placeholder}get filterQuery(){return this.search}isSelected(t){return this.values.includes(t.value)}get formValue(){const{value:t}=this;return Array.isArray(t)?t.length?t.join(","):void 0:t||void 0}get hasValue(){return this.values.length>0}get createIndex(){return-1}get canCreate(){return!1}renderLeadingControl(){return o}get ariaAutocomplete(){return"list"}selectOption(t){t.disabled||(this.labelCache.set(t.value,t.label),this.value=t.value,this.search="",this.queryDirty=!1,this.commit(),this.hide(),this.focus())}handleEnter(t){return!1}onKeydown(t){}onBlur(){}afterUpdate(){}onOptionHover(){}onMove(){}get values(){const{value:t}=this;return Array.isArray(t)?t:t?[t]:[]}cacheLabels(t){for(const e of t)e.value&&this.labelCache.set(e.value,e.label);if(this.labelCache.size<=st.labelCacheLimit)return;const e=new Set(this.values);for(const t of this.labelCache.keys()){if(this.labelCache.size<=st.labelCacheLimit)break;e.has(t)||this.labelCache.delete(t)}}get resolvedOptions(){return this.options}get filtered(){const t=this.resolvedOptions,e=this.filterQuery,i=this.externalFiltering,s=this.filteredCache;if(s&&s.options===t&&s.query===e&&s.external===i)return s;s&&s.options===t||this.cacheLabels(t);const n=e.toLocaleLowerCase(),o=i||!e?t:t.filter((t=>t.label.toLocaleLowerCase().includes(n))),r=o.some((t=>t.group)),l=r?Array.from(y(o,"group"),(([,t])=>t)).flat():o;return this.filteredCache={options:t,query:e,external:i,result:l,hasGroups:r,groups:r?y(l,"group"):void 0},this.filteredCache}get filteredOptions(){return this.filtered.result}get rowCount(){return this.filteredOptions.length+(this.canCreate?1:0)}get activeOption(){return this.filteredOptions[this.activeDescendant.activeIndex]}get isVirtual(){if(!this.virtualized)return!1;const{result:t,hasGroups:e}=this.filtered;return t.length>0&&!e}connectedCallback(){var t,e,i;super.connectedCallback(),null!==(t=this.ariaObserver)&&void 0!==t||(this.ariaObserver=new MutationObserver((()=>this.requestUpdate()))),this.ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-labelledby"]}),null!==(e=this.widthObserver)&&void 0!==e||(this.widthObserver=new ResizeObserver((()=>this.syncAnchorInlineSize()))),this.widthObserver.observe(this),this.syncAnchorInlineSize(),null!==(i=this.slotObserver)&&void 0!==i||(this.slotObserver=new MutationObserver((()=>this.requestUpdate()))),this.slotObserver.observe(this,{childList:!0})}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.ariaObserver)||void 0===t||t.disconnect(),this.ariaObserver=void 0,null===(e=this.widthObserver)||void 0===e||e.disconnect(),this.widthObserver=void 0,null===(i=this.slotObserver)||void 0===i||i.disconnect(),this.slotObserver=void 0}relocateSlots(){if(r)return;const t=(t,e)=>{if(e)for(const i of Array.from(this.children))i.getAttribute("slot")===t&&i.parentElement!==e&&e.appendChild(i)};t("start",this.startSlot),t("end",this.endSlot)}syncAnchorInlineSize(){const t=this.offsetWidth;t&&this.style.setProperty("--_n-combobox-anchor-inline-size",`${t}px`)}createRenderRoot(){if(r)return this;const t=document.createElement("div");return t.className="n-render-root",this.appendChild(t),t}show(){if(this.open||this.disabled||this.readonly)return;this.dispatchEvent(new E("open",{cancelable:!0}))&&(this.open=!0)}hide(){this.open&&(this.open=!1,this.onHide(),this.dispatchEvent(new E("close")))}onHide(){this.search="",this.queryDirty=!1}focus(t){var e;null===(e=this.inputRef.value)||void 0===e||e.focus(t)}handleOpenChange(){var t,e;this.open?(null===(t=this.popout)||void 0===t||t.show(),this.resetActiveIndex()):null===(e=this.popout)||void 0===e||e.hide(!1)}handleDisabledChange(){this.disabled&&this.open&&this.hide()}resetRowSample(){this.measuredRowSize=void 0}updated(t){super.updated(t),this.relocateSlots(),this.afterUpdate(),this.sampleRowSize(),this.scrollActivePending&&(this.scrollActivePending=!1,this.scrollActiveIntoView())}willUpdate(t){if(super.willUpdate(t),this.isVirtual){const t=this.virtualizer.getVirtualizer(),e=this.filteredOptions.length;t.options.count!==e&&t.setOptions({...t.options,count:e})}}scrollActiveIntoView(){var t;const e=this.listboxEl;if(!e)return;const i=this.activeDescendant.activeIndex;this.isVirtual&&i>=0&&i!==this.createIndex?this.virtualizer.getVirtualizer().scrollToIndex(i,{align:"auto"}):null===(t=e.querySelector(".n-option.is-active"))||void 0===t||t.scrollIntoView({block:"nearest"})}handlePopoutClose(t){t.stopPropagation(),this.open&&this.hide()}handlePopoutOpen(t){t.stopPropagation()}resetActiveIndex(){this.autoHighlight?this.activeDescendant.setActiveIndex(this.activeDescendant.nextEnabledIndex(0,1)):-1!==this.createIndex&&this.filteredOptions.every((t=>t.disabled))?this.activeDescendant.setActiveIndex(this.createIndex):this.activeDescendant.reset(),this.navigated=!1,this.scrollActivePending=!0}handleInput(t){if(t.stopPropagation(),this.readonly)return;const e=t.target;this.search=e.value,this.queryDirty=!0,this.open||this.show(),this.dispatchEvent(new E("input")),this.onInput(e)}onInput(t){}handleBlur(){this.onBlur()}handleKeydown(t){if(!this.readonly)switch(this.onKeydown(t),t.key){case"ArrowDown":if(t.preventDefault(),!this.open)return void this.show();this.move(1);break;case"ArrowUp":if(t.preventDefault(),!this.open)return void this.show();this.move(-1);break;case"End":this.open&&(t.preventDefault(),this.activeDescendant.last()&&(this.navigated=!0,this.scrollActivePending=!0));break;case"Home":this.open&&(t.preventDefault(),this.activeDescendant.first()&&(this.navigated=!0,this.scrollActivePending=!0));break;case"Enter":if(!this.open)break;if(this.handleEnter(t))break;if(-1!==this.createIndex&&this.activeDescendant.activeIndex===this.createIndex){t.preventDefault(),this.emitCreate();break}(this.navigated||this.autoHighlight)&&this.activeOption&&(t.preventDefault(),this.selectOption(this.activeOption));break;case"Escape":this.open&&(t.preventDefault(),this.hide());break;default:this.onUnhandledKeydown(t)}}onUnhandledKeydown(t){}emitCreate(){}move(t){0!==this.rowCount&&(this.onMove(),this.activeDescendant.move(t)&&(this.navigated=!0,this.scrollActivePending=!0))}commit(){this.requestUpdate(),this.dispatchEvent(new E("change"))}labelFor(t){var e,i;const s=this.resolvedOptions.find((e=>e.value===t));return null!==(i=null!==(e=null==s?void 0:s.label)&&void 0!==e?e:this.labelCache.get(t))&&void 0!==i?i:t}render(){const{result:t,hasGroups:e,groups:i}=this.filtered,s=this.virtualized&&!e&&t.length>0,n=s?this.virtualizer.getVirtualizer().getVirtualItems():void 0,r=e?new Map(t.map(((t,e)=>[t.value,e]))):void 0,a=this.activeDescendant.activeIndex,h=this.activeOption,c=!n||a===this.createIndex||n.some((t=>t.index===a)),d=-1!==this.createIndex&&a===this.createIndex?`${this.comboboxId}-create`:h&&c?this.optionId(a):void 0,u=`${this.comboboxId}-list`,f=`${this.comboboxId}-anchor`,S=this.showClear,y=this.controlAriaLabel,x=this.controlAriaLabelledby,O=this.controlAriaDescribedby,z=l`<input ${v(this.inputRef)} class="n-input" type="text" id="${this.comboboxId}-input" role="combobox" .value="${this.displayValue}" placeholder="${m(this.inputPlaceholder)}" ?disabled="${this.effectiveDisabled}" ?readonly="${this.readonly}" ?required="${this.required}" autocomplete="off" autocapitalize="off" spellcheck="false" aria-label="${m(y)}" aria-labelledby="${m(x)}" aria-describedby="${m(O)}" aria-autocomplete="${this.ariaAutocomplete}" aria-haspopup="listbox" aria-controls="${u}" aria-expanded="${this.open?"true":"false"}" aria-activedescendant="${m(this.open?d:void 0)}" aria-invalid="${m(this.controlAriaInvalid)}" @input="${this.handleInput}" @blur="${this.handleBlur}" @keydown="${this.handleKeydown}">`,I=this.renderLeadingControl();return l`${this.renderLabel()}<div class="n-combobox" id="${f}"><div class="${p({"n-control":!0,"is-invalid":this.effectiveInvalid})}" style="${b({"--_n-combobox-start-inline-size":et(this.startObserver.inlineSize),"--_n-combobox-end-inline-size":et(this.endObserver.inlineSize)})}" @click="${this.handleControlClick}"><span class="n-slot n-slot-start"></span> ${I===o?z:l`<div class="n-tags">${I}${z}</div>`} <span class="n-slot n-slot-end"></span> ${this.loading?l`<nord-spinner class="n-loading" size="s"></nord-spinner>`:o} ${S?l`<button class="n-clear" type="button" aria-label="${this.localize.term("clearLabel")}" ?disabled="${this.disabled||this.readonly}" @click="${this.handleClearClick}"><nord-icon name="interface-close-small"></nord-icon></button> ${this.showToggle?l`<span class="n-divider" aria-hidden="true"></span>`:o}`:o} ${this.showToggle?l`<button class="n-toggle" type="button" tabindex="-1" aria-hidden="true" ?disabled="${this.disabled||this.readonly}" @click="${this.handleToggleClick}"><nord-icon name="interface-dropdown-small"></nord-icon></button>`:o}</div><nord-popout id="${this.comboboxId}-popout" anchor="${f}" align="${m(this.align)}" position="${m(this.position)}" always-floating @open="${this.handlePopoutOpen}" @close="${this.handlePopoutClose}"><div id="${u}" class="n-listbox" role="${m(this.rowCount?"listbox":void 0)}" aria-label="${m(this.rowCount?y:void 0)}" aria-labelledby="${m(this.rowCount?x:void 0)}" aria-multiselectable="${m(this.rowCount?this.ariaMultiselectable:void 0)}">${0!==t.length||this.canCreate?e&&i&&r?Array.from(i,(([t,e])=>this.renderGroup(t,e,r))):s&&n?this.renderVirtualOptions(t,n):g(t,(t=>t.value),((t,e)=>this.renderListOption(t,e))):this.renderEmpty()} ${this.canCreate?this.renderCreate():o}</div></nord-popout></div>${this.renderError()} ${this.isHintBelow?this.renderHint():o}`}get showClear(){return!1}get showToggle(){return!this.readonly}get ariaMultiselectable(){return"false"}renderGroup(t,e,i){const s=`${this.comboboxId}-group-${t}`;return l`<div role="group" aria-labelledby="${C(t,s)}">${t?l`<div class="n-group-label" role="presentation" id="${s}">${t}</div>`:o} ${g(e,(t=>t.value),(t=>{var e;return this.renderListOption(t,null!==(e=i.get(t.value))&&void 0!==e?e:0)}))}</div>`}optionContent(t){return this.renderOption?this.renderOption(t):t.html?S(t.html):t.label}sampleRowSize(){var t;if(!this.isVirtual||void 0!==this.measuredRowSize)return;const e=null===(t=this.listboxEl)||void 0===t?void 0:t.querySelector(".n-virtual-row .n-option"),i=null==e?void 0:e.getBoundingClientRect().height;i&&i>0&&(this.measuredRowSize=i,this.virtualizer.getVirtualizer().measure())}renderVirtualOptions(t,e){const i=t.length,s=this.virtualizer.getVirtualizer().getTotalSize(),n=void 0!==this.measuredRowSize;return l`<div class="n-virtual-sizer" style="block-size:${s}">${g(e,(t=>t.key),(e=>l`<div class="n-virtual-row" data-index="${e.index}" style="${n?`block-size:${e.size}px; transform: translateY(${e.start}px)`:`transform: translateY(${e.start}px)`}">${this.renderListOption(t[e.index],e.index,i)}</div>`))}</div>`}renderListOption(t,e,i){const s=this.isSelected(t);return l`<div id="${this.optionId(e)}" class="${p({"n-option":!0,"is-active":e===this.activeDescendant.activeIndex,"is-disabled":Boolean(t.disabled)})}" role="option" aria-selected="${this.optionAriaSelected(s)}" aria-disabled="${t.disabled?"true":o}" aria-setsize="${m(i)}" aria-posinset="${m(void 0===i?void 0:e+1)}" @click="${()=>this.selectOption(t)}" @mousemove="${()=>this.handleOptionHover(e)}">${this.rendersCheck?l`<span class="n-option-check">${this.showCheck(s)?l`<nord-icon name="interface-checked" size="s"></nord-icon>`:o}</span>`:o} <span class="n-option-label">${this.optionContent(t)}</span></div>`}optionAriaSelected(t){return t?"true":"false"}showCheck(t){return t}get rendersCheck(){return!0}renderCreate(){return o}renderEmpty(){return this.loading?l`<div class="n-empty" role="status"><nord-spinner size="s"></nord-spinner></div>`:l`<div class="n-empty" role="status">${this.noResultsText||this.localize.term("noResults")}</div>`}optionId(t){return`${this.comboboxId}-option-${t}`}get createId(){return`${this.comboboxId}-create`}handleOptionHover(t){this.onOptionHover(),this.activeDescendant.setActiveIndex(t)}handleControlClick(){this.disabled||(!this.open&&this.openOnInputClick&&this.show(),this.focus())}handleClearClick(t){t.stopPropagation(),this.disabled||this.readonly||this.clear()}clear(){}handleToggleClick(t){t.stopPropagation(),this.disabled||this.readonly||(this.open?this.hide():this.show(),this.focus())}}st.VIRTUAL_ROW_ESTIMATE=36,st.VIRTUAL_OVERSCAN=6,st.labelCacheLimit=500,t([c("nord-popout",!0)],st.prototype,"popout",void 0),t([d({attribute:!1})],st.prototype,"options",void 0),t([d({reflect:!0})],st.prototype,"placeholder",void 0),t([d({reflect:!0,type:Boolean,attribute:"external-filtering"})],st.prototype,"externalFiltering",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"loading",void 0),t([d({reflect:!0,type:Boolean,attribute:"auto-highlight"})],st.prototype,"autoHighlight",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"invalid",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"readonly",void 0),t([d({reflect:!0,type:Boolean,attribute:"open-on-input-click"})],st.prototype,"openOnInputClick",void 0),t([d({reflect:!0,attribute:"no-results-text"})],st.prototype,"noResultsText",void 0),t([d({reflect:!0,type:Boolean})],st.prototype,"virtualized",void 0),t([d({attribute:!1})],st.prototype,"renderOption",void 0),t([u()],st.prototype,"search",void 0),t([u()],st.prototype,"queryDirty",void 0),t([c(".n-listbox")],st.prototype,"listboxEl",void 0),t([c(".n-slot-start")],st.prototype,"startSlot",void 0),t([c(".n-slot-end")],st.prototype,"endSlot",void 0),t([w("open","updated")],st.prototype,"handleOpenChange",null),t([w("disabled")],st.prototype,"handleDisabledChange",null),t([w("size")],st.prototype,"resetRowSample",null),t([w("search")],st.prototype,"resetActiveIndex",null);export{st as default,it as retagComboboxStyles};
2
2
  //# sourceMappingURL=ComboboxBase.js.map