import t from "../../../inherits-browser/dist/index.es.mjs";
import t$1 from "./BaseRenderer.mjs";
import { createLine as f, componentsToPath as c } from "../util/RenderUtil.mjs";
import { create as M, attr as N, append as _ } from "../../../tiny-svg/dist/index.esm.mjs";
import { assign as q } from "../../../min-dash/dist/index.esm.mjs";
import { isFrameElement as v } from "../util/Elements.mjs";
var m = 1;
function i(n, e) {
  t$1.call(this, n, m), this.CONNECTION_STYLE = e.style(["no-fill"], { strokeWidth: 5, stroke: "fuchsia" }), this.SHAPE_STYLE = e.style({ fill: "white", stroke: "fuchsia", strokeWidth: 2 }), this.FRAME_STYLE = e.style(["no-fill"], { stroke: "fuchsia", strokeDasharray: 4, strokeWidth: 2 });
}
t(i, t$1);
i.prototype.canRender = function() {
  return true;
};
i.prototype.drawShape = function(e, o, r) {
  var t2 = M("rect");
  return N(t2, {
    x: 0,
    y: 0,
    width: o.width || 0,
    height: o.height || 0
  }), v(o) ? N(t2, q({}, this.FRAME_STYLE, r || {})) : N(t2, q({}, this.SHAPE_STYLE, r || {})), _(e, t2), t2;
};
i.prototype.drawConnection = function(e, o, r) {
  var t2 = f(o.waypoints, q({}, this.CONNECTION_STYLE, r || {}));
  return _(e, t2), t2;
};
i.prototype.getShapePath = function(e) {
  var o = e.x, r = e.y, t2 = e.width, a = e.height, u = [
    ["M", o, r],
    ["l", t2, 0],
    ["l", 0, a],
    ["l", -t2, 0],
    ["z"]
  ];
  return c(u);
};
i.prototype.getConnectionPath = function(e) {
  var o = e.waypoints, r, t2, a = [];
  for (r = 0; t2 = o[r]; r++)
    t2 = t2.original || t2, a.push([r === 0 ? "M" : "L", t2.x, t2.y]);
  return c(a);
};
i.$inject = ["eventBus", "styles"];
export {
  i as default
};
