!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit"),require("lit/decorators.js"),require("@lit-labs/virtualizer"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js","@lit-labs/virtualizer"],t);else{var i="object"==typeof exports?t(require("lit"),require("lit/decorators.js"),require("@lit-labs/virtualizer")):t(e.lit,e["lit/decorators.js"],e["@lit-labs/virtualizer"]);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(e,t,i)=>(()=>{"use strict";var s,r={9236(e,t,i){i.r(t),i.d(t,{AdvanceList:()=>s});var s,r=i(2900),l=i(9609),a=i(3203),d=i(4084),o=(i(3048),i(7161)),n=i(429),h=i(3013),c=function(e,t,i,s){var r,l=arguments.length,a=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var d=e.length-1;d>=0;d--)(r=e[d])&&(a=(l<3?r(a):l>3?r(t,i,a):r(t,i))||a);return l>3&&a&&Object.defineProperty(t,i,a),a};!function(e){e.prefixId="item-";let t=class extends((0,a.y)(o.LitElement)){constructor(){super(...arguments),this.items=[],this.isLoading=!1,this.isMulti=!1,this.groupOnMultiSelect=!1,this.value=[],this.ariaRoleList="listbox",this.ariaRoleListItem="option",this.ariaLabelList="",this.isError=!1,this.containerHeight="292px",this.lastSelectedIdByOrder="",this.selectAllItems=!1,this.focusReset=!1,this.disabledItems=[],this.totalRecords=0,this.isNonSelectable=!1,this.scrollIndex=-1,this.activeId="",this.selectedItemsIds=[],this.isUserNavigated=!1,this.handleKeyDown=t=>{var i,s,l;const{ArrowDown:a,ArrowUp:d,Tab:o,Space:n,Enter:h}=r.Uz,{code:c}=t,p=c===a,u=c===d,v=c===o,m=c===n,b=c===h;if(p||u){if(t.preventDefault(),this.isUserNavigated=!0,""===this.activeId&&this.value.length>0&&""!==this.value[0])return void(this.activeId=this.value[0]);if(""===this.activeId&&!u&&this.items.length>0)return void(this.activeId=this.items[0].id);const e=this.items.findIndex(e=>e.id===this.activeId);p?e<this.items.length-1&&!this.isNextElemenentStatusIndicator(e)&&(this.scrollIndex=e+1,this.activeId=this.items[this.scrollIndex].id,null===(i=this.virtualizer)||void 0===i||i.scrollToIndex(this.scrollIndex,"start")):e>0&&(this.scrollIndex=e-1,this.activeId=this.items[this.scrollIndex].id,null===(s=this.virtualizer)||void 0===s||s.scrollToIndex(this.scrollIndex,"start"))}else if(v)""===this.activeId&&this.value.length>0&&(this.activeId=this.value[0]);else if((m||b)&&(t.preventDefault(),this.activeId)){const t=null===(l=this.shadowRoot)||void 0===l?void 0:l.querySelector(`#${e.prefixId}${this.activeId}`);t&&("true"===t.getAttribute("aria-disabled")||t.hasAttribute("disabled")||this.updateItemSelection(t))}},this.handleRangeChange=e=>{const{last:t}=e;this.updateSelectedState(),this.items.length<this.totalRecords&&t>=this.items.length-1&&!this.isLoading&&!this.isError&&this.dispatchEvent(new CustomEvent("load-more",{bubbles:!0,composed:!0})),this.isUserNavigated=!1},this.renderItem=(t,i)=>{if(!t)return o.html`<div class="default-wrapper-error">Invalid item</div>`;if(!t.id)return console.warn(`AdvanceList.renderItem: item missing id at index ${i}`,t),o.html`<div class="default-wrapper-error">Item missing ID</div>`;try{return"status-indicator"===t.id?o.html`
            <div class="default-wrapper-status-indicator" id="status-indicator">${t.template(t,i)}</div>
          `:o.html`
          <div
            class="default-wrapper ${t.id} ${this.isNonSelectable?"non-selectable":""}"
            part="advance-list-item-wrapper"
            aria-setsize="${this.totalRecords}"
            aria-posinset="${i+1}"
            role="${this.ariaRoleListItem}"
            aria-label=${t.name||"Unknown item"}
            id="${e.prefixId}${t.id}"
            data-index="${i}"
          >
            ${t.template(t,i)}
          </div>
        `}catch(e){return console.error(`AdvanceList.renderItem: Error rendering item ${t.id} at index ${i}:`,e,t),o.html`<div class="default-wrapper-error">Error rendering item</div>`}}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick)}static get styles(){return[d.A,h.A]}getStyles(){return o.html`
        <style>
          :host .virtual-scroll {
            height: ${this.containerHeight};
          }
        </style>
      `}disconnectedCallback(){var e;super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),null===(e=this.listContainer)||void 0===e||e.removeEventListener("keydown",this.handleKeyDown)}firstUpdated(e){var t;super.firstUpdated(e),null===(t=this.listContainer)||void 0===t||t.addEventListener("keydown",this.handleKeyDown)}willUpdate(e){var t;null===(t=super.willUpdate)||void 0===t||t.call(this,e),e.has("value")&&(void 0!==e.get("value")||this.value.length>0)&&(this.selectedItemsIds=this.value),e.has("selectAllItems")&&this.selectAllItems&&(this.selectedItemsIds=this.items.filter(e=>e&&e.id&&!this.disabledItems.includes(e.id)).map(e=>e.id)),e.has("focusReset")&&this.focusReset&&(this.activeId="")}updated(e){super.updated(e),e.has("value")&&(void 0!==e.get("value")||this.value.length>0)&&requestAnimationFrame(()=>this.updateSelectedState()),e.has("selectAllItems")&&this.selectAllItems&&(this.updateSelectedState(),this.notifySelectedChange()),e.has("activeId")&&this.isUserNavigated&&requestAnimationFrame(()=>this.updateSelectedState())}setCheckboxAttributes(e,t){var i,s,r,l;!e||(null===(i=t.firstElementChild)||void 0===i?void 0:i.hasAttribute("disabled"))&&"true"===(null===(s=t.firstElementChild)||void 0===s?void 0:s.getAttribute("aria-disabled"))?null===(l=t.querySelector("md-checkbox"))||void 0===l||l.removeAttribute("checked"):null===(r=t.querySelector("md-checkbox"))||void 0===r||r.setAttribute("checked","true")}updateWrapperAttributes(e,t){this.isMulti?this.setCheckboxAttributes(t,e):e.classList.toggle("selected",t),e.setAttribute("selected",t.toString()),e.setAttribute("aria-selected",t.toString()),e.setAttribute("tabindex",t?"0":"-1")}updateSelectedState(){var t;Array.from((null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelectorAll(".default-wrapper"))||[]).forEach(t=>{var i,s;const r=this.selectedItemsIds.some(i=>t.id===`${e.prefixId}${i}`);this.updateWrapperAttributes(t,r),this.groupOnMultiSelect&&this.value.length>0&&this.items.length!==this.value.length&&t.id===`${e.prefixId}${this.lastSelectedIdByOrder}`?t.classList.add("selected-border-bottom"):t.classList.remove("selected-border-bottom"),t.id===`${e.prefixId}${this.activeId}`?(t.setAttribute("tabindex","0"),this.isUserNavigated&&t.focus()):t.setAttribute("tabindex","-1"),""==this.activeId&&t.id===`${e.prefixId}${this.value[0]}`&&t.setAttribute("tabindex","0"),(null===(i=t.firstElementChild)||void 0===i?void 0:i.hasAttribute("disabled"))||"true"===(null===(s=t.firstElementChild)||void 0===s?void 0:s.getAttribute("aria-disabled"))?(t.setAttribute("disabled",""),t.setAttribute("aria-disabled","true")):(t.removeAttribute("disabled"),t.removeAttribute("aria-disabled"))})}findClickedItem(e){var t;const i=Array.from((null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelectorAll(".default-wrapper"))||[]),s=e.composedPath(),r=i.find(e=>s.includes(e));if(r)return(null==r?void 0:r.hasAttribute("disabled"))||"true"===(null==r?void 0:r.getAttribute("aria-disabled"))?0:r}isNextElemenentStatusIndicator(e){return(this.isLoading||this.isError)&&e===this.items.length-2}updateItemForMultiSelect(e){const t=this.selectedItemsIds.indexOf(e);-1===t?(this.selectedItemsIds.push(this.activeId),this.selectedItemsIds.length===this.items.length-this.disabledItems.length&&(this.selectAllItems=!0)):(this.selectedItemsIds.splice(t,1),this.selectAllItems=!1)}updateItemSelection(e){e&&(this.activeId=e.id.substring(e.id.indexOf("-")+1),this.isMulti?this.updateItemForMultiSelect(this.activeId):this.selectedItemsIds=[this.activeId],this.updateSelectedState(),this.notifySelectedChange())}handleClick(e){e.preventDefault(),this.isUserNavigated=!1;const t=this.findClickedItem(e);t&&(this.scrollIndex=parseInt(t.getAttribute("index")||"0"),this.updateItemSelection(t))}notifySelectedChange(){this.dispatchEvent(new CustomEvent("list-item-change",{detail:{selected:this.selectedItemsIds},bubbles:!0,composed:!0}))}getActiveDescendant(){return this.activeId?`${e.prefixId}${this.activeId}`:this.value&&this.value.length>0&&this.value[0]?`${e.prefixId}${this.value[0]}`:""}render(){return o.html`
        ${this.getStyles()}
        <div
          class="md-advance-list-wrapper virtual-scroll"
          tabindex="0"
          aria-activedescendant=${this.getActiveDescendant()}
          aria-multiselectable=${this.isMulti}
          aria-label=${this.ariaLabelList}
          role=${this.ariaRoleList}
        >
          <lit-virtualizer
            .items=${this.items}
            .renderItem=${(e,t)=>this.renderItem(e,t)}
            @rangeChanged=${this.handleRangeChange}
          ></lit-virtualizer>
        </div>
      `}};c([(0,n.property)({type:Array})],t.prototype,"items",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"isLoading",void 0),c([(0,n.property)({type:Boolean,attribute:"is-multi"})],t.prototype,"isMulti",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"groupOnMultiSelect",void 0),c([(0,n.property)({type:Array})],t.prototype,"value",void 0),c([(0,n.property)({type:String})],t.prototype,"ariaRoleList",void 0),c([(0,n.property)({type:String})],t.prototype,"ariaRoleListItem",void 0),c([(0,n.property)({type:String})],t.prototype,"ariaLabelList",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"isError",void 0),c([(0,n.property)({type:String})],t.prototype,"containerHeight",void 0),c([(0,n.property)({type:String})],t.prototype,"lastSelectedIdByOrder",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"selectAllItems",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"focusReset",void 0),c([(0,n.property)({type:Array})],t.prototype,"disabledItems",void 0),c([(0,n.property)({type:Number})],t.prototype,"totalRecords",void 0),c([(0,n.property)({type:Boolean})],t.prototype,"isNonSelectable",void 0),c([(0,n.query)(".virtual-scroll")],t.prototype,"listContainer",void 0),c([(0,n.query)("lit-virtualizer")],t.prototype,"virtualizer",void 0),c([(0,n.state)()],t.prototype,"scrollIndex",void 0),c([(0,n.state)()],t.prototype,"activeId",void 0),c([(0,n.state)()],t.prototype,"selectedItemsIds",void 0),c([(0,n.state)()],t.prototype,"isUserNavigated",void 0),t=c([(0,l.w)("md-advance-list")],t),e.ELEMENT=t}(s||(s={}))},3048(e){e.exports=i},7161(t){t.exports=e},429(e){e.exports=t}},l={};function a(e){var t=l[e];if(void 0!==t)return t.exports;var i=l[e]={exports:{}};return r[e](i,i.exports,a),i.exports}a.m=r,s=[],a.O=(e,t,i,r)=>{if(!t){var l=1/0;for(h=0;h<s.length;h++){for(var[t,i,r]=s[h],d=!0,o=0;o<t.length;o++)(!1&r||l>=r)&&Object.keys(a.O).every(e=>a.O[e](t[o]))?t.splice(o--,1):(d=!1,r<l&&(l=r));if(d){s.splice(h--,1);var n=i();void 0!==n&&(e=n)}}return e}r=r||0;for(var h=s.length;h>0&&s[h-1][2]>r;h--)s[h]=s[h-1];s[h]=[t,i,r]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={3079:0};a.O.j=t=>0===e[t];var t=(t,i)=>{var s,r,[l,d,o]=i,n=0;if(l.some(t=>0!==e[t])){for(s in d)a.o(d,s)&&(a.m[s]=d[s]);if(o)var h=o(a)}for(t&&t(i);n<l.length;n++)r=l[n],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return a.O(h)},i=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var d=a.O(void 0,[9609,4084,519,8441,9983,3013],()=>a(9236));return a.O(d)})());