const e=require("../../_util/vnode.js"),t=require("../../table/context.js"),n=require("../utils/legacyUtil.js"),r=require("../constant.js");let i=require("vue");function a(e){return e.reduce((e,t)=>{let{fixed:n}=t,r=n===!0?`left`:n,i=t.children;return i&&i.length>0?[...e,...a(i).map(e=>({fixed:r,...e}))]:[...e,{...t,fixed:r}]},[])}function o(e){return e.map(e=>{let{fixed:t,...n}=e,r=t;return t===`left`?r=`right`:t===`right`&&(r=`left`),{fixed:r,...n}})}function s({prefixCls:s,columns:c,expandable:l,expandedKeys:u,getRowKey:d,onTriggerExpand:f,expandIcon:p,rowExpandable:m,expandIconColumnIndex:h,direction:g,expandRowByClick:_,expandColumnWidth:v,expandFixed:y},b){let x=t.useInjectSlots(),S=(0,i.computed)(()=>{if(l.value){let t=c.value.slice();if(!t.includes(r.EXPAND_COLUMN)){let e=h.value||0;e>=0&&t.splice(e,0,r.EXPAND_COLUMN)}let a=t.indexOf(r.EXPAND_COLUMN);t=t.filter((e,t)=>e!==r.EXPAND_COLUMN||t===a);let o=c.value[a],l;l=(y.value===`left`||y.value)&&!h.value?`left`:(y.value===`right`||y.value)&&h.value===c.value.length?`right`:o?o.fixed:null;let g=u.value,b=m.value,S=p.value,C=s.value,w=_.value,T={[n.INTERNAL_COL_DEFINE]:{class:`${s.value}-expand-icon-col`,columnType:`EXPAND_COLUMN`},title:e.customRenderSlot(x.value,`expandColumnTitle`,{},()=>[``]),fixed:l,class:`${s.value}-row-expand-icon-cell`,width:v.value,customRender:({record:e,index:t})=>{let n=d.value(e,t),r=g.has(n),a=!b||b(e),o=S({prefixCls:C,expanded:r,expandable:a,record:e,onExpand:f});return w?(0,i.createVNode)(`span`,{onClick:e=>e.stopPropagation()},[o]):o}};return t.map(e=>e===r.EXPAND_COLUMN?T:e)}return c.value.filter(e=>e!==r.EXPAND_COLUMN)}),C=(0,i.computed)(()=>{let e=S.value;return b.value&&(e=b.value(e)),e.length||(e=[{customRender:()=>null}]),e});return[C,(0,i.computed)(()=>g.value===`rtl`?o(a(C.value)):a(C.value))]}exports.default=s;