"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index_es = require("../../../inherits-browser/dist/index.es.js");
const index_esm$1 = require("../../../min-dash/dist/index.esm.js");
const BaseRenderer = require("../../../diagram-js/lib/draw/BaseRenderer.js");
const DiUtil = require("../util/DiUtil.js");
const LabelUtil = require("../features/label-editing/LabelUtil.js");
const ModelUtil = require("../util/ModelUtil.js");
const RenderUtil = require("../../../diagram-js/lib/util/RenderUtil.js");
const BpmnRenderUtil = require("./BpmnRenderUtil.js");
const index_esm$3 = require("../../../min-dom/dist/index.esm.js");
const index_esm$2 = require("../../../tiny-svg/dist/index.esm.js");
const SvgTransformUtil = require("../../../diagram-js/lib/util/SvgTransformUtil.js");
const index_esm = require("../../../ids/dist/index.esm.js");
var Ii = new index_esm.default(), V = 10, M = 3, N = 0.95, Ni = 0.35, Hi = 10;
function H(S, W, x, s, q, $, ci) {
  BaseRenderer.default.call(this, W, ci);
  var v = S && S.defaultFillColor, n = S && S.defaultStrokeColor, R = S && S.defaultLabelColor, hi = Ii.next(), z = {}, m = x.computeStyle;
  function _(t, i) {
    var r = index_esm$1.assign({
      fill: BpmnRenderUtil.black,
      strokeWidth: 1,
      strokeLinecap: "round",
      strokeDasharray: "none"
    }, i.attrs), a = i.ref || { x: 0, y: 0 }, o = i.scale || 1;
    r.strokeDasharray === "none" && (r.strokeDasharray = [1e4, 1]);
    var h = index_esm$2.create("marker");
    index_esm$2.attr(i.element, r), index_esm$2.append(h, i.element), index_esm$2.attr(h, {
      id: t,
      viewBox: "0 0 20 20",
      refX: a.x,
      refY: a.y,
      markerWidth: 20 * o,
      markerHeight: 20 * o,
      orient: "auto"
    });
    var l = index_esm$3.query("defs", q._svg);
    l || (l = index_esm$2.create("defs"), index_esm$2.append(q._svg, l)), index_esm$2.append(l, h), z[t] = h;
  }
  function X(t) {
    return t.replace(/[^0-9a-zA-z]+/g, "_");
  }
  function D(t, i, r) {
    var a = t + "-" + X(i) + "-" + X(r) + "-" + hi;
    return z[a] || si(a, t, i, r), "url(#" + a + ")";
  }
  function si(t, i, r, a) {
    if (i === "sequenceflow-end") {
      var o = index_esm$2.create("path");
      index_esm$2.attr(o, { d: "M 1 5 L 11 10 L 1 15 Z" }), _(t, {
        element: o,
        ref: { x: 11, y: 10 },
        scale: 0.5,
        attrs: {
          fill: a,
          stroke: a
        }
      });
    }
    if (i === "messageflow-start") {
      var h = index_esm$2.create("circle");
      index_esm$2.attr(h, { cx: 6, cy: 6, r: 3.5 }), _(t, {
        element: h,
        attrs: {
          fill: r,
          stroke: a
        },
        ref: { x: 6, y: 6 }
      });
    }
    if (i === "messageflow-end") {
      var l = index_esm$2.create("path");
      index_esm$2.attr(l, { d: "m 1 5 l 0 -3 l 7 3 l -7 3 z" }), _(t, {
        element: l,
        attrs: {
          fill: r,
          stroke: a,
          strokeLinecap: "butt"
        },
        ref: { x: 8.5, y: 5 }
      });
    }
    if (i === "association-start") {
      var f = index_esm$2.create("path");
      index_esm$2.attr(f, { d: "M 11 5 L 1 10 L 11 15" }), _(t, {
        element: f,
        attrs: {
          fill: "none",
          stroke: a,
          strokeWidth: 1.5
        },
        ref: { x: 1, y: 10 },
        scale: 0.5
      });
    }
    if (i === "association-end") {
      var E = index_esm$2.create("path");
      index_esm$2.attr(E, { d: "M 1 5 L 11 10 L 1 15" }), _(t, {
        element: E,
        attrs: {
          fill: "none",
          stroke: a,
          strokeWidth: 1.5
        },
        ref: { x: 12, y: 10 },
        scale: 0.5
      });
    }
    if (i === "conditional-flow-marker") {
      var b = index_esm$2.create("path");
      index_esm$2.attr(b, { d: "M 0 10 L 8 6 L 16 10 L 8 14 Z" }), _(t, {
        element: b,
        attrs: {
          fill: r,
          stroke: a
        },
        ref: { x: -1, y: 10 },
        scale: 0.5
      });
    }
    if (i === "conditional-default-flow-marker") {
      var I = index_esm$2.create("path");
      index_esm$2.attr(I, { d: "M 6 4 L 10 16" }), _(t, {
        element: I,
        attrs: {
          stroke: a
        },
        ref: { x: 0, y: 10 },
        scale: 0.5
      });
    }
  }
  function P(t, i, r, a, o) {
    index_esm$1.isObject(a) && (o = a, a = 0), a = a || 0, o = m(o, {
      stroke: BpmnRenderUtil.black,
      strokeWidth: 2,
      fill: "white"
    }), o.fill === "none" && delete o.fillOpacity;
    var h = i / 2, l = r / 2, f = index_esm$2.create("circle");
    return index_esm$2.attr(f, {
      cx: h,
      cy: l,
      r: Math.round((i + r) / 4 - a)
    }), index_esm$2.attr(f, o), index_esm$2.append(t, f), f;
  }
  function O(t, i, r, a, o, h) {
    index_esm$1.isObject(o) && (h = o, o = 0), o = o || 0, h = m(h, {
      stroke: BpmnRenderUtil.black,
      strokeWidth: 2,
      fill: "white"
    });
    var l = index_esm$2.create("rect");
    return index_esm$2.attr(l, {
      x: o,
      y: o,
      width: i - o * 2,
      height: r - o * 2,
      rx: a,
      ry: a
    }), index_esm$2.attr(l, h), index_esm$2.append(t, l), l;
  }
  function di(t, i, r, a) {
    var o = i / 2, h = r / 2, l = [{ x: o, y: 0 }, { x: i, y: h }, { x: o, y: r }, { x: 0, y: h }], f = l.map(function(b) {
      return b.x + "," + b.y;
    }).join(" ");
    a = m(a, {
      stroke: BpmnRenderUtil.black,
      strokeWidth: 2,
      fill: "white"
    });
    var E = index_esm$2.create("polygon");
    return index_esm$2.attr(E, {
      points: f
    }), index_esm$2.attr(E, a), index_esm$2.append(t, E), E;
  }
  function J(t, i, r) {
    r = m(r, ["no-fill"], {
      stroke: BpmnRenderUtil.black,
      strokeWidth: 2,
      fill: "none"
    });
    var a = RenderUtil.createLine(i, r);
    return index_esm$2.append(t, a), a;
  }
  function e(t, i, r) {
    r = m(r, ["no-fill"], {
      strokeWidth: 2,
      stroke: BpmnRenderUtil.black
    });
    var a = index_esm$2.create("path");
    return index_esm$2.attr(a, { d: i }), index_esm$2.attr(a, r), index_esm$2.append(t, a), a;
  }
  function L(t, i, r, a) {
    return e(i, r, index_esm$1.assign({ "data-marker": t }, a));
  }
  function d(t) {
    return li[t];
  }
  function j(t) {
    return function(i, r) {
      return d(t)(i, r);
    };
  }
  function K(t, i) {
    var r = BpmnRenderUtil.getSemantic(t), a = BpmnRenderUtil.isThrowEvent(r);
    return r.eventDefinitions && r.eventDefinitions.length > 1 ? r.parallelMultiple ? d("bpmn:ParallelMultipleEventDefinition")(i, t, a) : d("bpmn:MultipleEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:MessageEventDefinition") ? d("bpmn:MessageEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:TimerEventDefinition") ? d("bpmn:TimerEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:ConditionalEventDefinition") ? d("bpmn:ConditionalEventDefinition")(i, t) : BpmnRenderUtil.isTypedEvent(r, "bpmn:SignalEventDefinition") ? d("bpmn:SignalEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:EscalationEventDefinition") ? d("bpmn:EscalationEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:LinkEventDefinition") ? d("bpmn:LinkEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:ErrorEventDefinition") ? d("bpmn:ErrorEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:CancelEventDefinition") ? d("bpmn:CancelEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:CompensateEventDefinition") ? d("bpmn:CompensateEventDefinition")(i, t, a) : BpmnRenderUtil.isTypedEvent(r, "bpmn:TerminateEventDefinition") ? d("bpmn:TerminateEventDefinition")(i, t, a) : null;
  }
  function C(t, i, r) {
    r = index_esm$1.assign({
      size: {
        width: 100
      }
    }, r);
    var a = $.createText(i || "", r);
    return index_esm$2.classes(a).add("djs-label"), index_esm$2.append(t, a), a;
  }
  function Z(t, i, r) {
    var a = BpmnRenderUtil.getSemantic(i);
    return C(t, a.name, {
      box: i,
      align: r,
      padding: 5,
      style: {
        fill: BpmnRenderUtil.getLabelColor(i, R, n)
      }
    });
  }
  function ei(t, i) {
    var r = {
      width: 90,
      height: 30,
      x: i.width / 2 + i.x,
      y: i.height / 2 + i.y
    };
    return C(t, LabelUtil.getLabel(i), {
      box: r,
      fitBox: true,
      style: index_esm$1.assign(
        {},
        $.getExternalStyle(),
        {
          fill: BpmnRenderUtil.getLabelColor(i, R, n)
        }
      )
    });
  }
  function Q(t, i, r) {
    var a = C(t, i, {
      box: {
        height: 30,
        width: r.height
      },
      align: "center-middle",
      style: {
        fill: BpmnRenderUtil.getLabelColor(r, R, n)
      }
    }), o = -1 * r.height;
    SvgTransformUtil.transform(a, 0, -o, 270);
  }
  function G(t) {
    for (var i = t.waypoints, r = "m  " + i[0].x + "," + i[0].y, a = 1; a < i.length; a++)
      r += "L" + i[a].x + "," + i[a].y + " ";
    return r;
  }
  var li = this.handlers = {
    "bpmn:Event": function(t, i, r) {
      return "fillOpacity" in r || (r.fillOpacity = N), P(t, i.width, i.height, r);
    },
    "bpmn:StartEvent": function(t, i) {
      var r = {
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, a = BpmnRenderUtil.getSemantic(i);
      a.isInterrupting || (r = {
        strokeDasharray: "6",
        strokeLinecap: "round",
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var o = d("bpmn:Event")(t, i, r);
      return K(i, t), o;
    },
    "bpmn:MessageEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_MESSAGE", {
        xScaleFactor: 0.9,
        yScaleFactor: 0.9,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.235,
          my: 0.315
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : BpmnRenderUtil.getFillColor(i, v), h = r ? BpmnRenderUtil.getFillColor(i, v) : BpmnRenderUtil.getStrokeColor(i, n), l = e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: h
      });
      return l;
    },
    "bpmn:TimerEventDefinition": function(t, i) {
      var r = P(t, i.width, i.height, 0.2 * i.height, {
        strokeWidth: 2,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), a = s.getScaledPath("EVENT_TIMER_WH", {
        xScaleFactor: 0.75,
        yScaleFactor: 0.75,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.5,
          my: 0.5
        }
      });
      e(t, a, {
        strokeWidth: 2,
        strokeLinecap: "square",
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      for (var o = 0; o < 12; o++) {
        var h = s.getScaledPath("EVENT_TIMER_LINE", {
          xScaleFactor: 0.75,
          yScaleFactor: 0.75,
          containerWidth: i.width,
          containerHeight: i.height,
          position: {
            mx: 0.5,
            my: 0.5
          }
        }), l = i.width / 2, f = i.height / 2;
        e(t, h, {
          strokeWidth: 1,
          strokeLinecap: "square",
          transform: "rotate(" + o * 30 + "," + f + "," + l + ")",
          stroke: BpmnRenderUtil.getStrokeColor(i, n)
        });
      }
      return r;
    },
    "bpmn:EscalationEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_ESCALATION", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.5,
          my: 0.2
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:ConditionalEventDefinition": function(t, i) {
      var r = s.getScaledPath("EVENT_CONDITIONAL", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.5,
          my: 0.222
        }
      });
      return e(t, r, {
        strokeWidth: 1,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:LinkEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_LINK", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.57,
          my: 0.263
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:ErrorEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_ERROR", {
        xScaleFactor: 1.1,
        yScaleFactor: 1.1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.2,
          my: 0.722
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:CancelEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_CANCEL_45", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.638,
          my: -0.055
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none", h = e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return SvgTransformUtil.rotate(h, 45), h;
    },
    "bpmn:CompensateEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_COMPENSATION", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.22,
          my: 0.5
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:SignalEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_SIGNAL", {
        xScaleFactor: 0.9,
        yScaleFactor: 0.9,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.5,
          my: 0.2
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:MultipleEventDefinition": function(t, i, r) {
      var a = s.getScaledPath("EVENT_MULTIPLE", {
        xScaleFactor: 1.1,
        yScaleFactor: 1.1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.222,
          my: 0.36
        }
      }), o = r ? BpmnRenderUtil.getStrokeColor(i, n) : "none";
      return e(t, a, {
        strokeWidth: 1,
        fill: o
      });
    },
    "bpmn:ParallelMultipleEventDefinition": function(t, i) {
      var r = s.getScaledPath("EVENT_PARALLEL_MULTIPLE", {
        xScaleFactor: 1.2,
        yScaleFactor: 1.2,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.458,
          my: 0.194
        }
      });
      return e(t, r, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    "bpmn:EndEvent": function(t, i) {
      var r = d("bpmn:Event")(t, i, {
        strokeWidth: 4,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return K(i, t), r;
    },
    "bpmn:TerminateEventDefinition": function(t, i) {
      var r = P(t, i.width, i.height, 8, {
        strokeWidth: 4,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return r;
    },
    "bpmn:IntermediateEvent": function(t, i) {
      var r = d("bpmn:Event")(t, i, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return P(t, i.width, i.height, M, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, "none"),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), K(i, t), r;
    },
    "bpmn:IntermediateCatchEvent": j("bpmn:IntermediateEvent"),
    "bpmn:IntermediateThrowEvent": j("bpmn:IntermediateEvent"),
    "bpmn:Activity": function(t, i, r) {
      return r = r || {}, "fillOpacity" in r || (r.fillOpacity = N), O(t, i.width, i.height, V, r);
    },
    "bpmn:Task": function(t, i) {
      var r = {
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, a = d("bpmn:Activity")(t, i, r);
      return Z(t, i, "center-middle"), U(t, i), a;
    },
    "bpmn:ServiceTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = s.getScaledPath("TASK_TYPE_SERVICE", {
        abspos: {
          x: 12,
          y: 18
        }
      });
      e(t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var o = s.getScaledPath("TASK_TYPE_SERVICE_FILL", {
        abspos: {
          x: 17.2,
          y: 18
        }
      });
      e(t, o, {
        strokeWidth: 0,
        fill: BpmnRenderUtil.getFillColor(i, v)
      });
      var h = s.getScaledPath("TASK_TYPE_SERVICE", {
        abspos: {
          x: 17,
          y: 22
        }
      });
      return e(t, h, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:UserTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = 15, o = 12, h = s.getScaledPath("TASK_TYPE_USER_1", {
        abspos: {
          x: a,
          y: o
        }
      });
      e(t, h, {
        strokeWidth: 0.5,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var l = s.getScaledPath("TASK_TYPE_USER_2", {
        abspos: {
          x: a,
          y: o
        }
      });
      e(t, l, {
        strokeWidth: 0.5,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var f = s.getScaledPath("TASK_TYPE_USER_3", {
        abspos: {
          x: a,
          y: o
        }
      });
      return e(t, f, {
        strokeWidth: 0.5,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:ManualTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = s.getScaledPath("TASK_TYPE_MANUAL", {
        abspos: {
          x: 17,
          y: 15
        }
      });
      return e(t, a, {
        strokeWidth: 0.5,
        // 0.25,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:SendTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = s.getScaledPath("TASK_TYPE_SEND", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: 21,
        containerHeight: 14,
        position: {
          mx: 0.285,
          my: 0.357
        }
      });
      return e(t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getFillColor(i, v)
      }), r;
    },
    "bpmn:ReceiveTask": function(t, i) {
      var r = BpmnRenderUtil.getSemantic(i), a = d("bpmn:Task")(t, i), o;
      return r.instantiate ? (P(t, 28, 28, 20 * 0.22, { strokeWidth: 1 }), o = s.getScaledPath("TASK_TYPE_INSTANTIATING_SEND", {
        abspos: {
          x: 7.77,
          y: 9.52
        }
      })) : o = s.getScaledPath("TASK_TYPE_SEND", {
        xScaleFactor: 0.9,
        yScaleFactor: 0.9,
        containerWidth: 21,
        containerHeight: 14,
        position: {
          mx: 0.3,
          my: 0.4
        }
      }), e(t, o, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), a;
    },
    "bpmn:ScriptTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = s.getScaledPath("TASK_TYPE_SCRIPT", {
        abspos: {
          x: 15,
          y: 20
        }
      });
      return e(t, a, {
        strokeWidth: 1,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:BusinessRuleTask": function(t, i) {
      var r = d("bpmn:Task")(t, i), a = s.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER", {
        abspos: {
          x: 8,
          y: 8
        }
      }), o = e(t, a);
      index_esm$2.attr(o, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, "#aaaaaa"),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var h = s.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN", {
        abspos: {
          x: 8,
          y: 8
        }
      }), l = e(t, h);
      return index_esm$2.attr(l, {
        strokeWidth: 1,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:SubProcess": function(t, i, r) {
      r = index_esm$1.assign({
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, r);
      var a = d("bpmn:Activity")(t, i, r), o = DiUtil.isExpanded(i);
      return DiUtil.isEventSubProcess(i) && index_esm$2.attr(a, {
        strokeDasharray: "1,2"
      }), Z(t, i, o ? "center-top" : "center-middle"), o ? U(t, i) : U(t, i, ["SubProcessMarker"]), a;
    },
    "bpmn:AdHocSubProcess": function(t, i) {
      return d("bpmn:SubProcess")(t, i);
    },
    "bpmn:Transaction": function(t, i) {
      var r = d("bpmn:SubProcess")(t, i), a = x.style(["no-fill", "no-events"], {
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return O(t, i.width, i.height, V - 2, M, a), r;
    },
    "bpmn:CallActivity": function(t, i) {
      return d("bpmn:SubProcess")(t, i, {
        strokeWidth: 5
      });
    },
    "bpmn:Participant": function(t, i) {
      var r = {
        fillOpacity: N,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, a = d("bpmn:Lane")(t, i, r), o = DiUtil.isExpanded(i);
      if (o) {
        J(t, [
          { x: 30, y: 0 },
          { x: 30, y: i.height }
        ], {
          stroke: BpmnRenderUtil.getStrokeColor(i, n)
        });
        var h = BpmnRenderUtil.getSemantic(i).name;
        Q(t, h, i);
      } else {
        var l = BpmnRenderUtil.getSemantic(i).name;
        C(t, l, {
          box: i,
          align: "center-middle",
          style: {
            fill: BpmnRenderUtil.getLabelColor(i, R, n)
          }
        });
      }
      var f = !!BpmnRenderUtil.getSemantic(i).participantMultiplicity;
      return f && d("ParticipantMultiplicityMarker")(t, i), a;
    },
    "bpmn:Lane": function(t, i, r) {
      var a = O(t, i.width, i.height, 0, index_esm$1.assign({
        fill: BpmnRenderUtil.getFillColor(i, v),
        fillOpacity: Ni,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, r)), o = BpmnRenderUtil.getSemantic(i);
      if (o.$type === "bpmn:Lane") {
        var h = o.name;
        Q(t, h, i);
      }
      return a;
    },
    "bpmn:InclusiveGateway": function(t, i) {
      var r = d("bpmn:Gateway")(t, i);
      return P(t, i.width, i.height, i.height * 0.24, {
        strokeWidth: 2.5,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:ExclusiveGateway": function(t, i) {
      var r = d("bpmn:Gateway")(t, i), a = s.getScaledPath("GATEWAY_EXCLUSIVE", {
        xScaleFactor: 0.4,
        yScaleFactor: 0.4,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.32,
          my: 0.3
        }
      });
      return ModelUtil.getDi(i).isMarkerVisible && e(t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:ComplexGateway": function(t, i) {
      var r = d("bpmn:Gateway")(t, i), a = s.getScaledPath("GATEWAY_COMPLEX", {
        xScaleFactor: 0.5,
        yScaleFactor: 0.5,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.46,
          my: 0.26
        }
      });
      return e(t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:ParallelGateway": function(t, i) {
      var r = d("bpmn:Gateway")(t, i), a = s.getScaledPath("GATEWAY_PARALLEL", {
        xScaleFactor: 0.6,
        yScaleFactor: 0.6,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.46,
          my: 0.2
        }
      });
      return e(t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), r;
    },
    "bpmn:EventBasedGateway": function(t, i) {
      var r = BpmnRenderUtil.getSemantic(i), a = d("bpmn:Gateway")(t, i);
      P(t, i.width, i.height, i.height * 0.2, {
        strokeWidth: 1,
        fill: "none",
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var o = r.eventGatewayType, h = !!r.instantiate;
      function l() {
        var I = s.getScaledPath("GATEWAY_EVENT_BASED", {
          xScaleFactor: 0.18,
          yScaleFactor: 0.18,
          containerWidth: i.width,
          containerHeight: i.height,
          position: {
            mx: 0.36,
            my: 0.44
          }
        }), F = {
          strokeWidth: 2,
          fill: BpmnRenderUtil.getFillColor(i, "none"),
          stroke: BpmnRenderUtil.getStrokeColor(i, n)
        };
        e(t, I, F);
      }
      if (o === "Parallel") {
        var f = s.getScaledPath("GATEWAY_PARALLEL", {
          xScaleFactor: 0.4,
          yScaleFactor: 0.4,
          containerWidth: i.width,
          containerHeight: i.height,
          position: {
            mx: 0.474,
            my: 0.296
          }
        }), E = e(t, f);
        index_esm$2.attr(E, {
          strokeWidth: 1,
          fill: "none"
        });
      } else if (o === "Exclusive") {
        if (!h) {
          var b = P(t, i.width, i.height, i.height * 0.26);
          index_esm$2.attr(b, {
            strokeWidth: 1,
            fill: "none",
            stroke: BpmnRenderUtil.getStrokeColor(i, n)
          });
        }
        l();
      }
      return a;
    },
    "bpmn:Gateway": function(t, i) {
      var r = {
        fill: BpmnRenderUtil.getFillColor(i, v),
        fillOpacity: N,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      };
      return di(t, i.width, i.height, r);
    },
    "bpmn:SequenceFlow": function(t, i) {
      var r = G(i), a = BpmnRenderUtil.getFillColor(i, v), o = BpmnRenderUtil.getStrokeColor(i, n), h = {
        strokeLinejoin: "round",
        markerEnd: D("sequenceflow-end", a, o),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, l = e(t, r, h), f = BpmnRenderUtil.getSemantic(i), E;
      return i.source && (E = i.source.businessObject, f.conditionExpression && E.$instanceOf("bpmn:Activity") && index_esm$2.attr(l, {
        markerStart: D("conditional-flow-marker", a, o)
      }), E.default && (E.$instanceOf("bpmn:Gateway") || E.$instanceOf("bpmn:Activity")) && E.default === f && index_esm$2.attr(l, {
        markerStart: D("conditional-default-flow-marker", a, o)
      })), l;
    },
    "bpmn:Association": function(t, i, r) {
      var a = BpmnRenderUtil.getSemantic(i), o = BpmnRenderUtil.getFillColor(i, v), h = BpmnRenderUtil.getStrokeColor(i, n);
      return r = index_esm$1.assign({
        strokeDasharray: "0.5, 5",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, r || {}), (a.associationDirection === "One" || a.associationDirection === "Both") && (r.markerEnd = D("association-end", o, h)), a.associationDirection === "Both" && (r.markerStart = D("association-start", o, h)), J(t, i.waypoints, r);
    },
    "bpmn:DataInputAssociation": function(t, i) {
      var r = BpmnRenderUtil.getFillColor(i, v), a = BpmnRenderUtil.getStrokeColor(i, n);
      return d("bpmn:Association")(t, i, {
        markerEnd: D("association-end", r, a)
      });
    },
    "bpmn:DataOutputAssociation": function(t, i) {
      var r = BpmnRenderUtil.getFillColor(i, v), a = BpmnRenderUtil.getStrokeColor(i, n);
      return d("bpmn:Association")(t, i, {
        markerEnd: D("association-end", r, a)
      });
    },
    "bpmn:MessageFlow": function(t, i) {
      var r = BpmnRenderUtil.getSemantic(i), a = ModelUtil.getDi(i), o = BpmnRenderUtil.getFillColor(i, v), h = BpmnRenderUtil.getStrokeColor(i, n), l = G(i), f = {
        markerEnd: D("messageflow-end", o, h),
        markerStart: D("messageflow-start", o, h),
        strokeDasharray: "10, 12",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5px",
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }, E = e(t, l, f);
      if (r.messageRef) {
        var b = E.getPointAtLength(E.getTotalLength() / 2), I = s.getScaledPath("MESSAGE_FLOW_MARKER", {
          abspos: {
            x: b.x,
            y: b.y
          }
        }), F = { strokeWidth: 1 };
        a.messageVisibleKind === "initiating" ? (F.fill = "white", F.stroke = BpmnRenderUtil.black) : (F.fill = "#888", F.stroke = "white");
        var vi = e(t, I, F), fi = r.messageRef.name, ii = C(t, fi, {
          align: "center-top",
          fitBox: true,
          style: {
            fill: BpmnRenderUtil.getStrokeColor(i, R)
          }
        }), ki = vi.getBBox(), Ei = ii.getBBox(), Si = b.x - Ei.width / 2, gi = b.y + ki.height / 2 + Hi;
        SvgTransformUtil.transform(ii, Si, gi, 0);
      }
      return E;
    },
    "bpmn:DataObject": function(t, i) {
      var r = s.getScaledPath("DATA_OBJECT_PATH", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0.474,
          my: 0.296
        }
      }), a = e(t, r, {
        fill: BpmnRenderUtil.getFillColor(i, v),
        fillOpacity: N,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      }), o = BpmnRenderUtil.getSemantic(i);
      return BpmnRenderUtil.isCollection(o) && ui(t, i), a;
    },
    "bpmn:DataObjectReference": j("bpmn:DataObject"),
    "bpmn:DataInput": function(t, i) {
      var r = s.getRawPath("DATA_ARROW"), a = d("bpmn:DataObject")(t, i);
      return e(t, r, { strokeWidth: 1 }), a;
    },
    "bpmn:DataOutput": function(t, i) {
      var r = s.getRawPath("DATA_ARROW"), a = d("bpmn:DataObject")(t, i);
      return e(t, r, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.black
      }), a;
    },
    "bpmn:DataStoreReference": function(t, i) {
      var r = s.getScaledPath("DATA_STORE", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0,
          my: 0.133
        }
      }), a = e(t, r, {
        strokeWidth: 2,
        fill: BpmnRenderUtil.getFillColor(i, v),
        fillOpacity: N,
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      return a;
    },
    "bpmn:BoundaryEvent": function(t, i) {
      var r = BpmnRenderUtil.getSemantic(i), a = r.cancelActivity, o = {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      };
      a || (o.strokeDasharray = "6", o.strokeLinecap = "round");
      var h = index_esm$1.assign({}, o, {
        fillOpacity: 1
      }), l = index_esm$1.assign({}, o, {
        fill: "none"
      }), f = d("bpmn:Event")(t, i, h);
      return P(t, i.width, i.height, M, l), K(i, t), f;
    },
    "bpmn:Group": function(t, i) {
      var r = O(t, i.width, i.height, V, {
        stroke: BpmnRenderUtil.getStrokeColor(i, n),
        strokeWidth: 1,
        strokeDasharray: "8,3,1,3",
        fill: "none",
        pointerEvents: "none"
      });
      return r;
    },
    label: function(t, i) {
      return ei(t, i);
    },
    "bpmn:TextAnnotation": function(t, i) {
      var r = {
        fill: "none",
        stroke: "none"
      }, a = O(t, i.width, i.height, 0, 0, r), o = s.getScaledPath("TEXT_ANNOTATION", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: 0,
          my: 0
        }
      });
      e(t, o, {
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      var h = BpmnRenderUtil.getSemantic(i).text || "";
      return C(t, h, {
        box: i,
        align: "left-top",
        padding: 5,
        style: {
          fill: BpmnRenderUtil.getLabelColor(i, R, n)
        }
      }), a;
    },
    ParticipantMultiplicityMarker: function(t, i) {
      var r = s.getScaledPath("MARKER_PARALLEL", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: i.width / 2 / i.width,
          my: (i.height - 15) / i.height
        }
      });
      L("participant-multiplicity", t, r, {
        strokeWidth: 2,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    SubProcessMarker: function(t, i) {
      var r = O(t, 14, 14, 0, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
      SvgTransformUtil.translate(r, i.width / 2 - 7.5, i.height - 20);
      var a = s.getScaledPath("MARKER_SUB_PROCESS", {
        xScaleFactor: 1.5,
        yScaleFactor: 1.5,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 - 7.5) / i.width,
          my: (i.height - 20) / i.height
        }
      });
      L("sub-process", t, a, {
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    ParallelMarker: function(t, i, r) {
      var a = s.getScaledPath("MARKER_PARALLEL", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 + r.parallel) / i.width,
          my: (i.height - 20) / i.height
        }
      });
      L("parallel", t, a, {
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    SequentialMarker: function(t, i, r) {
      var a = s.getScaledPath("MARKER_SEQUENTIAL", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 + r.seq) / i.width,
          my: (i.height - 19) / i.height
        }
      });
      L("sequential", t, a, {
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    CompensationMarker: function(t, i, r) {
      var a = s.getScaledPath("MARKER_COMPENSATION", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 + r.compensation) / i.width,
          my: (i.height - 13) / i.height
        }
      });
      L("compensation", t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    },
    LoopMarker: function(t, i, r) {
      var a = s.getScaledPath("MARKER_LOOP", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 + r.loop) / i.width,
          my: (i.height - 7) / i.height
        }
      });
      L("loop", t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getFillColor(i, v),
        stroke: BpmnRenderUtil.getStrokeColor(i, n),
        strokeLinecap: "round",
        strokeMiterlimit: 0.5
      });
    },
    AdhocMarker: function(t, i, r) {
      var a = s.getScaledPath("MARKER_ADHOC", {
        xScaleFactor: 1,
        yScaleFactor: 1,
        containerWidth: i.width,
        containerHeight: i.height,
        position: {
          mx: (i.width / 2 + r.adhoc) / i.width,
          my: (i.height - 15) / i.height
        }
      });
      L("adhoc", t, a, {
        strokeWidth: 1,
        fill: BpmnRenderUtil.getStrokeColor(i, n),
        stroke: BpmnRenderUtil.getStrokeColor(i, n)
      });
    }
  };
  function U(t, i, r) {
    var a = BpmnRenderUtil.getSemantic(i), o = r && r.indexOf("SubProcessMarker") !== -1, h;
    o ? h = {
      seq: -21,
      parallel: -22,
      compensation: -42,
      loop: -18,
      adhoc: 10
    } : h = {
      seq: -3,
      parallel: -6,
      compensation: -27,
      loop: 0,
      adhoc: 10
    }, index_esm$1.forEach(r, function(E) {
      d(E)(t, i, h);
    }), a.isForCompensation && d("CompensationMarker")(t, i, h), a.$type === "bpmn:AdHocSubProcess" && d("AdhocMarker")(t, i, h);
    var l = a.loopCharacteristics, f = l && l.isSequential;
    l && (f === void 0 && d("LoopMarker")(t, i, h), f === false && d("ParallelMarker")(t, i, h), f === true && d("SequentialMarker")(t, i, h));
  }
  function ui(t, i) {
    var r = (i.height - 18) / i.height, a = s.getScaledPath("DATA_OBJECT_COLLECTION_PATH", {
      xScaleFactor: 1,
      yScaleFactor: 1,
      containerWidth: i.width,
      containerHeight: i.height,
      position: {
        mx: 0.33,
        my: r
      }
    });
    e(t, a, {
      strokeWidth: 2
    });
  }
  this._drawPath = e, this._renderer = d;
}
index_es.default(H, BaseRenderer.default);
H.$inject = [
  "config.bpmnRenderer",
  "eventBus",
  "styles",
  "pathMap",
  "canvas",
  "textRenderer"
];
H.prototype.canRender = function(S) {
  return ModelUtil.is(S, "bpmn:BaseElement");
};
H.prototype.drawShape = function(S, W) {
  var x = W.type, s = this._renderer(x);
  return s(S, W);
};
H.prototype.drawConnection = function(S, W) {
  var x = W.type, s = this._renderer(x);
  return s(S, W);
};
H.prototype.getShapePath = function(S) {
  return ModelUtil.is(S, "bpmn:Event") ? BpmnRenderUtil.getCirclePath(S) : ModelUtil.is(S, "bpmn:Activity") ? BpmnRenderUtil.getRoundRectPath(S, V) : ModelUtil.is(S, "bpmn:Gateway") ? BpmnRenderUtil.getDiamondPath(S) : BpmnRenderUtil.getRectPath(S);
};
exports.default = H;
