text: "use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/ripple"),n=require("vue");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t),s={emits:["option-select","optiongroup-select"],name:"cascadeselect-sub",props:{selectionPath:Array,level:Number,options:Array,optionLabel:String,optionValue:String,optionGroupLabel:String,optionGroupChildren:Array,parentActive:Boolean,dirty:Boolean,templates:null,root:Boolean},data:()=>({activeOption:null}),mounted(){if(this.selectionPath&&this.options&&!this.dirty)for(let e of this.options)if(this.selectionPath.includes(e)){this.activeOption=e;break}this.root||this.position()},watch:{parentActive(e){e||(this.activeOption=null)}},methods:{onOptionClick(e,t){this.isOptionGroup(t)?(this.activeOption=this.activeOption===t?null:t,this.$emit("optiongroup-select",{originalEvent:e,value:t})):this.$emit("option-select",{originalEvent:e,value:this.getOptionValue(t)})},onOptionSelect(e){this.$emit("option-select",e)},onOptionGroupSelect(e){this.$emit("optiongroup-select",e)},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionGroupLabel(t){return this.optionGroupLabel?e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel):null},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren[this.level])},isOptionGroup(e){return Object.prototype.hasOwnProperty.call(e,this.optionGroupChildren[this.level])},getOptionLabelToRender(e){return this.isOptionGroup(e)?this.getOptionGroupLabel(e):this.getOptionLabel(e)},getItemClass(e){return["p-cascadeselect-item",{"p-cascadeselect-item-group":this.isOptionGroup(e),"p-cascadeselect-item-active p-highlight":this.isOptionActive(e)}]},isOptionActive(e){return this.activeOption===e},onKeyDown(e,t,i){switch(e.key){case"Down":case"ArrowDown":var n=this.$el.children[i+1];n&&n.children[0].focus();break;case"Up":case"ArrowUp":var o=this.$el.children[i-1];o&&o.children[0].focus();break;case"Right":case"ArrowRight":this.isOptionGroup(t)&&(this.isOptionActive(t)?e.currentTarget.nextElementSibling.children[0].children[0].focus():this.activeOption=t);break;case"Left":case"ArrowLeft":this.activeOption=null;var l=e.currentTarget.parentElement.parentElement.previousElementSibling;l&&l.focus();break;case"Enter":this.onOptionClick(e,t)}e.preventDefault()},position(){const t=this.$el.parentElement,i=e.DomHandler.getOffset(t),n=e.DomHandler.getViewport(),o=this.$el.offsetParent?this.$el.offsetWidth:e.DomHandler.getHiddenElementOuterWidth(this.$el),l=e.DomHandler.getOuterWidth(t.children[0]);parseInt(i.left,10)+l+o>n.width-e.DomHandler.calculateScrollbarWidth()&&(this.$el.style.left="-100%")}},directives:{ripple:o(i).default}};const a={class:"p-cascadeselect-panel p-cascadeselect-items",role:"listbox","aria-orientation":"horizontal"},r={key:1,class:"p-cascadeselect-item-text"},c={key:2,class:"p-cascadeselect-group-icon pi pi-angle-right"};s.render=function(e,t,i,o,l,s){const p=n.resolveComponent("cascadeselect-sub"),d=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("ul",a,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(i.options,((e,t)=>(n.openBlock(),n.createBlock("li",{key:s.getOptionLabelToRender(e),class:s.getItemClass(e),role:"none"},[n.withDirectives(n.createVNode("div",{class:"p-cascadeselect-item-content",onClick:t=>s.onOptionClick(t,e),tabindex:"0",onKeydown:i=>s.onKeyDown(i,e,t)},[i.templates.option?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.templates.option),{key:0,option:e},null,8,["option"])):(n.openBlock(),n.createBlock("span",r,n.toDisplayString(s.getOptionLabelToRender(e)),1)),s.isOptionGroup(e)?(n.openBlock(),n.createBlock("span",c)):n.createCommentVNode("",!0)],40,["onClick","onKeydown"]),[[d]]),s.isOptionGroup(e)&&s.isOptionActive(e)?(n.openBlock(),n.createBlock(p,{key:0,class:"p-cascadeselect-sublist",selectionPath:i.selectionPath,options:s.getOptionGroupChildren(e),optionLabel:i.optionLabel,optionValue:i.optionValue,level:i.level+1,onOptionSelect:s.onOptionSelect,onOptiongroupSelect:s.onOptionGroupSelect,optionGroupLabel:i.optionGroupLabel,optionGroupChildren:i.optionGroupChildren,parentActive:s.isOptionActive(e),dirty:i.dirty,templates:i.templates},null,8,["selectionPath","options","optionLabel","optionValue","level","onOptionSelect","onOptiongroupSelect","optionGroupLabel","optionGroupChildren","parentActive","dirty","templates"])):n.createCommentVNode("",!0)],2)))),128))])};var p={emits:["update:modelValue","change","group-change","before-show","before-hide","hide","show"],data:()=>({selectionPath:null,focused:!1,overlayVisible:!1,dirty:!1}),props:{modelValue:null,options:Array,optionLabel:String,optionValue:String,optionGroupLabel:String,optionGroupChildren:Array,placeholder:String,disabled:Boolean,dataKey:null,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},panelClass:null},outsideClickListener:null,scrollHandler:null,resizeListener:null,overlay:null,beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},mounted(){this.updateSelectionPath()},watch:{modelValue(){this.updateSelectionPath()}},methods:{onOptionSelect(e){this.$emit("update:modelValue",e.value),this.$emit("change",e),this.hide(),this.$refs.focusInput.focus()},onOptionGroupSelect(e){this.dirty=!0,this.$emit("group-change",e)},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionGroupChildren(t,i){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren[i])},isOptionGroup(e,t){return Object.prototype.hasOwnProperty.call(e,this.optionGroupChildren[t])},updateSelectionPath(){let e;if(null!=this.modelValue&&this.options)for(let t of this.options)if(e=this.findModelOptionInGroup(t,0),e)break;this.selectionPath=e},findModelOptionInGroup(t,i){if(this.isOptionGroup(t,i)){let e;for(let n of this.getOptionGroupChildren(t,i))if(e=this.findModelOptionInGroup(n,i+1),e)return e.unshift(t),e}else if(e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.dataKey))return[t];return null},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(){this.focused=!0},onBlur(){this.focused=!1},onClick(e){this.disabled||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOverlayEnter(t){e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null,this.dirty=!1},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},overlayRef(e){this.overlay=e},onKeyDown(t){switch(t.key){case"Down":case"ArrowDown":this.overlayVisible?e.DomHandler.findSingle(this.overlay,".p-cascadeselect-item").children[0].focus():t.altKey&&this.options&&this.options.length&&this.show(),t.preventDefault();break;case"Escape":this.overlayVisible&&(this.hide(),t.preventDefault());break;case"Tab":this.hide()}},onOverlayClick(e){l.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{containerClass(){return["p-cascadeselect p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-cascadeselect-label",{"p-placeholder":this.label===this.placeholder,"p-cascadeselect-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},label(){return this.selectionPath?this.getOptionLabel(this.selectionPath[this.selectionPath.length-1]):this.placeholder||"p-emptylabel"},panelStyleClass(){return["p-cascadeselect-panel p-component",this.panelClass]},appendDisabled(){return"self"===this.appendTo},appendTarget(){return this.appendDisabled?null:this.appendTo}},components:{CascadeSelectSub:s}};const d={class:"p-hidden-accessible"},h=n.createVNode("span",{class:"p-cascadeselect-trigger-icon pi pi-chevron-down"},null,-1),u={class:"p-cascadeselect-items-wrapper"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-cascadeselect {\n    display: -webkit-inline-box;\n    display: -ms-inline-flexbox;\n    display: inline-flex;\n    cursor: pointer;\n    position: relative;\n    -webkit-user-select: none;\n       -moz-user-select: none;\n        -ms-user-select: none;\n            user-select: none;\n}\n.p-cascadeselect-trigger {\n    display: -webkit-box;\n    display: -ms-flexbox;\n    display: flex;\n    -webkit-box-align: center;\n        -ms-flex-align: center;\n            align-items: center;\n    -webkit-box-pack: center;\n        -ms-flex-pack: center;\n            justify-content: center;\n    -ms-flex-negative: 0;\n        flex-shrink: 0;\n}\n.p-cascadeselect-label {\n    display: block;\n    white-space: nowrap;\n    overflow: hidden;\n    -webkit-box-flex: 1;\n        -ms-flex: 1 1 auto;\n            flex: 1 1 auto;\n    width: 1%;\n    text-overflow: ellipsis;\n    cursor: pointer;\n}\n.p-cascadeselect-label-empty {\n    overflow: hidden;\n    visibility: hidden;\n}\n.p-cascadeselect .p-cascadeselect-panel {\n    min-width: 100%;\n}\n.p-cascadeselect-panel {\n    position: absolute;\n}\n.p-cascadeselect-item {\n    cursor: pointer;\n    font-weight: normal;\n    white-space: nowrap;\n}\n.p-cascadeselect-item-content {\n    display: -webkit-box;\n    display: -ms-flexbox;\n    display: flex;\n    -webkit-box-align: center;\n        -ms-flex-align: center;\n            align-items: center;\n    overflow: hidden;\n    position: relative;\n}\n.p-cascadeselect-group-icon {\n    margin-left: auto;\n}\n.p-cascadeselect-items {\n    margin: 0;\n    padding: 0;\n    list-style-type: none;\n    min-width: 100%;\n}\n.p-fluid .p-cascadeselect {\n    display: -webkit-box;\n    display: -ms-flexbox;\n    display: flex;\n}\n.p-fluid .p-cascadeselect .p-cascadeselect-label {\n    width: 1%;\n}\n.p-cascadeselect-sublist {\n    position: absolute;\n    min-width: 100%;\n    z-index: 1;\n    display: none;\n}\n.p-cascadeselect-item-active {\n    overflow: visible !important;\n}\n.p-cascadeselect-item-active > .p-cascadeselect-sublist {\n    display: block;\n    left: 100%;\n    top: 0;\n}\n"),p.render=function(e,t,i,o,l,s){const a=n.resolveComponent("CascadeSelectSub");return n.openBlock(),n.createBlock("div",{ref:"container",class:s.containerClass,onClick:t[5]||(t[5]=e=>s.onClick(e))},[n.createVNode("div",d,[n.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"listbox","aria-expanded":l.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),n.createVNode("span",{class:s.labelClass},[n.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[n.createTextVNode(n.toDisplayString(s.label),1)]))],2),n.createVNode("div",{class:"p-cascadeselect-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":l.overlayVisible},[h],8,["aria-expanded"]),(n.openBlock(),n.createBlock(n.Teleport,{to:s.appendTarget,disabled:s.appendDisabled},[n.createVNode(n.Transition,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:n.withCtx((()=>[l.overlayVisible?(n.openBlock(),n.createBlock("div",{key:0,ref:s.overlayRef,class:s.panelStyleClass,onClick:t[4]||(t[4]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e))},[n.createVNode("div",u,[n.createVNode(a,{options:i.options,selectionPath:l.selectionPath,optionLabel:i.optionLabel,optionValue:i.optionValue,level:0,templates:e.$slots,optionGroupLabel:i.optionGroupLabel,optionGroupChildren:i.optionGroupChildren,onOptionSelect:s.onOptionSelect,onOptiongroupSelect:s.onOptionGroupSelect,dirty:l.dirty,root:!0},null,8,["options","selectionPath","optionLabel","optionValue","templates","optionGroupLabel","optionGroupChildren","onOptionSelect","onOptiongroupSelect","dirty"])])],2)):n.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=p;
  