import { inject, provide } from 'vue';
const noop = () => {};
const watermarkContextKey = Symbol('watermarkContextKey');
export const useProvideWatermark = props => {
  provide(watermarkContextKey, props);
};
export function usePanelRef(panelSelector) {
  const watermark = inject(watermarkContextKey, {
    add: noop,
    remove: noop
  });
  let panelEleRef = null;
  const panelRef = ele => {
    if (ele) {
      const innerContentEle = panelSelector ? ele.querySelector(panelSelector) : ele;
      if (innerContentEle === panelEleRef) {
        return;
      }
      watermark.add(innerContentEle);
      panelEleRef = innerContentEle;
    } else {
      watermark.remove(panelEleRef);
    }
  };
  return panelRef;
}