primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 36.5 kB
JavaScript
this.primevue=this.primevue||{},this.primevue.multiselect=function(e,t,i,l,s,n,o,r,a,c,d,p,h,u){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(t),g=m(i),b=m(l),y=m(s),v=m(n),O=m(o),x=m(r),k=m(a),I=m(c),S=m(d),V=m(h),C={name:"MultiSelect",extends:f.default,emits:["update:modelValue","change","focus","blur","before-show","before-hide","show","hide","filter","selectall-change"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},placeholder:String,disabled:Boolean,inputId:{type:String,default:null},inputProps:{type:null,default:null},panelClass:{type:String,default:null},panelStyle:{type:null,default:null},panelProps:{type:null,default:null},filterInputProps:{type:null,default:null},closeButtonProps:{type:null,default:null},dataKey:null,filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},appendTo:{type:String,default:"body"},display:{type:String,default:"comma"},selectedItemsLabel:{type:String,default:"{0} items selected"},maxSelectedLabels:{type:Number,default:null},selectionLimit:{type:Number,default:null},showToggleAll:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},checkboxIcon:{type:String,default:void 0},closeIcon:{type:String,default:void 0},dropdownIcon:{type:String,default:void 0},filterIcon:{type:String,default:void 0},loadingIcon:{type:String,default:void 0},removeTokenIcon:{type:String,default:void 0},selectAll:{type:Boolean,default:null},resetFilterOnHide:{type:Boolean,default:!1},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},autoFilterFocus:{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},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,scrollHandler:null,resizeListener:null,overlay:null,list:null,virtualScroller:null,startRangeIndex:-1,searchTimeout:null,searchValue:"",selectOnFocus:!1,focusOnHover:!1,data(){return{id:this.$attrs.id,focused:!1,focusedOptionIndex:-1,headerCheckboxFocused:!1,filterValue:null,overlayVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||p.UniqueComponentId()},options(){this.autoUpdateModel()}},mounted(){this.id=this.id||p.UniqueComponentId(),this.autoUpdateModel()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(p.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.optionLabel?p.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?p.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e){return this.dataKey?p.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e)},getHeaderCheckboxPTOptions(e){return this.ptm(e,{context:{selected:this.allSelected,focused:this.headerCheckboxFocused}})},getCheckboxPTOptions(e,t,i,l){return this.ptm(l,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled(e){return!(!this.maxSelectionLimitReached||this.isSelected(e))||!!this.optionDisabled&&p.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return p.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return p.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&p.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.overlayVisible=!1,this.focusedOptionIndex=-1,this.searchValue="",this.resetFilterOnHide&&(this.filterValue=null),e&&p.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){this.disabled||(this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur(e){this.focused=!1,this.focusedOptionIndex=-1,this.searchValue="",this.$emit("blur",e)},onKeyDown(e){if(this.disabled)return void e.preventDefault();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.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if("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&&p.ObjectUtils.isPrintableCharacter(e.key)&&(!this.overlayVisible&&this.show(),this.searchOptions(e),e.preventDefault())}},onContainerClick(e){this.disabled||this.loading||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide(!0):this.show(!0))},onFirstHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?p.DomHandler.getFirstFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;p.DomHandler.focus(t)},onLastHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?p.DomHandler.getLastFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;p.DomHandler.focus(t)},onCloseClick(){this.hide(!0)},onHeaderCheckboxFocus(){this.headerCheckboxFocused=!0},onHeaderCheckboxBlur(){this.headerCheckboxFocused=!1},onOptionSelect(e,t,i=-1,l=!1){if(this.disabled||this.isOptionDisabled(t))return;let s=null;s=this.isSelected(t)?this.modelValue.filter((e=>!p.ObjectUtils.equals(e,this.getOptionValue(t),this.equalityKey))):[...this.modelValue||[],this.getOptionValue(t)],this.updateModel(e,s),-1!==i&&(this.focusedOptionIndex=i),l&&p.DomHandler.focus(this.$refs.focusInput)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},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 l=Math.min(t,i),s=Math.max(t,i),n=this.visibleOptions.slice(l,s+1).filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(e,n)}},onFilterChange(e){const t=e.target.value;this.filterValue=t,this.focusedOptionIndex=-1,this.$emit("filter",{originalEvent:e,value:t}),!this.virtualScrollerDisabled&&this.virtualScroller.scrollToIndex(0)},onFilterKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,!0);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"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e,!0)}},onFilterBlur(){this.focusedOptionIndex=-1},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},onOverlayClick(e){k.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()},onArrowUpKey(e,t=!1){if(e.altKey&&!t)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()}},onArrowLeftKey(e,t=!1){t&&(this.focusedOptionIndex=-1)},onHomeKey(e,t=!1){const{currentTarget:i}=e;if(t){const t=i.value.length;i.setSelectionRange(0,e.shiftKey?t:0),this.focusedOptionIndex=-1}else{let t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i),!this.overlayVisible&&this.show()}e.preventDefault()},onEndKey(e,t=!1){const{currentTarget:i}=e;if(t){const t=i.value.length;i.setSelectionRange(e.shiftKey?0:t,t),this.focusedOptionIndex=-1}else{let t=e.metaKey||e.ctrlKey,i=this.findLastOptionIndex();e.shiftKey&&t&&this.onOptionSelectRange(e,this.startRangeIndex,i),this.changeFocusedOptionIndex(e,i),!this.overlayVisible&&this.show()}e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?-1!==this.focusedOptionIndex&&(e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e,t=!1){t||(this.overlayVisible&&this.hasFocusableElements()?(p.DomHandler.focus(e.shiftKey?this.$refs.lastHiddenFocusableElementOnOverlay:this.$refs.firstHiddenFocusableElementOnOverlay),e.preventDefault()):(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(this.filter)))},onShiftKey(){this.startRangeIndex=this.focusedOptionIndex},onOverlayEnter(e){p.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.scrollInView(),this.autoFilterFocus&&p.DomHandler.focus(this.$refs.filterInput)},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){p.ZIndexUtils.clear(e)},alignOverlay(){"self"===this.appendTo?p.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=p.DomHandler.getOuterWidth(this.$el)+"px",p.DomHandler.absolutePosition(this.overlay,this.$el))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new p.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!p.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!(this.$el.isSameNode(e.target)||this.$el.contains(e.target)||this.overlay&&this.overlay.contains(e.target))},getLabelByValue(e){const t=(this.optionGroupLabel?this.flatOptions(this.options):this.options||[]).find((t=>!this.isOptionGroup(t)&&p.ObjectUtils.equals(this.getOptionValue(t),e,this.equalityKey)));return t?this.getOptionLabel(t):null},getSelectedItemsLabel(){let e=/{(.*?)}/;return e.test(this.selectedItemsLabel)?this.selectedItemsLabel.replace(this.selectedItemsLabel.match(e)[0],this.modelValue.length+""):this.selectedItemsLabel},onToggleAll(e){if(null!==this.selectAll)this.$emit("selectall-change",{originalEvent:e,checked:!this.allSelected});else{const t=this.allSelected?[]:this.visibleOptions.filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(e,t)}this.headerCheckboxFocused=!0},removeOption(e,t){let i=this.modelValue.filter((e=>!p.ObjectUtils.equals(e,t,this.equalityKey)));this.updateModel(e,i)},clearFilter(){this.filterValue=null},hasFocusableElements(){return p.DomHandler.getFocusableElements(this.overlay,":not(.p-hidden-focusable)").length>0},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.modelValue||[]).some((e=>p.ObjectUtils.equals(e,t,this.equalityKey)))},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return p.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?p.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?p.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?p.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){this.searchValue=(this.searchValue||"")+e.key;let t=-1;-1!==this.focusedOptionIndex?(t=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))),t=-1===t?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))):t+this.focusedOptionIndex):t=this.visibleOptions.findIndex((e=>this.isOptionMatched(e))),-1===t&&-1===this.focusedOptionIndex&&(t=this.findFirstFocusedOptionIndex()),-1!==t&&this.changeFocusedOptionIndex(e,t),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView())},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=p.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(){if(this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption){this.focusedOptionIndex=this.findFirstFocusedOptionIndex();const e=this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]);this.updateModel(null,[e])}},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 l=this.getOptionGroupChildren(t);return l&&l.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-multiselect p-component p-inputwrapper",{"p-multiselect-chip":"chip"===this.display,"p-disabled":this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue&&this.modelValue.length,"p-inputwrapper-focus":this.focused||this.overlayVisible,"p-overlay-open":this.overlayVisible}]},labelClass(){return["p-multiselect-label",{"p-placeholder":this.label===this.placeholder,"p-multiselect-label-empty":!(this.placeholder||this.modelValue&&0!==this.modelValue.length)}]},panelStyleClass(){return["p-multiselect-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},headerCheckboxClass(){return["p-checkbox p-component",{"p-checkbox-checked":this.allSelected,"p-checkbox-focused":this.headerCheckboxFocused}]},visibleOptions(){const t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){const i=e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){const e=this.options||[],t=[];return e.forEach((e=>{const l=this.getOptionGroupChildren(e).filter((e=>i.includes(e)));l.length>0&&t.push({...e,["string"==typeof this.optionGroupChildren?this.optionGroupChildren:"items"]:[...l]})})),this.flatOptions(t)}return i}return t},label(){let e;if(this.modelValue&&this.modelValue.length){if(p.ObjectUtils.isNotEmpty(this.maxSelectedLabels)&&this.modelValue.length>this.maxSelectedLabels)return this.getSelectedItemsLabel();e="";for(let t=0;t<this.modelValue.length;t++)0!==t&&(e+=", "),e+=this.getLabelByValue(this.modelValue[t])}else e=this.placeholder;return e},chipSelectedItems(){return p.ObjectUtils.isNotEmpty(this.maxSelectedLabels)&&this.modelValue&&this.modelValue.length>this.maxSelectedLabels?this.modelValue.slice(0,this.maxSelectedLabels):this.modelValue},allSelected(){return null!==this.selectAll?this.selectAll:p.ObjectUtils.isNotEmpty(this.visibleOptions)&&this.visibleOptions.every((e=>this.isOptionGroup(e)||this.isOptionDisabled(e)||this.isSelected(e)))},hasSelectedOption(){return p.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},maxSelectionLimitReached(){return this.selectionLimit&&this.modelValue&&this.modelValue.length===this.selectionLimit},filterResultMessageText(){return p.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.modelValue.length):this.emptySelectionMessageText},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},toggleAllAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria[this.allSelected?"selectAll":"unselectAll"]:void 0},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:S.default},components:{VirtualScroller:V.default,Portal:I.default,TimesIcon:O.default,SearchIcon:y.default,TimesCircleIcon:x.default,ChevronDownIcon:b.default,SpinnerIcon:v.default,CheckIcon:g.default}};const L=["id","disabled","placeholder","tabindex","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],F=["onClick"],w=["checked","aria-label"],E=["value","placeholder","aria-owns","aria-activedescendant"],D=["aria-label"],B=["id"],P=["id"],T=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"];return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-multiselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n}\n.p-multiselect-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n.p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n.p-multiselect-label {\n display: block;\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n.p-multiselect-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n}\n.p-multiselect-token-icon {\n cursor: pointer;\n}\n.p-multiselect .p-multiselect-panel {\n min-width: 100%;\n}\n.p-multiselect-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-multiselect-items-wrapper {\n overflow: auto;\n}\n.p-multiselect-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-multiselect-item {\n cursor: pointer;\n display: flex;\n align-items: center;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-multiselect-item-group {\n cursor: auto;\n}\n.p-multiselect-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n.p-multiselect-filter-container {\n position: relative;\n flex: 1 1 auto;\n}\n.p-multiselect-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-multiselect-filter-container .p-inputtext {\n width: 100%;\n}\n.p-multiselect-close {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n position: relative;\n margin-left: auto;\n}\n.p-fluid .p-multiselect {\n display: flex;\n}\n"),C.render=function(e,t,i,l,s,n){const o=u.resolveComponent("TimesCircleIcon"),r=u.resolveComponent("SpinnerIcon"),a=u.resolveComponent("VirtualScroller"),c=u.resolveComponent("Portal"),d=u.resolveDirective("ripple");return u.openBlock(),u.createElementBlock("div",u.mergeProps({ref:"container",class:n.containerClass,onClick:t[15]||(t[15]=(...e)=>n.onContainerClick&&n.onContainerClick(...e))},e.ptm("root")),[u.createElementVNode("div",u.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenInputWrapper")),[u.createElementVNode("input",u.mergeProps({ref:"focusInput",id:i.inputId,type:"text",readonly:"",disabled:i.disabled,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":s.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":s.focused?n.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>n.onFocus&&n.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>n.onBlur&&n.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>n.onKeyDown&&n.onKeyDown(...e))},{...i.inputProps,...e.ptm("input")}),null,16,L)],16),u.createElementVNode("div",u.mergeProps({class:"p-multiselect-label-container"},e.ptm("labelContainer")),[u.createElementVNode("div",u.mergeProps({class:n.labelClass},e.ptm("label")),[u.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>["comma"===i.display?(u.openBlock(),u.createElementBlock(u.Fragment,{key:0},[u.createTextVNode(u.toDisplayString(n.label||"empty"),1)],64)):"chip"===i.display?(u.openBlock(),u.createElementBlock(u.Fragment,{key:1},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(n.chipSelectedItems,(t=>(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:n.getLabelByValue(t),class:"p-multiselect-token"},e.ptm("token")),[u.renderSlot(e.$slots,"chip",{value:t},(()=>[u.createElementVNode("span",u.mergeProps({class:"p-multiselect-token-label"},e.ptm("tokenLabel")),u.toDisplayString(n.getLabelByValue(t)),17)])),i.disabled?u.createCommentVNode("",!0):u.renderSlot(e.$slots,"removetokenicon",{key:0,class:"p-multiselect-token-icon",onClick:e=>n.removeOption(e,t)},(()=>[i.removeTokenIcon?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:0,class:["p-multiselect-token-icon",i.removeTokenIcon],onClick:u.withModifiers((e=>n.removeOption(e,t)),["stop"])},e.ptm("removeTokenIcon")),null,16,F)):(u.openBlock(),u.createBlock(o,u.mergeProps({key:1,class:"p-multiselect-token-icon",onClick:u.withModifiers((e=>n.removeOption(e,t)),["stop"])},e.ptm("removeTokenIcon")),null,16,["onClick"]))]))],16)))),128)),i.modelValue&&0!==i.modelValue.length?u.createCommentVNode("",!0):(u.openBlock(),u.createElementBlock(u.Fragment,{key:0},[u.createTextVNode(u.toDisplayString(i.placeholder||"empty"),1)],64))],64)):u.createCommentVNode("",!0)]))],16)],16),u.createElementVNode("div",u.mergeProps({class:"p-multiselect-trigger"},e.ptm("trigger")),[i.loading?u.renderSlot(e.$slots,"loadingicon",{key:0,class:"p-multiselect-trigger-icon"},(()=>[i.loadingIcon?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:0,class:["p-multiselect-trigger-icon pi-spin",i.loadingIcon],"aria-hidden":"true"},e.ptm("triggerIcon")),null,16)):(u.openBlock(),u.createBlock(r,u.mergeProps({key:1,class:"p-multiselect-trigger-icon",spin:"","aria-hidden":"true"},e.ptm("triggerIcon")),null,16))])):u.renderSlot(e.$slots,"dropdownicon",{key:1,class:"p-multiselect-trigger-icon"},(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.dropdownIcon?"span":"ChevronDownIcon"),u.mergeProps({class:["p-multiselect-trigger-icon",i.dropdownIcon],"aria-hidden":"true"},e.ptm("dropdownIcon")),null,16,["class"]))]))],16),u.createVNode(c,{appendTo:i.appendTo},{default:u.withCtx((()=>[u.createVNode(u.Transition,{name:"p-connected-overlay",onEnter:n.onOverlayEnter,onAfterEnter:n.onOverlayAfterEnter,onLeave:n.onOverlayLeave,onAfterLeave:n.onOverlayAfterLeave},{default:u.withCtx((()=>[s.overlayVisible?(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:0,ref:n.overlayRef,style:i.panelStyle,class:n.panelStyleClass,onClick:t[13]||(t[13]=(...e)=>n.onOverlayClick&&n.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>n.onOverlayKeyDown&&n.onOverlayKeyDown(...e))},{...i.panelProps,...e.ptm("panel")}),[u.createElementVNode("span",u.mergeProps({ref:"firstHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[3]||(t[3]=(...e)=>n.onFirstHiddenFocus&&n.onFirstHiddenFocus(...e))},e.ptm("hiddenFirstFocusableEl")),null,16),u.renderSlot(e.$slots,"header",{value:i.modelValue,options:n.visibleOptions}),i.showToggleAll&&null==i.selectionLimit||i.filter?(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:0,class:"p-multiselect-header"},e.ptm("header")),[i.showToggleAll&&null==i.selectionLimit?(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:0,class:n.headerCheckboxClass,onClick:t[6]||(t[6]=(...e)=>n.onToggleAll&&n.onToggleAll(...e))},e.ptm("headerCheckboxContainer")),[u.createElementVNode("div",u.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenInputWrapper")),[u.createElementVNode("input",u.mergeProps({type:"checkbox",readonly:"",checked:n.allSelected,"aria-label":n.toggleAllAriaLabel,onFocus:t[4]||(t[4]=(...e)=>n.onHeaderCheckboxFocus&&n.onHeaderCheckboxFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>n.onHeaderCheckboxBlur&&n.onHeaderCheckboxBlur(...e))},e.ptm("headerCheckbox")),null,16,w)],16),u.createElementVNode("div",u.mergeProps({class:["p-checkbox-box",{"p-highlight":n.allSelected,"p-focus":s.headerCheckboxFocused}]},n.getHeaderCheckboxPTOptions("headerCheckbox")),[u.renderSlot(e.$slots,"headercheckboxicon",{allSelected:n.allSelected,class:"p-checkbox-icon"},(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.checkboxIcon?"span":"CheckIcon"),u.mergeProps({class:["p-checkbox-icon",{[i.checkboxIcon]:n.allSelected}]},n.getHeaderCheckboxPTOptions("headerCheckboxIcon")),null,16,["class"]))]))],16)],16)):u.createCommentVNode("",!0),i.filter?(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:1,class:"p-multiselect-filter-container"},e.ptm("filterContainer")),[u.createElementVNode("input",u.mergeProps({ref:"filterInput",type:"text",value:s.filterValue,onVnodeMounted:t[7]||(t[7]=(...e)=>n.onFilterUpdated&&n.onFilterUpdated(...e)),class:"p-multiselect-filter p-inputtext p-component",placeholder:i.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":s.id+"_list","aria-activedescendant":n.focusedOptionId,onKeydown:t[8]||(t[8]=(...e)=>n.onFilterKeyDown&&n.onFilterKeyDown(...e)),onBlur:t[9]||(t[9]=(...e)=>n.onFilterBlur&&n.onFilterBlur(...e)),onInput:t[10]||(t[10]=(...e)=>n.onFilterChange&&n.onFilterChange(...e))},{...i.filterInputProps,...e.ptm("filterInput")}),null,16,E),u.renderSlot(e.$slots,"filtericon",{class:"p-multiselect-filter-icon"},(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.filterIcon?"span":"SearchIcon"),u.mergeProps({class:["p-multiselect-filter-icon",i.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]))],16)):u.createCommentVNode("",!0),i.filter?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:2,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult")),u.toDisplayString(n.filterResultMessageText),17)):u.createCommentVNode("",!0),u.withDirectives((u.openBlock(),u.createElementBlock("button",u.mergeProps({class:"p-multiselect-close p-link","aria-label":n.closeAriaLabel,onClick:t[11]||(t[11]=(...e)=>n.onCloseClick&&n.onCloseClick(...e)),type:"button"},{...i.closeButtonProps,...e.ptm("closeButton")}),[u.renderSlot(e.$slots,"closeicon",{class:"p-multiselect-close-icon"},(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.closeIcon?"span":"TimesIcon"),u.mergeProps({class:["p-multiselect-close-icon",i.closeIcon]},e.ptm("closeIcon")),null,16,["class"]))]))],16,D)),[[d]])],16)):u.createCommentVNode("",!0),u.createElementVNode("div",u.mergeProps({class:"p-multiselect-items-wrapper",style:{"max-height":n.virtualScrollerDisabled?i.scrollHeight:""}},e.ptm("wrapper")),[u.createVNode(a,u.mergeProps({ref:n.virtualScrollerRef},{...i.virtualScrollerOptions,...e.ptm("virtualScroller")},{items:n.visibleOptions,style:{height:i.scrollHeight},tabindex:-1,disabled:n.virtualScrollerDisabled}),u.createSlots({content:u.withCtx((({styleClass:t,contentRef:l,items:o,getItemOptions:r,contentStyle:a,itemSize:c})=>[u.createElementVNode("ul",u.mergeProps({ref:e=>n.listRef(e,l),id:s.id+"_list",class:["p-multiselect-items p-component",t],style:a,role:"listbox","aria-multiselectable":"true"},e.ptm("list")),[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(o,((t,l)=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:n.getOptionRenderKey(t,n.getOptionIndex(l,r))},[n.isOptionGroup(t)?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:0,id:s.id+"_"+n.getOptionIndex(l,r),style:{height:c?c+"px":void 0},class:"p-multiselect-item-group",role:"option"},e.ptm("itemGroup")),[u.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,index:n.getOptionIndex(l,r)},(()=>[u.createTextVNode(u.toDisplayString(n.getOptionGroupLabel(t.optionGroup)),1)]))],16,P)):u.withDirectives((u.openBlock(),u.createElementBlock("li",u.mergeProps({key:1,id:s.id+"_"+n.getOptionIndex(l,r),style:{height:c?c+"px":void 0},class:["p-multiselect-item",{"p-highlight":n.isSelected(t),"p-focus":s.focusedOptionIndex===n.getOptionIndex(l,r),"p-disabled":n.isOptionDisabled(t)}],role:"option","aria-label":n.getOptionLabel(t),"aria-selected":n.isSelected(t),"aria-disabled":n.isOptionDisabled(t),"aria-setsize":n.ariaSetSize,"aria-posinset":n.getAriaPosInset(n.getOptionIndex(l,r)),onClick:e=>n.onOptionSelect(e,t,n.getOptionIndex(l,r),!0),onMousemove:e=>n.onOptionMouseMove(e,n.getOptionIndex(l,r))},n.getCheckboxPTOptions(t,r,l,"item")),[u.createElementVNode("div",u.mergeProps({class:"p-checkbox p-component"},e.ptm("checkboxContainer")),[u.createElementVNode("div",u.mergeProps({class:["p-checkbox-box",{"p-highlight":n.isSelected(t)}]},n.getCheckboxPTOptions(t,r,l,"checkbox")),[u.renderSlot(e.$slots,"itemcheckboxicon",{selected:n.isSelected(t),class:"p-checkbox-icon"},(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.checkboxIcon?"span":"CheckIcon"),u.mergeProps({class:["p-checkbox-icon",{[i.checkboxIcon]:n.isSelected(t)}]},n.getCheckboxPTOptions(t,r,l,"checkboxIcon")),null,16,["class"]))]))],16)],16),u.renderSlot(e.$slots,"option",{option:t,index:n.getOptionIndex(l,r)},(()=>[u.createElementVNode("span",u.normalizeProps(u.guardReactiveProps(e.ptm("option"))),u.toDisplayString(n.getOptionLabel(t)),17)]))],16,T)),[[d]])],64)))),128)),s.filterValue&&(!o||o&&0===o.length)?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:0,class:"p-multiselect-empty-message",role:"option"},e.ptm("emptyMessage")),[u.renderSlot(e.$slots,"emptyfilter",{},(()=>[u.createTextVNode(u.toDisplayString(n.emptyFilterMessageText),1)]))],16)):!i.options||i.options&&0===i.options.length?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:1,class:"p-multiselect-empty-message",role:"option"},e.ptm("emptyMessage")),[u.renderSlot(e.$slots,"empty",{},(()=>[u.createTextVNode(u.toDisplayString(n.emptyMessageText),1)]))],16)):u.createCommentVNode("",!0)],16,B)])),_:2},[e.$slots.loader?{name:"loader",fn:u.withCtx((({options:t})=>[u.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["items","style","disabled"])],16),u.renderSlot(e.$slots,"footer",{value:i.modelValue,options:n.visibleOptions}),!i.options||i.options&&0===i.options.length?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("emptyMessage")),u.toDisplayString(n.emptyMessageText),17)):u.createCommentVNode("",!0),u.createElementVNode("span",u.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage")),u.toDisplayString(n.selectedMessageText),17),u.createElementVNode("span",u.mergeProps({ref:"lastHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[12]||(t[12]=(...e)=>n.onLastHiddenFocus&&n.onLastHiddenFocus(...e))},e.ptm("hiddenLastFocusableEl")),null,16)],16)):u.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],16)},C}(primevue.api,primevue.basecomponent,primevue.icons.check,primevue.icons.chevrondown,primevue.icons.search,primevue.icons.spinner,primevue.icons.times,primevue.icons.timescircle,primevue.overlayeventbus,primevue.portal,primevue.ripple,primevue.utils,primevue.virtualscroller,Vue);