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