import{cj as B,ck as pt,d as re,cl as bt,aQ as E,r as R,C as yt,bi as d,a2 as xe,cm as wt,D as Se,F as h,cn as ce,co as kt,cp as $e,cq as Rt,cr as Ct,m as xt,cs as Pe,ct as St,cu as Mt,cv as he,cw as Tt,H as qe,cx as We,cy as Qe,cz as Nt,cA as Ft,N as Pt,cB as Ot,cC as Ge,cD as Kt,cE as fe,cF as je,cG as ke,cH as Q,cI as _t,cJ as Je,cK as Lt,cL as De,cM as It,cN as Ce,aE as Bt,M as Ee,O as At,cO as Vt,cP as zt,cQ as $t,cR as jt,cS as Dt,cT as Ue,cU as Et,cV as Ut,cW as Ht,cX as qt,cY as Wt,cZ as ee,U as Qt}from"./index.789dd106.js";const Gt=B("base-menu-mask",` position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px; overflow: hidden; `,[pt()]),Jt=re({name:"BaseMenuMask",props:{clsPrefix:{type:String,required:!0}},setup(t){bt("-base-menu-mask",Gt,E(t,"clsPrefix"));const l=R(null);let a=null;const r=R(!1);return yt(()=>{a!==null&&window.clearTimeout(a)}),Object.assign({message:l,show:r},{showOnce(y,x=1500){a&&window.clearTimeout(a),r.value=!0,l.value=y,a=window.setTimeout(()=>{r.value=!1,l.value=null},x)}})},render(){return d(xe,{name:"fade-in-transition"},{default:()=>this.show?d("div",{class:`${this.clsPrefix}-base-menu-mask`},this.message):null})}});function Re(t){return t?t.map(l=>l.rawNode):null}function Xt(t,l,a,r){const v=[],y=[];function x(m){for(const w of m){if(w.disabled)continue;const{rawNode:S}=w;y.push(S),(w.isLeaf||!l)&&v.push({label:Oe(w,r,a),value:w.key,rawNode:w.rawNode,path:Array.from(y)}),!w.isLeaf&&w.children&&x(w.children),y.pop()}}return x(t),v}function Oe(t,l,a){const r=[];for(;t;)r.push(t.rawNode[a]),t=t.parent;return r.reverse().join(l)}const ve=wt("n-cascader"),He=re({name:"NCascaderOption",props:{tmNode:{type:Object,required:!0}},setup(t){const{expandTriggerRef:l,remoteRef:a,multipleRef:r,mergedValueRef:v,checkedKeysRef:y,indeterminateKeysRef:x,hoverKeyPathRef:m,keyboardKeyRef:w,loadingKeySetRef:S,cascadeRef:C,mergedCheckStrategyRef:K,onLoadRef:V,mergedClsPrefixRef:_,mergedThemeRef:G,labelFieldRef:Y,showCheckboxRef:M,updateHoverKey:g,updateKeyboardKey:L,addLoadingKey:P,deleteLoadingKey:O,closeMenu:I,doCheck:j,doUncheck:te,renderLabelRef:ne}=Se(ve),z=h(()=>t.tmNode.key),u=h(()=>{const{value:T}=l,{value:W}=a;return!W&&T==="hover"}),N=h(()=>{if(u.value)return X}),A=h(()=>{if(u.value)return ue}),F=ce(()=>{const{value:T}=r;return T?y.value.includes(z.value):v.value===z.value}),U=ce(()=>r.value?x.value.includes(z.value):!1),H=ce(()=>m.value.includes(z.value)),ie=ce(()=>{const{value:T}=w;return T===null?!1:T===z.value}),Me=ce(()=>a.value?S.value.has(z.value):!1),se=h(()=>t.tmNode.isLeaf),D=h(()=>t.tmNode.disabled),me=h(()=>t.tmNode.rawNode[Y.value]),q=h(()=>t.tmNode.shallowLoaded);function J(T){if(D.value)return;const{value:W}=a,{value:pe}=S,{value:be}=V,{value:k}=z,{value:Te}=se,{value:$}=q;Pe(T,"checkbox")||(W&&!$&&!pe.has(k)&&be&&(P(k),be(t.tmNode.rawNode).then(()=>{O(k)}).catch(()=>{O(k)})),g(k),L(k)),Te&&ae()}function X(){if(!u.value||D.value)return;const{value:T}=z;g(T),L(T)}function ue(){!u.value||X()}function ge(){const{value:T}=se;T||ae()}function ae(){const{value:T}=r,{value:W}=z;T?U.value||F.value?te(W):j(W):(j(W),I(!0))}return{checkStrategy:K,multiple:r,cascade:C,checked:F,indeterminate:U,hoverPending:H,keyboardPending:ie,isLoading:Me,showCheckbox:M,isLeaf:se,disabled:D,label:me,mergedClsPrefix:_,mergedTheme:G,handleClick:J,handleCheckboxUpdateValue:ge,mergedHandleMouseEnter:N,mergedHandleMouseMove:A,renderLabel:ne}},render(){const{mergedClsPrefix:t,renderLabel:l}=this;return d("div",{class:[`${t}-cascader-option`,{[`${t}-cascader-option--pending`]:this.keyboardPending||this.hoverPending,[`${t}-cascader-option--disabled`]:this.disabled,[`${t}-cascader-option--show-prefix`]:this.showCheckbox}],onMouseenter:this.mergedHandleMouseEnter,onMousemove:this.mergedHandleMouseMove,onClick:this.handleClick},this.showCheckbox?d("div",{class:`${t}-cascader-option__prefix`},d(xt,{focusable:!1,"data-checkbox":!0,disabled:this.disabled,checked:this.checked,indeterminate:this.indeterminate,theme:this.mergedTheme.peers.Checkbox,themeOverrides:this.mergedTheme.peerOverrides.Checkbox,onUpdateChecked:this.handleCheckboxUpdateValue})):null,d("span",{class:`${t}-cascader-option__label`},l?l(this.tmNode.rawNode,this.checked):this.label),d("div",{class:`${t}-cascader-option__suffix`},d("div",{class:`${t}-cascader-option-icon-placeholder`},this.isLeaf?this.checkStrategy==="child"&&!(this.multiple&&this.cascade)?d(xe,{name:"fade-in-scale-up-transition"},{default:()=>this.checked?d($e,{clsPrefix:t,class:`${t}-cascader-option-icon ${t}-cascader-option-icon--checkmark`},{default:()=>d(Ct,null)}):null}):null:d(kt,{clsPrefix:t,scale:.85,strokeWidth:24,show:this.isLoading,class:`${t}-cascader-option-icon`},{default:()=>d($e,{clsPrefix:t,key:"arrow",class:`${t}-cascader-option-icon ${t}-cascader-option-icon--arrow`},{default:()=>d(Rt,null)})}))))}}),Yt=re({name:"CascaderSubmenu",props:{depth:{type:Number,required:!0},tmNodes:{type:Array,required:!0}},setup(){const{virtualScrollRef:t,mergedClsPrefixRef:l,mergedThemeRef:a,optionHeightRef:r}=Se(ve),v=R(null),y=R(null),x={scroll(m,w){var S,C;t.value?(S=y.value)===null||S===void 0||S.scrollTo({index:m}):(C=v.value)===null||C===void 0||C.scrollTo({index:m,elSize:w})}};return Object.assign({mergedClsPrefix:l,mergedTheme:a,scrollbarInstRef:v,vlInstRef:y,virtualScroll:t,itemSize:h(()=>he(r.value)),handleVlScroll:()=>{var m;(m=v.value)===null||m===void 0||m.sync()},getVlContainer:()=>{var m;return(m=y.value)===null||m===void 0?void 0:m.listElRef},getVlContent:()=>{var m;return(m=y.value)===null||m===void 0?void 0:m.itemsElRef}},x)},render(){const{mergedClsPrefix:t,mergedTheme:l,virtualScroll:a}=this;return d("div",{class:[a&&`${t}-cascader-submenu--virtual`,`${t}-cascader-submenu`]},d(St,{ref:"scrollbarInstRef",theme:l.peers.Scrollbar,themeOverrides:l.peerOverrides.Scrollbar,container:a?this.getVlContainer:void 0,content:a?this.getVlContent:void 0},{default:()=>a?d(Mt,{items:this.tmNodes,itemSize:this.itemSize,onScroll:this.handleVlScroll,showScrollbar:!1,ref:"vlInstRef"},{default:({item:r})=>d(He,{key:r.key,tmNode:r})}):this.tmNodes.map(r=>d(He,{key:r.key,tmNode:r}))}))}}),Zt=re({name:"NCascaderMenu",props:{value:[String,Number,Array],placement:{type:String,default:"bottom-start"},show:Boolean,menuModel:{type:Array,required:!0},loading:Boolean,onFocus:{type:Function,required:!0},onBlur:{type:Function,required:!0},onKeydown:{type:Function,required:!0},onMousedown:{type:Function,required:!0},onTabout:{type:Function,required:!0}},setup(t){const{localeRef:l,isMountedRef:a,mergedClsPrefixRef:r,syncCascaderMenuPosition:v,handleCascaderMenuClickOutside:y,mergedThemeRef:x}=Se(ve),m=[],w=R(null),S=R(null);function C(){v()}Tt(S,C);function K(M){var g;const{value:{loadingRequiredMessage:L}}=l;(g=w.value)===null||g===void 0||g.showOnce(L(M))}function V(M){y(M)}function _(M){const{value:g}=S;!g||g.contains(M.relatedTarget)||t.onFocus(M)}function G(M){const{value:g}=S;!g||g.contains(M.relatedTarget)||t.onBlur(M)}return Object.assign({isMounted:a,mergedClsPrefix:r,selfElRef:S,submenuInstRefs:m,maskInstRef:w,mergedTheme:x,handleFocusin:_,handleFocusout:G,handleClickOutside:V},{scroll(M,g,L){const P=m[M];P&&P.scroll(g,L)},showErrorMessage:K})},render(){const{submenuInstRefs:t,mergedClsPrefix:l,mergedTheme:a}=this;return d(xe,{name:"fade-in-scale-up-transition",appear:this.isMounted},{default:()=>this.show?qe(d("div",{tabindex:"0",ref:"selfElRef",class:`${l}-cascader-menu`,onMousedown:this.onMousedown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeydown:this.onKeydown},this.menuModel[0].length?d("div",{class:`${l}-cascader-submenu-wrapper`},this.menuModel.map((r,v)=>d(Yt,{ref:y=>{y&&(t[v]=y)},key:v,tmNodes:r,depth:v+1})),d(Jt,{clsPrefix:l,ref:"maskInstRef"})):d("div",{class:`${l}-cascader-menu__empty`},Qe(this.$slots.empty,()=>[d(Pt,{theme:a.peers.Empty,themeOverrides:a.peerOverrides.Empty})])),Nt(this.$slots.action,r=>r&&d("div",{class:`${l}-cascader-menu-action`,"data-action":!0},r)),d(Ft,{onFocus:this.onTabout})),[[We,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),en=re({name:"NCascaderSelectMenu",props:{value:{type:[String,Number,Array],default:null},show:Boolean,pattern:{type:String,default:""},multiple:Boolean,tmNodes:{type:Array,default:()=>[]},filter:Function,labelField:{type:String,required:!0},separator:{type:String,required:!0}},setup(t){const{isMountedRef:l,mergedValueRef:a,mergedClsPrefixRef:r,mergedThemeRef:v,mergedCheckStrategyRef:y,slots:x,syncSelectMenuPosition:m,closeMenu:w,handleSelectMenuClickOutside:S,doUncheck:C,doCheck:K,clearPattern:V}=Se(ve),_=R(null),G=h(()=>Xt(t.tmNodes,y.value==="child",t.labelField,t.separator)),Y=h(()=>{const{filter:u}=t;if(u)return u;const{labelField:N}=t;return(A,F,U)=>U.some(H=>H[N]&&~H[N].indexOf(A))}),M=h(()=>{const{pattern:u}=t,{value:N}=Y;return(u?G.value.filter(A=>N(u,A.rawNode,A.path)):G.value).map(A=>({value:A.value,label:A.label}))}),g=h(()=>Ge(M.value,Kt("value","children")));function L(){m()}function P(u){O(u)}function O(u){if(t.multiple){const{value:N}=a;Array.isArray(N)?N.includes(u.key)?C(u.key):K(u.key):N===null&&K(u.key),V()}else K(u.key),w(!0)}function I(){var u;(u=_.value)===null||u===void 0||u.prev()}function j(){var u;(u=_.value)===null||u===void 0||u.next()}function te(){var u;if(_){const N=(u=_.value)===null||u===void 0?void 0:u.getPendingTmNode();return N&&O(N),!0}return!1}function ne(u){S(u)}return Object.assign({isMounted:l,mergedTheme:v,mergedClsPrefix:r,menuInstRef:_,selectTreeMate:g,handleResize:L,handleToggle:P,handleClickOutside:ne,cascaderSlots:x},{prev:I,next:j,enter:te})},render(){const{mergedClsPrefix:t,isMounted:l,mergedTheme:a,cascaderSlots:r}=this;return d(xe,{name:"fade-in-scale-up-transition",appear:l},{default:()=>this.show?qe(d(Ot,{ref:"menuInstRef",onResize:this.handleResize,clsPrefix:t,class:`${t}-cascader-menu`,autoPending:!0,themeOverrides:a.peerOverrides.InternalSelectMenu,theme:a.peers.InternalSelectMenu,treeMate:this.selectTreeMate,multiple:this.multiple,value:this.value,onToggle:this.handleToggle},{empty:()=>Qe(r["not-found"],()=>[])}),[[We,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),tn=fe([B("cascader-menu",` outline: none; position: relative; margin: 4px 0; display: flex; flex-flow: column nowrap; border-radius: var(--n-menu-border-radius); overflow: hidden; box-shadow: var(--n-menu-box-shadow); color: var(--n-option-text-color); background-color: var(--n-menu-color); `,[je({transformOrigin:"inherit",duration:"0.2s"}),ke("empty",` display: flex; padding: 12px 32px; flex: 1; justify-content: center; `),B("scrollbar",{width:"100%"}),B("base-menu-mask",{backgroundColor:"var(--n-menu-mask-color)"}),B("base-loading",{color:"var(--n-loading-color)"}),B("cascader-submenu-wrapper",` position: relative; display: flex; flex-wrap: nowrap; `),B("cascader-submenu",` height: var(--n-menu-height); min-width: var(--n-column-width); position: relative; `,[Q("virtual",` width: var(--n-column-width); `),B("scrollbar-content",{position:"relative"}),fe("&:first-child",` border-top-left-radius: var(--n-menu-border-radius); border-bottom-left-radius: var(--n-menu-border-radius); `),fe("&:last-child",` border-top-right-radius: var(--n-menu-border-radius); border-bottom-right-radius: var(--n-menu-border-radius); `),fe("&:not(:first-child)",` border-left: 1px solid var(--n-menu-divider-color); `)]),B("cascader-menu-action",` box-sizing: border-box; padding: 8px; border-top: 1px solid var(--n-menu-divider-color); `),B("cascader-option",` height: var(--n-option-height); line-height: var(--n-option-height); font-size: var(--n-option-font-size); padding: 0 0 0 18px; box-sizing: border-box; min-width: 182px; background-color: #0000; display: flex; align-items: center; white-space: nowrap; position: relative; cursor: pointer; transition: background-color .2s var(--n-bezier), color 0.2s var(--n-bezier); `,[Q("show-prefix",{paddingLeft:0}),ke("label",` flex: 1 0 0; overflow: hidden; text-overflow: ellipsis; `),ke("prefix",{width:"32px",display:"flex",alignItems:"center",justifyContent:"center"}),ke("suffix",{width:"32px",display:"flex",alignItems:"center",justifyContent:"center"}),B("cascader-option-icon-placeholder",{lineHeight:0,position:"relative",width:"16px",height:"16px",fontSize:"16px"},[B("cascader-option-icon",[Q("checkmark",{color:"var(--n-option-check-mark-color)"},[je({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})]),Q("arrow",{color:"var(--n-option-arrow-color)"})])]),Q("selected",{color:"var(--n-option-text-color-active)"}),Q("active",{color:"var(--n-option-text-color-active)",backgroundColor:"var(--n-option-color-hover)"}),Q("pending",{backgroundColor:"var(--n-option-color-hover)"}),fe("&:hover",{backgroundColor:"var(--n-option-color-hover)"}),Q("disabled",` color: var(--n-option-text-color-disabled); background-color: #0000; cursor: not-allowed; `,[B("cascader-option-icon",[Q("arrow",{color:"var(--n-option-text-color-disabled)"})])])])]),B("cascader",` z-index: auto; position: relative; width: 100%; `)]),nn=Object.assign(Object.assign({},Je.props),{allowCheckingNotLoaded:Boolean,to:Ce.propTo,bordered:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},value:[String,Number,Array],defaultValue:{type:[String,Number,Array],default:null},placeholder:String,multiple:Boolean,size:String,filterable:Boolean,disabled:{type:Boolean,default:void 0},disabledField:{type:String,default:"disabled"},expandTrigger:{type:String,default:"click"},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},remote:Boolean,onLoad:Function,separator:{type:String,default:" / "},filter:Function,placement:{type:String,default:"bottom-start"},cascade:{type:Boolean,default:!0},leafOnly:Boolean,showPath:{type:Boolean,default:!0},show:{type:Boolean,default:void 0},maxTagCount:[String,Number],menuProps:Object,filterMenuProps:Object,virtualScroll:{type:Boolean,default:!0},checkStrategy:{type:String,default:"all"},valueField:{type:String,default:"value"},labelField:{type:String,default:"label"},childrenField:{type:String,default:"children"},renderLabel:Function,status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onBlur:Function,onFocus:Function,onChange:[Function,Array]}),ln=re({name:"Cascader",props:nn,setup(t,{slots:l}){const{mergedBorderedRef:a,mergedClsPrefixRef:r,namespaceRef:v,inlineThemeDisabled:y}=_t(t),x=Je("Cascader","-cascader",tn,Et,t,r),{localeRef:m}=Lt("Cascader"),w=R(t.defaultValue),S=h(()=>t.value),C=De(S,w),K=h(()=>t.leafOnly?"child":t.checkStrategy),V=R(""),_=It(t),{mergedSizeRef:G,mergedDisabledRef:Y,mergedStatusRef:M}=_,g=R(null),L=R(null),P=R(null),O=R(null),I=R(null),j=R(new Set),te=R(null),ne=R(null),z=Ce(t),u=R(!1),N=e=>{j.value.add(e)},A=e=>{j.value.delete(e)},F=h(()=>{const{valueField:e,childrenField:n,disabledField:o}=t;return Ge(t.options,{getDisabled(c){return c[o]},getKey(c){return c[e]},getChildren(c){return c[n]}})}),U=h(()=>{const{cascade:e,multiple:n}=t;return n&&Array.isArray(C.value)?F.value.getCheckedKeys(C.value,{cascade:e,allowNotLoaded:t.allowCheckingNotLoaded}):{checkedKeys:[],indeterminateKeys:[]}}),H=h(()=>U.value.checkedKeys),ie=h(()=>U.value.indeterminateKeys),Me=h(()=>{const{treeNodePath:e,treeNode:n}=F.value.getPath(I.value);let o;return n===null?o=[F.value.treeNodes]:(o=e.map(c=>c.siblings),!n.isLeaf&&!j.value.has(n.key)&&n.children&&o.push(n.children)),o}),se=h(()=>{const{keyPath:e}=F.value.getPath(I.value);return e}),D=h(()=>x.value.self.optionHeight);Bt(t.options)&&Ee(t.options,(e,n)=>{e!==n&&(I.value=null,O.value=null)});function me(e){const{onUpdateShow:n,"onUpdate:show":o}=t;n&&ee(n,e),o&&ee(o,e),pe.value=e}function q(e,n,o){const{onUpdateValue:c,"onUpdate:value":i,onChange:p}=t,{nTriggerFormInput:s,nTriggerFormChange:b}=_;c&&ee(c,e,n,o),i&&ee(i,e,n,o),p&&ee(p,e,n,o),w.value=e,s(),b()}function J(e){O.value=e}function X(e){I.value=e}function ue(e){const{value:{getNode:n}}=F;return e.map(o=>{var c;return((c=n(o))===null||c===void 0?void 0:c.rawNode)||null})}function ge(e){var n;const{cascade:o,multiple:c,filterable:i}=t,{value:{check:p,getNode:s,getPath:b}}=F;if(c)try{const{checkedKeys:f}=p(e,U.value.checkedKeys,{cascade:o,checkStrategy:K.value,allowNotLoaded:t.allowCheckingNotLoaded});q(f,ue(f),f.map(oe=>{var de;return Re((de=b(oe))===null||de===void 0?void 0:de.treeNodePath)})),i&&Ne(),O.value=e,I.value=e}catch(f){if(f instanceof Ut){if(g.value){const oe=s(e);oe!==null&&g.value.showErrorMessage(oe.rawNode[t.labelField])}}else throw f}else if(K.value==="child"){const f=s(e);if(f!=null&&f.isLeaf)q(e,f.rawNode,Re(b(e).treeNodePath));else return!1}else{const f=s(e);q(e,(f==null?void 0:f.rawNode)||null,Re((n=b(e))===null||n===void 0?void 0:n.treeNodePath))}return!0}function ae(e){const{cascade:n,multiple:o}=t;if(o){const{value:{uncheck:c,getNode:i,getPath:p}}=F,{checkedKeys:s}=c(e,U.value.checkedKeys,{cascade:n,checkStrategy:K.value,allowNotLoaded:t.allowCheckingNotLoaded});q(s,s.map(b=>{var f;return((f=i(b))===null||f===void 0?void 0:f.rawNode)||null}),s.map(b=>{var f;return Re((f=p(b))===null||f===void 0?void 0:f.treeNodePath)})),O.value=e,I.value=e}}const T=h(()=>{if(t.multiple){const{showPath:e,separator:n,labelField:o,cascade:c}=t,{getCheckedKeys:i,getNode:p}=F.value;return i(H.value,{cascade:c,checkStrategy:K.value,allowNotLoaded:t.allowCheckingNotLoaded}).checkedKeys.map(b=>{const f=p(b);return f===null?{label:String(b),value:b}:{label:e?Oe(f,n,o):f.rawNode[o],value:f.key}})}else return[]}),W=h(()=>{const{multiple:e,showPath:n,separator:o,labelField:c}=t,{value:i}=C;if(!e&&!Array.isArray(i)){const{getNode:p}=F.value;if(i===null)return null;const s=p(i);return s===null?{label:String(i),value:i}:{label:n?Oe(s,o,c):s.rawNode[c],value:s.key}}else return null}),pe=R(!1),be=E(t,"show"),k=De(be,pe),Te=h(()=>{const{placeholder:e}=t;return e!==void 0?e:m.value.placeholder}),$=h(()=>!!(t.filterable&&V.value));Ee(k,e=>{if(!e||t.multiple)return;const{value:n}=C;!Array.isArray(n)&&n!==null?(O.value=n,I.value=n,Qt(()=>{var o;if(!k.value)return;const{value:c}=I;if(C.value!==null){const i=F.value.getNode(c);i&&((o=g.value)===null||o===void 0||o.scroll(i.level,i.index,he(D.value)))}})):(O.value=null,I.value=null)},{immediate:!0});function Ke(e){const{onBlur:n}=t,{nTriggerFormBlur:o}=_;n&&ee(n,e),o()}function _e(e){const{onFocus:n}=t,{nTriggerFormFocus:o}=_;n&&ee(n,e),o()}function Ne(){var e;(e=P.value)===null||e===void 0||e.focusInput()}function Xe(){var e;(e=P.value)===null||e===void 0||e.focus()}function ye(){Y.value||(V.value="",me(!0),t.filterable&&Ne())}function Z(e=!1){e&&Xe(),me(!1),V.value=""}function Le(e){var n;$.value||k.value&&(!((n=P.value)===null||n===void 0)&&n.$el.contains(Ht(e))||Z())}function Ye(e){!$.value||Le(e)}function Ie(){t.clearFilterAfterSelect&&(V.value="")}function we(e){var n,o,c;const{value:i}=O,{value:p}=F;switch(e){case"prev":if(i!==null){const s=p.getPrev(i,{loop:!0});s!==null&&(J(s.key),(n=g.value)===null||n===void 0||n.scroll(s.level,s.index,he(D.value)))}break;case"next":if(i===null){const s=p.getFirstAvailableNode();s!==null&&(J(s.key),(o=g.value)===null||o===void 0||o.scroll(s.level,s.index,he(D.value)))}else{const s=p.getNext(i,{loop:!0});s!==null&&(J(s.key),(c=g.value)===null||c===void 0||c.scroll(s.level,s.index,he(D.value)))}break;case"child":if(i!==null){const s=p.getNode(i);if(s!==null)if(s.shallowLoaded){const b=p.getChild(i);b!==null&&(X(i),J(b.key))}else{const{value:b}=j;if(!b.has(i)){N(i),X(i);const{onLoad:f}=t;f&&f(s.rawNode).then(()=>{A(i)}).catch(()=>{A(i)})}}}break;case"parent":if(i!==null){const s=p.getParent(i);if(s!==null){J(s.key);const b=s.getParent();X(b===null?null:b.key)}}break}}function Be(e){var n,o;switch(e.key){case" ":case"ArrowDown":case"ArrowUp":if(t.filterable&&k.value)break;e.preventDefault();break}if(!Pe(e,"action"))switch(e.key){case" ":if(t.filterable)return;case"Enter":if(!k.value)ye();else{const{value:c}=$,{value:i}=O;if(c)L.value&&L.value.enter()&&Ie();else if(i!==null)if(H.value.includes(i)||ie.value.includes(i))ae(i);else{const p=ge(i);!t.multiple&&p&&Z(!0)}}break;case"ArrowUp":e.preventDefault(),k.value&&($.value?(n=L.value)===null||n===void 0||n.prev():we("prev"));break;case"ArrowDown":e.preventDefault(),k.value?$.value?(o=L.value)===null||o===void 0||o.next():we("next"):ye();break;case"ArrowLeft":e.preventDefault(),k.value&&!$.value&&we("parent");break;case"ArrowRight":e.preventDefault(),k.value&&!$.value&&we("child");break;case"Escape":k.value&&(qt(e),Z(!0))}}function Ze(e){Be(e)}function et(e){e.stopPropagation(),t.multiple?q([],[],[]):q(null,null,null)}function tt(e){var n;!((n=g.value)===null||n===void 0)&&n.$el.contains(e.relatedTarget)||(u.value=!0,_e(e))}function nt(e){var n;!((n=g.value)===null||n===void 0)&&n.$el.contains(e.relatedTarget)||(u.value=!1,Ke(e),Z())}function at(e){var n;!((n=P.value)===null||n===void 0)&&n.$el.contains(e.relatedTarget)||(u.value=!0,_e(e))}function lt(e){var n;!((n=P.value)===null||n===void 0)&&n.$el.contains(e.relatedTarget)||(u.value=!1,Ke(e))}function ot(e){Pe(e,"action")||t.multiple&&t.filter&&(e.preventDefault(),Ne())}function rt(){Z(!0)}function it(){t.filterable?ye():k.value?Z(!0):ye()}function st(e){V.value=e.target.value}function ut(e){const{multiple:n}=t,{value:o}=C;n&&Array.isArray(o)&&e.value!==void 0?ae(e.value):q(null,null,null)}function Ae(){var e;(e=te.value)===null||e===void 0||e.syncPosition()}function Ve(){var e;(e=ne.value)===null||e===void 0||e.syncPosition()}function dt(){k.value&&($.value?Ae():Ve())}const Fe=h(()=>!!(t.multiple&&t.cascade||K.value!=="child"));At(ve,{slots:l,mergedClsPrefixRef:r,mergedThemeRef:x,mergedValueRef:C,checkedKeysRef:H,indeterminateKeysRef:ie,hoverKeyPathRef:se,mergedCheckStrategyRef:K,showCheckboxRef:Fe,cascadeRef:E(t,"cascade"),multipleRef:E(t,"multiple"),keyboardKeyRef:O,hoverKeyRef:I,remoteRef:E(t,"remote"),loadingKeySetRef:j,expandTriggerRef:E(t,"expandTrigger"),isMountedRef:Vt(),onLoadRef:E(t,"onLoad"),virtualScrollRef:E(t,"virtualScroll"),optionHeightRef:D,localeRef:m,labelFieldRef:E(t,"labelField"),renderLabelRef:E(t,"renderLabel"),syncCascaderMenuPosition:Ve,syncSelectMenuPosition:Ae,updateKeyboardKey:J,updateHoverKey:X,addLoadingKey:N,deleteLoadingKey:A,doCheck:ge,doUncheck:ae,closeMenu:Z,handleSelectMenuClickOutside:Ye,handleCascaderMenuClickOutside:Le,clearPattern:Ie});const ct={focus:()=>{var e;(e=P.value)===null||e===void 0||e.focus()},blur:()=>{var e;(e=P.value)===null||e===void 0||e.blur()},getCheckedData:()=>{if(Fe.value){const e=H.value;return{keys:e,options:ue(e)}}return{keys:[],options:[]}},getIndeterminateData:()=>{if(Fe.value){const e=ie.value;return{keys:e,options:ue(e)}}return{keys:[],options:[]}}},ze=h(()=>{const{self:{optionArrowColor:e,optionTextColor:n,optionTextColorActive:o,optionTextColorDisabled:c,optionCheckMarkColor:i,menuColor:p,menuBoxShadow:s,menuDividerColor:b,menuBorderRadius:f,menuHeight:oe,optionColorHover:de,optionHeight:ft,optionFontSize:ht,loadingColor:vt,columnWidth:mt},common:{cubicBezierEaseInOut:gt}}=x.value;return{"--n-bezier":gt,"--n-menu-border-radius":f,"--n-menu-box-shadow":s,"--n-menu-height":oe,"--n-column-width":mt,"--n-menu-color":p,"--n-menu-divider-color":b,"--n-option-height":ft,"--n-option-font-size":ht,"--n-option-text-color":n,"--n-option-text-color-disabled":c,"--n-option-text-color-active":o,"--n-option-color-hover":de,"--n-option-check-mark-color":i,"--n-option-arrow-color":e,"--n-menu-mask-color":Wt(p,{alpha:.75}),"--n-loading-color":vt}}),le=y?zt("cascader",void 0,ze,t):void 0;return Object.assign(Object.assign({},ct),{handleTriggerResize:dt,mergedStatus:M,selectMenuFollowerRef:te,cascaderMenuFollowerRef:ne,triggerInstRef:P,selectMenuInstRef:L,cascaderMenuInstRef:g,mergedBordered:a,mergedClsPrefix:r,namespace:v,mergedValue:C,mergedShow:k,showSelectMenu:$,pattern:V,treeMate:F,mergedSize:G,mergedDisabled:Y,localizedPlaceholder:Te,selectedOption:W,selectedOptions:T,adjustedTo:z,menuModel:Me,handleMenuTabout:rt,handleMenuFocus:at,handleMenuBlur:lt,handleMenuKeydown:Ze,handleMenuMousedown:ot,handleTriggerFocus:tt,handleTriggerBlur:nt,handleTriggerClick:it,handleClear:et,handleDeleteOption:ut,handlePatternInput:st,handleKeydown:Be,focused:u,optionHeight:D,mergedTheme:x,cssVars:y?void 0:ze,themeClass:le==null?void 0:le.themeClass,onRender:le==null?void 0:le.onRender})},render(){const{mergedClsPrefix:t}=this;return d("div",{class:`${t}-cascader`},d($t,null,{default:()=>[d(jt,null,{default:()=>d(Dt,{onResize:this.handleTriggerResize,ref:"triggerInstRef",status:this.mergedStatus,clsPrefix:t,maxTagCount:this.maxTagCount,bordered:this.mergedBordered,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,active:this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,focused:this.focused,onFocus:this.handleTriggerFocus,onBlur:this.handleTriggerBlur,onClick:this.handleTriggerClick,onClear:this.handleClear,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onKeydown:this.handleKeydown},{arrow:()=>{var l,a;return(a=(l=this.$slots).arrow)===null||a===void 0?void 0:a.call(l)}})}),d(Ue,{key:"cascaderMenu",ref:"cascaderMenuFollowerRef",show:this.mergedShow&&!this.showSelectMenu,containerClass:this.namespace,placement:this.placement,width:this.options.length?void 0:"target",teleportDisabled:this.adjustedTo===Ce.tdkey,to:this.adjustedTo},{default:()=>{var l;(l=this.onRender)===null||l===void 0||l.call(this);const{menuProps:a}=this;return d(Zt,Object.assign({},a,{ref:"cascaderMenuInstRef",class:[this.themeClass,a==null?void 0:a.class],value:this.mergedValue,show:this.mergedShow&&!this.showSelectMenu,menuModel:this.menuModel,style:[this.cssVars,a==null?void 0:a.style],onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onMousedown:this.handleMenuMousedown,onTabout:this.handleMenuTabout}),{action:()=>{var r,v;return(v=(r=this.$slots).action)===null||v===void 0?void 0:v.call(r)},empty:()=>{var r,v;return(v=(r=this.$slots).empty)===null||v===void 0?void 0:v.call(r)}})}}),d(Ue,{key:"selectMenu",ref:"selectMenuFollowerRef",show:this.mergedShow&&this.showSelectMenu,containerClass:this.namespace,width:"target",placement:this.placement,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Ce.tdkey},{default:()=>{var l;(l=this.onRender)===null||l===void 0||l.call(this);const{filterMenuProps:a}=this;return d(en,Object.assign({},a,{ref:"selectMenuInstRef",class:[this.themeClass,a==null?void 0:a.class],value:this.mergedValue,show:this.mergedShow&&this.showSelectMenu,pattern:this.pattern,multiple:this.multiple,tmNodes:this.treeMate.treeNodes,filter:this.filter,labelField:this.labelField,separator:this.separator,style:[this.cssVars,a==null?void 0:a.style]}))}})]}))}});export{ln as N};