"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),E=require("@ant-design/icons-vue/BarsOutlined"),$=require("@ant-design/icons-vue/LeftOutlined"),k=require("@ant-design/icons-vue/RightOutlined"),S=require("../_util/classNames.js"),F=require("../_util/isNumeric.js"),H=require("../_util/props-util/initDefaultProps.js"),C=require("../_util/type.js"),n=require("../_util/vue-types/index.js"),D=require("../config-provider/hooks/useConfigInject.js"),N=require("./injectionKey.js"),O={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px",xxxl:"1999.98px"},q=()=>({prefixCls:String,collapsible:{type:Boolean,default:void 0},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean,default:void 0},reverseArrow:{type:Boolean,default:void 0},zeroWidthTriggerStyle:{type:Object,default:void 0},trigger:n.default.any,width:n.default.oneOfType([n.default.number,n.default.string]),collapsedWidth:n.default.oneOfType([n.default.number,n.default.string]),breakpoint:n.default.oneOf(C.tuple("xs","sm","md","lg","xl","xxl","xxxl")),theme:n.default.oneOf(C.tuple("light","dark")).def("dark"),onBreakpoint:Function,onCollapse:Function}),I=(()=>{let l=0;return(i="")=>(l+=1,`${i}${l}`)})(),K=t.defineComponent({compatConfig:{MODE:3},name:"ALayoutSider",inheritAttrs:!1,props:H.default(q(),{collapsible:!1,defaultCollapsed:!1,reverseArrow:!1,width:200,collapsedWidth:80}),emits:["breakpoint","update:collapsed","collapse"],setup(l,{emit:i,attrs:f,slots:m}){const{prefixCls:W}=D.default("layout-sider",l),u=t.inject(N.SiderHookProviderKey,void 0),r=t.shallowRef(!!(l.collapsed!==void 0?l.collapsed:l.defaultCollapsed)),p=t.shallowRef(!1);t.watch(()=>l.collapsed,()=>{r.value=!!l.collapsed}),t.provide(N.SiderCollapsedKey,r);const x=(e,s)=>{l.collapsed===void 0&&(r.value=e),i("update:collapsed",e),i("collapse",e,s)},V=t.shallowRef(e=>{p.value=e.matches,i("breakpoint",e.matches),r.value!==e.matches&&x(e.matches,"responsive")});let a;function d(e){return V.value(e)}const y=I("ant-sider-");u&&u.addSider(y),t.onMounted(()=>{t.watch(()=>l.breakpoint,()=>{try{a?.removeEventListener("change",d)}catch{a?.removeListener(d)}if(typeof window<"u"){const{matchMedia:e}=window;if(e&&l.breakpoint&&l.breakpoint in O){a=e(`(max-width: ${O[l.breakpoint]})`);try{a.addEventListener("change",d)}catch{a.addListener(d)}d(a)}}},{immediate:!0})}),t.onBeforeUnmount(()=>{try{a?.removeEventListener("change",d)}catch{a?.removeListener(d)}u&&u.removeSider(y)});const w=()=>{x(!r.value,"clickTrigger")};return()=>{const e=W.value,{collapsedWidth:s,width:L,reverseArrow:g,zeroWidthTriggerStyle:T,trigger:c=m.trigger?.(),collapsible:b,theme:B}=l,h=r.value?s:L,o=F.default(h)?`${h}px`:String(h),v=Number.parseFloat(String(s||0))===0?t.createVNode("span",{onClick:w,class:S.default(`${e}-zero-width-trigger`,`${e}-zero-width-trigger-${g?"right":"left"}`),style:T},[c||t.createVNode(E,null,null)]):null,M={expanded:g?t.createVNode(k,null,null):t.createVNode($,null,null),collapsed:g?t.createVNode($,null,null):t.createVNode(k,null,null)},j=r.value?"collapsed":"expanded",z=M[j],A=c!==null?v||t.createVNode("div",{class:`${e}-trigger`,onClick:w,style:{width:o}},[c||z]):null,P=[f.style,{flex:`0 0 ${o}`,maxWidth:o,minWidth:o,width:o}],R=S.default(e,`${e}-${B}`,{[`${e}-collapsed`]:!!r.value,[`${e}-has-trigger`]:b&&c!==null&&!v,[`${e}-below`]:!!p.value,[`${e}-zero-width`]:Number.parseFloat(o)===0},f.class);return t.createVNode("aside",{...f,class:R,style:P},[t.createVNode("div",{class:`${e}-children`},[m.default?.()]),b||p.value&&v?A:null])}}});exports.default=K;exports.siderProps=q;
