"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("lodash-unified"),n=require("vue"),x=a=>{const u=n.ref([]);function s(e,t){u.value=t}const l=e=>h.isFunction(a.rowKey)?a.rowKey(e):e[a.rowKey],c=n.computed(()=>{const e=new Map;return n.unref(u).forEach(t=>{e.set(l(t),t)}),e});function r(e){return n.unref(c).has(l(e))}function f(e){const t=n.unref(c);t.set(l(e),e),u.value=[...t.values()]}function d(e){const t=n.unref(c);for(const o of e)t.set(l(o),o);u.value=[...t.values()]}function i(e){const t=n.unref(c);t.delete(l(e)),u.value=[...t.values()]}function v(e){const t=n.unref(c);for(const o of e)t.delete(l(o));u.value=[...t.values()]}function S(){const e=n.unref(c);n.unref(a.dataSource).forEach(t=>{e.set(l(t),t)}),u.value=[...e.values()]}function M(e){const t=n.unref(c),o=l(e);t.has(o)?t.delete(o):t.set(o,e),u.value=[...t.values()]}function w(){const e=n.unref(c);n.unref(a.dataSource).forEach(t=>{e.delete(l(t))}),u.value=[...e.values()]}function g(){u.value=[]}return{select:f,unSelect:i,isSelected:r,selectAll:S,unSelectAll:w,clearAll:g,toggleSelect:M,selectedRows:u,selectMulti:d,unSelectMulti:v,rowSelection:n.computed(()=>({...a,onChange:s,selectedRowKeys:n.unref(u).map(e=>l(e))}))}};exports.default=x;
