import {
  __commonJS
} from "./chunk-HFNDKYVF.js";

// ../node_modules/debounce/index.js
var require_debounce = __commonJS({
  "../node_modules/debounce/index.js"(exports, module) {
    function debounce(func, wait, immediate) {
      var timeout, args, context, timestamp, result;
      if (null == wait) wait = 100;
      function later() {
        var last = Date.now() - timestamp;
        if (last < wait && last >= 0) {
          timeout = setTimeout(later, wait - last);
        } else {
          timeout = null;
          if (!immediate) {
            result = func.apply(context, args);
            context = args = null;
          }
        }
      }
      ;
      var debounced = function() {
        context = this;
        args = arguments;
        timestamp = Date.now();
        var callNow = immediate && !timeout;
        if (!timeout) timeout = setTimeout(later, wait);
        if (callNow) {
          result = func.apply(context, args);
          context = args = null;
        }
        return result;
      };
      debounced.clear = function() {
        if (timeout) {
          clearTimeout(timeout);
          timeout = null;
        }
      };
      debounced.flush = function() {
        if (timeout) {
          result = func.apply(context, args);
          context = args = null;
          clearTimeout(timeout);
          timeout = null;
        }
      };
      return debounced;
    }
    debounce.debounce = debounce;
    module.exports = debounce;
  }
});

// termsetting/HandlerBase.ts
var HandlerBase = class {
  //tw: TwBase
  constructor(opts) {
    this.termsetting = opts.termsetting;
  }
  showEditMenu(_) {
  }
  getPillStatus(_) {
    const tw = this.termsetting.tw;
    return tw.getStatus?.() || { text: "" };
  }
  // this is equivalent to getPillNameDefault()
  getPillName(d) {
    const self = this.termsetting;
    if (!self.opts.abbrCutoff) return d.name;
    return d.name.length <= self.opts.abbrCutoff + 2 ? d.name : '<label title="' + d.name + '">' + d.name.substring(0, self.opts.abbrCutoff) + "...</label>";
  }
  applyEdits() {
  }
  undoEdits() {
  }
  showLoading(_div) {
    const self = this.termsetting;
    const div = _div || self.dom.tip.d;
    div.selectAll("*").remove();
    this.dom.loadingDiv = div.append("div").style("margin", "15px").text("Loading ...");
  }
  hideLoading() {
    this.dom.loadingDiv?.remove();
  }
};

export {
  require_debounce,
  HandlerBase
};
//# sourceMappingURL=chunk-LSEFWW72.js.map
