"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("lodash-unified"),o=require("vue"),d=Symbol("ag-grid-provider-key");function p(r){const t=o.ref(),l=o.ref(),s=o.ref(0),u=e=>{t.value=e},a=()=>t.value,g=(e="reset")=>{t.value&&e in t.value&&t.value[e]()},v=e=>{t.value?.rowSelection.setSelectedRowKeys(e)},w=()=>A.cloneDeep(t.value?.rowSelection.selectedRows.value),f=()=>t.value?.rowSelection.clearAll(),S=e=>t.value?.rowSelection.unSelectRows([e]),R=e=>{if(!e)return;const c=e.getDisplayedRowCount();if(c>0){const n=e.getDisplayedRowAtIndex(c-1);if(n&&n.rowTop&&n.rowHeight){const y=n.rowTop+n.rowHeight;s.value=y}}};o.watch(t,e=>{e&&r?.onMounted?.()}),o.watch(()=>t.value?.rowSelection.selectedRows.value,e=>{l.value=e,r?.onSelectedRows?.(e)});const i={setInstance:u,refresh:g,getInstance:a,setSelectedRowKeys:v,getSelectedRows:w,clearAllSelected:f,removeSelected:S,onAgGridUpdate:R},h=o.defineComponent({setup(e,{slots:c}){return o.provide(d,{...i,selectedRows:o.toRef(()=>l.value),agGridBodyHeight:o.toRef(()=>s.value)}),()=>c.default?.()},unmounted(){s.value=0}});return[i,h]}function G(){return o.inject(d)}exports.useAgGridInstance=p;exports.useAgGridModalInject=G;
