import { getBBox as g } from "../../util/Elements.mjs";
import { create as M, attr as N, append as _ } from "../../../../tiny-svg/dist/index.esm.mjs";
import { query as K } from "../../../../min-dom/dist/index.esm.mjs";
import { assign as q } from "../../../../min-dash/dist/index.esm.mjs";
var x = 500;
function r(n, o, f) {
  this.offset = 6;
  var l = o.cls("djs-outline", ["no-fill"]), a = this;
  function u(e, s) {
    var t = M("rect");
    return N(t, q({
      x: 10,
      y: 10,
      rx: 3,
      width: 100,
      height: 100
    }, l)), _(e, t), t;
  }
  n.on(["shape.added", "shape.changed"], x, function(e) {
    var s = e.element, t = e.gfx, i = K(".djs-outline", t);
    i || (i = u(t)), a.updateShapeOutline(i, s);
  }), n.on(["connection.added", "connection.changed"], function(e) {
    var s = e.element, t = e.gfx, i = K(".djs-outline", t);
    i || (i = u(t)), a.updateConnectionOutline(i, s);
  });
}
r.prototype.updateShapeOutline = function(n, o) {
  N(n, {
    x: -this.offset,
    y: -this.offset,
    width: o.width + this.offset * 2,
    height: o.height + this.offset * 2
  });
};
r.prototype.updateConnectionOutline = function(n, o) {
  var f = g(o);
  N(n, {
    x: f.x - this.offset,
    y: f.y - this.offset,
    width: f.width + this.offset * 2,
    height: f.height + this.offset * 2
  });
};
r.$inject = ["eventBus", "styles", "elementRegistry"];
export {
  r as default
};
