"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index_es = require("../../../inherits-browser/dist/index.es.js");
const BaseRenderer = require("./BaseRenderer.js");
const RenderUtil = require("../util/RenderUtil.js");
const index_esm = require("../../../tiny-svg/dist/index.esm.js");
const index_esm$1 = require("../../../min-dash/dist/index.esm.js");
const Elements = require("../util/Elements.js");
var m = 1;
function i(n, e) {
  BaseRenderer.default.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 });
}
index_es.default(i, BaseRenderer.default);
i.prototype.canRender = function() {
  return true;
};
i.prototype.drawShape = function(e, o, r) {
  var t = index_esm.create("rect");
  return index_esm.attr(t, {
    x: 0,
    y: 0,
    width: o.width || 0,
    height: o.height || 0
  }), Elements.isFrameElement(o) ? index_esm.attr(t, index_esm$1.assign({}, this.FRAME_STYLE, r || {})) : index_esm.attr(t, index_esm$1.assign({}, this.SHAPE_STYLE, r || {})), index_esm.append(e, t), t;
};
i.prototype.drawConnection = function(e, o, r) {
  var t = RenderUtil.createLine(o.waypoints, index_esm$1.assign({}, this.CONNECTION_STYLE, r || {}));
  return index_esm.append(e, t), t;
};
i.prototype.getShapePath = function(e) {
  var o = e.x, r = e.y, t = e.width, a = e.height, u = [
    ["M", o, r],
    ["l", t, 0],
    ["l", 0, a],
    ["l", -t, 0],
    ["z"]
  ];
  return RenderUtil.componentsToPath(u);
};
i.prototype.getConnectionPath = function(e) {
  var o = e.waypoints, r, t, a = [];
  for (r = 0; t = o[r]; r++)
    t = t.original || t, a.push([r === 0 ? "M" : "L", t.x, t.y]);
  return RenderUtil.componentsToPath(a);
};
i.$inject = ["eventBus", "styles"];
exports.default = i;
