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