primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 21.3 kB
JavaScript
"use strict";var e=require("primevue/api"),t=require("primevue/basecomponent"),i=require("primevue/icons/search"),s=require("primevue/ripple"),n=require("primevue/utils"),o=require("primevue/virtualscroller"),l=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(t),d=a(i),p=a(s),c=a(o),u={name:"Listbox",extends:r.default,emits:["update:modelValue","change","focus","blur","filter"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:Boolean,dataKey:null,multiple:Boolean,metaKeySelection:Boolean,filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},filterIcon:{type:String,default:void 0},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",focusOnHover:!1,data(){return{id:this.$attrs.id,filterValue:null,focused:!1,focusedOptionIndex:-1}},watch:{"$attrs.id":function(e){this.id=e||n.UniqueComponentId()},options(){this.autoUpdateModel()}},mounted(){this.id=this.id||n.UniqueComponentId(),this.autoUpdateModel()},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.optionLabel?n.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?n.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e,t){return(this.dataKey?n.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTOptions(e,t,i,s){return this.ptm(s,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled(e){return!!this.optionDisabled&&n.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},onFirstHiddenFocus(){n.DomHandler.focus(this.list);const e=n.DomHandler.getFirstFocusableElement(this.$el,":not(.p-hidden-focusable)");this.$refs.lastHiddenFocusableElement.tabIndex=n.ObjectUtils.isEmpty(e)?-1:void 0,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus(e){if(e.relatedTarget===this.list){const e=n.DomHandler.getFirstFocusableElement(this.$el,":not(.p-hidden-focusable)");n.DomHandler.focus(e),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else n.DomHandler.focus(this.$refs.firstHiddenFocusableElement);this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus(e){this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.$emit("focus",e)},onListBlur(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown(e){const t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":case"Space":this.onSpaceKey(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if(this.multiple&&"KeyA"===e.code&&t){const t=this.visibleOptions.filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(e,t),e.preventDefault();break}!t&&n.ObjectUtils.isPrintableCharacter(e.key)&&(this.searchOptions(e,e.key),e.preventDefault())}},onOptionSelect(e,t,i=-1){this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseDown(e,t){this.changeFocusedOptionIndex(e,t)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle(e,t){let i=this.isSelected(t),s=!1,n=null;if(!this.optionTouched&&this.metaKeySelection){let o=e.metaKey||e.ctrlKey;i?o&&(n=null,s=!0):(n=this.getOptionValue(t),s=!0)}else n=i?null:this.getOptionValue(t),s=!0;s&&this.updateModel(e,n)},onOptionSelectMultiple(e,t){let i=this.isSelected(t),s=null;if(!this.optionTouched&&this.metaKeySelection){let n=e.metaKey||e.ctrlKey;i?s=n?this.removeOption(t):[this.getOptionValue(t)]:(s=n&&this.modelValue||[],s=[...s,this.getOptionValue(t)])}else s=i?this.removeOption(t):[...this.modelValue||[],this.getOptionValue(t)];this.updateModel(e,s)},onOptionSelectRange(e,t=-1,i=-1){if(-1===t&&(t=this.findNearestSelectedOptionIndex(i,!0)),-1===i&&(i=this.findNearestSelectedOptionIndex(t)),-1!==t&&-1!==i){const s=Math.min(t,i),n=Math.max(t,i),o=this.visibleOptions.slice(s,n+1).filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(e,o)}},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey(e){const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey(e,t=!1){t&&(this.focusedOptionIndex=-1)},onHomeKey(e,t=!1){if(t)e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{let t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey(e,t=!1){if(t){const t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{let t=e.metaKey||e.ctrlKey,i=this.findLastOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,this.startRangeIndex,i),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey(e){this.onEnterKey(e)},onShiftKey(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){const t=this.getOptionValue(e);return this.multiple?(this.modelValue||[]).some((e=>n.ObjectUtils.equals(e,t,this.equalityKey))):n.ObjectUtils.equals(this.modelValue,t,this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return n.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findFirstSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findLastSelectedOptionIndex(){return this.hasSelectedOption?n.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidSelectedOption(e))):-1},findNextSelectedOptionIndex(e){const t=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidSelectedOption(e))):-1;return t>-1?t+e+1:-1},findPrevSelectedOptionIndex(e){const t=this.hasSelectedOption&&e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidSelectedOption(e))):-1;return t>-1?t:-1},findNearestSelectedOptionIndex(e,t=!1){let i=-1;return this.hasSelectedOption&&(t?(i=this.findPrevSelectedOptionIndex(e),i=-1===i?this.findNextSelectedOptionIndex(e):i):(i=this.findNextSelectedOptionIndex(e),i=-1===i?this.findPrevSelectedOptionIndex(e):i)),i>-1?i:e},findFirstFocusedOptionIndex(){const e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions(e,t){this.searchValue=(this.searchValue||"")+t;let i=-1;-1!==this.focusedOptionIndex?(i=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))),i=-1===i?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))):i+this.focusedOptionIndex):i=this.visibleOptions.findIndex((e=>this.isOptionMatched(e))),-1===i&&-1===this.focusedOptionIndex&&(i=this.findFirstFocusedOptionIndex()),-1!==i&&this.changeFocusedOptionIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500)},removeOption(e){return this.modelValue.filter((t=>!n.ObjectUtils.equals(t,this.getOptionValue(e),this.equalityKey)))},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.onOptionSelect(e,this.visibleOptions[t]))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=n.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)},autoUpdateModel(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&!this.multiple&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex]))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const s=this.getOptionGroupChildren(t);return s&&s.forEach((t=>e.push(t))),e}),[])},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-listbox p-component",{"p-focus":this.focused,"p-disabled":this.disabled}]},visibleOptions(){const t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):t},hasSelectedOption(){return n.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},filterResultMessageText(){return n.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:p.default},components:{VirtualScroller:c.default,SearchIcon:d.default}};const h=["id"],f=["tabindex"],O=["placeholder","aria-owns","aria-activedescendant","tabindex"],m=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],b=["id"],g=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousedown","onMousemove"],x=["tabindex"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-listbox-list-wrapper {\n overflow: auto;\n}\n.p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n}\n.p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.p-listbox-item-group {\n cursor: auto;\n}\n.p-listbox-filter-container {\n position: relative;\n}\n.p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-listbox-filter {\n width: 100%;\n}\n"),u.render=function(e,t,i,s,n,o){const a=l.resolveComponent("VirtualScroller"),r=l.resolveDirective("ripple");return l.openBlock(),l.createElementBlock("div",l.mergeProps({id:n.id,class:o.containerClass,onFocusout:t[10]||(t[10]=(...e)=>o.onFocusout&&o.onFocusout(...e))},e.ptm("root")),[l.createElementVNode("span",l.mergeProps({ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:i.disabled?-1:i.tabindex,onFocus:t[0]||(t[0]=(...e)=>o.onFirstHiddenFocus&&o.onFirstHiddenFocus(...e))},e.ptm("hiddenFirstFocusableEl")),null,16,f),l.renderSlot(e.$slots,"header",{value:i.modelValue,options:o.visibleOptions}),i.filter?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:"p-listbox-header"},e.ptm("header")),[l.createElementVNode("div",l.mergeProps({class:"p-listbox-filter-container"},e.ptm("filterContainer")),[l.withDirectives(l.createElementVNode("input",l.mergeProps({ref:"filterInput","onUpdate:modelValue":t[1]||(t[1]=e=>n.filterValue=e),type:"text",class:"p-listbox-filter p-inputtext p-component",placeholder:i.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":n.id+"_list","aria-activedescendant":o.focusedOptionId,tabindex:i.disabled||n.focused?-1:i.tabindex,onInput:t[2]||(t[2]=(...e)=>o.onFilterChange&&o.onFilterChange(...e)),onBlur:t[3]||(t[3]=(...e)=>o.onFilterBlur&&o.onFilterBlur(...e)),onKeydown:t[4]||(t[4]=(...e)=>o.onFilterKeyDown&&o.onFilterKeyDown(...e))},{...i.filterInputProps,...e.ptm("filterInput")}),null,16,O),[[l.vModelText,n.filterValue]]),l.renderSlot(e.$slots,"filtericon",{},(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(i.filterIcon?"span":"SearchIcon"),l.mergeProps({class:["p-listbox-filter-icon",i.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]))],16),l.createElementVNode("span",l.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult")),l.toDisplayString(o.filterResultMessageText),17)],16)):l.createCommentVNode("",!0),l.createElementVNode("div",l.mergeProps({ref:"listWrapper",class:"p-listbox-list-wrapper",style:i.listStyle},e.ptm("wrapper")),[l.createVNode(a,l.mergeProps({ref:o.virtualScrollerRef},{...i.virtualScrollerOptions,...e.ptm("virtualScroller")},{style:i.listStyle,items:o.visibleOptions,tabindex:-1,disabled:o.virtualScrollerDisabled}),l.createSlots({content:l.withCtx((({styleClass:s,contentRef:a,items:d,getItemOptions:p,contentStyle:c,itemSize:u})=>[l.createElementVNode("ul",l.mergeProps({ref:e=>o.listRef(e,a),id:n.id+"_list",class:["p-listbox-list",s],style:c,tabindex:-1,role:"listbox","aria-multiselectable":i.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":n.focused?o.focusedOptionId:void 0,"aria-disabled":i.disabled,onFocus:t[6]||(t[6]=(...e)=>o.onListFocus&&o.onListFocus(...e)),onBlur:t[7]||(t[7]=(...e)=>o.onListBlur&&o.onListBlur(...e)),onKeydown:t[8]||(t[8]=(...e)=>o.onListKeyDown&&o.onListKeyDown(...e))},e.ptm("list")),[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(d,((i,s)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:o.getOptionRenderKey(i,o.getOptionIndex(s,p))},[o.isOptionGroup(i)?(l.openBlock(),l.createElementBlock("li",l.mergeProps({key:0,id:n.id+"_"+o.getOptionIndex(s,p),style:{height:u?u+"px":void 0},class:"p-listbox-item-group",role:"option"},e.ptm("itemGroup")),[l.renderSlot(e.$slots,"optiongroup",{option:i.optionGroup,index:o.getOptionIndex(s,p)},(()=>[l.createTextVNode(l.toDisplayString(o.getOptionGroupLabel(i.optionGroup)),1)]))],16,b)):l.withDirectives((l.openBlock(),l.createElementBlock("li",l.mergeProps({key:1,id:n.id+"_"+o.getOptionIndex(s,p),style:{height:u?u+"px":void 0},class:["p-listbox-item",{"p-highlight":o.isSelected(i),"p-focus":n.focusedOptionIndex===o.getOptionIndex(s,p),"p-disabled":o.isOptionDisabled(i)}],role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i),"aria-disabled":o.isOptionDisabled(i),"aria-setsize":o.ariaSetSize,"aria-posinset":o.getAriaPosInset(o.getOptionIndex(s,p)),onClick:e=>o.onOptionSelect(e,i,o.getOptionIndex(s,p)),onMousedown:e=>o.onOptionMouseDown(e,o.getOptionIndex(s,p)),onMousemove:e=>o.onOptionMouseMove(e,o.getOptionIndex(s,p)),onTouchend:t[5]||(t[5]=e=>o.onOptionTouchEnd())},o.getPTOptions(i,p,s,"item")),[l.renderSlot(e.$slots,"option",{option:i,index:o.getOptionIndex(s,p)},(()=>[l.createTextVNode(l.toDisplayString(o.getOptionLabel(i)),1)]))],16,g)),[[r]])],64)))),128)),n.filterValue&&(!d||d&&0===d.length)?(l.openBlock(),l.createElementBlock("li",l.mergeProps({key:0,class:"p-listbox-empty-message",role:"option"},e.ptm("emptyMessage")),[l.renderSlot(e.$slots,"emptyfilter",{},(()=>[l.createTextVNode(l.toDisplayString(o.emptyFilterMessageText),1)]))],16)):!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("li",l.mergeProps({key:1,class:"p-listbox-empty-message",role:"option"},e.ptm("emptyMessage")),[l.renderSlot(e.$slots,"empty",{},(()=>[l.createTextVNode(l.toDisplayString(o.emptyMessageText),1)]))],16)):l.createCommentVNode("",!0)],16,m)])),_:2},[e.$slots.loader?{name:"loader",fn:l.withCtx((({options:t})=>[l.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"])],16),l.renderSlot(e.$slots,"footer",{value:i.modelValue,options:o.visibleOptions}),!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("emptyMessage")),l.toDisplayString(o.emptyMessageText),17)):l.createCommentVNode("",!0),l.createElementVNode("span",l.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage")),l.toDisplayString(o.selectedMessageText),17),l.createElementVNode("span",l.mergeProps({ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:i.disabled?-1:i.tabindex,onFocus:t[9]||(t[9]=(...e)=>o.onLastHiddenFocus&&o.onLastHiddenFocus(...e))},e.ptm("hiddenLastFocusableEl")),null,16,x)],16,h)},module.exports=u;