chunk-PK6SUIG5.js 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985
  1. import {
  2. query
  3. } from "./chunk-XZ2PVW7M.js";
  4. import {
  5. e
  6. } from "./chunk-6C2KFJ7V.js";
  7. import {
  8. getLabel
  9. } from "./chunk-PSXVIVF4.js";
  10. import {
  11. black,
  12. createLine,
  13. getBounds,
  14. getCirclePath,
  15. getDiamondPath,
  16. getFillColor,
  17. getHeight,
  18. getLabelColor,
  19. getRectPath,
  20. getRoundRectPath,
  21. getStrokeColor,
  22. getWidth,
  23. isCollection,
  24. isThrowEvent,
  25. isTypedEvent
  26. } from "./chunk-LSRYXWJD.js";
  27. import {
  28. append,
  29. attr,
  30. classes,
  31. create,
  32. createTransform,
  33. transform
  34. } from "./chunk-IQOBXLIK.js";
  35. import {
  36. isEventSubProcess,
  37. isExpanded,
  38. isHorizontal
  39. } from "./chunk-ZH5JUQV2.js";
  40. import {
  41. getBusinessObject,
  42. getDi,
  43. is
  44. } from "./chunk-L5SG54UC.js";
  45. import {
  46. assign,
  47. forEach,
  48. isObject
  49. } from "./chunk-4AK4GF4H.js";
  50. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/draw/BaseRenderer.js
  51. var DEFAULT_RENDER_PRIORITY = 1e3;
  52. function BaseRenderer(eventBus, renderPriority) {
  53. var self = this;
  54. renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY;
  55. eventBus.on(["render.shape", "render.connection"], renderPriority, function(evt, context) {
  56. var type = evt.type, element = context.element, visuals = context.gfx, attrs = context.attrs;
  57. if (self.canRender(element)) {
  58. if (type === "render.shape") {
  59. return self.drawShape(visuals, element, attrs);
  60. } else {
  61. return self.drawConnection(visuals, element, attrs);
  62. }
  63. }
  64. });
  65. eventBus.on(["render.getShapePath", "render.getConnectionPath"], renderPriority, function(evt, element) {
  66. if (self.canRender(element)) {
  67. if (evt.type === "render.getShapePath") {
  68. return self.getShapePath(element);
  69. } else {
  70. return self.getConnectionPath(element);
  71. }
  72. }
  73. });
  74. }
  75. BaseRenderer.prototype.canRender = function(element) {
  76. };
  77. BaseRenderer.prototype.drawShape = function(visuals, shape) {
  78. };
  79. BaseRenderer.prototype.drawConnection = function(visuals, connection) {
  80. };
  81. BaseRenderer.prototype.getShapePath = function(shape) {
  82. };
  83. BaseRenderer.prototype.getConnectionPath = function(connection) {
  84. };
  85. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/SvgTransformUtil.js
  86. function transform2(gfx, x, y, angle, amount) {
  87. var translate2 = createTransform();
  88. translate2.setTranslate(x, y);
  89. var rotate2 = createTransform();
  90. rotate2.setRotate(angle || 0, 0, 0);
  91. var scale = createTransform();
  92. scale.setScale(amount || 1, amount || 1);
  93. transform(gfx, [translate2, rotate2, scale]);
  94. }
  95. function translate(gfx, x, y) {
  96. var translate2 = createTransform();
  97. translate2.setTranslate(x, y);
  98. transform(gfx, translate2);
  99. }
  100. function rotate(gfx, angle) {
  101. var rotate2 = createTransform();
  102. rotate2.setRotate(angle, 0, 0);
  103. transform(gfx, rotate2);
  104. }
  105. // node_modules/.pnpm/ids@1.0.5/node_modules/ids/dist/index.esm.js
  106. function createCommonjsModule(fn, module) {
  107. return module = { exports: {} }, fn(module, module.exports), module.exports;
  108. }
  109. var hat_1 = createCommonjsModule(function(module) {
  110. var hat = module.exports = function(bits, base) {
  111. if (!base)
  112. base = 16;
  113. if (bits === void 0)
  114. bits = 128;
  115. if (bits <= 0)
  116. return "0";
  117. var digits = Math.log(Math.pow(2, bits)) / Math.log(base);
  118. for (var i = 2; digits === Infinity; i *= 2) {
  119. digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;
  120. }
  121. var rem = digits - Math.floor(digits);
  122. var res = "";
  123. for (var i = 0; i < Math.floor(digits); i++) {
  124. var x = Math.floor(Math.random() * base).toString(base);
  125. res = x + res;
  126. }
  127. if (rem) {
  128. var b = Math.pow(base, rem);
  129. var x = Math.floor(Math.random() * b).toString(base);
  130. res = x + res;
  131. }
  132. var parsed = parseInt(res, base);
  133. if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {
  134. return hat(bits, base);
  135. } else
  136. return res;
  137. };
  138. hat.rack = function(bits, base, expandBy) {
  139. var fn = function(data) {
  140. var iters = 0;
  141. do {
  142. if (iters++ > 10) {
  143. if (expandBy)
  144. bits += expandBy;
  145. else
  146. throw new Error("too many ID collisions, use more bits");
  147. }
  148. var id = hat(bits, base);
  149. } while (Object.hasOwnProperty.call(hats, id));
  150. hats[id] = data;
  151. return id;
  152. };
  153. var hats = fn.hats = {};
  154. fn.get = function(id) {
  155. return fn.hats[id];
  156. };
  157. fn.set = function(id, value) {
  158. fn.hats[id] = value;
  159. return fn;
  160. };
  161. fn.bits = bits || 128;
  162. fn.base = base || 16;
  163. return fn;
  164. };
  165. });
  166. function Ids(seed) {
  167. if (!(this instanceof Ids)) {
  168. return new Ids(seed);
  169. }
  170. seed = seed || [128, 36, 1];
  171. this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
  172. }
  173. Ids.prototype.next = function(element) {
  174. return this._seed(element || true);
  175. };
  176. Ids.prototype.nextPrefixed = function(prefix, element) {
  177. var id;
  178. do {
  179. id = prefix + this.next(true);
  180. } while (this.assigned(id));
  181. this.claim(id, element);
  182. return id;
  183. };
  184. Ids.prototype.claim = function(id, element) {
  185. this._seed.set(id, element || true);
  186. };
  187. Ids.prototype.assigned = function(id) {
  188. return this._seed.get(id) || false;
  189. };
  190. Ids.prototype.unclaim = function(id) {
  191. delete this._seed.hats[id];
  192. };
  193. Ids.prototype.clear = function() {
  194. var hats = this._seed.hats, id;
  195. for (id in hats) {
  196. this.unclaim(id);
  197. }
  198. };
  199. var index_esm_default = Ids;
  200. // node_modules/.pnpm/bpmn-js@16.3.2/node_modules/bpmn-js/lib/draw/BpmnRenderer.js
  201. var rendererIds = new index_esm_default();
  202. var ELEMENT_LABEL_DISTANCE = 10;
  203. var INNER_OUTER_DIST = 3;
  204. var PARTICIPANT_STROKE_WIDTH = 1.5;
  205. var TASK_BORDER_RADIUS = 10;
  206. var DEFAULT_OPACITY = 0.95;
  207. var FULL_OPACITY = 1;
  208. var LOW_OPACITY = 0.25;
  209. function BpmnRenderer(config, eventBus, styles, pathMap, canvas, textRenderer, priority) {
  210. BaseRenderer.call(this, eventBus, priority);
  211. var defaultFillColor = config && config.defaultFillColor, defaultStrokeColor = config && config.defaultStrokeColor, defaultLabelColor = config && config.defaultLabelColor;
  212. var rendererId = rendererIds.next();
  213. var markers = {};
  214. function shapeStyle(attrs) {
  215. return styles.computeStyle(attrs, {
  216. strokeLinecap: "round",
  217. strokeLinejoin: "round",
  218. stroke: black,
  219. strokeWidth: 2,
  220. fill: "white"
  221. });
  222. }
  223. function lineStyle(attrs) {
  224. return styles.computeStyle(attrs, ["no-fill"], {
  225. strokeLinecap: "round",
  226. strokeLinejoin: "round",
  227. stroke: black,
  228. strokeWidth: 2
  229. });
  230. }
  231. function addMarker(id, options) {
  232. var {
  233. ref = { x: 0, y: 0 },
  234. scale = 1,
  235. element
  236. } = options;
  237. var marker2 = create("marker", {
  238. id,
  239. viewBox: "0 0 20 20",
  240. refX: ref.x,
  241. refY: ref.y,
  242. markerWidth: 20 * scale,
  243. markerHeight: 20 * scale,
  244. orient: "auto"
  245. });
  246. append(marker2, element);
  247. var defs = query("defs", canvas._svg);
  248. if (!defs) {
  249. defs = create("defs");
  250. append(canvas._svg, defs);
  251. }
  252. append(defs, marker2);
  253. markers[id] = marker2;
  254. }
  255. function colorEscape(str) {
  256. return str.replace(/[^0-9a-zA-Z]+/g, "_");
  257. }
  258. function marker(type, fill, stroke) {
  259. var id = type + "-" + colorEscape(fill) + "-" + colorEscape(stroke) + "-" + rendererId;
  260. if (!markers[id]) {
  261. createMarker(id, type, fill, stroke);
  262. }
  263. return "url(#" + id + ")";
  264. }
  265. function createMarker(id, type, fill, stroke) {
  266. if (type === "sequenceflow-end") {
  267. var sequenceflowEnd = create("path", {
  268. d: "M 1 5 L 11 10 L 1 15 Z",
  269. ...shapeStyle({
  270. fill: stroke,
  271. stroke,
  272. strokeWidth: 1
  273. })
  274. });
  275. addMarker(id, {
  276. element: sequenceflowEnd,
  277. ref: { x: 11, y: 10 },
  278. scale: 0.5
  279. });
  280. }
  281. if (type === "messageflow-start") {
  282. var messageflowStart = create("circle", {
  283. cx: 6,
  284. cy: 6,
  285. r: 3.5,
  286. ...shapeStyle({
  287. fill,
  288. stroke,
  289. strokeWidth: 1,
  290. // fix for safari / chrome / firefox bug not correctly
  291. // resetting stroke dash array
  292. strokeDasharray: [1e4, 1]
  293. })
  294. });
  295. addMarker(id, {
  296. element: messageflowStart,
  297. ref: { x: 6, y: 6 }
  298. });
  299. }
  300. if (type === "messageflow-end") {
  301. var messageflowEnd = create("path", {
  302. d: "m 1 5 l 0 -3 l 7 3 l -7 3 z",
  303. ...shapeStyle({
  304. fill,
  305. stroke,
  306. strokeWidth: 1,
  307. // fix for safari / chrome / firefox bug not correctly
  308. // resetting stroke dash array
  309. strokeDasharray: [1e4, 1]
  310. })
  311. });
  312. addMarker(id, {
  313. element: messageflowEnd,
  314. ref: { x: 8.5, y: 5 }
  315. });
  316. }
  317. if (type === "association-start") {
  318. var associationStart = create("path", {
  319. d: "M 11 5 L 1 10 L 11 15",
  320. ...lineStyle({
  321. fill: "none",
  322. stroke,
  323. strokeWidth: 1.5,
  324. // fix for safari / chrome / firefox bug not correctly
  325. // resetting stroke dash array
  326. strokeDasharray: [1e4, 1]
  327. })
  328. });
  329. addMarker(id, {
  330. element: associationStart,
  331. ref: { x: 1, y: 10 },
  332. scale: 0.5
  333. });
  334. }
  335. if (type === "association-end") {
  336. var associationEnd = create("path", {
  337. d: "M 1 5 L 11 10 L 1 15",
  338. ...lineStyle({
  339. fill: "none",
  340. stroke,
  341. strokeWidth: 1.5,
  342. // fix for safari / chrome / firefox bug not correctly
  343. // resetting stroke dash array
  344. strokeDasharray: [1e4, 1]
  345. })
  346. });
  347. addMarker(id, {
  348. element: associationEnd,
  349. ref: { x: 11, y: 10 },
  350. scale: 0.5
  351. });
  352. }
  353. if (type === "conditional-flow-marker") {
  354. var conditionalFlowMarker = create("path", {
  355. d: "M 0 10 L 8 6 L 16 10 L 8 14 Z",
  356. ...shapeStyle({
  357. fill,
  358. stroke
  359. })
  360. });
  361. addMarker(id, {
  362. element: conditionalFlowMarker,
  363. ref: { x: -1, y: 10 },
  364. scale: 0.5
  365. });
  366. }
  367. if (type === "conditional-default-flow-marker") {
  368. var defaultFlowMarker = create("path", {
  369. d: "M 6 4 L 10 16",
  370. ...shapeStyle({
  371. stroke
  372. })
  373. });
  374. addMarker(id, {
  375. element: defaultFlowMarker,
  376. ref: { x: 0, y: 10 },
  377. scale: 0.5
  378. });
  379. }
  380. }
  381. function drawCircle(parentGfx, width, height, offset, attrs = {}) {
  382. if (isObject(offset)) {
  383. attrs = offset;
  384. offset = 0;
  385. }
  386. offset = offset || 0;
  387. attrs = shapeStyle(attrs);
  388. var cx = width / 2, cy = height / 2;
  389. var circle = create("circle", {
  390. cx,
  391. cy,
  392. r: Math.round((width + height) / 4 - offset),
  393. ...attrs
  394. });
  395. append(parentGfx, circle);
  396. return circle;
  397. }
  398. function drawRect(parentGfx, width, height, r, offset, attrs) {
  399. if (isObject(offset)) {
  400. attrs = offset;
  401. offset = 0;
  402. }
  403. offset = offset || 0;
  404. attrs = shapeStyle(attrs);
  405. var rect = create("rect", {
  406. x: offset,
  407. y: offset,
  408. width: width - offset * 2,
  409. height: height - offset * 2,
  410. rx: r,
  411. ry: r,
  412. ...attrs
  413. });
  414. append(parentGfx, rect);
  415. return rect;
  416. }
  417. function drawDiamond(parentGfx, width, height, attrs) {
  418. var x_2 = width / 2;
  419. var y_2 = height / 2;
  420. var points = [
  421. { x: x_2, y: 0 },
  422. { x: width, y: y_2 },
  423. { x: x_2, y: height },
  424. { x: 0, y: y_2 }
  425. ];
  426. var pointsString = points.map(function(point) {
  427. return point.x + "," + point.y;
  428. }).join(" ");
  429. attrs = shapeStyle(attrs);
  430. var polygon = create("polygon", {
  431. ...attrs,
  432. points: pointsString
  433. });
  434. append(parentGfx, polygon);
  435. return polygon;
  436. }
  437. function drawLine(parentGfx, waypoints, attrs, radius) {
  438. attrs = lineStyle(attrs);
  439. var line = createLine(waypoints, attrs, radius);
  440. append(parentGfx, line);
  441. return line;
  442. }
  443. function drawConnectionSegments(parentGfx, waypoints, attrs) {
  444. return drawLine(parentGfx, waypoints, attrs, 5);
  445. }
  446. function drawPath(parentGfx, d, attrs) {
  447. attrs = lineStyle(attrs);
  448. var path = create("path", {
  449. ...attrs,
  450. d
  451. });
  452. append(parentGfx, path);
  453. return path;
  454. }
  455. function drawMarker(type, parentGfx, path, attrs) {
  456. return drawPath(parentGfx, path, assign({ "data-marker": type }, attrs));
  457. }
  458. function renderer(type) {
  459. return handlers[type];
  460. }
  461. function as(type) {
  462. return function(parentGfx, element, attrs) {
  463. return renderer(type)(parentGfx, element, attrs);
  464. };
  465. }
  466. var eventIconRenderers = {
  467. "bpmn:MessageEventDefinition": function(parentGfx, element, attrs = {}, isThrowing) {
  468. var pathData = pathMap.getScaledPath("EVENT_MESSAGE", {
  469. xScaleFactor: 0.9,
  470. yScaleFactor: 0.9,
  471. containerWidth: element.width,
  472. containerHeight: element.height,
  473. position: {
  474. mx: 0.235,
  475. my: 0.315
  476. }
  477. });
  478. var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor, attrs.stroke) : getFillColor(element, defaultFillColor, attrs.fill);
  479. var stroke = isThrowing ? getFillColor(element, defaultFillColor, attrs.fill) : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
  480. var messagePath = drawPath(parentGfx, pathData, {
  481. fill,
  482. stroke,
  483. strokeWidth: 1
  484. });
  485. return messagePath;
  486. },
  487. "bpmn:TimerEventDefinition": function(parentGfx, element, attrs = {}) {
  488. var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
  489. fill: getFillColor(element, defaultFillColor, attrs.fill),
  490. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  491. strokeWidth: 2
  492. });
  493. var pathData = pathMap.getScaledPath("EVENT_TIMER_WH", {
  494. xScaleFactor: 0.75,
  495. yScaleFactor: 0.75,
  496. containerWidth: element.width,
  497. containerHeight: element.height,
  498. position: {
  499. mx: 0.5,
  500. my: 0.5
  501. }
  502. });
  503. drawPath(parentGfx, pathData, {
  504. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  505. strokeWidth: 2
  506. });
  507. for (var i = 0; i < 12; i++) {
  508. var linePathData = pathMap.getScaledPath("EVENT_TIMER_LINE", {
  509. xScaleFactor: 0.75,
  510. yScaleFactor: 0.75,
  511. containerWidth: element.width,
  512. containerHeight: element.height,
  513. position: {
  514. mx: 0.5,
  515. my: 0.5
  516. }
  517. });
  518. var width = element.width / 2, height = element.height / 2;
  519. drawPath(parentGfx, linePathData, {
  520. strokeWidth: 1,
  521. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  522. transform: "rotate(" + i * 30 + "," + height + "," + width + ")"
  523. });
  524. }
  525. return circle;
  526. },
  527. "bpmn:EscalationEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  528. var pathData = pathMap.getScaledPath("EVENT_ESCALATION", {
  529. xScaleFactor: 1,
  530. yScaleFactor: 1,
  531. containerWidth: event.width,
  532. containerHeight: event.height,
  533. position: {
  534. mx: 0.5,
  535. my: 0.2
  536. }
  537. });
  538. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  539. return drawPath(parentGfx, pathData, {
  540. fill,
  541. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  542. strokeWidth: 1
  543. });
  544. },
  545. "bpmn:ConditionalEventDefinition": function(parentGfx, event, attrs = {}) {
  546. var pathData = pathMap.getScaledPath("EVENT_CONDITIONAL", {
  547. xScaleFactor: 1,
  548. yScaleFactor: 1,
  549. containerWidth: event.width,
  550. containerHeight: event.height,
  551. position: {
  552. mx: 0.5,
  553. my: 0.222
  554. }
  555. });
  556. return drawPath(parentGfx, pathData, {
  557. fill: getFillColor(event, defaultFillColor, attrs.fill),
  558. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  559. strokeWidth: 1
  560. });
  561. },
  562. "bpmn:LinkEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  563. var pathData = pathMap.getScaledPath("EVENT_LINK", {
  564. xScaleFactor: 1,
  565. yScaleFactor: 1,
  566. containerWidth: event.width,
  567. containerHeight: event.height,
  568. position: {
  569. mx: 0.57,
  570. my: 0.263
  571. }
  572. });
  573. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  574. return drawPath(parentGfx, pathData, {
  575. fill,
  576. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  577. strokeWidth: 1
  578. });
  579. },
  580. "bpmn:ErrorEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  581. var pathData = pathMap.getScaledPath("EVENT_ERROR", {
  582. xScaleFactor: 1.1,
  583. yScaleFactor: 1.1,
  584. containerWidth: event.width,
  585. containerHeight: event.height,
  586. position: {
  587. mx: 0.2,
  588. my: 0.722
  589. }
  590. });
  591. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  592. return drawPath(parentGfx, pathData, {
  593. fill,
  594. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  595. strokeWidth: 1
  596. });
  597. },
  598. "bpmn:CancelEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  599. var pathData = pathMap.getScaledPath("EVENT_CANCEL_45", {
  600. xScaleFactor: 1,
  601. yScaleFactor: 1,
  602. containerWidth: event.width,
  603. containerHeight: event.height,
  604. position: {
  605. mx: 0.638,
  606. my: -0.055
  607. }
  608. });
  609. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : "none";
  610. var path = drawPath(parentGfx, pathData, {
  611. fill,
  612. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  613. strokeWidth: 1
  614. });
  615. rotate(path, 45);
  616. return path;
  617. },
  618. "bpmn:CompensateEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  619. var pathData = pathMap.getScaledPath("EVENT_COMPENSATION", {
  620. xScaleFactor: 1,
  621. yScaleFactor: 1,
  622. containerWidth: event.width,
  623. containerHeight: event.height,
  624. position: {
  625. mx: 0.22,
  626. my: 0.5
  627. }
  628. });
  629. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  630. return drawPath(parentGfx, pathData, {
  631. fill,
  632. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  633. strokeWidth: 1
  634. });
  635. },
  636. "bpmn:SignalEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  637. var pathData = pathMap.getScaledPath("EVENT_SIGNAL", {
  638. xScaleFactor: 0.9,
  639. yScaleFactor: 0.9,
  640. containerWidth: event.width,
  641. containerHeight: event.height,
  642. position: {
  643. mx: 0.5,
  644. my: 0.2
  645. }
  646. });
  647. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  648. return drawPath(parentGfx, pathData, {
  649. strokeWidth: 1,
  650. fill,
  651. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
  652. });
  653. },
  654. "bpmn:MultipleEventDefinition": function(parentGfx, event, attrs = {}, isThrowing) {
  655. var pathData = pathMap.getScaledPath("EVENT_MULTIPLE", {
  656. xScaleFactor: 1.1,
  657. yScaleFactor: 1.1,
  658. containerWidth: event.width,
  659. containerHeight: event.height,
  660. position: {
  661. mx: 0.222,
  662. my: 0.36
  663. }
  664. });
  665. var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : getFillColor(event, defaultFillColor, attrs.fill);
  666. return drawPath(parentGfx, pathData, {
  667. fill,
  668. strokeWidth: 1
  669. });
  670. },
  671. "bpmn:ParallelMultipleEventDefinition": function(parentGfx, event, attrs = {}) {
  672. var pathData = pathMap.getScaledPath("EVENT_PARALLEL_MULTIPLE", {
  673. xScaleFactor: 1.2,
  674. yScaleFactor: 1.2,
  675. containerWidth: event.width,
  676. containerHeight: event.height,
  677. position: {
  678. mx: 0.458,
  679. my: 0.194
  680. }
  681. });
  682. return drawPath(parentGfx, pathData, {
  683. fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  684. stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
  685. strokeWidth: 1
  686. });
  687. },
  688. "bpmn:TerminateEventDefinition": function(parentGfx, element, attrs = {}) {
  689. var circle = drawCircle(parentGfx, element.width, element.height, 8, {
  690. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  691. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  692. strokeWidth: 4
  693. });
  694. return circle;
  695. }
  696. };
  697. function renderEventIcon(element, parentGfx, attrs = {}) {
  698. var semantic = getBusinessObject(element), isThrowing = isThrowEvent(semantic);
  699. if (semantic.get("eventDefinitions") && semantic.get("eventDefinitions").length > 1) {
  700. if (semantic.get("parallelMultiple")) {
  701. return eventIconRenderers["bpmn:ParallelMultipleEventDefinition"](parentGfx, element, attrs, isThrowing);
  702. } else {
  703. return eventIconRenderers["bpmn:MultipleEventDefinition"](parentGfx, element, attrs, isThrowing);
  704. }
  705. }
  706. if (isTypedEvent(semantic, "bpmn:MessageEventDefinition")) {
  707. return eventIconRenderers["bpmn:MessageEventDefinition"](parentGfx, element, attrs, isThrowing);
  708. }
  709. if (isTypedEvent(semantic, "bpmn:TimerEventDefinition")) {
  710. return eventIconRenderers["bpmn:TimerEventDefinition"](parentGfx, element, attrs, isThrowing);
  711. }
  712. if (isTypedEvent(semantic, "bpmn:ConditionalEventDefinition")) {
  713. return eventIconRenderers["bpmn:ConditionalEventDefinition"](parentGfx, element, attrs, isThrowing);
  714. }
  715. if (isTypedEvent(semantic, "bpmn:SignalEventDefinition")) {
  716. return eventIconRenderers["bpmn:SignalEventDefinition"](parentGfx, element, attrs, isThrowing);
  717. }
  718. if (isTypedEvent(semantic, "bpmn:EscalationEventDefinition")) {
  719. return eventIconRenderers["bpmn:EscalationEventDefinition"](parentGfx, element, attrs, isThrowing);
  720. }
  721. if (isTypedEvent(semantic, "bpmn:LinkEventDefinition")) {
  722. return eventIconRenderers["bpmn:LinkEventDefinition"](parentGfx, element, attrs, isThrowing);
  723. }
  724. if (isTypedEvent(semantic, "bpmn:ErrorEventDefinition")) {
  725. return eventIconRenderers["bpmn:ErrorEventDefinition"](parentGfx, element, attrs, isThrowing);
  726. }
  727. if (isTypedEvent(semantic, "bpmn:CancelEventDefinition")) {
  728. return eventIconRenderers["bpmn:CancelEventDefinition"](parentGfx, element, attrs, isThrowing);
  729. }
  730. if (isTypedEvent(semantic, "bpmn:CompensateEventDefinition")) {
  731. return eventIconRenderers["bpmn:CompensateEventDefinition"](parentGfx, element, attrs, isThrowing);
  732. }
  733. if (isTypedEvent(semantic, "bpmn:TerminateEventDefinition")) {
  734. return eventIconRenderers["bpmn:TerminateEventDefinition"](parentGfx, element, attrs, isThrowing);
  735. }
  736. return null;
  737. }
  738. var taskMarkerRenderers = {
  739. "ParticipantMultiplicityMarker": function(parentGfx, element, attrs = {}) {
  740. var width = getWidth(element, attrs), height = getHeight(element, attrs);
  741. var markerPath = pathMap.getScaledPath("MARKER_PARALLEL", {
  742. xScaleFactor: 1,
  743. yScaleFactor: 1,
  744. containerWidth: width,
  745. containerHeight: height,
  746. position: {
  747. mx: (width / 2 - 6) / width,
  748. my: (height - 15) / height
  749. }
  750. });
  751. drawMarker("participant-multiplicity", parentGfx, markerPath, {
  752. strokeWidth: 2,
  753. fill: getFillColor(element, defaultFillColor, attrs.fill),
  754. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  755. });
  756. },
  757. "SubProcessMarker": function(parentGfx, element, attrs = {}) {
  758. var markerRect = drawRect(parentGfx, 14, 14, 0, {
  759. strokeWidth: 1,
  760. fill: getFillColor(element, defaultFillColor, attrs.fill),
  761. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  762. });
  763. translate(markerRect, element.width / 2 - 7.5, element.height - 20);
  764. var markerPath = pathMap.getScaledPath("MARKER_SUB_PROCESS", {
  765. xScaleFactor: 1.5,
  766. yScaleFactor: 1.5,
  767. containerWidth: element.width,
  768. containerHeight: element.height,
  769. position: {
  770. mx: (element.width / 2 - 7.5) / element.width,
  771. my: (element.height - 20) / element.height
  772. }
  773. });
  774. drawMarker("sub-process", parentGfx, markerPath, {
  775. fill: getFillColor(element, defaultFillColor, attrs.fill),
  776. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  777. });
  778. },
  779. "ParallelMarker": function(parentGfx, element, attrs) {
  780. var width = getWidth(element, attrs), height = getHeight(element, attrs);
  781. var markerPath = pathMap.getScaledPath("MARKER_PARALLEL", {
  782. xScaleFactor: 1,
  783. yScaleFactor: 1,
  784. containerWidth: width,
  785. containerHeight: height,
  786. position: {
  787. mx: (width / 2 + attrs.parallel) / width,
  788. my: (height - 20) / height
  789. }
  790. });
  791. drawMarker("parallel", parentGfx, markerPath, {
  792. fill: getFillColor(element, defaultFillColor, attrs.fill),
  793. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  794. });
  795. },
  796. "SequentialMarker": function(parentGfx, element, attrs) {
  797. var markerPath = pathMap.getScaledPath("MARKER_SEQUENTIAL", {
  798. xScaleFactor: 1,
  799. yScaleFactor: 1,
  800. containerWidth: element.width,
  801. containerHeight: element.height,
  802. position: {
  803. mx: (element.width / 2 + attrs.seq) / element.width,
  804. my: (element.height - 19) / element.height
  805. }
  806. });
  807. drawMarker("sequential", parentGfx, markerPath, {
  808. fill: getFillColor(element, defaultFillColor, attrs.fill),
  809. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  810. });
  811. },
  812. "CompensationMarker": function(parentGfx, element, attrs) {
  813. var markerMath = pathMap.getScaledPath("MARKER_COMPENSATION", {
  814. xScaleFactor: 1,
  815. yScaleFactor: 1,
  816. containerWidth: element.width,
  817. containerHeight: element.height,
  818. position: {
  819. mx: (element.width / 2 + attrs.compensation) / element.width,
  820. my: (element.height - 13) / element.height
  821. }
  822. });
  823. drawMarker("compensation", parentGfx, markerMath, {
  824. strokeWidth: 1,
  825. fill: getFillColor(element, defaultFillColor, attrs.fill),
  826. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  827. });
  828. },
  829. "LoopMarker": function(parentGfx, element, attrs) {
  830. var width = getWidth(element, attrs), height = getHeight(element, attrs);
  831. var markerPath = pathMap.getScaledPath("MARKER_LOOP", {
  832. xScaleFactor: 1,
  833. yScaleFactor: 1,
  834. containerWidth: width,
  835. containerHeight: height,
  836. position: {
  837. mx: (width / 2 + attrs.loop) / width,
  838. my: (height - 7) / height
  839. }
  840. });
  841. drawMarker("loop", parentGfx, markerPath, {
  842. strokeWidth: 1.5,
  843. fill: "none",
  844. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  845. strokeMiterlimit: 0.5
  846. });
  847. },
  848. "AdhocMarker": function(parentGfx, element, attrs) {
  849. var width = getWidth(element, attrs), height = getHeight(element, attrs);
  850. var markerPath = pathMap.getScaledPath("MARKER_ADHOC", {
  851. xScaleFactor: 1,
  852. yScaleFactor: 1,
  853. containerWidth: width,
  854. containerHeight: height,
  855. position: {
  856. mx: (width / 2 + attrs.adhoc) / width,
  857. my: (height - 15) / height
  858. }
  859. });
  860. drawMarker("adhoc", parentGfx, markerPath, {
  861. strokeWidth: 1,
  862. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  863. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  864. });
  865. }
  866. };
  867. function renderTaskMarker(type, parentGfx, element, attrs) {
  868. taskMarkerRenderers[type](parentGfx, element, attrs);
  869. }
  870. function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
  871. attrs = {
  872. fill: attrs.fill,
  873. stroke: attrs.stroke,
  874. width: getWidth(element, attrs),
  875. height: getHeight(element, attrs)
  876. };
  877. var semantic = getBusinessObject(element);
  878. var subprocess = taskMarkers && taskMarkers.includes("SubProcessMarker");
  879. if (subprocess) {
  880. attrs = {
  881. ...attrs,
  882. seq: -21,
  883. parallel: -22,
  884. compensation: -42,
  885. loop: -18,
  886. adhoc: 10
  887. };
  888. } else {
  889. attrs = {
  890. ...attrs,
  891. seq: -5,
  892. parallel: -6,
  893. compensation: -27,
  894. loop: 0,
  895. adhoc: 10
  896. };
  897. }
  898. forEach(taskMarkers, function(marker2) {
  899. renderTaskMarker(marker2, parentGfx, element, attrs);
  900. });
  901. if (semantic.get("isForCompensation")) {
  902. renderTaskMarker("CompensationMarker", parentGfx, element, attrs);
  903. }
  904. if (is(semantic, "bpmn:AdHocSubProcess")) {
  905. renderTaskMarker("AdhocMarker", parentGfx, element, attrs);
  906. }
  907. var loopCharacteristics = semantic.get("loopCharacteristics"), isSequential = loopCharacteristics && loopCharacteristics.get("isSequential");
  908. if (loopCharacteristics) {
  909. if (isSequential === void 0) {
  910. renderTaskMarker("LoopMarker", parentGfx, element, attrs);
  911. }
  912. if (isSequential === false) {
  913. renderTaskMarker("ParallelMarker", parentGfx, element, attrs);
  914. }
  915. if (isSequential === true) {
  916. renderTaskMarker("SequentialMarker", parentGfx, element, attrs);
  917. }
  918. }
  919. }
  920. function renderLabel(parentGfx, label, attrs = {}) {
  921. attrs = assign({
  922. size: {
  923. width: 100
  924. }
  925. }, attrs);
  926. var text = textRenderer.createText(label || "", attrs);
  927. classes(text).add("djs-label");
  928. append(parentGfx, text);
  929. return text;
  930. }
  931. function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
  932. var semantic = getBusinessObject(element);
  933. var box = getBounds({
  934. x: element.x,
  935. y: element.y,
  936. width: element.width,
  937. height: element.height
  938. }, attrs);
  939. return renderLabel(parentGfx, semantic.name, {
  940. align,
  941. box,
  942. padding: 7,
  943. style: {
  944. fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
  945. }
  946. });
  947. }
  948. function renderExternalLabel(parentGfx, element, attrs = {}) {
  949. var box = {
  950. width: 90,
  951. height: 30,
  952. x: element.width / 2 + element.x,
  953. y: element.height / 2 + element.y
  954. };
  955. return renderLabel(parentGfx, getLabel(element), {
  956. box,
  957. fitBox: true,
  958. style: assign(
  959. {},
  960. textRenderer.getExternalStyle(),
  961. {
  962. fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
  963. }
  964. )
  965. });
  966. }
  967. function renderLaneLabel(parentGfx, text, element, attrs = {}) {
  968. var isHorizontalLane = isHorizontal(element);
  969. var textBox = renderLabel(parentGfx, text, {
  970. box: {
  971. height: 30,
  972. width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs)
  973. },
  974. align: "center-middle",
  975. style: {
  976. fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
  977. }
  978. });
  979. if (isHorizontalLane) {
  980. var top = -1 * getHeight(element, attrs);
  981. transform2(textBox, 0, -top, 270);
  982. }
  983. }
  984. function renderActivity(parentGfx, element, attrs = {}) {
  985. var {
  986. width,
  987. height
  988. } = getBounds(element, attrs);
  989. return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
  990. ...attrs,
  991. fill: getFillColor(element, defaultFillColor, attrs.fill),
  992. fillOpacity: DEFAULT_OPACITY,
  993. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  994. });
  995. }
  996. function renderAssociation(parentGfx, element, attrs = {}) {
  997. var semantic = getBusinessObject(element);
  998. var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
  999. if (semantic.get("associationDirection") === "One" || semantic.get("associationDirection") === "Both") {
  1000. attrs.markerEnd = marker("association-end", fill, stroke);
  1001. }
  1002. if (semantic.get("associationDirection") === "Both") {
  1003. attrs.markerStart = marker("association-start", fill, stroke);
  1004. }
  1005. attrs = pickAttrs(attrs, [
  1006. "markerStart",
  1007. "markerEnd"
  1008. ]);
  1009. return drawConnectionSegments(parentGfx, element.waypoints, {
  1010. ...attrs,
  1011. stroke,
  1012. strokeDasharray: "0, 5"
  1013. });
  1014. }
  1015. function renderDataObject(parentGfx, element, attrs = {}) {
  1016. var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
  1017. var pathData = pathMap.getScaledPath("DATA_OBJECT_PATH", {
  1018. xScaleFactor: 1,
  1019. yScaleFactor: 1,
  1020. containerWidth: element.width,
  1021. containerHeight: element.height,
  1022. position: {
  1023. mx: 0.474,
  1024. my: 0.296
  1025. }
  1026. });
  1027. var dataObject = drawPath(parentGfx, pathData, {
  1028. fill,
  1029. fillOpacity: DEFAULT_OPACITY,
  1030. stroke
  1031. });
  1032. var semantic = getBusinessObject(element);
  1033. if (isCollection(semantic)) {
  1034. var collectionPathData = pathMap.getScaledPath("DATA_OBJECT_COLLECTION_PATH", {
  1035. xScaleFactor: 1,
  1036. yScaleFactor: 1,
  1037. containerWidth: element.width,
  1038. containerHeight: element.height,
  1039. position: {
  1040. mx: 0.33,
  1041. my: (element.height - 18) / element.height
  1042. }
  1043. });
  1044. drawPath(parentGfx, collectionPathData, {
  1045. strokeWidth: 2,
  1046. fill,
  1047. stroke
  1048. });
  1049. }
  1050. return dataObject;
  1051. }
  1052. function renderEvent(parentGfx, element, attrs = {}) {
  1053. return drawCircle(parentGfx, element.width, element.height, {
  1054. fillOpacity: DEFAULT_OPACITY,
  1055. ...attrs,
  1056. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1057. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  1058. });
  1059. }
  1060. function renderGateway(parentGfx, element, attrs = {}) {
  1061. return drawDiamond(parentGfx, element.width, element.height, {
  1062. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1063. fillOpacity: DEFAULT_OPACITY,
  1064. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  1065. });
  1066. }
  1067. function renderLane(parentGfx, element, attrs = {}) {
  1068. var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
  1069. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1070. fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
  1071. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1072. strokeWidth: 1.5
  1073. });
  1074. var semantic = getBusinessObject(element);
  1075. if (is(semantic, "bpmn:Lane")) {
  1076. var text = semantic.get("name");
  1077. renderLaneLabel(parentGfx, text, element, attrs);
  1078. }
  1079. return lane;
  1080. }
  1081. function renderSubProcess(parentGfx, element, attrs = {}) {
  1082. var activity = renderActivity(parentGfx, element, attrs);
  1083. if (isEventSubProcess(element)) {
  1084. attr(activity, {
  1085. strokeDasharray: "0, 5.5",
  1086. strokeWidth: 2.5
  1087. });
  1088. }
  1089. var expanded = isExpanded(element);
  1090. renderEmbeddedLabel(parentGfx, element, expanded ? "center-top" : "center-middle", attrs);
  1091. if (expanded) {
  1092. renderTaskMarkers(parentGfx, element, void 0, attrs);
  1093. } else {
  1094. renderTaskMarkers(parentGfx, element, ["SubProcessMarker"], attrs);
  1095. }
  1096. return activity;
  1097. }
  1098. function renderTask(parentGfx, element, attrs = {}) {
  1099. var activity = renderActivity(parentGfx, element, attrs);
  1100. renderEmbeddedLabel(parentGfx, element, "center-middle", attrs);
  1101. renderTaskMarkers(parentGfx, element, void 0, attrs);
  1102. return activity;
  1103. }
  1104. var handlers = this.handlers = {
  1105. "bpmn:AdHocSubProcess": function(parentGfx, element, attrs = {}) {
  1106. if (isExpanded(element)) {
  1107. attrs = pickAttrs(attrs, [
  1108. "fill",
  1109. "stroke",
  1110. "width",
  1111. "height"
  1112. ]);
  1113. } else {
  1114. attrs = pickAttrs(attrs, [
  1115. "fill",
  1116. "stroke"
  1117. ]);
  1118. }
  1119. return renderSubProcess(parentGfx, element, attrs);
  1120. },
  1121. "bpmn:Association": function(parentGfx, element, attrs = {}) {
  1122. attrs = pickAttrs(attrs, [
  1123. "fill",
  1124. "stroke"
  1125. ]);
  1126. return renderAssociation(parentGfx, element, attrs);
  1127. },
  1128. "bpmn:BoundaryEvent": function(parentGfx, element, attrs = {}) {
  1129. var { renderIcon = true } = attrs;
  1130. attrs = pickAttrs(attrs, [
  1131. "fill",
  1132. "stroke"
  1133. ]);
  1134. var semantic = getBusinessObject(element), cancelActivity = semantic.get("cancelActivity");
  1135. attrs = {
  1136. strokeWidth: 1.5,
  1137. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1138. fillOpacity: FULL_OPACITY,
  1139. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  1140. };
  1141. if (!cancelActivity) {
  1142. attrs.strokeDasharray = "6";
  1143. }
  1144. var event = renderEvent(parentGfx, element, attrs);
  1145. drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
  1146. ...attrs,
  1147. fill: "none"
  1148. });
  1149. if (renderIcon) {
  1150. renderEventIcon(element, parentGfx, attrs);
  1151. }
  1152. return event;
  1153. },
  1154. "bpmn:BusinessRuleTask": function(parentGfx, element, attrs = {}) {
  1155. attrs = pickAttrs(attrs, [
  1156. "fill",
  1157. "stroke"
  1158. ]);
  1159. var task = renderTask(parentGfx, element, attrs);
  1160. var headerData = pathMap.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN", {
  1161. abspos: {
  1162. x: 8,
  1163. y: 8
  1164. }
  1165. });
  1166. var businessPath = drawPath(parentGfx, headerData);
  1167. attr(businessPath, {
  1168. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1169. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1170. strokeWidth: 1
  1171. });
  1172. var headerPathData = pathMap.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER", {
  1173. abspos: {
  1174. x: 8,
  1175. y: 8
  1176. }
  1177. });
  1178. var businessHeaderPath = drawPath(parentGfx, headerPathData);
  1179. attr(businessHeaderPath, {
  1180. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1181. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1182. strokeWidth: 1
  1183. });
  1184. return task;
  1185. },
  1186. "bpmn:CallActivity": function(parentGfx, element, attrs = {}) {
  1187. attrs = pickAttrs(attrs, [
  1188. "fill",
  1189. "stroke"
  1190. ]);
  1191. return renderSubProcess(parentGfx, element, {
  1192. strokeWidth: 5,
  1193. ...attrs
  1194. });
  1195. },
  1196. "bpmn:ComplexGateway": function(parentGfx, element, attrs = {}) {
  1197. attrs = pickAttrs(attrs, [
  1198. "fill",
  1199. "stroke"
  1200. ]);
  1201. var gateway = renderGateway(parentGfx, element, attrs);
  1202. var pathData = pathMap.getScaledPath("GATEWAY_COMPLEX", {
  1203. xScaleFactor: 0.5,
  1204. yScaleFactor: 0.5,
  1205. containerWidth: element.width,
  1206. containerHeight: element.height,
  1207. position: {
  1208. mx: 0.46,
  1209. my: 0.26
  1210. }
  1211. });
  1212. drawPath(parentGfx, pathData, {
  1213. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1214. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1215. strokeWidth: 1
  1216. });
  1217. return gateway;
  1218. },
  1219. "bpmn:DataInput": function(parentGfx, element, attrs = {}) {
  1220. attrs = pickAttrs(attrs, [
  1221. "fill",
  1222. "stroke"
  1223. ]);
  1224. var arrowPathData = pathMap.getRawPath("DATA_ARROW");
  1225. var dataObject = renderDataObject(parentGfx, element, attrs);
  1226. drawPath(parentGfx, arrowPathData, {
  1227. fill: "none",
  1228. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1229. strokeWidth: 1
  1230. });
  1231. return dataObject;
  1232. },
  1233. "bpmn:DataInputAssociation": function(parentGfx, element, attrs = {}) {
  1234. attrs = pickAttrs(attrs, [
  1235. "fill",
  1236. "stroke"
  1237. ]);
  1238. return renderAssociation(parentGfx, element, {
  1239. ...attrs,
  1240. markerEnd: marker("association-end", getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
  1241. });
  1242. },
  1243. "bpmn:DataObject": function(parentGfx, element, attrs = {}) {
  1244. attrs = pickAttrs(attrs, [
  1245. "fill",
  1246. "stroke"
  1247. ]);
  1248. return renderDataObject(parentGfx, element, attrs);
  1249. },
  1250. "bpmn:DataObjectReference": as("bpmn:DataObject"),
  1251. "bpmn:DataOutput": function(parentGfx, element, attrs = {}) {
  1252. attrs = pickAttrs(attrs, [
  1253. "fill",
  1254. "stroke"
  1255. ]);
  1256. var arrowPathData = pathMap.getRawPath("DATA_ARROW");
  1257. var dataObject = renderDataObject(parentGfx, element, attrs);
  1258. drawPath(parentGfx, arrowPathData, {
  1259. strokeWidth: 1,
  1260. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1261. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  1262. });
  1263. return dataObject;
  1264. },
  1265. "bpmn:DataOutputAssociation": function(parentGfx, element, attrs = {}) {
  1266. attrs = pickAttrs(attrs, [
  1267. "fill",
  1268. "stroke"
  1269. ]);
  1270. return renderAssociation(parentGfx, element, {
  1271. ...attrs,
  1272. markerEnd: marker("association-end", getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
  1273. });
  1274. },
  1275. "bpmn:DataStoreReference": function(parentGfx, element, attrs = {}) {
  1276. attrs = pickAttrs(attrs, [
  1277. "fill",
  1278. "stroke"
  1279. ]);
  1280. var dataStorePath = pathMap.getScaledPath("DATA_STORE", {
  1281. xScaleFactor: 1,
  1282. yScaleFactor: 1,
  1283. containerWidth: element.width,
  1284. containerHeight: element.height,
  1285. position: {
  1286. mx: 0,
  1287. my: 0.133
  1288. }
  1289. });
  1290. return drawPath(parentGfx, dataStorePath, {
  1291. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1292. fillOpacity: DEFAULT_OPACITY,
  1293. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1294. strokeWidth: 2
  1295. });
  1296. },
  1297. "bpmn:EndEvent": function(parentGfx, element, attrs = {}) {
  1298. var { renderIcon = true } = attrs;
  1299. attrs = pickAttrs(attrs, [
  1300. "fill",
  1301. "stroke"
  1302. ]);
  1303. var event = renderEvent(parentGfx, element, {
  1304. ...attrs,
  1305. strokeWidth: 4
  1306. });
  1307. if (renderIcon) {
  1308. renderEventIcon(element, parentGfx, attrs);
  1309. }
  1310. return event;
  1311. },
  1312. "bpmn:EventBasedGateway": function(parentGfx, element, attrs = {}) {
  1313. attrs = pickAttrs(attrs, [
  1314. "fill",
  1315. "stroke"
  1316. ]);
  1317. var semantic = getBusinessObject(element);
  1318. var diamond = renderGateway(parentGfx, element, attrs);
  1319. drawCircle(parentGfx, element.width, element.height, element.height * 0.2, {
  1320. fill: getFillColor(element, "none", attrs.fill),
  1321. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1322. strokeWidth: 1
  1323. });
  1324. var type = semantic.get("eventGatewayType"), instantiate = !!semantic.get("instantiate");
  1325. function drawEvent() {
  1326. var pathData2 = pathMap.getScaledPath("GATEWAY_EVENT_BASED", {
  1327. xScaleFactor: 0.18,
  1328. yScaleFactor: 0.18,
  1329. containerWidth: element.width,
  1330. containerHeight: element.height,
  1331. position: {
  1332. mx: 0.36,
  1333. my: 0.44
  1334. }
  1335. });
  1336. drawPath(parentGfx, pathData2, {
  1337. fill: "none",
  1338. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1339. strokeWidth: 2
  1340. });
  1341. }
  1342. if (type === "Parallel") {
  1343. var pathData = pathMap.getScaledPath("GATEWAY_PARALLEL", {
  1344. xScaleFactor: 0.4,
  1345. yScaleFactor: 0.4,
  1346. containerWidth: element.width,
  1347. containerHeight: element.height,
  1348. position: {
  1349. mx: 0.474,
  1350. my: 0.296
  1351. }
  1352. });
  1353. drawPath(parentGfx, pathData, {
  1354. fill: "none",
  1355. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1356. strokeWidth: 1
  1357. });
  1358. } else if (type === "Exclusive") {
  1359. if (!instantiate) {
  1360. drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
  1361. fill: "none",
  1362. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1363. strokeWidth: 1
  1364. });
  1365. }
  1366. drawEvent();
  1367. }
  1368. return diamond;
  1369. },
  1370. "bpmn:ExclusiveGateway": function(parentGfx, element, attrs = {}) {
  1371. attrs = pickAttrs(attrs, [
  1372. "fill",
  1373. "stroke"
  1374. ]);
  1375. var gateway = renderGateway(parentGfx, element, attrs);
  1376. var pathData = pathMap.getScaledPath("GATEWAY_EXCLUSIVE", {
  1377. xScaleFactor: 0.4,
  1378. yScaleFactor: 0.4,
  1379. containerWidth: element.width,
  1380. containerHeight: element.height,
  1381. position: {
  1382. mx: 0.32,
  1383. my: 0.3
  1384. }
  1385. });
  1386. var di = getDi(element);
  1387. if (di.get("isMarkerVisible")) {
  1388. drawPath(parentGfx, pathData, {
  1389. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1390. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1391. strokeWidth: 1
  1392. });
  1393. }
  1394. return gateway;
  1395. },
  1396. "bpmn:Gateway": function(parentGfx, element, attrs = {}) {
  1397. attrs = pickAttrs(attrs, [
  1398. "fill",
  1399. "stroke"
  1400. ]);
  1401. return renderGateway(parentGfx, element, attrs);
  1402. },
  1403. "bpmn:Group": function(parentGfx, element, attrs = {}) {
  1404. attrs = pickAttrs(attrs, [
  1405. "fill",
  1406. "stroke",
  1407. "width",
  1408. "height"
  1409. ]);
  1410. return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
  1411. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1412. strokeWidth: 1.5,
  1413. strokeDasharray: "10, 6, 0, 6",
  1414. fill: "none",
  1415. pointerEvents: "none",
  1416. width: getWidth(element, attrs),
  1417. height: getHeight(element, attrs)
  1418. });
  1419. },
  1420. "bpmn:InclusiveGateway": function(parentGfx, element, attrs = {}) {
  1421. attrs = pickAttrs(attrs, [
  1422. "fill",
  1423. "stroke"
  1424. ]);
  1425. var gateway = renderGateway(parentGfx, element, attrs);
  1426. drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
  1427. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1428. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1429. strokeWidth: 2.5
  1430. });
  1431. return gateway;
  1432. },
  1433. "bpmn:IntermediateEvent": function(parentGfx, element, attrs = {}) {
  1434. var { renderIcon = true } = attrs;
  1435. attrs = pickAttrs(attrs, [
  1436. "fill",
  1437. "stroke"
  1438. ]);
  1439. var outer = renderEvent(parentGfx, element, {
  1440. ...attrs,
  1441. strokeWidth: 1.5
  1442. });
  1443. drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
  1444. fill: "none",
  1445. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1446. strokeWidth: 1.5
  1447. });
  1448. if (renderIcon) {
  1449. renderEventIcon(element, parentGfx, attrs);
  1450. }
  1451. return outer;
  1452. },
  1453. "bpmn:IntermediateCatchEvent": as("bpmn:IntermediateEvent"),
  1454. "bpmn:IntermediateThrowEvent": as("bpmn:IntermediateEvent"),
  1455. "bpmn:Lane": function(parentGfx, element, attrs = {}) {
  1456. attrs = pickAttrs(attrs, [
  1457. "fill",
  1458. "stroke",
  1459. "width",
  1460. "height"
  1461. ]);
  1462. return renderLane(parentGfx, element, {
  1463. ...attrs,
  1464. fillOpacity: LOW_OPACITY
  1465. });
  1466. },
  1467. "bpmn:ManualTask": function(parentGfx, element, attrs = {}) {
  1468. attrs = pickAttrs(attrs, [
  1469. "fill",
  1470. "stroke"
  1471. ]);
  1472. var task = renderTask(parentGfx, element, attrs);
  1473. var pathData = pathMap.getScaledPath("TASK_TYPE_MANUAL", {
  1474. abspos: {
  1475. x: 17,
  1476. y: 15
  1477. }
  1478. });
  1479. drawPath(parentGfx, pathData, {
  1480. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1481. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1482. strokeWidth: 0.5
  1483. });
  1484. return task;
  1485. },
  1486. "bpmn:MessageFlow": function(parentGfx, element, attrs = {}) {
  1487. attrs = pickAttrs(attrs, [
  1488. "fill",
  1489. "stroke"
  1490. ]);
  1491. var semantic = getBusinessObject(element), di = getDi(element);
  1492. var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
  1493. var path = drawConnectionSegments(parentGfx, element.waypoints, {
  1494. markerEnd: marker("messageflow-end", fill, stroke),
  1495. markerStart: marker("messageflow-start", fill, stroke),
  1496. stroke,
  1497. strokeDasharray: "10, 11",
  1498. strokeWidth: 1.5
  1499. });
  1500. if (semantic.get("messageRef")) {
  1501. var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
  1502. var markerPathData = pathMap.getScaledPath("MESSAGE_FLOW_MARKER", {
  1503. abspos: {
  1504. x: midPoint.x,
  1505. y: midPoint.y
  1506. }
  1507. });
  1508. var messageAttrs = {
  1509. strokeWidth: 1
  1510. };
  1511. if (di.get("messageVisibleKind") === "initiating") {
  1512. messageAttrs.fill = fill;
  1513. messageAttrs.stroke = stroke;
  1514. } else {
  1515. messageAttrs.fill = stroke;
  1516. messageAttrs.stroke = fill;
  1517. }
  1518. var message = drawPath(parentGfx, markerPathData, messageAttrs);
  1519. var messageRef = semantic.get("messageRef"), name = messageRef.get("name");
  1520. var label = renderLabel(parentGfx, name, {
  1521. align: "center-top",
  1522. fitBox: true,
  1523. style: {
  1524. fill: stroke
  1525. }
  1526. });
  1527. var messageBounds = message.getBBox(), labelBounds = label.getBBox();
  1528. var translateX = midPoint.x - labelBounds.width / 2, translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
  1529. transform2(label, translateX, translateY, 0);
  1530. }
  1531. return path;
  1532. },
  1533. "bpmn:ParallelGateway": function(parentGfx, element, attrs = {}) {
  1534. attrs = pickAttrs(attrs, [
  1535. "fill",
  1536. "stroke"
  1537. ]);
  1538. var diamond = renderGateway(parentGfx, element, attrs);
  1539. var pathData = pathMap.getScaledPath("GATEWAY_PARALLEL", {
  1540. xScaleFactor: 0.6,
  1541. yScaleFactor: 0.6,
  1542. containerWidth: element.width,
  1543. containerHeight: element.height,
  1544. position: {
  1545. mx: 0.46,
  1546. my: 0.2
  1547. }
  1548. });
  1549. drawPath(parentGfx, pathData, {
  1550. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1551. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1552. strokeWidth: 1
  1553. });
  1554. return diamond;
  1555. },
  1556. "bpmn:Participant": function(parentGfx, element, attrs = {}) {
  1557. attrs = pickAttrs(attrs, [
  1558. "fill",
  1559. "stroke",
  1560. "width",
  1561. "height"
  1562. ]);
  1563. var participant = renderLane(parentGfx, element, attrs);
  1564. var expandedParticipant = isExpanded(element);
  1565. var horizontalParticipant = isHorizontal(element);
  1566. var semantic = getBusinessObject(element), name = semantic.get("name");
  1567. if (expandedParticipant) {
  1568. var waypoints = horizontalParticipant ? [
  1569. {
  1570. x: 30,
  1571. y: 0
  1572. },
  1573. {
  1574. x: 30,
  1575. y: getHeight(element, attrs)
  1576. }
  1577. ] : [
  1578. {
  1579. x: 0,
  1580. y: 30
  1581. },
  1582. {
  1583. x: getWidth(element, attrs),
  1584. y: 30
  1585. }
  1586. ];
  1587. drawLine(parentGfx, waypoints, {
  1588. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1589. strokeWidth: PARTICIPANT_STROKE_WIDTH
  1590. });
  1591. renderLaneLabel(parentGfx, name, element, attrs);
  1592. } else {
  1593. var bounds = getBounds(element, attrs);
  1594. if (!horizontalParticipant) {
  1595. bounds.height = getWidth(element, attrs);
  1596. bounds.width = getHeight(element, attrs);
  1597. }
  1598. var textBox = renderLabel(parentGfx, name, {
  1599. box: bounds,
  1600. align: "center-middle",
  1601. style: {
  1602. fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
  1603. }
  1604. });
  1605. if (!horizontalParticipant) {
  1606. var top = -1 * getHeight(element, attrs);
  1607. transform2(textBox, 0, -top, 270);
  1608. }
  1609. }
  1610. if (semantic.get("participantMultiplicity")) {
  1611. renderTaskMarker("ParticipantMultiplicityMarker", parentGfx, element, attrs);
  1612. }
  1613. return participant;
  1614. },
  1615. "bpmn:ReceiveTask": function(parentGfx, element, attrs = {}) {
  1616. attrs = pickAttrs(attrs, [
  1617. "fill",
  1618. "stroke"
  1619. ]);
  1620. var semantic = getBusinessObject(element);
  1621. var task = renderTask(parentGfx, element, attrs);
  1622. var pathData;
  1623. if (semantic.get("instantiate")) {
  1624. drawCircle(parentGfx, 28, 28, 20 * 0.22, {
  1625. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1626. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1627. strokeWidth: 1
  1628. });
  1629. pathData = pathMap.getScaledPath("TASK_TYPE_INSTANTIATING_SEND", {
  1630. abspos: {
  1631. x: 7.77,
  1632. y: 9.52
  1633. }
  1634. });
  1635. } else {
  1636. pathData = pathMap.getScaledPath("TASK_TYPE_SEND", {
  1637. xScaleFactor: 0.9,
  1638. yScaleFactor: 0.9,
  1639. containerWidth: 21,
  1640. containerHeight: 14,
  1641. position: {
  1642. mx: 0.3,
  1643. my: 0.4
  1644. }
  1645. });
  1646. }
  1647. drawPath(parentGfx, pathData, {
  1648. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1649. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1650. strokeWidth: 1
  1651. });
  1652. return task;
  1653. },
  1654. "bpmn:ScriptTask": function(parentGfx, element, attrs = {}) {
  1655. attrs = pickAttrs(attrs, [
  1656. "fill",
  1657. "stroke"
  1658. ]);
  1659. var task = renderTask(parentGfx, element, attrs);
  1660. var pathData = pathMap.getScaledPath("TASK_TYPE_SCRIPT", {
  1661. abspos: {
  1662. x: 15,
  1663. y: 20
  1664. }
  1665. });
  1666. drawPath(parentGfx, pathData, {
  1667. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1668. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1669. strokeWidth: 1
  1670. });
  1671. return task;
  1672. },
  1673. "bpmn:SendTask": function(parentGfx, element, attrs = {}) {
  1674. attrs = pickAttrs(attrs, [
  1675. "fill",
  1676. "stroke"
  1677. ]);
  1678. var task = renderTask(parentGfx, element, attrs);
  1679. var pathData = pathMap.getScaledPath("TASK_TYPE_SEND", {
  1680. xScaleFactor: 1,
  1681. yScaleFactor: 1,
  1682. containerWidth: 21,
  1683. containerHeight: 14,
  1684. position: {
  1685. mx: 0.285,
  1686. my: 0.357
  1687. }
  1688. });
  1689. drawPath(parentGfx, pathData, {
  1690. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1691. stroke: getFillColor(element, defaultFillColor, attrs.fill),
  1692. strokeWidth: 1
  1693. });
  1694. return task;
  1695. },
  1696. "bpmn:SequenceFlow": function(parentGfx, element, attrs = {}) {
  1697. attrs = pickAttrs(attrs, [
  1698. "fill",
  1699. "stroke"
  1700. ]);
  1701. var fill = getFillColor(element, defaultFillColor, attrs.fill), stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
  1702. var connection = drawConnectionSegments(parentGfx, element.waypoints, {
  1703. markerEnd: marker("sequenceflow-end", fill, stroke),
  1704. stroke
  1705. });
  1706. var semantic = getBusinessObject(element);
  1707. var { source } = element;
  1708. if (source) {
  1709. var sourceSemantic = getBusinessObject(source);
  1710. if (semantic.get("conditionExpression") && is(sourceSemantic, "bpmn:Activity")) {
  1711. attr(connection, {
  1712. markerStart: marker("conditional-flow-marker", fill, stroke)
  1713. });
  1714. }
  1715. if (sourceSemantic.get("default") && (is(sourceSemantic, "bpmn:Gateway") || is(sourceSemantic, "bpmn:Activity")) && sourceSemantic.get("default") === semantic) {
  1716. attr(connection, {
  1717. markerStart: marker("conditional-default-flow-marker", fill, stroke)
  1718. });
  1719. }
  1720. }
  1721. return connection;
  1722. },
  1723. "bpmn:ServiceTask": function(parentGfx, element, attrs = {}) {
  1724. attrs = pickAttrs(attrs, [
  1725. "fill",
  1726. "stroke"
  1727. ]);
  1728. var task = renderTask(parentGfx, element, attrs);
  1729. drawCircle(parentGfx, 10, 10, {
  1730. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1731. stroke: "none",
  1732. transform: "translate(6, 6)"
  1733. });
  1734. var pathDataService1 = pathMap.getScaledPath("TASK_TYPE_SERVICE", {
  1735. abspos: {
  1736. x: 12,
  1737. y: 18
  1738. }
  1739. });
  1740. drawPath(parentGfx, pathDataService1, {
  1741. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1742. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1743. strokeWidth: 1
  1744. });
  1745. drawCircle(parentGfx, 10, 10, {
  1746. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1747. stroke: "none",
  1748. transform: "translate(11, 10)"
  1749. });
  1750. var pathDataService2 = pathMap.getScaledPath("TASK_TYPE_SERVICE", {
  1751. abspos: {
  1752. x: 17,
  1753. y: 22
  1754. }
  1755. });
  1756. drawPath(parentGfx, pathDataService2, {
  1757. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1758. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1759. strokeWidth: 1
  1760. });
  1761. return task;
  1762. },
  1763. "bpmn:StartEvent": function(parentGfx, element, attrs = {}) {
  1764. var { renderIcon = true } = attrs;
  1765. attrs = pickAttrs(attrs, [
  1766. "fill",
  1767. "stroke"
  1768. ]);
  1769. var semantic = getBusinessObject(element);
  1770. if (!semantic.get("isInterrupting")) {
  1771. attrs = {
  1772. ...attrs,
  1773. strokeDasharray: "6"
  1774. };
  1775. }
  1776. var event = renderEvent(parentGfx, element, attrs);
  1777. if (renderIcon) {
  1778. renderEventIcon(element, parentGfx, attrs);
  1779. }
  1780. return event;
  1781. },
  1782. "bpmn:SubProcess": function(parentGfx, element, attrs = {}) {
  1783. if (isExpanded(element)) {
  1784. attrs = pickAttrs(attrs, [
  1785. "fill",
  1786. "stroke",
  1787. "width",
  1788. "height"
  1789. ]);
  1790. } else {
  1791. attrs = pickAttrs(attrs, [
  1792. "fill",
  1793. "stroke"
  1794. ]);
  1795. }
  1796. return renderSubProcess(parentGfx, element, attrs);
  1797. },
  1798. "bpmn:Task": function(parentGfx, element, attrs = {}) {
  1799. attrs = pickAttrs(attrs, [
  1800. "fill",
  1801. "stroke"
  1802. ]);
  1803. return renderTask(parentGfx, element, attrs);
  1804. },
  1805. "bpmn:TextAnnotation": function(parentGfx, element, attrs = {}) {
  1806. attrs = pickAttrs(attrs, [
  1807. "fill",
  1808. "stroke",
  1809. "width",
  1810. "height"
  1811. ]);
  1812. var {
  1813. width,
  1814. height
  1815. } = getBounds(element, attrs);
  1816. var textElement = drawRect(parentGfx, width, height, 0, 0, {
  1817. fill: "none",
  1818. stroke: "none"
  1819. });
  1820. var textPathData = pathMap.getScaledPath("TEXT_ANNOTATION", {
  1821. xScaleFactor: 1,
  1822. yScaleFactor: 1,
  1823. containerWidth: width,
  1824. containerHeight: height,
  1825. position: {
  1826. mx: 0,
  1827. my: 0
  1828. }
  1829. });
  1830. drawPath(parentGfx, textPathData, {
  1831. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
  1832. });
  1833. var semantic = getBusinessObject(element), text = semantic.get("text") || "";
  1834. renderLabel(parentGfx, text, {
  1835. align: "left-top",
  1836. box: getBounds(element, attrs),
  1837. padding: 7,
  1838. style: {
  1839. fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
  1840. }
  1841. });
  1842. return textElement;
  1843. },
  1844. "bpmn:Transaction": function(parentGfx, element, attrs = {}) {
  1845. if (isExpanded(element)) {
  1846. attrs = pickAttrs(attrs, [
  1847. "fill",
  1848. "stroke",
  1849. "width",
  1850. "height"
  1851. ]);
  1852. } else {
  1853. attrs = pickAttrs(attrs, [
  1854. "fill",
  1855. "stroke"
  1856. ]);
  1857. }
  1858. var outer = renderSubProcess(parentGfx, element, {
  1859. strokeWidth: 1.5,
  1860. ...attrs
  1861. });
  1862. var innerAttrs = styles.style(["no-fill", "no-events"], {
  1863. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1864. strokeWidth: 1.5
  1865. });
  1866. var expanded = isExpanded(element);
  1867. if (!expanded) {
  1868. attrs = {};
  1869. }
  1870. drawRect(
  1871. parentGfx,
  1872. getWidth(element, attrs),
  1873. getHeight(element, attrs),
  1874. TASK_BORDER_RADIUS - INNER_OUTER_DIST,
  1875. INNER_OUTER_DIST,
  1876. innerAttrs
  1877. );
  1878. return outer;
  1879. },
  1880. "bpmn:UserTask": function(parentGfx, element, attrs = {}) {
  1881. attrs = pickAttrs(attrs, [
  1882. "fill",
  1883. "stroke"
  1884. ]);
  1885. var task = renderTask(parentGfx, element, attrs);
  1886. var x = 15;
  1887. var y = 12;
  1888. var pathDataUser1 = pathMap.getScaledPath("TASK_TYPE_USER_1", {
  1889. abspos: {
  1890. x,
  1891. y
  1892. }
  1893. });
  1894. drawPath(parentGfx, pathDataUser1, {
  1895. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1896. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1897. strokeWidth: 0.5
  1898. });
  1899. var pathDataUser2 = pathMap.getScaledPath("TASK_TYPE_USER_2", {
  1900. abspos: {
  1901. x,
  1902. y
  1903. }
  1904. });
  1905. drawPath(parentGfx, pathDataUser2, {
  1906. fill: getFillColor(element, defaultFillColor, attrs.fill),
  1907. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1908. strokeWidth: 0.5
  1909. });
  1910. var pathDataUser3 = pathMap.getScaledPath("TASK_TYPE_USER_3", {
  1911. abspos: {
  1912. x,
  1913. y
  1914. }
  1915. });
  1916. drawPath(parentGfx, pathDataUser3, {
  1917. fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1918. stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
  1919. strokeWidth: 0.5
  1920. });
  1921. return task;
  1922. },
  1923. "label": function(parentGfx, element, attrs = {}) {
  1924. return renderExternalLabel(parentGfx, element, attrs);
  1925. }
  1926. };
  1927. this._drawPath = drawPath;
  1928. this._renderer = renderer;
  1929. }
  1930. e(BpmnRenderer, BaseRenderer);
  1931. BpmnRenderer.$inject = [
  1932. "config.bpmnRenderer",
  1933. "eventBus",
  1934. "styles",
  1935. "pathMap",
  1936. "canvas",
  1937. "textRenderer"
  1938. ];
  1939. BpmnRenderer.prototype.canRender = function(element) {
  1940. return is(element, "bpmn:BaseElement");
  1941. };
  1942. BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
  1943. var { type } = element;
  1944. var handler = this._renderer(type);
  1945. return handler(parentGfx, element, attrs);
  1946. };
  1947. BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
  1948. var { type } = element;
  1949. var handler = this._renderer(type);
  1950. return handler(parentGfx, element, attrs);
  1951. };
  1952. BpmnRenderer.prototype.getShapePath = function(element) {
  1953. if (is(element, "bpmn:Event")) {
  1954. return getCirclePath(element);
  1955. }
  1956. if (is(element, "bpmn:Activity")) {
  1957. return getRoundRectPath(element, TASK_BORDER_RADIUS);
  1958. }
  1959. if (is(element, "bpmn:Gateway")) {
  1960. return getDiamondPath(element);
  1961. }
  1962. return getRectPath(element);
  1963. };
  1964. function pickAttrs(attrs, keys = []) {
  1965. return keys.reduce((pickedAttrs, key) => {
  1966. if (attrs[key]) {
  1967. pickedAttrs[key] = attrs[key];
  1968. }
  1969. return pickedAttrs;
  1970. }, {});
  1971. }
  1972. export {
  1973. BaseRenderer,
  1974. transform2 as transform,
  1975. translate,
  1976. rotate,
  1977. index_esm_default,
  1978. BpmnRenderer
  1979. };
  1980. //# sourceMappingURL=chunk-PK6SUIG5.js.map