From ceeecbe27ecc8a2b23693556cca2e4123db79365 Mon Sep 17 00:00:00 2001 From: Will Gunter <74369489+wcgunter@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:09:08 -0500 Subject: [PATCH] Update web modeler to latest bpmn-js version (16.4.0) (#198) * Update web modeler to latest bpmn-js version * Update panel direction to be ltr (instead of rtl) * Fix deploy to CWS error (had trouble fetching process name), update CSS * Update history.css (history page css) * Autowire process service * Move away from thread? * Autowire context? * Remake context? * Revert "Merge branch 'develop' into wg-update-web-modeler" This reverts commit 2f310e01f40afe575ca41710d27addda60a090a5, reversing changes made to 1cab3bffbe3e5ae03f26110380f6ffa563edb03b. * Revert "Update history.css (history page css)" This reverts commit 1cab3bffbe3e5ae03f26110380f6ffa563edb03b. * Update history.css * Revert "Revert "Merge branch 'develop' into wg-update-web-modeler"" This reverts commit 7356fb9c86cf95078c68f2fe7061c8aa8b5b0532. * Revert changes to CwsTask.java --- .../src/main/java/jpl/cws/task/CwsTask.java | 64 +- cws-ui/src/main/webapp/css/history.css | 24 +- cws-ui/src/main/webapp/js/modeler.js | 237305 ++++++++++----- install/cws-ui/modeler.ftl | 37 +- 4 files changed, 161065 insertions(+), 76365 deletions(-) diff --git a/cws-tasks/src/main/java/jpl/cws/task/CwsTask.java b/cws-tasks/src/main/java/jpl/cws/task/CwsTask.java index f76473d6..a1f343b5 100644 --- a/cws-tasks/src/main/java/jpl/cws/task/CwsTask.java +++ b/cws-tasks/src/main/java/jpl/cws/task/CwsTask.java @@ -15,7 +15,7 @@ /** * Abstract base class for all CWS built-in (and custom user-added) task * implementations. - * + * */ public abstract class CwsTask implements JavaDelegate { @@ -55,32 +55,32 @@ public CwsTask() { * 1) initializes parameters * 2) runs the task implementation * 3) throws any qualified exceptions - * + * */ public void execute(final DelegateExecution execution) { this.execution = execution; - + // setup tags on logging log.setProcTags(getProcDefKey(execution), - execution.getProcessInstanceId(), + execution.getProcessInstanceId(), execution.getActivityInstanceId()); - + try { // setup base params throwOnTruncatedVariableBoolean = getBooleanParam( throwOnTruncatedVariable, "throwOnTruncatedVariable", DEFAULT_THROW_ON_TRUNCATED_VARIABLE); - + // Evaluate preCondition. // If preCondition passes, then execute task, // otherwise skip task execution. if (evaluateTaskPreCondition()) { setOutputVariable("preConditionPassed", true); - + // get params log.trace("INITIALIZING PARAMETERS FOR TASK: " + this); initParams(); - + // execute the task log.trace("EXECUTING TASK: " + this); executeTask(); @@ -91,17 +91,17 @@ public void execute(final DelegateExecution execution) { } catch (BpmnError e) { log.warn("Propagating BpmnError(" + e.getErrorCode() + ")..."); setOutputVariable("bpmnErrorMessage", e.getErrorCode()); - + // We saw an error, but we want to check with Camunda because this is by-passing our end-event listener notifyWorkerOfFailedProcess(); - + throw e; // propagate so engine can handle (if boundary catch defined) } catch (Throwable t) { log.error("Unexpected Throwable while executing " + this, t); setOutputVariable("unexpectedErrorMessage", t.getMessage()); - + notifyWorkerOfFailedProcess(); - + // wrap and propagate so engine can (if boundary catch defined) handle throw new BpmnError(UNEXPECTED_ERROR); } finally { @@ -109,7 +109,7 @@ public void execute(final DelegateExecution execution) { this.execution = null; } } - + private void notifyWorkerOfFailedProcess() { log.debug("notifying workers of failed process..."); @@ -128,8 +128,8 @@ public void run() { } }).start(); } - - + + private String getProcDefKey(final DelegateExecution execution) { String procDefKey = "UNKNOWN"; @@ -159,34 +159,34 @@ private String getProcDefKey(final DelegateExecution execution) { /** * Implementation must be filled out by subclasses. - * + * */ protected abstract void initParams() throws Exception; /** * Implementation must be filled out by subclasses. - * + * */ protected abstract void executeTask() throws Exception; /** * Evaluates the task preCondition. - * + * * @return true if preCondition passes false if preCondition fails - * + * * @throws Exception if unexpected exception occurs * @throws BpmnError if process is to be determined. */ private boolean evaluateTaskPreCondition() throws Exception { - + if (!getBooleanParam(preCondition, "preCondition", DEFAULT_PRE_CONDITION)) { - + // Check special case for preCondition is "none" and pass as true if (preCondition != null && preCondition.getValue(execution).equals("none")) { return true; } - + log.warn("preCondition was not satisfied"); PreConditionFailBehavior failBehavior = PreConditionFailBehavior .valueOf(getStringParam(onPreConditionFail, @@ -269,7 +269,7 @@ protected String getStringParam(Expression expression, String paramName) } protected String getStringParam(Expression expression, String paramName, - String defaultValue) throws Exception { + String defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -292,7 +292,7 @@ protected Boolean getBooleanParam(Expression expression, String paramName) } protected Boolean getBooleanParam(Expression expression, String paramName, - Boolean defaultValue) throws Exception { + Boolean defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -322,7 +322,7 @@ protected Integer getIntegerParam(Expression expression, String paramName) } protected Integer getIntegerParam(Expression expression, String paramName, - Integer defaultValue) throws Exception { + Integer defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -352,7 +352,7 @@ protected Long getLongParam(Expression expression, String paramName) } protected Long getLongParam(Expression expression, String paramName, - Long defaultValue) throws Exception { + Long defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -384,7 +384,7 @@ protected Float getFloatParam(Expression expression, String paramName) } protected Float getFloatParam(Expression expression, String paramName, - Float defaultValue) throws Exception { + Float defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -414,7 +414,7 @@ protected Double getDoubleParam(Expression expression, String paramName) } protected Double getDoubleParam(Expression expression, String paramName, - Double defaultValue) throws Exception { + Double defaultValue) throws Exception { if (expression == null) { // return default return defaultValue; @@ -437,10 +437,10 @@ private Double getDoubleValue(Object value, String paramName) /** * For now only supports Map but may want to support * generics/others in future... - * + * */ protected Map getMapParam(Expression expression, - String paramName) throws Exception { + String paramName) throws Exception { if (expression == null) { // no default, so throw exception throw new Exception("Mandatory parameter '" + paramName + "' not specified"); @@ -449,7 +449,7 @@ protected Map getMapParam(Expression expression, } protected Map getMapParam(Expression expression, - String paramName, Map defaultValue) + String paramName, Map defaultValue) throws Exception { if (expression == null) { // return default @@ -482,4 +482,4 @@ private Map getMapValue(Object value, String paramName) } } -} +} \ No newline at end of file diff --git a/cws-ui/src/main/webapp/css/history.css b/cws-ui/src/main/webapp/css/history.css index 4cbde4d0..e565ab4c 100644 --- a/cws-ui/src/main/webapp/css/history.css +++ b/cws-ui/src/main/webapp/css/history.css @@ -61,34 +61,34 @@ summary { } .proc-var-flex-main { - margin-bottom: 10px; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - justify-content: flex-start; + margin-bottom: 10px; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; align-items: center; } .proc-var-flex-main-sub-1 { align-self: start; - display: flex; - flex-wrap: nowrap; + display: flex; + flex-wrap: nowrap; justify-content: space-between; } .proc-var-flex-main-sub-2 { - width: 150px; - word-wrap: break-word; + width: 160px; + word-wrap: break-word; overflow: hidden; } .proc-var-flex-main-sub-3 { - width: 200px; + width: 300px; word-wrap: break-word; } .proc-var-flex-btn { - align-self: start; + align-self: start; } #logDataNest { @@ -97,4 +97,4 @@ summary { .procInstId-cell { width: 300px; -} \ No newline at end of file +} diff --git a/cws-ui/src/main/webapp/js/modeler.js b/cws-ui/src/main/webapp/js/modeler.js index aeaa4983..732264e0 100644 --- a/cws-ui/src/main/webapp/js/modeler.js +++ b/cws-ui/src/main/webapp/js/modeler.js @@ -1,89787 +1,174480 @@ var bpmnModeler; var openDiagram; -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "../node_modules/@bpmn-io/cm-theme/dist/index.es.js": +/*!**********************************************************!*\ + !*** ../node_modules/@bpmn-io/cm-theme/dist/index.es.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ darkTheme: () => (/* binding */ darkTheme), +/* harmony export */ lightTheme: () => (/* binding */ lightTheme) +/* harmony export */ }); +/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/view */ "../node_modules/@codemirror/view/dist/index.js"); +/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/language */ "../node_modules/@codemirror/language/dist/index.js"); +/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/highlight */ "../node_modules/@lezer/highlight/dist/index.js"); + + + + +const highlightStyle$2 = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.syntaxHighlighting)(_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.HighlightStyle.define([ + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.strong, fontWeight: 'bold' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.emphasis, fontStyle: 'italic' }, +])); + +const theme$2 = _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.theme({ + '& .cm-lintRange': { + position: 'relative', + }, + '& .cm-lintRange::after': { + content: '""', + width: '100%', + position: 'absolute', + left: '0px', + bottom: '-2px', + height: '3px', + backgroundRepeat: 'repeat-x', + }, + '& .cm-lintRange.cm-lintRange-warning, & .cm-lintRange.cm-lintRange-error': { + backgroundImage: 'none', + }, + '& .cm-lintPoint::after': { + bottom: '-2px' + } +}); + +var commonTheme = [ + theme$2, + highlightStyle$2 +]; + +const _urlify = (color) => `%23${color.slice(1)}`; + +const colors = { + black: '#1f2b36', + darkGrey: '#2f3d58', + grey: '#404a5c', + midGrey: '#576071', + lightGrey: '#c5d1e5', + offWhite: '#d9e0f5', + snowWhite: '#eaf1ff', + white: '#ffffff', + mossGreen: '#7ab6aa', + iceBlue: '#6cbfd8', + waterBlue: '#065aaa', + brightBlue: '#0a56b9', + deepBlue: '#355472', + red: '#9f1c15', + orangeBrown: '#b4502f', + yellow: '#debd71', + lila: '#9a4890', + purple: '#5b2c83' +}; + +const colorByRole = { + lightBackground: colors.white, + darkBackground: colors.snowWhite, + selection: colors.snowWhite, + tooltipBackground: colors.offWhite, + error: colors.red, + warning: colors.yellow, + invalid: '#b40000' +}; + +const theme$1 = _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.theme( + { + '&': { color: colors.black, backgroundColor: colorByRole.lightBackground }, + '.cm-content': { caretColor: colors.darkGrey }, + '.cm-cursor, .cm-dropCursor': { borderLeftColor: colors.darkGrey }, + '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': + { backgroundColor: colorByRole.selection }, + + '.cm-panels': { backgroundColor: colorByRole.darkBackground, color: colors.grey }, + '.cm-panels.cm-panels-top': { borderBottom: `2px solid ${ colors.black }` }, + '.cm-panels.cm-panels-bottom': { borderTop: `2px solid ${ colors.black }` }, + + '.cm-searchMatch': { + backgroundColor: '#72a1ff59', + outline: `1px solid ${colors.midGrey}` + }, + '.cm-searchMatch.cm-searchMatch-selected': { backgroundColor: colors.offWhite }, + '.cm-activeLine': { backgroundColor: colorByRole.selection }, + '.cm-selectionMatch': { backgroundColor: colors.offWhite }, + + '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': { + outline: `1px solid ${colors.grey}` + }, + + '&.cm-focused .cm-matchingBracket': { + backgroundColor: colors.snowWhite + }, + + '.cm-gutters': { + backgroundColor: '#f3f7fe', + color: '#52668d', + border: 'none', + padding: '0 5px' + }, + + '.cm-activeLineGutter': { + backgroundColor: colorByRole.selection + }, + + '.cm-foldPlaceholder': { + backgroundColor: 'transparent', + border: 'none', + color: '#ddd' + }, + + '.cm-tooltip': { + border: 'none', + backgroundColor: colorByRole.tooltipBackground + }, + '.cm-tooltip .cm-tooltip-arrow:before': { + borderTopColor: 'transparent', + borderBottomColor: 'transparent' + }, + '.cm-tooltip .cm-tooltip-arrow:after': { + borderTopColor: colorByRole.tooltipBackground, + borderBottomColor: colorByRole.tooltipBackground + }, + '.cm-tooltip-autocomplete': { + '& > ul > li[aria-selected]': { + backgroundColor: colorByRole.darkBackground, + color: colors.midGrey + } + }, + '& .cm-lintRange.cm-lintRange-warning::after': { + backgroundImage: `url("data:image/svg+xml,")`, + }, + '& .cm-lintRange.cm-lintRange-error::after': { + backgroundImage: `url("data:image/svg+xml,")`, + }, + '& .cm-diagnostic-warning': { + border: `1px solid ${colorByRole.warning}`, + borderLeft: `5px solid ${colorByRole.warning}`, + background: colorByRole.lightBackground, + }, + '& .cm-diagnostic-error': { + border: `1px solid ${colorByRole.error}`, + borderLeft: `5px solid ${colorByRole.error}`, + background: colorByRole.lightBackground + }, + '& .cm-diagnostic': { + padding: '3px 8px' + } + }, + { dark: false } +); + +const highlightStyle$1 = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.syntaxHighlighting)(_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.HighlightStyle.define([ + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.macroName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName ], + color: colors.waterBlue + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bracket) ], + color: colors.waterBlue, + fontWeight: 'bold' + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.color, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.constant(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.standard(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.propertyName, ], + color: colors.deepBlue + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.propertyName) ], + color: colors.brightBlue, + }, + { tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.labelName ], color: colors.orangeBrown }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.annotation ], + color: colorByRole.invalid + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.number, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.changed, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.annotation, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.modifier, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.self, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.namespace, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.atom, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bool, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName) ], + color: colors.red + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.typeName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.className, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.attributeName ], + color: colors.lila + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.operator, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.operatorKeyword, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.tagName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.keyword ], + color: colors.purple + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.angleBracket, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.squareBracket, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.brace, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.separator, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.punctuation ], + color: colors.midGrey + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.regexp ], + color: colors.deepBlue + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.quote ], + color: colors.darkGrey + }, + { tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.character, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.deleted ], color: colors.orangeBrown }, + { + tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.link, + color: colors.mossGreen, + textDecoration: 'underline', + textUnderlinePosition: 'under' + }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.url, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.escape, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string) ], + color: colors.red + }, + { tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.meta ], color: colors.iceBlue }, + { tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.comment ], color: colors.midGrey, fontStyle: 'italic' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.strong, fontWeight: 'bold', color: colors.deepBlue }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.emphasis, fontStyle: 'italic', color: colors.deepBlue }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.strikethrough, textDecoration: 'line-through' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading, fontWeight: 'bold', color: colors.midGray }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading1), fontWeight: 'bold', color: colors.darkGrey }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading1, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading2, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading3, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading4 ], + fontWeight: 'bold', + color: colors.midGrey + }, + { tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading5, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading6, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.processingInstruction, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.inserted ], color: colors.grey }, + { + tag: [ _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.contentSeparator ], + color: colors.yellow + }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.invalid, color: colors.midGrey, borderBottom: `1px dotted ${colorByRole.invalid}` } +])); + +var bpmnioLight = [ + theme$1, + highlightStyle$1 +]; + +const ivory = '#abb2bf', + peach = '#f07178', + stone = '#7d8799', + invalid = '#ffffff', + pastelYellow = '#fffce1', + pastelOrange = '#ec9e6f', + raisinBlack = '#21252b', + highlightBackground = 'rgba(0, 0, 0, 0.5)', + background = '#292d3e', + tooltipBackground = '#353a42', + selection = 'rgba(128, 203, 196, 0.2)', + cursor = '#ffcc00'; + +const urlHash = '%23'; +const warningColorHex = 'fff890'; +const errorColor = 'red'; +const warningBackgroundColor = '#281e16'; +const errorBackgroundColor = '#281616'; + +const theme = _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.theme( + { + '&': { + color: '#ffffff', + backgroundColor: background + }, + '.cm-content': { + caretColor: cursor + }, + '&.cm-focused .cm-cursor': { + borderLeftColor: cursor + }, + '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': + { backgroundColor: selection }, + '.cm-panels': { backgroundColor: raisinBlack, color: '#ffffff' }, + '.cm-panels.cm-panels-top': { borderBottom: '2px solid black' }, + '.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' }, + '.cm-searchMatch': { + backgroundColor: '#72a1ff59', + outline: '1px solid #457dff' + }, + '.cm-searchMatch.cm-searchMatch-selected': { + backgroundColor: '#6199ff2f' + }, + '.cm-activeLine': { backgroundColor: highlightBackground }, + '.cm-selectionMatch': { backgroundColor: '#aafe661a' }, + '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': { + backgroundColor: '#bad0f847', + outline: '1px solid #515a6b' + }, + '.cm-gutters': { + background: '#292d3e', + color: '#676e95', + border: 'none', + padding: '0 5px' + }, + '.cm-activeLineGutter': { + backgroundColor: highlightBackground + }, + '.cm-foldPlaceholder': { + backgroundColor: 'transparent', + border: 'none', + color: '#ddd' + }, + '.cm-tooltip': { + border: 'none', + backgroundColor: tooltipBackground + }, + '.cm-tooltip .cm-tooltip-arrow:before': { + borderTopColor: 'transparent', + borderBottomColor: 'transparent' + }, + '.cm-tooltip .cm-tooltip-arrow:after': { + borderTopColor: tooltipBackground, + borderBottomColor: tooltipBackground + }, + '.cm-tooltip-autocomplete': { + '& > ul > li[aria-selected]': { + backgroundColor: highlightBackground, + color: ivory + } + }, + '& .cm-lintRange.cm-lintRange-warning::after': { + backgroundImage: `url("data:image/svg+xml,")`, + }, + '& .cm-lintRange.cm-lintRange-error::after': { + backgroundImage: `url("data:image/svg+xml,")`, + }, + '& .cm-diagnostic-warning': { + borderLeft: `5px solid #${warningColorHex}`, + background: warningBackgroundColor + }, + '& .cm-diagnostic-error': { + borderLeft: `5px solid ${errorColor}`, + background: errorBackgroundColor + }, + '& .cm-diagnostic': { + borderRadius: '2px', + padding: '3px 8px' + } + }, + { dark: true } +); + +const highlightStyle = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.syntaxHighlighting)(_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.HighlightStyle.define([ + + // Markdown headings + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading1, color: pastelYellow }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading2, color: pastelYellow }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading3, color: pastelYellow }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading4, color: pastelYellow }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading5, color: pastelYellow }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading6, color: pastelYellow }, + + // Feelers + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bracket), color: pastelOrange, fontWeight: 'bold' }, + + // Everything else + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.keyword, color: '#c792ea' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.operator, color: '#89ddff' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName), color: '#eeffff' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.typeName, color: '#f07178' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.atom, color: '#f78c6c' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.number, color: '#ff5370' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bool, color: '#ff5370' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName), color: '#82aaff' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string, color: '#c3e88d' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.comment, color: stone }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.tagName, color: '#ff5370' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bracket, color: '#a2a1a4' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.meta, color: '#ffcb6b' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string), color: peach }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.propertyName, color: pastelOrange }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName, color: pastelOrange }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.attributeName, color: peach }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.className, color: peach }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.invalid, color: invalid } +])); + +var bpmnioDark = [ + theme, + highlightStyle +]; + +const lightTheme = [ ...commonTheme, ...bpmnioLight ]; +const darkTheme = [ ...commonTheme, ...bpmnioDark ]; + + + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/element-template-chooser/dist/index.es.js": +/*!**************************************************************************!*\ + !*** ../node_modules/@bpmn-io/element-template-chooser/dist/index.es.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ index) +/* harmony export */ }); +/* harmony import */ var bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bpmn-js/lib/util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); + + +/** + * An element template chooser that hooks into + * properties panel fired "choose template" events. + * + * @param {Object} config + * @param {EventBus} eventBus + * @param {ElementTemplates} elementTemplates + * @param {Translate} translate + * @param {PopupMenu} popupMenu + */ +function ElementTemplateChooser( + config, + eventBus, + elementTemplates, + translate, + popupMenu) { - var _Modeler = _interopRequireDefault(require("bpmn-js/lib/Modeler")); + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._translate = translate; + this._popupMenu = popupMenu; - var _bpmnJsPropertiesPanel = _interopRequireDefault(require("bpmn-js-properties-panel")); + const enableChooser = !config || config.elementTemplateChooser !== false; - var _camunda = _interopRequireDefault(require("bpmn-js-properties-panel/lib/provider/camunda")); + enableChooser && eventBus.on('elementTemplates.select', (event) => { - var _camunda2 = _interopRequireDefault(require("camunda-bpmn-moddle/resources/camunda.json")); + const { element } = event; - var _minDash = require("min-dash"); + this.open(element).then(template => { + elementTemplates.applyTemplate(element, template); + }).catch(err => { + if (err !== 'user-canceled') { + console.error('elementTemplate.select :: error', err); + } + }); + }); +} - var _newDiagram = _interopRequireDefault(require("../resources/newDiagram.bpmn")); +ElementTemplateChooser.$inject = [ + 'config.connectorsExtension', + 'eventBus', + 'elementTemplates', + 'translate', + 'popupMenu' +]; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +ElementTemplateChooser.prototype.open = function(element) { - var templates = require('../resources/elements.json'); + const popupMenu = this._popupMenu; + const translate = this._translate; + const eventBus = this._eventBus; - var container = (0, _jquery.default)('#js-drop-zone'); - var canvas = (0, _jquery.default)('#js-canvas'); - bpmnModeler = new _Modeler.default({ - container: canvas, - propertiesPanel: { - parent: '#js-properties-panel' - }, - elementTemplates: templates, - keyboard: { - bindTo: document - }, - additionalModules: [_bpmnJsPropertiesPanel.default, _camunda.default], - moddleExtensions: { - camunda: _camunda2.default - } - }); - container.removeClass('with-diagram'); + return new Promise((resolve, reject) => { - function createNewDiagram() { - openDiagram(_newDiagram.default); - } + const handleClosed = () => reject('user-canceled'); - openDiagram = async function openDiagram(xml) { - try { - await bpmnModeler.importXML(xml); - container.removeClass('with-error').addClass('with-diagram'); - } catch (err) { - container.removeClass('with-diagram').addClass('with-error'); - container.find('.error pre').text(err.message); - console.error(err); - } - } + eventBus.once('popupMenu.close', handleClosed); - function registerFileDrop(container, callback) { - function handleFileSelect(e) { - e.stopPropagation(); - e.preventDefault(); - var files = e.dataTransfer.files; - var file = files[0]; - var reader = new FileReader(); + eventBus.once('elementTemplateChooser.chosen', event => { - reader.onload = function (e) { - var xml = e.target.result; - callback(xml); - }; + const { template } = event; - reader.readAsText(file); - } + eventBus.off('popupMenu.close', handleClosed); - function handleDragOver(e) { - e.stopPropagation(); - e.preventDefault(); - e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. - } + resolve(template); + }); - container.get(0).addEventListener('dragover', handleDragOver, false); - container.get(0).addEventListener('drop', handleFileSelect, false); - } ////// file drag / drop /////////////////////// -// check file api availability + popupMenu.open(element, 'element-template-chooser', { x: 0, y: 0 }, { + title: translate('Choose element template'), + search: true, + width: 350 + }); + }); +}; - if (!window.FileList || !window.FileReader) { - window.alert('Looks like you use an older browser that does not support drag and drop. ' + 'Try using Chrome, Firefox or the Internet Explorer > 10.'); - } else { - registerFileDrop(container, openDiagram); - } // bootstrap diagram functions +/** + * A entry provider for the popup menu. + */ +function ElementTemplateChooserEntryProvider(popupMenu, eventBus, translate, elementTemplates) { + this._popupMenu = popupMenu; + this._eventBus = eventBus; + this._translate = translate; + this._elementTemplates = elementTemplates; - (0, _jquery.default)(function () { - (0, _jquery.default)('#js-create-diagram').click(function (e) { - e.stopPropagation(); - e.preventDefault(); - createNewDiagram(); - }); - var downloadLink = (0, _jquery.default)('#js-download-diagram'); - var downloadSvgLink = (0, _jquery.default)('#js-download-svg'); - var deployToCwsLink = (0, _jquery.default)('#deploy-to-cws'); - (0, _jquery.default)('.buttons a').click(function (e) { - if (!(0, _jquery.default)(this).is('.active')) { - e.preventDefault(); - e.stopPropagation(); - } - }); + this.register(); +} - function setEncoded(link, name, data) { - var encodedData = encodeURIComponent(data); +ElementTemplateChooserEntryProvider.$inject = [ + 'popupMenu', + 'eventBus', + 'translate', + 'elementTemplates' +]; - if (data) { - link.addClass('active').attr({ - 'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData, - 'download': name - }); - } else { - link.removeClass('active'); - } - } +/** + * Register replace menu provider in the popup menu + */ +ElementTemplateChooserEntryProvider.prototype.register = function() { + this._popupMenu.registerProvider('element-template-chooser', this); +}; - var exportArtifacts = (0, _minDash.debounce)(async function () { - try { - const { - svg - } = await bpmnModeler.saveSVG(); - setEncoded(downloadSvgLink, 'diagram.svg', svg); - } catch (err) { - console.error('Error happened saving SVG: ', err); - setEncoded(downloadSvgLink, 'diagram.svg', null); - } +/** + * Adds the element templates to the replace menu. + * @param {djs.model.Base} element + * + * @returns {Object} + */ +ElementTemplateChooserEntryProvider.prototype.getPopupMenuEntries = function(element) { - try { - const { - xml - } = await bpmnModeler.saveXML({ - format: true - }); - setEncoded(downloadLink, 'diagram.bpmn', xml); - } catch (err) { - console.log('Error happened saving XML: ', err); - setEncoded(downloadLink, 'diagram.bpmn', null); - } + // convert to object + return this.getTemplateEntries(element).reduce((entries, [ key, value ]) => { + entries[key] = value; - try { - deployToCwsLink.css('opacity', '1.0'); - } catch (err) { - console.error('Error updating Deploy To CWS button opacity: ', err); - } - }, 500); - bpmnModeler.on('commandStack.changed', exportArtifacts); - }); + return entries; + }, {}); - },{"../resources/elements.json":659,"../resources/newDiagram.bpmn":660,"bpmn-js-properties-panel":2,"bpmn-js-properties-panel/lib/provider/camunda":63,"bpmn-js/lib/Modeler":114,"camunda-bpmn-moddle/resources/camunda.json":243,"jquery":439,"min-dash":646}],2:[function(require,module,exports){ - module.exports = require('./lib'); +}; - },{"./lib":33}],3:[function(require,module,exports){ - 'use strict'; +/** + * Get all element templates that can be used to replace the given element. + * + * @param {djs.model.Base} element + * + * @return {Array} a list of element templates as menu entries + */ +ElementTemplateChooserEntryProvider.prototype.getTemplateEntries = function(element) { + + const eventBus = this._eventBus; + const translate = this._translate; + + return this._getMatchingTemplates(element).map(template => { + + const { + icon = {}, + category + } = template; + + const entryId = `apply-template-${ template.id }`; + + return [ entryId, { + label: template.name && translate(template.name), + description: template.description && translate(template.description), + documentationRef: template.documentationRef, + imageUrl: icon.contents, + group: category && { ...category, name: translate(category.name) }, + action: () => { + eventBus.fire('elementTemplateChooser.chosen', { element, template }); + } + } ]; + }); +}; + +/** + * Returns the templates that can the element can be replaced with. + * + * @param {djs.model.Base} element + * + * @return {Array} + */ +ElementTemplateChooserEntryProvider.prototype._getMatchingTemplates = function(element) { + return this._elementTemplates.getLatest().filter(template => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, template.appliesTo) && !isTemplateApplied(element, template); + }); +}; - var DEFAULT_PRIORITY = 1000; +// helpers //////////// - /** - * A component that decides upon the visibility / editable - * state of properties in the properties panel. - * - * Implementors must subclass this component and override - * {@link PropertiesActivator#isEntryVisible} and - * {@link PropertiesActivator#isPropertyEditable} to provide - * custom behavior. - * - * @class - * @constructor - * - * @param {EventBus} eventBus - * @param {Number} [priority] at which priority to hook into the activation - */ - function PropertiesActivator(eventBus, priority) { - var self = this; +function isTemplateApplied(element, template) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getBusinessObject)(element); - priority = priority || DEFAULT_PRIORITY; + if (businessObject) { + return businessObject.get('modelerTemplate') === template.id; + } - eventBus.on('propertiesPanel.isEntryVisible', priority, function(e) { - return self.isEntryVisible(e.entry, e.element); - }); + return false; +} - eventBus.on('propertiesPanel.isPropertyEditable', priority, function(e) { - return self.isPropertyEditable(e.entry, e.propertyName, e.element); - }); - } +var index = { + __init__: [ + 'elementTemplateChooser', + 'elementTemplateChooserEntryProvider' + ], + elementTemplateChooser: [ 'type', ElementTemplateChooser ], + elementTemplateChooserEntryProvider: [ 'type', ElementTemplateChooserEntryProvider ] +}; - PropertiesActivator.$inject = [ 'eventBus' ]; - module.exports = PropertiesActivator; +//# sourceMappingURL=index.es.js.map - /** - * Should the given entry be visible for the specified element. - * - * @method PropertiesActivator#isEntryVisible - * - * @param {EntryDescriptor} entry - * @param {ModdleElement} element - * - * @returns {Boolean} - */ - PropertiesActivator.prototype.isEntryVisible = function(entry, element) { - return true; - }; +/***/ }), - /** - * Should the given property be editable for the specified element - * - * @method PropertiesActivator#isPropertyEditable - * - * @param {EntryDescriptor} entry - * @param {String} propertyName - * @param {ModdleElement} element - * - * @returns {Boolean} - */ - PropertiesActivator.prototype.isPropertyEditable = function(entry, propertyName, element) { - return true; - }; - },{}],4:[function(require,module,exports){ - 'use strict'; +/***/ "../node_modules/@bpmn-io/extract-process-variables/dist/index.js": +/*!************************************************************************!*\ + !*** ../node_modules/@bpmn-io/extract-process-variables/dist/index.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - var escapeHTML = require('./Utils').escapeHTML; +"use strict"; - var domify = require('min-dom').domify, - domQuery = require('min-dom').query, - domQueryAll = require('min-dom').queryAll, - domRemove = require('min-dom').remove, - domClasses = require('min-dom').classes, - domClosest = require('min-dom').closest, - domAttr = require('min-dom').attr, - domDelegate = require('min-dom').delegate, - domMatches = require('min-dom').matches; - var forEach = require('lodash/forEach'), - filter = require('lodash/filter'), - get = require('lodash/get'), - keys = require('lodash/keys'), - isEmpty = require('lodash/isEmpty'), - isArray = require('lodash/isArray'), - xor = require('lodash/xor'), - debounce = require('lodash/debounce'); +Object.defineProperty(exports, "__esModule", ({ value: true })); - var updateSelection = require('selection-update'); +var minDash = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.cjs"); - var scrollTabs = require('scroll-tabs').default; +/** + * Get a inputOutput from the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} the inputOutput object + */ +function getInputOutput(element) { + return (getElements(element, 'camunda:InputOutput') || [])[0]; +} - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters(element) { + return getParameters(element, 'inputParameters'); +} - var HIDE_CLASS = 'bpp-hidden'; - var DEBOUNCE_DELAY = 300; +/** + * Return all output parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * @param {boolean} insideConnector + * + * @return {Array} a list of output parameter objects + */ +function getOutputParameters(element) { + return getParameters(element, 'outputParameters'); +} +/** + * Return all form fields existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of form fields + */ +function getFormFields(element) { + var formData = getFormData(element); + return (formData && formData.get('fields')) || []; +} - function isToggle(node) { - return node.type === 'checkbox' || node.type === 'radio'; - } +/** + * Return form data existing in the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} + */ +function getFormData(element) { + return getElements(element, 'camunda:FormData')[0]; +} - function isSelect(node) { - return node.type === 'select-one'; - } +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getOutMappings(element) { + return getElements(element, 'camunda:Out'); +} - function isContentEditable(node) { - return domAttr(node, 'contenteditable'); - } - function getPropertyPlaceholders(node) { - var selector = 'input[name], textarea[name], [data-value], [contenteditable]'; - var placeholders = domQueryAll(selector, node); - if ((!placeholders || !placeholders.length) && domMatches(node, selector)) { - placeholders = [ node ]; - } - return placeholders; - } +// helpers ////////// - /** - * Return all active form controls. - * This excludes the invisible controls unless all is true - * - * @param {Element} node - * @param {Boolean} [all=false] - */ - function getFormControls(node, all) { - var controls = domQueryAll('input[name], textarea[name], select[name], [contenteditable]', node); +function getElements(element, type, property) { + var elements = getExtensionElements(element, type); - if (!controls || !controls.length) { - controls = domMatches(node, 'option') ? [ node ] : controls; - } + return !property ? elements : (elements[0] || {})[property] || []; +} - if (!all) { - controls = filter(controls, function(node) { - return !domClosest(node, '.' + HIDE_CLASS); - }); - } +function getParameters(element, property) { + var inputOutput = getInputOutput(element); - return controls; - } + return (inputOutput && inputOutput.get(property)) || []; +} - function getFormControlValuesInScope(entryNode) { - var values = {}; +function getExtensionElements(element, type) { + var elements = []; + var extensionElements = element.get('extensionElements'); - var controlNodes = getFormControls(entryNode); + if (typeof extensionElements !== 'undefined') { + var extensionValues = extensionElements.get('values'); - forEach(controlNodes, function(controlNode) { - var value = controlNode.value; + if (typeof extensionValues !== 'undefined') { + elements = minDash.filter(extensionValues, function(value) { + return is$2(value, type); + }); + } + } - var name = domAttr(controlNode, 'name') || domAttr(controlNode, 'data-name'); + return elements; +} - // take toggle state into account for radio / checkboxes - if (isToggle(controlNode)) { - if (controlNode.checked) { - if (!domAttr(controlNode, 'value')) { - value = true; - } else { - value = controlNode.value; - } - } else { - value = null; - } - } else - if (isContentEditable(controlNode)) { - value = controlNode.innerText; - } +function is$2(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} - if (value !== null) { - // return the actual value - // handle serialization in entry provider - // (ie. if empty string should be serialized or not) - values[name] = value; - } - }); +/** + * Get all parent elements for a given element. + * + * @param {ModdleElement|string} element + * + * @returns {Array} + */ +function getParents(element) { + var parents = []; + var current = element; - return values; + while (current.$parent) { + parents.push(current.$parent); + current = current.$parent; + } - } + return parents; +} - /** - * Extract input values from entry node - * - * @param {DOMElement} entryNode - * @returns {Object} - */ - function getFormControlValues(entryNode) { +/** + * Iterate over each element in a collection, calling the iterator function `fn` + * with (element, index, recursionDepth). + * + * Recurse into all elements that are returned by `fn`. + * + * @param {Object|Array} elements + * @param {Function} fn iterator function called with (element, index, recursionDepth) + * @param {number} [depth] maximum recursion depth + */ +function eachElement(elements, fn, depth) { + depth = depth || 0; - var values; + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - var listContainer = domQuery('[data-list-entry-container]', entryNode); - if (listContainer) { - values = []; - var listNodes = listContainer.children || []; - forEach(listNodes, function(listNode) { - values.push(getFormControlValuesInScope(listNode)); - }); - } else { - values = getFormControlValuesInScope(entryNode); - } + minDash.forEach(elements, function(s, i) { + var filter = fn(s, i, depth); - return values; - } + if (minDash.isArray(filter) && filter.length) { + eachElement(filter, fn, depth + 1); + } + }); +} - /** - * Return true if the given form extracted value equals - * to an old cached version. - * - * @param {Object} value - * @param {Object} oldValue - * @return {Boolean} - */ - function valueEqual(value, oldValue) { +/** + * Adds an element to a collection and returns true if the + * element was added. + * + * @param {Array} elements + * @param {Object} e + * @param {boolean} unique + */ +function add(elements, e, unique) { + var canAdd = !unique || elements.indexOf(e) === -1; - if (value && !oldValue) { - return false; - } + if (canAdd) { + elements.push(e); + } - var allKeys = keys(value).concat(keys(oldValue)); + return canAdd; +} - return allKeys.every(function(key) { - return value[key] === oldValue[key]; - }); - } +/** + * Collects self + flow elements up to a given depth from a list of elements. + * + * @param {ModdleElement|Array} elements the elements to select the flowElements from + * @param {boolean} unique whether to return a unique result set (no duplicates) + * @param {number} maxDepth the depth to search through or -1 for infinite + * + * @return {Array} found elements + */ +function selfAndFlowElements(elements, unique, maxDepth) { + var result = [], + processedFlowElements = []; - /** - * Return true if the given form extracted value(s) - * equal an old cached version. - * - * @param {Array|Object} values - * @param {Array|Object} oldValues - * @return {Boolean} - */ - function valuesEqual(values, oldValues) { + eachElement(elements, function(element, i, depth) { + add(result, element, unique); - if (isArray(values)) { + var flowElements = element.flowElements; - if (values.length !== oldValues.length) { - return false; - } + // max traversal depth not reached yet + if (maxDepth === -1 || depth < maxDepth) { - return values.every(function(v, idx) { - return valueEqual(v, oldValues[idx]); - }); - } + // flowElements exist && flowElements not yet processed + if (flowElements && add(processedFlowElements, flowElements, unique)) { + return flowElements; + } + } + }); - return valueEqual(values, oldValues); - } + return result; +} - /** - * Return a mapping of { id: entry } for all entries in the given groups in the given tabs. - * - * @param {Object} tabs - * @return {Object} - */ - function extractEntries(tabs) { - return keyBy(flattenDeep(map(flattenDeep(map(tabs, 'groups')), 'entries')), 'id'); - } +/** + * Return self + ALL flowElements for a number of elements + * + * @param {Array} elements to query + * @param {boolean} allowDuplicates to allow duplicates in the result set + * + * @return {Array} the collected elements + */ +function selfAndAllFlowElements(elements, allowDuplicates) { + return selfAndFlowElements(elements, !allowDuplicates, -1); +} - /** - * Return a mapping of { id: group } for all groups in the given tabs. - * - * @param {Object} tabs - * @return {Object} - */ - function extractGroups(tabs) { - return keyBy(flattenDeep(map(tabs, 'groups')), 'id'); - } +/** + * Return full moddle element for given element id + * + * @param {string} elementId + * @param {ModdleElement} rootElement + * + * @returns {ModdleElement} + */ +function getElement(elementId, rootElement) { + var allElements = selfAndAllFlowElements(rootElement); + + return minDash.find(allElements, function(element) { + return element.id === elementId; + }); +} + +function addVariableToList(variablesList, newVariable) { + var foundIdx = minDash.findIndex(variablesList, function(variable) { + return ( + variable.name === newVariable.name && variable.scope === newVariable.scope + ); + }); + + if (foundIdx >= 0) { + variablesList[foundIdx].origin = combineArrays$1( + variablesList[foundIdx].origin, + newVariable.origin + ); + } else { + variablesList.push(newVariable); + } +} + +/** + * Creates new process variable definition object + * Identifies correct (highest) scope, in which variable is available + * + * @param {ModdleElement} flowElement + * @param {String} name + * @param {ModdleElement} defaultScope + * + * @returns {ProcessVariable} + */ +function createProcessVariable(flowElement, name, defaultScope) { + var scope = getScope(flowElement, defaultScope, name); - /** - * A properties panel implementation. - * - * To use it provide a `propertiesProvider` component that knows - * about which properties to display. - * - * Properties edit state / visibility can be intercepted - * via a custom {@link PropertiesActivator}. - * - * @class - * @constructor - * - * @param {Object} config - * @param {EventBus} eventBus - * @param {Modeling} modeling - * @param {PropertiesProvider} propertiesProvider - * @param {Canvas} canvas - * @param {CommandStack} commandStack - */ - function PropertiesPanel(config, eventBus, modeling, propertiesProvider, commandStack, canvas) { + return { + name: name, + origin: [ flowElement ], + scope: scope, + }; +} - this._eventBus = eventBus; - this._modeling = modeling; - this._commandStack = commandStack; - this._canvas = canvas; - this._propertiesProvider = propertiesProvider; - this._init(config); - } +// helpers //////////////////// - PropertiesPanel.$inject = [ - 'config.propertiesPanel', - 'eventBus', - 'modeling', - 'propertiesProvider', - 'commandStack', - 'canvas' - ]; +/** + * Set parent container if it defines it's own scope for the variable, so + * when it defines an input mapping for it. Otherwise returns the default global scope + */ +function getScope(element, globalScope, variableName) { + var parents = getParents(element); + + var scopedParent = minDash.find(parents, function(parent) { + return ( + is$1(parent, 'bpmn:SubProcess') && hasInputParameter(parent, variableName) + ); + }); + + return scopedParent ? scopedParent : globalScope; +} + +function is$1(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +function hasInputParameter(element, name) { + return minDash.find(getInputParameters(element), function(input) { + return input.name === name; + }); +} + +function combineArrays$1(a, b) { + return a.concat(b); +} + +/** + * Retrieves process variables defined in output parameters, e.g. + * + * + * 200 + * ${myLocalVar + 20} + * + * + * => Adds two variables "variable1" & "variable2" to the list. + * + */ +function extractOutputParameters(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - module.exports = PropertiesPanel; + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + minDash.forEach(elements, function(element) { - PropertiesPanel.prototype._init = function(config) { + // variables are created by output parameters + var outputParameters = getOutputParameters(element); - var canvas = this._canvas, - eventBus = this._eventBus; + // extract all variables with correct scope + minDash.forEach(outputParameters, function(parameter) { + var newVariable = createProcessVariable( + element, + parameter.name, + containerElement + ); - var self = this; + addVariableToList(processVariables, newVariable); + }); + }); - /** - * Select the root element once it is added to the canvas - */ - eventBus.on('root.added', function(e) { - var element = e.element; + return processVariables; +} - if (isImplicitRoot(element)) { - return; - } +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * => Adds one variable "variable1"to the list. + * + */ +function extractResultVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - self.update(element); - }); + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - eventBus.on('selection.changed', function(e) { - var newElement = e.newSelection[0]; + minDash.forEach(elements, function(element) { - var rootElement = canvas.getRootElement(); + var resultVariable = getResultVariable(element); - if (isImplicitRoot(rootElement)) { - return; - } + if (resultVariable) { + var newVariable = createProcessVariable( + element, + resultVariable, + containerElement + ); - self.update(newElement); - }); + addVariableToList(processVariables, newVariable); + } + }); - // add / update tab-bar scrolling - eventBus.on([ - 'propertiesPanel.changed', - 'propertiesPanel.resized' - ], function(event) { + return processVariables; +} - var tabBarNode = domQuery('.bpp-properties-tab-bar', self._container); - if (!tabBarNode) { - return; - } +// helpers /////////////////////// - var scroller = scrollTabs.get(tabBarNode); +function getResultVariable(element) { + return element.get('camunda:resultVariable'); +} - if (!scroller) { +/** + * Retrieves process variables defined in form fields, e.g. + * + * + * + * + * + * + * => Adds two variables "variable1" & "variable2" to the list. + * + */ +function extractFormFields(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - // we did not initialize yet, do that - // now and make sure we select the active - // tab on scroll update - scroller = scrollTabs(tabBarNode, { - selectors: { - tabsContainer: '.bpp-properties-tabs-links', - tab: '.bpp-properties-tabs-links li', - ignore: '.bpp-hidden', - active: '.bpp-active' - } - }); + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + minDash.forEach(elements, function(element) { - scroller.on('scroll', function(newActiveNode, oldActiveNode, direction) { + var formFields = getFormFields(element); - var linkNode = domQuery('[data-tab-target]', newActiveNode); + // extract all variables with correct scope + minDash.forEach(formFields, function(field) { + var newVariable = createProcessVariable( + element, + field.id, + containerElement + ); - var tabId = domAttr(linkNode, 'data-tab-target'); + addVariableToList(processVariables, newVariable); + }); + }); - self.activateTab(tabId); - }); - } + return processVariables; +} - // react on tab changes and or tabContainer resize - // and make sure the active tab is shown completely - scroller.update(); - }); +/** + * Retrieves process variables defined in output mappings and + * ignores local variables, e.g. + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractOutMappings(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - eventBus.on('elements.changed', function(e) { + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - var current = self._current; - var element = current && current.element; + minDash.forEach(elements, function(element) { - if (element) { - if (e.elements.indexOf(element) !== -1) { - self.update(element); - } - } - }); + var outMappings = getOutMappings(element); - eventBus.on('elementTemplates.changed', function() { - var current = self._current; - var element = current && current.element; + // extract all variables with correct scope + minDash.forEach(outMappings, function(mapping) { - if (element) { - self.update(element); - } - }); + // do not use variables marked as + if (mapping.local) { + return; + } - eventBus.on('diagram.destroy', function() { - self.detach(); - }); + var newVariable = createProcessVariable( + element, + mapping.target, + containerElement + ); - this._container = domify('
'); + addVariableToList(processVariables, newVariable); + }); + }); - this._bindListeners(this._container); + return processVariables; +} - if (config && config.parent) { - this.attachTo(config.parent); - } - }; +/** + * + * @param {ModdleElement} element + * @param {string} [type] - optional + * + * @return {Array|undefined} collection of event definitions or none + */ +function getEventDefinitions(element, type) { + var eventDefinitions = element.eventDefinitions; + if (!eventDefinitions || !type) { + return eventDefinitions; + } - PropertiesPanel.prototype.attachTo = function(parentNode) { + return minDash.filter(eventDefinitions, function(definition) { + return is(definition, type); + }); +} - if (!parentNode) { - throw new Error('parentNode required'); - } +/** + * Returns error event definitions for a given element. + * + * @param {ModdleElement} element + * + * @return {Array} collection of error event definitions + */ +function getErrorEventDefinitions(element) { + return getEventDefinitions(element, 'bpmn:ErrorEventDefinition'); +} - // ensure we detach from the - // previous, old parent - this.detach(); +/** + * Returns escalation event definitions for a given element. + * + * @param {ModdleElement} element + * + * @return {Array} collection of escalation event definitions + */ +function getEscalationEventDefinitions(element) { + return getEventDefinitions(element, 'bpmn:EscalationEventDefinition'); +} - // unwrap jQuery if provided - if (parentNode.get && parentNode.constructor.prototype.jquery) { - parentNode = parentNode.get(0); - } - if (typeof parentNode === 'string') { - parentNode = domQuery(parentNode); - } +// helper //////////////// - var container = this._container; +function is(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} - parentNode.appendChild(container); +/** + * Retrieves process variables defined in event definitions, e.g. + * + * + * + * => Adds one variable "variable1" to the list. + * + * + * + * => Adds two variables "variable2" & "variable3" to the list. + * + */ +function extractEventDefinitionVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - this._emit('attach'); - }; + var addVariable = function(element, name) { + var newVariable = createProcessVariable( + element, + name, + containerElement + ); - PropertiesPanel.prototype.detach = function() { + addVariableToList(processVariables, newVariable); + }; - var container = this._container, - parentNode = container.parentNode; + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - if (!parentNode) { - return; - } + minDash.forEach(elements, function(element) { - this._emit('detach'); + // (1) error event code + message variable + var errorEventDefinitions = getErrorEventDefinitions(element); - parentNode.removeChild(container); - }; + minDash.forEach(errorEventDefinitions, function(definition) { + var errorCodeVariable = definition.get('errorCodeVariable'), + errorMessageVariable = definition.get('errorMessageVariable'); - /** - * Select the given tab within the properties panel. - * - * @param {Object|String} tab - */ - PropertiesPanel.prototype.activateTab = function(tab) { + if (errorCodeVariable) { + addVariable(element, errorCodeVariable); + } - var tabId = typeof tab === 'string' ? tab : tab.id; + if (errorMessageVariable) { + addVariable(element, errorMessageVariable); + } + }); - var current = this._current; + // (2) escalation code variable + var escalationEventDefinitions = getEscalationEventDefinitions(element); - var panelNode = current.panel; + minDash.forEach(escalationEventDefinitions, function(definition) { - var allTabNodes = domQueryAll('.bpp-properties-tab', panelNode), - allTabLinkNodes = domQueryAll('.bpp-properties-tab-link', panelNode); + var escalationCodeVariable = definition.get('escalationCodeVariable'); - forEach(allTabNodes, function(tabNode) { + if (escalationCodeVariable) { + addVariable(element, escalationCodeVariable); + } + }); - var currentTabId = domAttr(tabNode, 'data-tab'); + }); - domClasses(tabNode).toggle('bpp-active', tabId === currentTabId); - }); + return processVariables; +} - forEach(allTabLinkNodes, function(tabLinkNode) { +var extractors = [ + extractOutputParameters, + extractResultVariables, + extractFormFields, + extractOutMappings, + extractEventDefinitionVariables +]; - var tabLink = domQuery('[data-tab-target]', tabLinkNode), - currentTabId = domAttr(tabLink, 'data-tab-target'); +/** + * @typedef {Object} ProcessVariable + * @property {string} name + * @property {Array} origin + * @property {ModdleElement} scope + */ - domClasses(tabLinkNode).toggle('bpp-active', tabId === currentTabId); - }); - }; - /** - * Update the DOM representation of the properties panel - */ - PropertiesPanel.prototype.update = function(element) { - var current = this._current; +/** + * Extractors add ProcessVariables to the `options.processVariables` parameter. + * @callback extractor + * @param {Object} options + * @param {Array} options.elements + * @param {ModdleElement} options.containerElement + * @param {Array} options.processVariables + */ - // no actual selection change - var needsCreate = true; +// api ///////////////////////// - if (typeof element === 'undefined') { +/** + * Retrieves all process variables for a given container element. + * @param {ModdleElement} containerElement + * @param {Array} additionalExtractors + * + * @returns {Promise>} + */ +function getProcessVariables(containerElement, additionalExtractors = []) { + const allPromises = []; + + var processVariables = []; + + // (1) extract all flow elements inside the container + var elements = selfAndAllFlowElements([ containerElement ], false); + + // (2) extract all variables from the extractors + minDash.forEach([ ...extractors, ...additionalExtractors ], function(extractor) { + allPromises.push( + extractor({ + elements: elements, + containerElement: containerElement, + processVariables: processVariables + }) + ); + }); + + return Promise.all(allPromises) + .then(() => processVariables); +} + +/** + * Retrieves all variables which are available in the given scope + * + * * Exclude variables which are only available in other scopes + * * Exclude variables which are produced by the given element + * * Include variables which are available in parent scopes + * + * @param {string} scope + * @param {ModdleElement} rootElement element from where to extract all variables + * @param {Array} additionalExtractors + * + * @returns {Promise>} + */ +async function getVariablesForScope(scope, rootElement, additionalExtractors = []) { - // use RootElement of BPMN diagram to generate properties panel if no element is selected - element = this._canvas.getRootElement(); - } + var allVariables = await getProcessVariables(rootElement, additionalExtractors); - var newTabs = this._propertiesProvider.getTabs(element); + var scopeElement = getElement(scope, rootElement); - if (current && current.element === element) { - // see if we can reuse the existing panel + // (1) get variables for given scope + var scopeVariables = minDash.filter(allVariables, function(variable) { + return variable.scope.id === scopeElement.id; + }); - needsCreate = this._entriesChanged(current, newTabs); - } + // (2) get variables for parent scopes + var parents = getParents(scopeElement); - if (needsCreate) { + var parentsScopeVariables = minDash.filter(allVariables, function(variable) { + return minDash.find(parents, function(parent) { + return parent.id === variable.scope.id; + }); + }); - if (current) { + return combineArrays(scopeVariables, parentsScopeVariables); +} - // get active tab from the existing panel before remove it - var activeTabNode = domQuery('.bpp-properties-tab.bpp-active', current.panel); +// helpers //////////////////// - var activeTabId; - if (activeTabNode) { - activeTabId = domAttr(activeTabNode, 'data-tab'); - } +function combineArrays(a, b) { + return a.concat(b); +} - // remove old panel - domRemove(current.panel); - } +exports.getProcessVariables = getProcessVariables; +exports.getVariablesForScope = getVariablesForScope; - this._current = this._create(element, newTabs); - // activate the saved active tab from the remove panel or the first tab - (activeTabId) ? this.activateTab(activeTabId) : this.activateTab(this._current.tabs[0]); +/***/ }), - } +/***/ "../node_modules/@bpmn-io/extract-process-variables/zeebe/index.js": +/*!*************************************************************************!*\ + !*** ../node_modules/@bpmn-io/extract-process-variables/zeebe/index.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (this._current) { - // make sure correct tab contents are visible - this._updateActivation(this._current); +"use strict"; - } - this._emit('changed'); - }; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var minDash = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.cjs"); - /** - * Returns true if one of two groups has different entries than the other. - * - * @param {Object} current - * @param {Object} newTabs - * @return {Boolean} - */ - PropertiesPanel.prototype._entriesChanged = function(current, newTabs) { +/** + * Get a inputOutput from the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} the inputOutput object + */ +function getInputOutput(element) { + return (getElements(element, 'zeebe:IoMapping') || [])[0]; +} - var oldEntryIds = keys(current.entries), - newEntryIds = keys(extractEntries(newTabs)); +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters(element) { + return getParameters(element, 'inputParameters'); +} - return !isEmpty(xor(oldEntryIds, newEntryIds)); - }; +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getOutMappings(element) { + return (getInputOutput(element) || {}).outputParameters; +} - PropertiesPanel.prototype._emit = function(event) { - this._eventBus.fire('propertiesPanel.' + event, { panel: this, current: this._current }); - }; +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getInMappings(element) { + return (getInputOutput(element) || {}).inputParameters; +} - PropertiesPanel.prototype._bindListeners = function(container) { +/** + * Get the inputElement name from a loopCharacteristics + * + * @param {MoodleElement} loopCharacteristics + * @returns {String} outputCollection + */ +function getInputElement(loopCharacteristics) { + const extensionElement = getElements(loopCharacteristics, 'zeebe:LoopCharacteristics')[0]; + return extensionElement && extensionElement.inputElement; +} - var self = this; +/** + * Get the outputCollection name from a loopCharacteristics + * + * @param {MoodleElement} loopCharacteristics + * @returns {String} outputCollection + */ +function getOutputCollection(loopCharacteristics) { + const extensionElement = getElements(loopCharacteristics, 'zeebe:LoopCharacteristics')[0]; + return extensionElement && extensionElement.outputCollection; - // handles a change for a given event - var handleChange = function handleChange(event) { +} - // see if we handle a change inside a [data-entry] element. - // if not, drop out - var inputNode = event.delegateTarget, - entryNode = domClosest(inputNode, '[data-entry]'), - entryId, entry; +/** + * Get a calledDecision from the business object + * + * @param {MoodleElement} element + * @returns {MoodleElement} the calledDecision object + */ +function getCalledDecision(element) { + return (getElements(element, 'zeebe:CalledDecision') || [])[0]; +} - // change from outside a [data-entry] element, simply ignore - if (!entryNode) { - return; - } - entryId = domAttr(entryNode, 'data-entry'); - entry = self.getEntry(entryId); +/** + * Get a script from the business object + * + * @param {MoodleElement} element + * @returns {MoodleElement} the script object + */ +function getScript(element) { + return (getElements(element, 'zeebe:Script') || [])[0]; +} - var values = getFormControlValues(entryNode); +// helpers ////////// - if (event.type === 'change') { +function getElements(element, type, property) { + var elements = getExtensionElements(element, type); - // - if the "data-on-change" attribute is present and a value is changed, - // then the associated action is performed. - // - if the associated action returns "true" then an update to the business - // object is done - // - if it does not return "true", then only the DOM content is updated - var onChangeAction = domAttr(inputNode, 'data-on-change'); + return !property ? elements : (elements[0] || {})[property] || []; +} - if (onChangeAction) { - var isEntryDirty = self.executeAction(entry, entryNode, onChangeAction, event); +function getParameters(element, property) { + var inputOutput = getInputOutput(element); - if (!isEntryDirty) { - return self.update(self._current.element); - } - } - } - self.applyChanges(entry, values, entryNode); - self.updateState(entry, entryNode); - }; + return (inputOutput && inputOutput.get(property)) || []; +} - // debounce update only elements that are target of key events, - // i.e. INPUT and TEXTAREA. SELECTs will trigger an immediate update anyway. - domDelegate.bind(container, 'input, textarea, [contenteditable]', 'input', debounce(handleChange, DEBOUNCE_DELAY)); - domDelegate.bind(container, 'input, textarea, select, [contenteditable]', 'change', handleChange); +function getExtensionElements(element, type) { + var elements = []; + var extensionElements = element.get('extensionElements'); - // paste as plain text only - domDelegate.bind(container, '[contenteditable]', 'paste', handlePaste); + if (typeof extensionElements !== 'undefined') { + var extensionValues = extensionElements.get('values'); - function handlePaste(event) { - var text = (event.clipboardData || window.clipboardData).getData('text'); - document.execCommand('insertText', false, text); + if (typeof extensionValues !== 'undefined') { + elements = minDash.filter(extensionValues, function(value) { + return is$2(value, type); + }); + } + } - event.preventDefault(); - } + return elements; +} - // handle key events - domDelegate.bind(container, 'select', 'keydown', function(e) { +function is$2(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} - // DEL - if (e.keyCode === 46) { - e.stopPropagation(); - e.preventDefault(); - } - }); +/** + * Get all parent elements for a given element. + * + * @param {ModdleElement|string} element + * + * @returns {Array} + */ +function getParents(element) { + var parents = []; + var current = element; - domDelegate.bind(container, '[data-action]', 'click', function onClick(event) { + while (current.$parent) { + parents.push(current.$parent); + current = current.$parent; + } - // triggers on all inputs - var inputNode = event.delegateTarget, - entryNode = domClosest(inputNode, '[data-entry]'); + return parents; +} - var actionId = domAttr(inputNode, 'data-action'), - entryId = domAttr(entryNode, 'data-entry'); +/** + * Iterate over each element in a collection, calling the iterator function `fn` + * with (element, index, recursionDepth). + * + * Recurse into all elements that are returned by `fn`. + * + * @param {Object|Array} elements + * @param {Function} fn iterator function called with (element, index, recursionDepth) + * @param {number} [depth] maximum recursion depth + */ +function eachElement(elements, fn, depth) { + depth = depth || 0; - var entry = self.getEntry(entryId); + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - var isEntryDirty = self.executeAction(entry, entryNode, actionId, event); + minDash.forEach(elements, function(s, i) { + var filter = fn(s, i, depth); - if (isEntryDirty) { - var values = getFormControlValues(entryNode); + if (minDash.isArray(filter) && filter.length) { + eachElement(filter, fn, depth + 1); + } + }); +} - self.applyChanges(entry, values, entryNode); - } +/** + * Adds an element to a collection and returns true if the + * element was added. + * + * @param {Array} elements + * @param {Object} e + * @param {boolean} unique + */ +function add(elements, e, unique) { + var canAdd = !unique || elements.indexOf(e) === -1; - self.updateState(entry, entryNode); - }); + if (canAdd) { + elements.push(e); + } - function handleInput(event, element) { - // triggers on all inputs - var inputNode = event.delegateTarget; + return canAdd; +} - var entryNode = domClosest(inputNode, '[data-entry]'); +/** + * Collects self + flow elements up to a given depth from a list of elements. + * + * @param {ModdleElement|Array} elements the elements to select the flowElements from + * @param {boolean} unique whether to return a unique result set (no duplicates) + * @param {number} maxDepth the depth to search through or -1 for infinite + * + * @return {Array} found elements + */ +function selfAndFlowElements(elements, unique, maxDepth) { + var result = [], + processedFlowElements = []; - // only work on data entries - if (!entryNode) { - return; - } + eachElement(elements, function(element, i, depth) { + add(result, element, unique); - var eventHandlerId = domAttr(inputNode, 'data-blur'), - entryId = domAttr(entryNode, 'data-entry'); + var flowElements = element.flowElements; - var entry = self.getEntry(entryId); + // max traversal depth not reached yet + if (maxDepth === -1 || depth < maxDepth) { - var isEntryDirty = self.executeAction(entry, entryNode, eventHandlerId, event); + // flowElements exist && flowElements not yet processed + if (flowElements && add(processedFlowElements, flowElements, unique)) { + return flowElements; + } + } + }); - if (isEntryDirty) { - var values = getFormControlValues(entryNode); + return result; +} - self.applyChanges(entry, values, entryNode); - } +/** + * Return self + ALL flowElements for a number of elements + * + * @param {Array} elements to query + * @param {boolean} allowDuplicates to allow duplicates in the result set + * + * @return {Array} the collected elements + */ +function selfAndAllFlowElements(elements, allowDuplicates) { + return selfAndFlowElements(elements, !allowDuplicates, -1); +} - self.updateState(entry, entryNode); - } +/** + * Return full moddle element for given element id + * + * @param {string} elementId + * @param {ModdleElement} rootElement + * + * @returns {ModdleElement} + */ +function getElement(elementId, rootElement) { + var allElements = selfAndAllFlowElements(rootElement); + + return minDash.find(allElements, function(element) { + return element.id === elementId; + }); +} + +function addVariableToList(variablesList, newVariable) { + var foundIdx = minDash.findIndex(variablesList, function(variable) { + return ( + variable.name === newVariable.name && variable.scope === newVariable.scope + ); + }); + + if (foundIdx >= 0) { + variablesList[foundIdx].origin = combineArrays$1( + variablesList[foundIdx].origin, + newVariable.origin + ); + } else { + variablesList.push(newVariable); + } +} + +/** + * Creates new process variable definition object + * Identifies correct (highest) scope, in which variable is available + * + * @param {ModdleElement} flowElement + * @param {String} name + * @param {ModdleElement} defaultScope + * + * @returns {ProcessVariable} + */ +function createProcessVariable(flowElement, name, defaultScope) { + var scope = getScope$1(flowElement, defaultScope, name); - domDelegate.bind(container, '[data-blur]', 'blur', handleInput, true); + return { + name: name, + origin: [ flowElement ], + scope: scope + }; +} - // make tab links interactive - domDelegate.bind(container, '.bpp-properties-tabs-links [data-tab-target]', 'click', function(event) { - event.preventDefault(); - var delegateTarget = event.delegateTarget; +// helpers //////////////////// - var tabId = domAttr(delegateTarget, 'data-tab-target'); +/** + * Set parent container if it defines it's own scope for the variable, so + * when it defines an input mapping for it. Otherwise returns the default global scope + */ +function getScope$1(element, globalScope, variableName) { + var parents = getParents(element); + + var scopedParent = minDash.find(parents, function(parent) { + return ( + is$1(parent, 'bpmn:SubProcess') && hasInputParameter(parent, variableName) + ); + }); + + return scopedParent ? scopedParent : globalScope; +} + +function is$1(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +function hasInputParameter(element, name) { + return minDash.find(getInputParameters(element), function(input) { + return input.target === name; + }); +} + +function combineArrays$1(a, b) { + return a.concat(b); +} + +/** + * Retrieves process variables defined in output mappings, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractInMappings(options) { + var elements = options.elements, + processVariables = options.processVariables; - // activate tab on link click - self.activateTab(tabId); - }); + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - }; + minDash.forEach(elements, function(element) { - PropertiesPanel.prototype.updateState = function(entry, entryNode) { - this.updateShow(entry, entryNode); - this.updateDisable(entry, entryNode); - }; + var inMappings = getInMappings(element); - /** - * Update the visibility of the entry node in the DOM - */ - PropertiesPanel.prototype.updateShow = function(entry, node) { + // extract all variables with correct scope + minDash.forEach(inMappings, function(mapping) { - var current = this._current; + var newVariable = createProcessVariable( + element, + mapping.target, + element + ); - if (!current) { - return; - } + addVariableToList(processVariables, newVariable); + }); + }); - var showNodes = domQueryAll('[data-show]', node) || []; + return processVariables; +} - forEach(showNodes, function(showNode) { +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "inputElement"to the list. + * + */ +function extractInputElement(options) { + var elements = options.elements, + processVariables = options.processVariables; - var expr = domAttr(showNode, 'data-show'); - var fn = get(entry, expr); - if (fn) { - var scope = domClosest(showNode, '[data-scope]') || node; - var shouldShow = fn(current.element, node, showNode, scope) || false; - if (shouldShow) { - domClasses(showNode).remove(HIDE_CLASS); - } else { - domClasses(showNode).add(HIDE_CLASS); - } - } - }); - }; + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - /** - * Evaluates a given function. If it returns true, then the - * node is marked as "disabled". - */ - PropertiesPanel.prototype.updateDisable = function(entry, node) { - var current = this._current; + minDash.forEach(elements, function(element) { - if (!current) { - return; - } + var loopCharacteristics = element.loopCharacteristics; - var nodes = domQueryAll('[data-disable]', node) || []; + var inputElement = loopCharacteristics && getInputElement(loopCharacteristics); - forEach(nodes, function(currentNode) { - var expr = domAttr(currentNode, 'data-disable'); - var fn = get(entry, expr); - if (fn) { - var scope = domClosest(currentNode, '[data-scope]') || node; - var shouldDisable = fn(current.element, node, currentNode, scope) || false; - domAttr(currentNode, 'disabled', shouldDisable ? '' : null); - } - }); - }; + if (inputElement) { + var newVariable = createProcessVariable( + element, + inputElement, + element + ); - PropertiesPanel.prototype.executeAction = function(entry, entryNode, actionId, event) { - var current = this._current; + addVariableToList(processVariables, newVariable); + } + }); - if (!current) { - return; - } + return processVariables; +} - var fn = get(entry, actionId); - if (fn) { - var scopeNode = domClosest(event.target, '[data-scope]') || entryNode; - return fn.apply(entry, [ current.element, entryNode, event, scopeNode ]); - } - }; +/** + * Retrieves process variables defined in output mappings, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractOutMappings(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; - /** - * Apply changes to the business object by executing a command - */ - PropertiesPanel.prototype.applyChanges = function(entry, values, containerElement) { + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - var element = this._current.element; + minDash.forEach(elements, function(element) { - // ensure we only update the model if we got dirty changes - if (valuesEqual(values, entry.oldValues)) { - return; - } + var outMappings = getOutMappings(element); - var command = entry.set(element, values, containerElement); + // extract all variables with correct scope + minDash.forEach(outMappings, function(mapping) { + var newVariable = createProcessVariable( + element, + mapping.target, + containerElement + ); - var commandToExecute; + addVariableToList(processVariables, newVariable); + }); + }); - if (isArray(command)) { - if (command.length) { - commandToExecute = { - cmd: 'properties-panel.multi-command-executor', - context: flattenDeep(command) - }; - } - } else { - commandToExecute = command; - } + return processVariables; +} - if (commandToExecute) { - this._commandStack.execute(commandToExecute.cmd, commandToExecute.context || { element : element }); - } else { - this.update(element); - } - }; +/** + * Retrieves process variables defined in output collection, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "outputCollection"to the list. + * + */ +function extractOutputCollections(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } - /** - * apply validation errors in the DOM and show or remove an error message near the entry node. - */ - PropertiesPanel.prototype.applyValidationErrors = function(validationErrors, entryNode) { + minDash.forEach(elements, function(element) { - var valid = true; + var loopCharacteristics = element.loopCharacteristics; - var controlNodes = getFormControls(entryNode, true); + var outputCollection = loopCharacteristics && getOutputCollection(loopCharacteristics); - forEach(controlNodes, function(controlNode) { + if (outputCollection) { + var newVariable = createProcessVariable( + element, + outputCollection, + containerElement + ); - var name = domAttr(controlNode, 'name') || domAttr(controlNode, 'data-name'); + addVariableToList(processVariables, newVariable); + } + }); - var error = validationErrors && validationErrors[name]; + return processVariables; +} - var errorMessageNode = domQuery('.bpp-error-message', controlNode.parentNode); +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * + * + * + * + * + * => Adds one variable "variable1"to the list. + * + */ +function extractResultVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var baseElement = getCalledDecision(element) || + getScript(element); + + if (!baseElement) { + return; + } + + var resultVariable = baseElement.resultVariable; + + if (resultVariable) { + var newVariable = createProcessVariable( + element, + resultVariable, + containerElement + ); + + addVariableToList(processVariables, newVariable); + } + }); + + return processVariables; +} + +var extractors = [ + extractInMappings, + extractInputElement, + extractOutMappings, + extractOutputCollections, + extractResultVariables +]; + +/** + * @typedef {Object} ProcessVariable + * @property {string} name + * @property {Array} origin + * @property {ModdleElement} scope + */ - if (error) { - valid = false; +// api ///////////////////////// - if (!errorMessageNode) { - errorMessageNode = domify('
'); +/** + * Extractors add ProcessVariables to the `options.processVariables` parameter. + * @callback extractor + * @param {Object} options + * @param {Array} options.elements + * @param {ModdleElement} options.containerElement + * @param {Array} options.processVariables + */ - domClasses(errorMessageNode).add('bpp-error-message'); +/** + * Retrieves all process variables for a given container element. + * @param {ModdleElement} containerElement + * @param {Array} [additionalExtractors] + * + * @returns {Promise>} + */ +function getProcessVariables(containerElement, additionalExtractors = []) { + var processVariables = []; - // insert errorMessageNode after controlNode - controlNode.parentNode.insertBefore(errorMessageNode, controlNode.nextSibling); - } + // (1) extract all flow elements inside the container + var elements = selfAndAllFlowElements([ containerElement ], false); - errorMessageNode.textContent = error; + const allPromises = []; - domClasses(controlNode).add('invalid'); - } else { - domClasses(controlNode).remove('invalid'); + // (2) extract all variables from the extractors + minDash.forEach([ ...extractors, ...additionalExtractors ], function(extractor) { + allPromises.push(extractor({ + elements: elements, + containerElement: containerElement, + processVariables: processVariables + })); + }); - if (errorMessageNode) { - controlNode.parentNode.removeChild(errorMessageNode); - } - } - }); + return Promise.all(allPromises) + .then(() => processVariables); +} - return valid; - }; +/** + * Retrieves all variables which are available in the given scope + * + * * Exclude variables which are only available in other scopes + * * Exclude variables which are produced by the given element + * * Include variables which are available in parent scopes + * + * @param {string} scope + * @param {ModdleElement} rootElement element from where to extract all variables + * @param {Array} [additionalExtractors] + * + * @returns {Promise>} + */ +async function getVariablesForScope(scope, rootElement, additionalExtractors = []) { + var allVariables = await getProcessVariables(rootElement, additionalExtractors); - /** - * Check if the entry contains valid input - */ - PropertiesPanel.prototype.validate = function(entry, values, entryNode) { - var self = this; + var scopeElement = getElement(scope, rootElement); - var current = this._current; + // (1) get variables for given scope + var scopeVariables = minDash.filter(allVariables, function(variable) { + return variable.scope.id === scopeElement.id; + }); - var valid = true; + // (2) get variables for parent scopes + var parents = getParents(scopeElement); - entryNode = entryNode || domQuery('[data-entry="' + entry.id + '"]', current.panel); + var parentsScopeVariables = minDash.filter(allVariables, function(variable) { + return minDash.find(parents, function(parent) { + return parent.id === variable.scope.id; + }); + }); - if (values instanceof Array) { - var listContainer = domQuery('[data-list-entry-container]', entryNode), - listEntryNodes = listContainer.children || []; + return combineArrays(scopeVariables, parentsScopeVariables); +} - // create new elements - for (var i = 0; i < values.length; i++) { - var listValue = values[i]; - if (entry.validateListItem) { +function getVariablesForElement(element, additionalExtractors = []) { + return getVariablesForScope(getScope(element), getRootElement(element), additionalExtractors); +} - var validationErrors = entry.validateListItem(current.element, listValue, entryNode, i), - listEntryNode = listEntryNodes[i]; +function getScope(element) { + const bo = getBusinessObject(element); - valid = self.applyValidationErrors(validationErrors, listEntryNode) && valid; - } - } - } else { - if (entry.validate) { - this.validationErrors = entry.validate(current.element, values, entryNode); + if (is(element, 'bpmn:Participant')) { + return bo.processRef.id; + } - valid = self.applyValidationErrors(this.validationErrors, entryNode) && valid; - } - } + return bo.id; +} - return valid; - }; +function getRootElement(element) { + const businessObject = getBusinessObject(element); - PropertiesPanel.prototype.getEntry = function(id) { - return this._current && this._current.entries[id]; - }; + if (is(businessObject, 'bpmn:Participant')) { + return businessObject.processRef; + } - var flattenDeep = require('lodash/flattenDeep'), - keyBy = require('lodash/keyBy'), - map = require('lodash/map'); + if (is(businessObject, 'bpmn:Process')) { + return businessObject; + } - PropertiesPanel.prototype._create = function(element, tabs) { + let parent = businessObject; - if (!element) { - return null; - } + while (parent.$parent && !is(parent, 'bpmn:Process')) { + parent = parent.$parent; + } - var containerNode = this._container; + return parent; +} - var panelNode = this._createPanel(element, tabs); - containerNode.appendChild(panelNode); +// helpers //////////////////// - var entries = extractEntries(tabs); - var groups = extractGroups(tabs); +function combineArrays(a, b) { + return a.concat(b); +} - return { - tabs: tabs, - groups: groups, - entries: entries, - element: element, - panel: panelNode - }; - }; - /** - * Update variable parts of the entry node on element changes. - * - * @param {djs.model.Base} element - * @param {EntryDescriptor} entry - * @param {Object} values - * @param {HTMLElement} entryNode - * @param {Number} idx - */ - PropertiesPanel.prototype._bindTemplate = function(element, entry, values, entryNode, idx) { +function getBusinessObject(element) { + return (element && element.businessObject) || element; +} - var eventBus = this._eventBus; - function isPropertyEditable(entry, propertyName) { - return eventBus.fire('propertiesPanel.isPropertyEditable', { - entry: entry, - propertyName: propertyName, - element: element - }); - } +function is(element, type) { + var bo = getBusinessObject(element); - var inputNodes = getPropertyPlaceholders(entryNode); + return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type); +} - forEach(inputNodes, function(node) { +exports.getProcessVariables = getProcessVariables; +exports.getVariablesForElement = getVariablesForElement; +exports.getVariablesForScope = getVariablesForScope; - var name, - newValue, - editable; - // we deal with an input element - if ('value' in node || isContentEditable(node) === 'true') { - name = domAttr(node, 'name') || domAttr(node, 'data-name'); - newValue = values[name]; +/***/ }), - editable = isPropertyEditable(entry, name); - if (editable && entry.editable) { - editable = entry.editable(element, entryNode, node, name, newValue, idx); - } +/***/ "../node_modules/@bpmn-io/feel-editor/dist/index.es.js": +/*!*************************************************************!*\ + !*** ../node_modules/@bpmn-io/feel-editor/dist/index.es.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ FeelEditor) +/* harmony export */ }); +/* harmony import */ var _codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/autocomplete */ "../node_modules/@codemirror/autocomplete/dist/index.js"); +/* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @codemirror/commands */ "../node_modules/@codemirror/commands/dist/index.js"); +/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @codemirror/language */ "../node_modules/@codemirror/language/dist/index.js"); +/* harmony import */ var _codemirror_lint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @codemirror/lint */ "../node_modules/@codemirror/lint/dist/index.js"); +/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @codemirror/state */ "../node_modules/@codemirror/state/dist/index.js"); +/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @codemirror/view */ "../node_modules/@codemirror/view/dist/index.js"); +/* harmony import */ var lang_feel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lang-feel */ "../node_modules/lang-feel/dist/index.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var _bpmn_io_feel_lint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @bpmn-io/feel-lint */ "../node_modules/@bpmn-io/feel-lint/dist/index.esm.js"); +/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/highlight */ "../node_modules/@lezer/highlight/dist/index.js"); + + + + + + + + + + + +// helpers /////////////////////////////// + +function isNodeEmpty(node) { + return node.from === node.to; +} + +function isPathExpression(node) { + if (!node) { + return false; + } + + if (node.name === 'PathExpression') { + return true; + } + + return isPathExpression(node.parent); +} + +var tags = [ + { + name: "not(negand)", + description: "

Returns the logical negation of the given value.

\n

Function signature

\n
not(negand: boolean): boolean\n
\n

Examples

\n
not(true)\n// false\n\nnot(null)\n// null\n
\n" + }, + { + name: "is defined(value)", + description: "

Camunda Extension

\n

Checks if a given value is not null. If the value is null then the function returns false.\nOtherwise, the function returns true.

\n

Function signature

\n
is defined(value: Any): boolean\n
\n

Examples

\n
is defined(1)\n// true\n\nis defined(null)\n// false\n\nis defined(x)\n// false - if no variable "x" exists\n\nis defined(x.y)\n// false - if no variable "x" exists or it doesn't have a property "y"\n
\n

:::caution Breaking change

\n

This function worked differently in previous versions. It returned true if the value was null.\nSince this version, the function returns false if the value is null.

\n

:::

\n" + }, + { + name: "get or else(value, default)", + description: "

Camunda Extension

\n

Return the provided value parameter if not null, otherwise return the default parameter

\n

Function signature

\n
get or else(value: Any, default: Any): Any\n
\n

Examples

\n
get or else("this", "default")\n// "this"\n\nget or else(null, "default")\n// "default"\n\nget or else(null, null)\n// null\n
\n" + }, + { + name: "assert(value, condition)", + description: "

Camunda Extension

\n

Verify that the given condition is met. If the condition is true, the function returns the value.\nOtherwise, the evaluation fails with an error.

\n

Function signature

\n
assert(value: Any, condition: Any)\n
\n

Examples

\n
assert(x, x != null)\n// "value" - if x is "value"\n// error - if x is null or doesn't exist\n\nassert(x, x >= 0)\n// 4 - if x is 4\n// error - if x is less than zero\n
\n" + }, + { + name: "assert(value, condition, cause)", + description: "

Camunda Extension

\n

Verify that the given condition is met. If the condition is true, the function returns the value.\nOtherwise, the evaluation fails with an error containing the given message.

\n

Function signature

\n
assert(value: Any, condition: Any, cause: String)\n
\n

Examples

\n
assert(x, x != null, "'x' should not be null")\n// "value" - if x is "value"\n// error('x' should not be null) - if x is null or doesn't exist\n\nassert(x, x >= 0, "'x' should be positive")\n// 4 - if x is 4\n// error('x' should be positive) - if x is less than zero\n
\n" + }, + { + name: "get value(context, key)", + description: "

Returns the value of the context entry with the given key.

\n

Function signature

\n
get value(context: context, key: string): Any\n
\n

Examples

\n
get value({foo: 123}, "foo")\n// 123\n\nget value({a: 1}, "b")\n// null\n
\n" + }, + { + name: "get value(context, keys)", + description: "

Camunda Extension

\n

Returns the value of the context entry for a context path defined by the given keys.

\n

If keys contains the keys [k1, k2] then it returns the value at the nested entry k1.k2 of the context.

\n

If keys are empty or the nested entry defined by the keys doesn't exist in the context, it returns null.

\n

Function signature

\n
get value(context: context, keys: list<string>): Any\n
\n

Examples

\n
get value({x:1, y: {z:0}}, ["y", "z"])\n// 0\n\nget value({x: {y: {z:0}}}, ["x", "y"])\n// {z:0}\n\nget value({a: {b: 3}}, ["b"])\n// null\n
\n" + }, + { + name: "get entries(context)", + description: "

Returns the entries of the context as a list of key-value-pairs.

\n

Function signature

\n
get entries(context: context): list<context>\n
\n

The return value is a list of contexts. Each context contains two entries for "key" and "value".

\n

Examples

\n
get entries({foo: 123})\n// [{key: "foo", value: 123}]\n
\n" + }, + { + name: "context put(context, key, value)", + description: "

Adds a new entry with the given key and value to the context. Returns a new context that includes the entry.

\n

If an entry for the same key already exists in the context, it overrides the value.

\n

Function signature

\n
context put(context: context, key: string, value: Any): context\n
\n

Examples

\n
context put({x:1}, "y", 2)\n// {x:1, y:2}\n
\n

:::info\nThe function context put() replaced the previous function put() (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::

\n" + }, + { + name: "context put(context, keys, value)", + description: "

Adds a new entry with the given value to the context. The path of the entry is defined by the keys. Returns a new context that includes the entry.

\n

If keys contains the keys [k1, k2] then it adds the nested entry k1.k2 = value to the context.

\n

If an entry for the same keys already exists in the context, it overrides the value.

\n

If keys are empty, it returns null.

\n

Function signature

\n
context put(context: context, keys: list<string>, value: Any): context\n
\n

Examples

\n
context put({x:1}, ["y"], 2)\n// {x:1, y:2}\n\ncontext put({x:1, y: {z:0}}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n\ncontext put({x:1}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n
\n" + }, + { + name: "context merge(contexts)", + description: "

Union the given contexts. Returns a new context that includes all entries of the given contexts.

\n

If an entry for the same key already exists in a context, it overrides the value. The entries are overridden in the same order as in the list of contexts.

\n

Function signature

\n
context merge(contexts: list<context>): context\n
\n

Examples

\n
context merge([{x:1}, {y:2}])\n// {x:1, y:2}\n\ncontext merge([{x:1, y: 0}, {y:2}])\n// {x:1, y:2}\n
\n

:::info\nThe function context merge() replaced the previous function put all() (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::

\n" + }, + { + name: "string(from)", + description: "

Returns the given value as a string representation.

\n

Function signature

\n
string(from: Any): string\n
\n

Examples

\n
string(1.1)\n// "1.1"\n\nstring(date("2012-12-25"))\n// "2012-12-25"\n
\n" + }, + { + name: "number(from)", + description: "

Parses the given string to a number.

\n

Function signature

\n
number(from: string): number\n
\n

Examples

\n
number("1500.5")\n// 1500.5\n
\n" + }, + { + name: "context(entries)", + description: "

Constructs a context of the given list of key-value pairs. It is the reverse function to get entries().

\n

Each key-value pair must be a context with two entries: key and value. The entry with name key must have a value of the type string.

\n

It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts in the given list.

\n

Returns null if one of the entries is not a context or if a context doesn't contain the required entries.

\n

Function signature

\n
context(entries: list<context>): context\n
\n

Examples

\n
context([{"key":"a", "value":1}, {"key":"b", "value":2}])\n// {a:1, b:2}\n
\n" + }, + { + name: "date(from)", + description: "

Returns a date from the given value.

\n

Function signature

\n
date(from: string): date\n
\n

Parses the given string into a date.

\n
date(from: date and time): date\n
\n

Extracts the date component from the given date and time.

\n

Examples

\n
date("2018-04-29")\n// date("2018-04-29")\n\ndate(date and time("2012-12-25T11:00:00"))\n// date("2012-12-25")\n
\n" + }, + { + name: "date(year, month, day)", + description: "

Returns a date from the given components.

\n

Function signature

\n
date(year: number, month: number, day: number): date\n
\n

Examples

\n
date(2012, 12, 25)\n// date("2012-12-25")\n
\n" + }, + { + name: "time(from)", + description: "

Returns a time from the given value.

\n

Function signature

\n
time(from: string): time\n
\n

Parses the given string into a time.

\n
time(from: date and time): time\n
\n

Extracts the time component from the given date and time.

\n

Examples

\n
time("12:00:00")\n// time("12:00:00")\n\ntime(date and time("2012-12-25T11:00:00"))\n// time("11:00:00")\n
\n" + }, + { + name: "time(hour, minute, second)", + description: "

Returns a time from the given components.

\n

Function signature

\n
time(hour: number, minute: number, second: number): time\n
\n

Examples

\n
time(23, 59, 0)\n// time("23:59:00")\n
\n" + }, + { + name: "time(hour, minute, second, offset)", + description: "

Returns a time from the given components, including a timezone offset.

\n

Function signature

\n
time(hour: number, minute: number, second: number, offset: days and time duration): time\n
\n

Examples

\n
time(14, 30, 0, duration("PT1H"))\n// time("14:30:00+01:00")\n
\n" + }, + { + name: "date and time(from)", + description: "

Parses the given string into a date and time.

\n

Function signature

\n
date and time(from: string): date and time\n
\n

Examples

\n
date and time("2018-04-29T009:30:00")\n// date and time("2018-04-29T009:30:00")\n
\n" + }, + { + name: "date and time(date, time)", + description: "

Returns a date and time from the given components.

\n

Function signature

\n
date and time(date: date, time: time): date and time\n
\n
date and time(date: date and time, time: time): date and time\n
\n

Returns a date and time value that consists of the date component of date combined with time.

\n

Examples

\n
date and time(date("2012-12-24"),time("T23:59:00"))\n// date and time("2012-12-24T23:59:00")\n\ndate and time(date and time("2012-12-25T11:00:00"),time("T23:59:00"))\n// date and time("2012-12-25T23:59:00")\n
\n" + }, + { + name: "date and time(date, timezone)", + description: "

Camunda Extension

\n

Returns the given date and time value at the given timezone.

\n

If date has a different timezone than timezone then it adjusts the time to match the local time of timezone.

\n

Function signature

\n
date and time(date: date and time, timezone: string): date and time\n
\n

Examples

\n
date and time(@"2020-07-31T14:27:30@Europe/Berlin", "America/Los_Angeles")\n// date and time("2020-07-31T05:27:30@America/Los_Angeles")\n\ndate and time(@"2020-07-31T14:27:30", "Z")\n// date and time("2020-07-31T12:27:30Z")\n
\n" + }, + { + name: "duration(from)", + description: "

Parses the given string into a duration. The duration is either a days and time duration or a years and months duration.

\n

Function signature

\n
duration(from: string): days and time duration\n
\n
duration(from: string): years and months duration\n
\n

Examples

\n
duration("P5D")\n// duration("P5D")\n\nduration("P32Y")\n// duration("P32Y")\n
\n" + }, + { + name: "years and months duration(from, to)", + description: "

Returns the years and months duration between from and to.

\n

Function signature

\n
years and months duration(from: date, to: date): years and months duration\n
\n

Examples

\n
years and months duration(date("2011-12-22"), date("2013-08-24"))\n// duration("P1Y8M")\n
\n" + }, + { + name: "list contains(list, element)", + description: "

Returns true if the given list contains the element. Otherwise, returns false.

\n

Function signature

\n
list contains(list: list, element: Any): boolean\n
\n

Examples

\n
list contains([1,2,3], 2)\n// true\n
\n" + }, + { + name: "count(list)", + description: "

Returns the number of elements of the given list.

\n

Function signature

\n
count(list: list): number\n
\n

Examples

\n
count([1,2,3])\n// 3\n
\n" + }, + { + name: "min(list)", + description: "

Returns the minimum of the given list.

\n

Function signature

\n
min(list: list): Any\n
\n

All elements in list should have the same type and be comparable.

\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
min([1,2,3])\n// 1\n\nmin(1,2,3)\n// 1\n
\n" + }, + { + name: "max(list)", + description: "

Returns the maximum of the given list.

\n

Function signature

\n
max(list: list): Any\n
\n

All elements in list should have the same type and be comparable.

\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
max([1,2,3])\n// 3\n\nmax(1,2,3)\n// 3\n
\n" + }, + { + name: "sum(list)", + description: "

Returns the sum of the given list of numbers.

\n

Function signature

\n
sum(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
sum([1,2,3])\n// 6\n\nsum(1,2,3)\n// 6\n
\n" + }, + { + name: "product(list)", + description: "

Returns the product of the given list of numbers.

\n

Function signature

\n
product(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
product([2, 3, 4])\n// 24\n\nproduct(2, 3, 4)\n// 24\n
\n" + }, + { + name: "mean(list)", + description: "

Returns the arithmetic mean (i.e. average) of the given list of numbers.

\n

Function signature

\n
mean(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
mean([1,2,3])\n// 2\n\nmean(1,2,3)\n// 2\n
\n" + }, + { + name: "median(list)", + description: "

Returns the median element of the given list of numbers.

\n

Function signature

\n
median(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
median(8, 2, 5, 3, 4)\n// 4\n\nmedian([6, 1, 2, 3])\n// 2.5\n
\n" + }, + { + name: "stddev(list)", + description: "

Returns the standard deviation of the given list of numbers.

\n

Function signature

\n
stddev(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
stddev(2, 4, 7, 5)\n// 2.0816659994661326\n\nstddev([2, 4, 7, 5])\n// 2.0816659994661326\n
\n" + }, + { + name: "mode(list)", + description: "

Returns the mode of the given list of numbers.

\n

Function signature

\n
mode(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
mode(6, 3, 9, 6, 6)\n// [6]\n\nmode([6, 1, 9, 6, 1])\n// [1, 6]\n
\n" + }, + { + name: "all(list)", + description: "

Returns false if any element of the given list is false. Otherwise, returns true.

\n

If the given list is empty, it returns true.

\n

Function signature

\n
all(list: list<boolean>): boolean\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
all([true,false])\n// false\n\nall(false,null,true)\n// false\n
\n

:::info\nThe function all() replaced the previous function and(). The previous function is deprecated and\nshould not be used anymore.\n:::

\n" + }, + { + name: "any(list)", + description: "

Returns true if any element of the given list is true. Otherwise, returns false.

\n

If the given list is empty, it returns false.

\n

Function signature

\n
any(list: list<boolean>): boolean\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
any([false,true])\n// true\n\nany(false,null,true)\n// true\n
\n

:::info\nThe function any() replaced the previous function or(). The previous function is deprecated and\nshould not be used anymore.\n:::

\n" + }, + { + name: "sublist(list, start position)", + description: "

Returns a partial list of the given value starting at start position.

\n

Function signature

\n
sublist(list: list, start position: number): list\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
sublist([1,2,3], 2)\n// [2,3]\n
\n" + }, + { + name: "sublist(list, start position, length)", + description: "

Returns a partial list of the given value starting at start position.

\n

Function signature

\n
sublist(list: list, start position: number, length: number): list\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
sublist([1,2,3], 1, 2)\n// [1,2]\n
\n" + }, + { + name: "append(list, items)", + description: "

Returns the given list with all items appended.

\n

Function signature

\n
append(list: list, items: Any): list\n
\n

The parameter items can be a single element or a sequence of elements.

\n

Examples

\n
append([1], 2, 3)\n// [1,2,3]\n
\n" + }, + { + name: "concatenate(lists)", + description: "

Returns a list that includes all elements of the given lists.

\n

Function signature

\n
concatenate(lists: list): list\n
\n

The parameter lists is a sequence of lists.

\n

Examples

\n
concatenate([1,2],[3])\n// [1,2,3]\n\nconcatenate([1],[2],[3])\n// [1,2,3]\n
\n" + }, + { + name: "insert before(list, position, newItem)", + description: "

Returns the given list with newItem inserted at position.

\n

Function signature

\n
insert before(list: list, position: number, newItem: Any): list\n
\n

The position starts at the index 1. The last position is -1.

\n

Examples

\n
insert before([1,3],1,2)\n// [2,1,3]\n
\n" + }, + { + name: "remove(list, position)", + description: "

Returns the given list without the element at position.

\n

Function signature

\n
remove(list: list, position: number): list\n
\n

The position starts at the index 1. The last position is -1.

\n

Examples

\n
remove([1,2,3], 2)\n// [1,3]\n
\n" + }, + { + name: "reverse(list)", + description: "

Returns the given list in revered order.

\n

Function signature

\n
reverse(list: list): list\n
\n

Examples

\n
reverse([1,2,3])\n// [3,2,1]\n
\n" + }, + { + name: "index of(list, match)", + description: "

Returns an ascending list of positions containing match.

\n

Function signature

\n
index of(list: list, match: Any): list<number>\n
\n

Examples

\n
index of([1,2,3,2],2)\n// [2,4]\n
\n" + }, + { + name: "union(list)", + description: "

Returns a list that includes all elements of the given lists without duplicates.

\n

Function signature

\n
union(list: list): list\n
\n

The parameter list is a sequence of lists.

\n

Examples

\n
union([1,2],[2,3])\n// [1,2,3]\n
\n" + }, + { + name: "distinct values(list)", + description: "

Returns the given list without duplicates.

\n

Function signature

\n
distinct values(list: list): list\n
\n

Examples

\n
distinct values([1,2,3,2,1])\n// [1,2,3]\n
\n" + }, + { + name: "duplicate values(list)", + description: "

Camunda Extension

\n

Returns all duplicate values of the given list.

\n

Function signature

\n
duplicate values(list: list): list\n
\n

Examples

\n
duplicate values([1,2,3,2,1])\n// [1,2]\n
\n" + }, + { + name: "flatten(list)", + description: "

Returns a list that includes all elements of the given list without nested lists.

\n

Function signature

\n
flatten(list: list): list\n
\n

Examples

\n
flatten([[1,2],[[3]], 4])\n// [1,2,3,4]\n
\n" + }, + { + name: "sort(list, precedes)", + description: "

Returns the given list sorted by the precedes function.

\n

Function signature

\n
sort(list: list, precedes: function<(Any, Any) -> boolean>): list\n
\n

Examples

\n
sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)\n// [1,2,3,4,5]\n
\n" + }, + { + name: "string join(list)", + description: "

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

Function signature

\n
string join(list: list<string>): string\n
\n

Examples

\n
string join(["a","b","c"])\n// "abc"\n\nstring join(["a",null,"c"])\n// "ac"\n\nstring join([])\n// ""\n
\n" + }, + { + name: "string join(list, delimiter)", + description: "

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

The resulting string contains a delimiter between each element.

\n

Function signature

\n
string join(list: list<string>, delimiter: string): string\n
\n

Examples

\n
string join(["a"], "X")\n// "a"\n\nstring join(["a","b","c"], ", ")\n// "a, b, c"\n
\n" + }, + { + name: "string join(list, delimiter, prefix, suffix)", + description: "

Camunda Extension

\n

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

The resulting string starts with prefix, contains a delimiter between each element, and ends\nwith suffix.

\n

Function signature

\n
string join(list: list<string>, delimiter: string, prefix: string, suffix: string): string\n
\n

Examples

\n
string join(["a","b","c"], ", ", "[", "]")\n// "[a, b, c]"\n
\n" + }, + { + name: "decimal(n, scale)", + description: "

Rounds the given value at the given scale.

\n

Function signature

\n
decimal(n: number, scale: number): number\n
\n

Examples

\n
decimal(1/3, 2)\n// .33\n\ndecimal(1.5, 0)\n// 2\n
\n" + }, + { + name: "floor(n)", + description: "

Rounds the given value with rounding mode flooring.

\n

Function signature

\n
floor(n: number): number\n
\n

Examples

\n
floor(1.5)\n// 1\n\nfloor(-1.5)\n// -2\n
\n" + }, + { + name: "floor(n, scale)", + description: "

Rounds the given value with rounding mode flooring at the given scale.

\n

Function signature

\n
floor(n: number, scale: number): number\n
\n

Examples

\n
floor(-1.56, 1)\n// -1.6\n
\n" + }, + { + name: "ceiling(n)", + description: "

Rounds the given value with rounding mode ceiling.

\n

Function signature

\n
ceiling(n: number): number\n
\n

Examples

\n
ceiling(1.5)\n// 2\n\nceiling(-1.5)\n// -1\n
\n" + }, + { + name: "ceiling(n, scale)", + description: "

Rounds the given value with rounding mode ceiling at the given scale.

\n

Function signature

\n
ceiling(n: number, scale: number): number\n
\n

Examples

\n
ceiling(-1.56, 1)\n// -1.5\n
\n" + }, + { + name: "round up(n, scale)", + description: "

Rounds the given value with the rounding mode round-up at the given scale.

\n

Function signature

\n
round up(n: number, scale: number): number\n
\n

Examples

\n
round up(5.5)\n// 6\n\nround up(-5.5)\n// -6\n\nround up(1.121, 2)\n// 1.13\n\nround up(-1.126, 2)\n// -1.13\n
\n" + }, + { + name: "round down(n, scale)", + description: "

Rounds the given value with the rounding mode round-down at the given scale.

\n

Function signature

\n
round down(n: number, scale: number): number\n
\n

Examples

\n
round down(5.5, 0)\n// 5\n\nround down (-5.5, 0)\n// -5\n\nround down (1.121, 2)\n// 1.12\n\nround down (-1.126, 2)\n// -1.12\n
\n" + }, + { + name: "round half up(n, scale)", + description: "

Rounds the given value with the rounding mode round-half-up at the given scale.

\n

Function signature

\n
round half up(n: number, scale: number): number\n
\n

Examples

\n
round half up(5.5, 0)\n// 6\n\nround half up(-5.5, 0)\n// -6\n\nround half up(1.121, 2)\n// 1.12\n\nround half up(-1.126, 2)\n// -1.13\n
\n" + }, + { + name: "round half down(n, scale)", + description: "

Rounds the given value with the rounding mode round-half-down at the given scale.

\n

Function signature

\n
round half down(n: number, scale: number): number\n
\n

Examples

\n
round half down (5.5, 0)\n// 5\n\nround half down (-5.5, 0)\n// -5\n\nround half down (1.121, 2)\n// 1.12\n\nround half down (-1.126, 2)\n// -1.13\n
\n" + }, + { + name: "abs(number)", + description: "

Returns the absolute value of the given numeric value.

\n

Function signature

\n
abs(number: number): number\n
\n

Examples

\n
abs(10)\n// 10\n\nabs(-10)\n// 10\n
\n" + }, + { + name: "modulo(dividend, divisor)", + description: "

Returns the remainder of the division of dividend by divisor.

\n

Function signature

\n
modulo(dividend: number, divisor: number): number\n
\n

Examples

\n
modulo(12, 5)\n// 2\n
\n" + }, + { + name: "sqrt(number)", + description: "

Returns the square root of the given value.

\n

Function signature

\n
sqrt(number: number): number\n
\n

Examples

\n
sqrt(16)\n// 4\n
\n" + }, + { + name: "log(number)", + description: "

Returns the natural logarithm (base e) of the given value.

\n

Function signature

\n
log(number: number): number\n
\n

Examples

\n
log(10)\n// 2.302585092994046\n
\n" + }, + { + name: "exp(number)", + description: "

Returns the Euler’s number e raised to the power of the given number .

\n

Function signature

\n
exp(number: number): number\n
\n

Examples

\n
exp(5)\n// 148.4131591025766\n
\n" + }, + { + name: "odd(number)", + description: "

Returns true if the given value is odd. Otherwise, returns false.

\n

Function signature

\n
odd(number: number): boolean\n
\n

Examples

\n
odd(5)\n// true\n\nodd(2)\n// false\n
\n" + }, + { + name: "even(number)", + description: "

Returns true if the given is even. Otherwise, returns false.

\n

Function signature

\n
even(number: number): boolean\n
\n

Examples

\n
even(5)\n// false\n\neven(2)\n// true\n
\n" + }, + { + name: "random number()", + description: "

Camunda Extension

\n

Returns a random number between 0 and 1.

\n

Function signature

\n
random number(): number\n
\n

Examples

\n
random number()\n// 0.9701618132579795\n
\n" + }, + { + name: "before(point1, point2)", + description: "

Function signature

\n
before(point1: Any, point2: Any): boolean\n
\n

Examples

\n
before(1, 10)\n// true\n\nbefore(10, 1)\n// false\n
\n" + }, + { + name: "before(range, point)", + description: "

Function signature

\n
before(range: range, point: Any): boolean\n
\n

Examples

\n
before([1..5], 10)\n// true\n
\n" + }, + { + name: "before(point, range)", + description: "

Function signature

\n
before(point: Any, range: range): boolean\n
\n

Examples

\n
before(1, [2..5])\n// true\n
\n" + }, + { + name: "before(range1, range2)", + description: "

Function signature

\n
before(range1: range, range2: range): boolean\n
\n

Examples

\n
before([1..5], [6..10])\n// true\n\nbefore([1..5),[5..10])\n// true\n
\n" + }, + { + name: "after(point1, point2)", + description: "

Function signature

\n
after(point1: Any, point2: Any): boolean\n
\n

Examples

\n
after(10, 1)\n// true\n\nafter(1, 10)\n// false\n
\n" + }, + { + name: "after(range, point)", + description: "

Function signature

\n
after(range: range, point: Any): boolean\n
\n

Examples

\n
after([1..5], 10)\n// false\n
\n" + }, + { + name: "after(point, range)", + description: "

Function signature

\n
after(point: Any, range: range): boolean\n
\n

Examples

\n
after(12, [2..5])\n// true\n
\n" + }, + { + name: "after(range1, range2)", + description: "

Function signature

\n
after(range1: range, range2: range): boolean\n
\n

Examples

\n
after([6..10], [1..5])\n// true\n\nafter([5..10], [1..5))\n// true\n
\n" + }, + { + name: "meets(range1, range2)", + description: "

Function signature

\n
meets(range1: range, range2: range): boolean\n
\n

Examples

\n
meets([1..5], [5..10])\n// true\n\nmeets([1..3], [4..6])\n// false\n\nmeets([1..3], [3..5])\n// true\n\nmeets([1..5], (5..8])\n// false\n
\n" + }, + { + name: "met by(range1, range2)", + description: "

Function signature

\n
met by(range1: range, range2: range): boolean\n
\n

Examples

\n
met by([5..10], [1..5])\n// true\n\nmet by([3..4], [1..2])\n// false\n\nmet by([3..5], [1..3])\n// true\n\nmet by((5..8], [1..5))\n// false\n\nmet by([5..10], [1..5))\n// false\n
\n" + }, + { + name: "overlaps(range1, range2)", + description: "

Function signature

\n
overlaps(range1: range, range2: range): boolean\n
\n

Examples

\n
overlaps([5..10], [1..6])\n// true\n\noverlaps((3..7], [1..4])\n// true\n\noverlaps([1..3], (3..6])\n// false\n\noverlaps((5..8], [1..5))\n// false\n\noverlaps([4..10], [1..5))\n// true\n
\n" + }, + { + name: "overlaps before(range1, range2)", + description: "

Function signature

\n
overlaps before(range1: range, range2: range): boolean\n
\n

Examples

\n
overlaps before([1..5], [4..10])\n// true\n\noverlaps before([3..4], [1..2])\n// false\n\noverlaps before([1..3], (3..5])\n// false\n\noverlaps before([1..5), (3..8])\n// true\n\noverlaps before([1..5), [5..10])\n// false\n
\n" + }, + { + name: "overlaps after(range1, range2)", + description: "

Function signature

\n
overlaps after(range1: range, range2: range): boolean\n
\n

Examples

\n
overlaps after([4..10], [1..5])\n// true\n\noverlaps after([3..4], [1..2])\n// false\n\noverlaps after([3..5], [1..3))\n// false\n\noverlaps after((5..8], [1..5))\n// false\n\noverlaps after([4..10], [1..5))\n// true\n
\n" + }, + { + name: "finishes(point, range)", + description: "

Function signature

\n
finishes(point: Any, range: range): boolean\n
\n

Examples

\n
finishes(5, [1..5])\n// true\n\nfinishes(10, [1..7])\n// false\n
\n" + }, + { + name: "finishes(range1, range2)", + description: "

Function signature

\n
finishes(range1: range, range2: range): boolean\n
\n

Examples

\n
finishes([3..5], [1..5])\n// true\n\nfinishes((1..5], [1..5))\n// false\n\nfinishes([5..10], [1..10))\n// false\n
\n" + }, + { + name: "finished by(range, point)", + description: "

Function signature

\n
finished by(range: range, point: Any): boolean\n
\n

Examples

\n
finished by([5..10], 10)\n// true\n\nfinished by([3..4], 2)\n// false\n
\n" + }, + { + name: "finished by(range1, range2)", + description: "

Function signature

\n
finished by(range1: range, range2: range): boolean\n
\n

Examples

\n
finished by([1..5], [3..5])\n// true\n\nfinished by((5..8], [1..5))\n// false\n\nfinished by([5..10], (1..10))\n// false\n
\n" + }, + { + name: "includes(range, point)", + description: "

Function signature

\n
includes(range: range, point: Any): boolean\n
\n

Examples

\n
includes([5..10], 6)\n// true\n\nincludes([3..4], 5)\n// false\n
\n" + }, + { + name: "includes(range1, range2)", + description: "

Function signature

\n
includes(range1: range, range2: range): boolean\n
\n

Examples

\n
includes([1..10], [4..6])\n// true\n\nincludes((5..8], [1..5))\n// false\n\nincludes([1..10], [1..5))\n// true\n
\n" + }, + { + name: "during(point, range)", + description: "

Function signature

\n
during(point: Any, range: range): boolean\n
\n

Examples

\n
during(5, [1..10])\n// true\n\nduring(12, [1..10])\n// false\n\nduring(1, (1..10])\n// false\n
\n" + }, + { + name: "during(range1, range2)", + description: "

Function signature

\n
during(range1: range, range2: range): boolean\n
\n

Examples

\n
during([4..6], [1..10))\n// true\n\nduring((1..5], (1..10])\n// true\n
\n" + }, + { + name: "starts(point, range)", + description: "

Function signature

\n
starts(point: Any, range: range): boolean\n
\n

Examples

\n
starts(1, [1..5])\n// true\n\nstarts(1, (1..8])\n// false\n
\n" + }, + { + name: "starts(range1, range2)", + description: "

Function signature

\n
starts(range1: range, range2: range): boolean\n
\n

Examples

\n
starts((1..5], [1..5])\n// false\n\nstarts([1..10], [1..5])\n// false\n\nstarts((1..5), (1..10))\n// true\n
\n" + }, + { + name: "started by(range, point)", + description: "

Function signature

\n
started by(range: range, point: Any): boolean\n
\n

Examples

\n
started by([1..10], 1)\n// true\n\nstarted by((1..10], 1)\n// false\n
\n" + }, + { + name: "started by(range1, range2)", + description: "

Function signature

\n
started by(range1: range, range2: range): boolean\n
\n

Examples

\n
started by([1..10], [1..5])\n// true\n\nstarted by((1..10], [1..5))\n// false\n\nstarted by([1..10], [1..10))\n// true\n
\n" + }, + { + name: "coincides(point1, point2)", + description: "

Function signature

\n
coincides(point1: Any, point2: Any): boolean\n
\n

Examples

\n
coincides(5, 5)\n// true\n\ncoincides(3, 4)\n// false\n
\n" + }, + { + name: "coincides(range1, range2)", + description: "

Function signature

\n
coincides(range1: range, range2: range): boolean\n
\n

Examples

\n
coincides([1..5], [1..5])\n// true\n\ncoincides((1..5], [1..5))\n// false\n\ncoincides([1..5], [2..6])\n// false\n
\n" + }, + { + name: "substring(string, start position)", + description: "

Returns a substring of the given value starting at start position.

\n

Function signature

\n
substring(string: string, start position: number): string\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
substring("foobar", 3)\n// "obar"\n
\n" + }, + { + name: "substring(string, start position, length)", + description: "

Returns a substring of the given value starting at start position.

\n

Function signature

\n
substring(string: string, start position: number, length: number): string\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
substring("foobar", 3, 3)\n// "oba"\n
\n" + }, + { + name: "string length(string)", + description: "

Returns the number of characters in the given value.

\n

Function signature

\n
string length(string: string): number\n
\n

Examples

\n
string length("foo")\n// 3\n
\n" + }, + { + name: "upper case(string)", + description: "

Returns the given value with all characters are uppercase.

\n

Function signature

\n
upper case(string: string): string\n
\n

Examples

\n
upper case("aBc4")\n// "ABC4"\n
\n" + }, + { + name: "lower case(string)", + description: "

Returns the given value with all characters are lowercase.

\n

Function signature

\n
lower case(string: string): string\n
\n

Examples

\n
lower case("aBc4")\n// "abc4"\n
\n" + }, + { + name: "substring before(string, match)", + description: "

Returns a substring of the given value that contains all characters before match.

\n

Function signature

\n
substring before(string: string, match: string): string\n
\n

Examples

\n
substring before("foobar", "bar")\n// "foo"\n
\n" + }, + { + name: "substring after(string, match)", + description: "

Returns a substring of the given value that contains all characters after match.

\n

Function signature

\n
substring after(string: string, match: string): string\n
\n

Examples

\n
substring after("foobar", "ob")\n// "ar"\n
\n" + }, + { + name: "contains(string, match)", + description: "

Returns true if the given value contains the substring match. Otherwise, returns false.

\n

Function signature

\n
contains(string: string, match: string): boolean\n
\n

Examples

\n
contains("foobar", "of")\n// false\n
\n" + }, + { + name: "starts with(string, match)", + description: "

Returns true if the given value starts with the substring match. Otherwise, returns false.

\n

Function signature

\n
starts with(string: string, match: string): boolean\n
\n

Examples

\n
starts with("foobar", "fo")\n// true\n
\n" + }, + { + name: "ends with(string, match)", + description: "

Returns true if the given value ends with the substring match. Otherwise, returns false.

\n

Function signature

\n
ends with(string: string, match: string): boolean\n
\n

Examples

\n
ends with("foobar", "r")\n// true\n
\n" + }, + { + name: "matches(input, pattern)", + description: "

Returns true if the given value matches the pattern. Otherwise, returns false.

\n

Function signature

\n
matches(input: string, pattern: string): boolean\n
\n

The pattern is a string that contains a regular expression.

\n

Examples

\n
matches("foobar", "^fo*bar")\n// true\n
\n" + }, + { + name: "matches(input, pattern, flags)", + description: "

Returns true if the given value matches the pattern. Otherwise, returns false.

\n

Function signature

\n
matches(input: string, pattern: string, flags: string): boolean\n
\n

The pattern is a string that contains a regular expression.

\n

The flags can contain one or more of the following characters:

\n
    \n
  • s (dot-all)
  • \n
  • m (multi-line)
  • \n
  • i (case insensitive)
  • \n
  • x (comments)
  • \n
\n

Examples

\n
matches("FooBar", "foo", "i")\n// true\n
\n" + }, + { + name: "replace(input, pattern, replacement)", + description: "

Returns the resulting string after replacing all occurrences of pattern with replacement.

\n

Function signature

\n
replace(input: string, pattern: string, replacement: string): string\n
\n

The pattern is a string that contains a regular expression.

\n

The replacement can access the match groups by using $ and the number of the group, for example,\n$1 to access the first group.

\n

Examples

\n
replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")\n// "[1=ab][2=]cd"\n\nreplace("0123456789", "(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3")\n// "(012) 345-6789"\n
\n" + }, + { + name: "replace(input, pattern, replacement, flags)", + description: "

Returns the resulting string after replacing all occurrences of pattern with replacement.

\n

Function signature

\n
replace(input: string, pattern: string, replacement: string, flags: string): string\n
\n

The pattern is a string that contains a regular expression.

\n

The replacement can access the match groups by using $ and the number of the group, for example,\n$1 to access the first group.

\n

The flags can contain one or more of the following characters:

\n
    \n
  • s (dot-all)
  • \n
  • m (multi-line)
  • \n
  • i (case insensitive)
  • \n
  • x (comments)
  • \n
\n

Examples

\n
replace("How do you feel?", "Feel", "FEEL", "i")\n// "How do you FEEL?"\n
\n" + }, + { + name: "split(string, delimiter)", + description: "

Splits the given value into a list of substrings, breaking at each occurrence of the delimiter pattern.

\n

Function signature

\n
split(string: string, delimiter: string): list<string>\n
\n

The delimiter is a string that contains a regular expression.

\n

Examples

\n
split("John Doe", "\\s" )\n// ["John", "Doe"]\n\nsplit("a;b;c;;", ";")\n// ["a", "b", "c", "", ""]\n
\n" + }, + { + name: "extract(string, pattern)", + description: "

Camunda Extension

\n

Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.

\n

Function signature

\n
extract(string: string, pattern: string): list<string>\n
\n

The pattern is a string that contains a regular expression.

\n

Examples

\n
extract("references are 1234, 1256, 1378", "12[0-9]*")\n// ["1234","1256"]\n
\n" + }, + { + name: "now()", + description: "

Returns the current date and time including the timezone.

\n

Function signature

\n
now(): date and time\n
\n

Examples

\n
now()\n// date and time("2020-07-31T14:27:30@Europe/Berlin")\n
\n" + }, + { + name: "today()", + description: "

Returns the current date.

\n

Function signature

\n
today(): date\n
\n

Examples

\n
today()\n// date("2020-07-31")\n
\n" + }, + { + name: "day of week(date)", + description: "

Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.

\n

Function signature

\n
day of week(date: date): string\n
\n
day of week(date: date and time): string\n
\n

Examples

\n
day of week(date("2019-09-17"))\n// "Tuesday"\n\nday of week(date and time("2019-09-17T12:00:00"))\n// "Tuesday"\n
\n" + }, + { + name: "day of year(date)", + description: "

Returns the Gregorian number of the day within the year.

\n

Function signature

\n
day of year(date: date): number\n
\n
day of year(date: date and time): number\n
\n

Examples

\n
day of year(date("2019-09-17"))\n// 260\n\nday of year(date and time("2019-09-17T12:00:00"))\n// 260\n
\n" + }, + { + name: "week of year(date)", + description: "

Returns the Gregorian number of the week within the year, according to ISO 8601.

\n

Function signature

\n
week of year(date: date): number\n
\n
week of year(date: date and time): number\n
\n

Examples

\n
week of year(date("2019-09-17"))\n// 38\n\nweek of year(date and time("2019-09-17T12:00:00"))\n// 38\n
\n" + }, + { + name: "month of year(date)", + description: "

Returns the month of the year according to the Gregorian calendar. Note that it always returns the English name of the month.

\n

Function signature

\n
month of year(date: date): string\n
\n
month of year(date: date and time): string\n
\n

Examples

\n
month of year(date("2019-09-17"))\n// "September"\n\nmonth of year(date and time("2019-09-17T12:00:00"))\n// "September"\n
\n" + }, + { + name: "abs(n)", + description: "

Returns the absolute value of a given duration.

\n

Function signature

\n
abs(n: days and time duration): days and time duration\n
\n
abs(n: years and months duration): years and months duration\n
\n

Examples

\n
abs(duration("-PT5H"))\n// "duration("PT5H")"\n\nabs(duration("PT5H"))\n// "duration("PT5H")"\n\nabs(duration("-P2M"))\n// duration("P2M")\n
\n" + }, + { + name: "last day of month(date)", + description: "

Camunda Extension

\n

Takes the month of the given date or date-time value and returns the last day of this month.

\n

Function signature

\n
last day of month(date: date): date\n
\n
last day of month(date: date and time): date\n
\n

Examples

\n
last day of month(date("2022-10-01"))\n// date("2022-10-31"))\n\nlast day of month(date and time("2022-10-16T12:00:00"))\n// date("2022-10-31"))\n
\n" + } +]; + +const options = tags.map(tag => { + const match = tag.name.match(/^([\w\s]+)\((.*)\)$/); + const functionName = match[1]; + const functionArguments = match[2]; + + const placeHolders = functionArguments + .split(', ') + .map((arg) => `\${${arg}}`) + .join(', '); + + return (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)( + `${functionName}(${placeHolders})`, + { + label: tag.name, + type: 'function', + info: () => { + const html = (0,min_dom__WEBPACK_IMPORTED_MODULE_3__.domify)(`
${tag.description}
`); + return html; + }, + boost: -1 + } + ); +}); + +var builtins = context => { + + let nodeBefore = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.syntaxTree)(context.state).resolve(context.pos, -1); + + // For the special case of empty nodes, we need to check the current node + // as well. The previous node could be part of another token, e.g. + // when typing functions "abs(". + let nextNode = nodeBefore.nextSibling; + const isInEmptyNode = + isNodeEmpty(nodeBefore) || + nextNode && nextNode.from === context.pos && isNodeEmpty(nextNode); + + if (isInEmptyNode) { + return context.explicit ? { + from: context.pos, + options: options + } : null; + } + + // Don't auto-complete on path expressions/context keys/... + if ((nodeBefore.parent && nodeBefore.parent.name !== 'VariableName') || isPathExpression(nodeBefore)) { + return null; + } + + return { + from: nodeBefore.from, + options: options + }; +}; + +/** + * @type {Facet} Variable + */ +const variablesFacet = _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.Facet.define(); + +var pathExpression = context => { + const variables = context.state.facet(variablesFacet)[0]; + const nodeBefore = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.syntaxTree)(context.state).resolve(context.pos, -1); + + if (!isPathExpression(nodeBefore)) { + return; + } + + const expression = findPathExpression(nodeBefore); + + // if the cursor is directly after the `.`, variable starts at the cursor position + const from = nodeBefore === expression ? context.pos : nodeBefore.from; + + const path = getPath(expression, context); + + let options = variables; + for (var i = 0; i < path.length - 1; i++) { + var childVar = options.find(val => val.name === path[i].name); + + if (!childVar) { + return null; + } + + // only suggest if variable type matches + if ( + childVar.isList !== 'optional' && + !!childVar.isList !== path[i].isList + ) { + return; + } + + options = childVar.entries; + } + + if (!options) return; + + options = options.map(v => ({ + label: v.name, + type: 'variable', + info: v.info, + detail: v.detail + })); + + const result = { + from: from, + options: options + }; + + return result; +}; + + +function findPathExpression(node) { + while (node) { + if (node.name === 'PathExpression') { + return node; + } + node = node.parent; + } +} + +// parses the path expression into a list of variable names with type information +// e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ] +function getPath(node, context) { + let path = []; + + for (let child = node.firstChild; child; child = child.nextSibling) { + if (child.name === 'PathExpression') { + path.push(...getPath(child, context)); + } else if (child.name === 'FilterExpression') { + path.push(...getFilter(child, context)); + } + else { + path.push({ + name: getNodeContent(child, context), + isList: false + }); + } + } + return path; +} + +function getFilter(node, context) { + const list = node.firstChild; + + if (list.name === 'PathExpression') { + const path = getPath(list, context); + const last = path[path.length - 1]; + last.isList = true; + + return path; + } + + return [ { + name: getNodeContent(list, context), + isList: true + } ]; +} + +function getNodeContent(node, context) { + return context.state.sliceDoc(node.from, node.to); +} + +/** + * @type {import('@codemirror/autocomplete').CompletionSource} + */ +var variables = context => { + + const variables = context.state.facet(variablesFacet)[0]; + + const options = variables.map(v => ({ + label: v.name, + type: 'variable', + info: v.info, + detail: v.detail + })); + + // In most cases, use what is typed before the cursor + let nodeBefore = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.syntaxTree)(context.state).resolve(context.pos, -1); + + // For the special case of empty nodes, we need to check the current node + // as well. The previous node could be part of another token, e.g. + // when typing functions "abs(". + let nextNode = nodeBefore.nextSibling; + const isInEmptyNode = + isNodeEmpty(nodeBefore) || + nextNode && nextNode.from === context.pos && isNodeEmpty(nextNode); + + if (isInEmptyNode) { + return context.explicit ? { + from: context.pos, + options: options + } : null; + } + + const result = { + from: nodeBefore.from, + options: options + }; + + // Only auto-complete variables + if ((nodeBefore.parent && nodeBefore.parent.name !== 'VariableName') || isPathExpression(nodeBefore)) { + return null; + } + + return result; +}; + +function autocompletion() { + return [ + (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.autocompletion)({ + override: [ + variables, + builtins, + (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.completeFromList)(lang_feel__WEBPACK_IMPORTED_MODULE_6__.snippets.map(s => ({ ...s, boost: -1 }))), + pathExpression, + ...lang_feel__WEBPACK_IMPORTED_MODULE_6__.keywordCompletions + ] + }) + ]; +} + +function language() { + return new _codemirror_language__WEBPACK_IMPORTED_MODULE_4__.LanguageSupport(lang_feel__WEBPACK_IMPORTED_MODULE_6__.feelLanguage, [ ]); +} + +var linter = [ (0,_codemirror_lint__WEBPACK_IMPORTED_MODULE_7__.linter)((0,_bpmn_io_feel_lint__WEBPACK_IMPORTED_MODULE_0__.cmFeelLinter)()) ]; + +const baseTheme = _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.theme({ + '& .cm-content': { + padding: '0px', + }, + '& .cm-line': { + padding: '0px', + }, + '&.cm-editor.cm-focused': { + outline: 'none', + }, + '& .cm-completionInfo': { + whiteSpace: 'pre-wrap', + overflow: 'hidden', + textOverflow: 'ellipsis' + }, + + // Don't wrap whitespace for custom HTML + '& .cm-completionInfo > *': { + whiteSpace: 'normal' + }, + '& .cm-completionInfo ul': { + margin: 0, + paddingLeft: '15px' + }, + '& .cm-completionInfo pre': { + marginBottom: 0, + whiteSpace: 'pre-wrap' + }, + '& .cm-completionInfo p': { + marginTop: 0, + }, + '& .cm-completionInfo p:not(:last-of-type)': { + marginBottom: 0, + } +}); + +const highlightTheme = _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.baseTheme({ + '& .variableName': { + color: '#10f' + }, + '& .number': { + color: '#164' + }, + '& .string': { + color: '#a11' + }, + '& .bool': { + color: '#219' + }, + '& .function': { + color: '#aa3731', + fontWeight: 'bold' + }, + '& .control': { + color: '#708' + } +}); + +const syntaxClasses = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.syntaxHighlighting)( + _codemirror_language__WEBPACK_IMPORTED_MODULE_4__.HighlightStyle.define([ + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName, class: 'variableName' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.name, class: 'variableName' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.number, class: 'number' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string, class: 'string' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bool, class: 'bool' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName), class: 'function' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName)), class: 'function' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.controlKeyword, class: 'control' }, + { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.operatorKeyword, class: 'control' } + ]) +); + +var theme = [ baseTheme, highlightTheme, syntaxClasses ]; + +/** + * @typedef {object} Variable + * @typedef {import('@codemirror/state').Extension} Extension + * @property {string} name name or key of the variable + * @property {string} [info] short information about the variable, e.g. type + * @property {string} [detail] longer description of the variable content + * @property {boolean} [isList] whether the variable is a list + * @property {array} [schema] array of child variables if the variable is a context or list + */ - domAttr(node, 'readonly', editable ? null : ''); - domAttr(node, 'disabled', editable ? null : ''); - - // take full control over setting the value - // and possibly updating the input in entry#setControlValue - if (entry.setControlValue) { - entry.setControlValue(element, entryNode, node, name, newValue, idx); - } else if (isToggle(node)) { - setToggleValue(node, newValue); - } else if (isSelect(node)) { - setSelectValue(node, newValue); - } else { - setInputValue(node, newValue); - } - } +const autocompletionConf = new _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.Compartment(); - // we deal with some non-editable html element - else { - name = domAttr(node, 'data-value'); - newValue = values[name]; - if (entry.setControlValue) { - entry.setControlValue(element, entryNode, node, name, newValue, idx); - } else { - setTextValue(node, newValue); - } - } - }); - }; +/** + * Creates a FEEL editor in the supplied container + * + * @param {Object} config + * @param {DOMNode} config.container + * @param {Extension[]} [config.extensions] + * @param {DOMNode|String} [config.tooltipContainer] + * @param {Function} [config.onChange] + * @param {Function} [config.onKeyDown] + * @param {Function} [config.onLint] + * @param {Boolean} [config.readOnly] + * @param {String} [config.value] + * @param {Variable[]} [config.variables] + * + * @returns {Object} editor + */ +function FeelEditor({ + extensions: editorExtensions = [], + container, + tooltipContainer, + onChange = () => {}, + onKeyDown = () => {}, + onLint = () => {}, + readOnly = false, + value = '', + variables = [] +}) { + + const changeHandler = _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.updateListener.of((update) => { + if (update.docChanged) { + onChange(update.state.doc.toString()); + } + }); + + const lintHandler = _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.updateListener.of((update) => { + const diagnosticEffects = update.transactions + .flatMap(t => t.effects) + .filter(effect => effect.is(_codemirror_lint__WEBPACK_IMPORTED_MODULE_7__.setDiagnosticsEffect)); + + if (!diagnosticEffects.length) { + return; + } + + const messages = diagnosticEffects.flatMap(effect => effect.value); + + onLint(messages); + }); + + const keyHandler = _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.domEventHandlers( + { + keydown: onKeyDown + } + ); + + if (typeof tooltipContainer === 'string') { + tooltipContainer = document.querySelector(tooltipContainer); + } + + const tooltipLayout = tooltipContainer ? (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_8__.tooltips)({ + tooltipSpace: function() { + return tooltipContainer.getBoundingClientRect(); + } + }) : []; + + const extensions = [ + autocompletionConf.of(variablesFacet.of(variables)), + autocompletion(), + (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.bracketMatching)(), + changeHandler, + (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.closeBrackets)(), + (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_4__.indentOnInput)(), + keyHandler, + _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.keymap.of([ + ..._codemirror_commands__WEBPACK_IMPORTED_MODULE_9__.defaultKeymap, + ]), + language(), + linter, + lintHandler, + tooltipLayout, + theme, + ...editorExtensions + ]; + + if (readOnly) { + extensions.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView.editable.of(false)); + } + + this._cmEditor = new _codemirror_view__WEBPACK_IMPORTED_MODULE_8__.EditorView({ + state: _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.EditorState.create({ + doc: value, + extensions: extensions + }), + parent: container + }); + + return this; +} + +/** + * Replaces the content of the Editor + * + * @param {String} value + */ +FeelEditor.prototype.setValue = function(value) { + this._cmEditor.dispatch({ + changes: { + from: 0, + to: this._cmEditor.state.doc.length, + insert: value, + } + }); +}; + +/** + * Sets the focus in the editor. + */ +FeelEditor.prototype.focus = function(position) { + const cmEditor = this._cmEditor; + + // the Codemirror `focus` method always calls `focus` with `preventScroll`, + // so we have to focus + scroll manually + cmEditor.contentDOM.focus(); + cmEditor.focus(); + + if (typeof position === 'number') { + const end = cmEditor.state.doc.length; + cmEditor.dispatch({ selection: { anchor: position <= end ? position : end } }); + } +}; + +/** + * Returns the current selection ranges. If no text is selected, a single + * range with the start and end index at the cursor position will be returned. + * + * @returns {Object} selection + * @returns {Array} selection.ranges + */ +FeelEditor.prototype.getSelection = function() { + return this._cmEditor.state.selection; +}; + +/** + * Set variables to be used for autocompletion. + * @param {Variable[]} variables + * @returns {void} + */ +FeelEditor.prototype.setVariables = function(variables) { + this._cmEditor.dispatch({ + effects: autocompletionConf.reconfigure(variablesFacet.of(variables)) + }); +}; -// TODO(nikku): WTF freaking name? Change / clarify. - PropertiesPanel.prototype._updateActivation = function(current) { - var self = this; - var eventBus = this._eventBus; - var element = current.element; - function isEntryVisible(entry) { - return eventBus.fire('propertiesPanel.isEntryVisible', { - entry: entry, - element: element - }); - } +/***/ }), - function isGroupVisible(group, element, groupNode) { - if (typeof group.enabled === 'function') { - return group.enabled(element, groupNode); - } else { - return true; - } - } +/***/ "../node_modules/@bpmn-io/feel-lint/dist/index.esm.js": +/*!************************************************************!*\ + !*** ../node_modules/@bpmn-io/feel-lint/dist/index.esm.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - function isTabVisible(tab, element) { - if (typeof tab.enabled === 'function') { - return tab.enabled(element); - } else { - return true; - } - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ cmFeelLinter: () => (/* binding */ cmFeelLinter), +/* harmony export */ lintExpression: () => (/* binding */ lintExpression) +/* harmony export */ }); +/* harmony import */ var lezer_feel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lezer-feel */ "../node_modules/lezer-feel/dist/index.js"); +/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/language */ "../node_modules/@codemirror/language/dist/index.js"); - function toggleVisible(node, visible) { - domClasses(node).toggle(HIDE_CLASS, !visible); - } - // check whether the active tab is visible - // if not: set the first tab as active tab - function checkActiveTabVisibility(node, visible) { - var isActive = domClasses(node).has('bpp-active'); - if (!visible && isActive) { - self.activateTab(current.tabs[0]); - } - } - function updateLabel(element, selector, text) { - var labelNode = domQuery(selector, element); +/** + * Create an array of syntax errors in the given tree. + * + * @param {Tree} syntaxTree + * @returns {LintMessage[]} array of syntax errors + */ +function lintSyntax(syntaxTree) { + + const lintMessages = []; + + syntaxTree.iterate({ + enter: ref => { + const node = ref.node; + + if (!node.type.isError) { + return; + } + + const parent = node.parent; + const next = getNextNode(node); + + const message = { + from: node.from, + to: node.to, + severity: 'error', + type: 'Syntax Error' + }; + + if (node.from !== node.to) { + message.message = `Unrecognized token in <${parent.name}>`; + } else if (next) { + message.message = `Unrecognized token <${next.name}> in <${parent.name}>`; + message.to = next.to; + } else { + const before = parent.enterUnfinishedNodesBefore(node.to); + message.message = `Incomplete <${ (before || parent).name }>`; + } + + lintMessages.push(message); + } + }); + + return lintMessages; +} + +function getNextNode(node) { + if (!node) { + return null; + } + + return node.nextSibling || getNextNode(node.parent); +} + +/** + * Generates lint messages for the given syntax tree. + * + * @param {Tree} syntaxTree + * @returns {LintMessage[]} array of all lint messages + */ +function lintAll(syntaxTree) { - if (!labelNode) { - return; - } + const lintMessages = [ + ...lintSyntax(syntaxTree) + ]; - labelNode.textContent = text; - } + return lintMessages; +} - var panelNode = current.panel; +/** + * Create an array of syntax errors for the given expression. + * + * @param {String} expression + * @returns {LintMessage[]} array of syntax errors + */ +function lintExpression(expression) { - forEach(current.tabs, function(tab) { + const syntaxTree = lezer_feel__WEBPACK_IMPORTED_MODULE_0__.parser.parse(expression); - var tabNode = domQuery('[data-tab=' + tab.id + ']', panelNode); - var tabLinkNode = domQuery('[data-tab-target=' + tab.id + ']', panelNode).parentNode; + const lintMessages = lintAll(syntaxTree); - var tabVisible = false; + return lintMessages; +} - forEach(tab.groups, function(group) { +/** + * CodeMirror extension that provides linting for FEEL expressions. + * + * @param {EditorView} editorView + * @returns {Source} CodeMirror linting source + */ +const cmFeelLinter = () => editorView => { + + // don't lint if the Editor is empty + if (editorView.state.doc.length === 0) { + return []; + } + + const tree = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_1__.syntaxTree)(editorView.state); + + const messages = lintAll(tree); + + return messages.map(message => ({ + ...message, + source: message.type + })); +}; + + + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/properties-panel/dist/index.esm.js": +/*!*******************************************************************!*\ + !*** ../node_modules/@bpmn-io/properties-panel/dist/index.esm.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ArrowIcon: () => (/* binding */ ArrowIcon), +/* harmony export */ CheckboxEntry: () => (/* binding */ CheckboxEntry), +/* harmony export */ CollapsibleEntry: () => (/* binding */ CollapsibleEntry), +/* harmony export */ CreateIcon: () => (/* binding */ CreateIcon), +/* harmony export */ DebounceInputModule: () => (/* binding */ index$1), +/* harmony export */ DeleteIcon: () => (/* binding */ DeleteIcon), +/* harmony export */ DescriptionContext: () => (/* binding */ DescriptionContext), +/* harmony export */ DescriptionEntry: () => (/* binding */ Description), +/* harmony export */ DragIcon: () => (/* binding */ DragIcon), +/* harmony export */ DropdownButton: () => (/* binding */ DropdownButton), +/* harmony export */ ErrorsContext: () => (/* binding */ ErrorsContext), +/* harmony export */ EventContext: () => (/* binding */ EventContext), +/* harmony export */ ExternalLinkIcon: () => (/* binding */ ExternalLinkIcon), +/* harmony export */ FeelCheckboxEntry: () => (/* binding */ FeelCheckboxEntry), +/* harmony export */ FeelEntry: () => (/* binding */ FeelEntry), +/* harmony export */ FeelIcon: () => (/* binding */ FeelIcon$1), +/* harmony export */ FeelNumberEntry: () => (/* binding */ FeelNumberEntry), +/* harmony export */ FeelPopupModule: () => (/* binding */ index), +/* harmony export */ FeelTemplatingEntry: () => (/* binding */ FeelTemplatingEntry), +/* harmony export */ FeelTextAreaEntry: () => (/* binding */ FeelTextAreaEntry), +/* harmony export */ FeelToggleSwitchEntry: () => (/* binding */ FeelToggleSwitchEntry), +/* harmony export */ Group: () => (/* binding */ Group), +/* harmony export */ Header: () => (/* binding */ Header), +/* harmony export */ HeaderButton: () => (/* binding */ HeaderButton), +/* harmony export */ HelpIcon: () => (/* binding */ HelpIcon), +/* harmony export */ LayoutContext: () => (/* binding */ LayoutContext), +/* harmony export */ ListEntry: () => (/* binding */ List), +/* harmony export */ ListGroup: () => (/* binding */ ListGroup), +/* harmony export */ ListItem: () => (/* binding */ ListItem), +/* harmony export */ NumberFieldEntry: () => (/* binding */ NumberFieldEntry), +/* harmony export */ Placeholder: () => (/* binding */ Placeholder), +/* harmony export */ Popup: () => (/* binding */ Popup), +/* harmony export */ PopupIcon: () => (/* binding */ PopupIcon), +/* harmony export */ PropertiesPanel: () => (/* binding */ PropertiesPanel), +/* harmony export */ PropertiesPanelContext: () => (/* binding */ LayoutContext), +/* harmony export */ SelectEntry: () => (/* binding */ SelectEntry), +/* harmony export */ SimpleEntry: () => (/* binding */ Simple), +/* harmony export */ TemplatingEntry: () => (/* binding */ TemplatingEntry), +/* harmony export */ TextAreaEntry: () => (/* binding */ TextAreaEntry), +/* harmony export */ TextFieldEntry: () => (/* binding */ TextfieldEntry), +/* harmony export */ ToggleSwitchEntry: () => (/* binding */ ToggleSwitchEntry), +/* harmony export */ TooltipContext: () => (/* binding */ TooltipContext), +/* harmony export */ TooltipEntry: () => (/* binding */ TooltipWrapper), +/* harmony export */ isCheckboxEntryEdited: () => (/* binding */ isEdited$5), +/* harmony export */ isFeelEntryEdited: () => (/* binding */ isEdited$6), +/* harmony export */ isNumberFieldEntryEdited: () => (/* binding */ isEdited$7), +/* harmony export */ isSelectEntryEdited: () => (/* binding */ isEdited$3), +/* harmony export */ isSimpleEntryEdited: () => (/* binding */ isEdited$2), +/* harmony export */ isTemplatingEntryEdited: () => (/* binding */ isEdited$4), +/* harmony export */ isTextAreaEntryEdited: () => (/* binding */ isEdited$1), +/* harmony export */ isTextFieldEntryEdited: () => (/* binding */ isEdited), +/* harmony export */ isToggleSwitchEntryEdited: () => (/* binding */ isEdited$8), +/* harmony export */ useDescriptionContext: () => (/* binding */ useDescriptionContext), +/* harmony export */ useError: () => (/* binding */ useError), +/* harmony export */ useErrors: () => (/* binding */ useErrors), +/* harmony export */ useEvent: () => (/* binding */ useEvent), +/* harmony export */ useKeyFactory: () => (/* binding */ useKeyFactory), +/* harmony export */ useLayoutState: () => (/* binding */ useLayoutState), +/* harmony export */ usePrevious: () => (/* binding */ usePrevious), +/* harmony export */ useShowEntryEvent: () => (/* binding */ useShowEntryEvent), +/* harmony export */ useStaticCallback: () => (/* binding */ useStaticCallback), +/* harmony export */ useStickyIntersectionObserver: () => (/* binding */ useStickyIntersectionObserver), +/* harmony export */ useTooltipContext: () => (/* binding */ useTooltipContext) +/* harmony export */ }); +/* harmony import */ var _preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../preact/hooks */ "../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _preact_compat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../preact/compat */ "../node_modules/@bpmn-io/properties-panel/preact/compat/dist/compat.module.js"); +/* harmony import */ var _preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../preact/jsx-runtime */ "../node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js"); +/* harmony import */ var _preact__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../preact */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! classnames */ "../node_modules/classnames/index.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var feelers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! feelers */ "../node_modules/feelers/dist/index.mjs"); +/* harmony import */ var _bpmn_io_feel_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @bpmn-io/feel-editor */ "../node_modules/@bpmn-io/feel-editor/dist/index.es.js"); +/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @codemirror/view */ "../node_modules/@codemirror/view/dist/index.js"); +/* harmony import */ var focus_trap__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! focus-trap */ "../node_modules/focus-trap/dist/focus-trap.esm.js"); + + + + + + + + + + + + +var ArrowIcon = function ArrowIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", { + ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fillRule: "evenodd", + d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8Z" + }) + }); +}; +ArrowIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; +var CreateIcon = function CreateIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", { + ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fillRule: "evenodd", + d: "M9 13V9h4a1 1 0 0 0 0-2H9V3a1 1 0 1 0-2 0v4H3a1 1 0 1 0 0 2h4v4a1 1 0 0 0 2 0Z" + }) + }); +}; +CreateIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; +var DeleteIcon = function DeleteIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", { + ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fillRule: "evenodd", + d: "M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8Zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5ZM13 3h-2l-1-1H6L5 3H3v1.5h10V3Z" + }) + }); +}; +DeleteIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; +var DragIcon = function DragIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("svg", { + ...props, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fill: "#fff", + style: { + mixBlendMode: "multiply" + }, + d: "M0 0h16v16H0z" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fill: "#fff", + style: { + mixBlendMode: "multiply" + }, + d: "M0 0h16v16H0z" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + d: "M7 3H5v2h2V3zm4 0H9v2h2V3zM7 7H5v2h2V7zm4 0H9v2h2V7zm-4 4H5v2h2v-2zm4 0H9v2h2v-2z", + fill: "#161616" + })] + }); +}; +DragIcon.defaultProps = { + width: "16", + height: "16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; +var ExternalLinkIcon = function ExternalLinkIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", { + ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274ZM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2Z", + fill: "currentcolor" + }) + }); +}; +ExternalLinkIcon.defaultProps = { + width: "16", + height: "16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; +var FeelIcon$1 = function FeelIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", { + ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + d: "M3.617 11.99c-.137.684-.392 1.19-.765 1.518-.362.328-.882.492-1.558.492H0l.309-1.579h1.264l1.515-7.64h-.912l.309-1.579h.911l.236-1.191c.137-.685.387-1.192.75-1.52C4.753.164 5.277 0 5.953 0h1.294L6.94 1.579H5.675l-.323 1.623h1.264l-.309 1.579H5.043l-1.426 7.208ZM5.605 11.021l3.029-4.155L7.28 3.202h2.073l.706 2.547h.176l1.691-2.547H14l-3.014 4.051 1.338 3.768H10.25l-.706-2.606H9.37L7.678 11.02H5.605Z", + fill: "currentcolor" + }) + }); +}; +FeelIcon$1.defaultProps = { + width: "14", + height: "14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; +var HelpIcon = function HelpIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("svg", { + ...props, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + d: "M16 2a14 14 0 1 0 14 14A14 14 0 0 0 16 2Zm0 26a12 12 0 1 1 12-12 12 12 0 0 1-12 12Z" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("circle", { + cx: "16", + cy: "23.5", + r: "1.5" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + d: "M17 8h-1.5a4.49 4.49 0 0 0-4.5 4.5v.5h2v-.5a2.5 2.5 0 0 1 2.5-2.5H17a2.5 2.5 0 0 1 0 5h-2v4.5h2V17a4.5 4.5 0 0 0 0-9Z" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + style: { + fill: "none" + }, + d: "M0 0h32v32H0z" + })] + }); +}; +HelpIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 32 32" +}; +var PopupIcon = function PopupIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("svg", { + ...props, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fill: "currentColor", + d: "M28 4H10a2.006 2.006 0 0 0-2 2v14a2.006 2.006 0 0 0 2 2h18a2.006 2.006 0 0 0 2-2V6a2.006 2.006 0 0 0-2-2Zm0 16H10V6h18Z" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { + fill: "currentColor", + d: "M18 26H4V16h2v-2H4a2.006 2.006 0 0 0-2 2v10a2.006 2.006 0 0 0 2 2h14a2.006 2.006 0 0 0 2-2v-2h-2Z" + })] + }); +}; +PopupIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16", + viewBox: "0 0 32 32" +}; + +function Header(props) { + const { + element, + headerProvider + } = props; + const { + getElementIcon, + getDocumentationRef, + getElementLabel, + getTypeLabel + } = headerProvider; + const label = getElementLabel(element); + const type = getTypeLabel(element); + const documentationRef = getDocumentationRef && getDocumentationRef(element); + const ElementIcon = getElementIcon(element); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-header", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-header-icon", + children: ElementIcon && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ElementIcon, { + width: "32", + height: "32", + viewBox: "0 0 32 32" + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-header-labels", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: type, + class: "bio-properties-panel-header-type", + children: type + }), label ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: label, + class: "bio-properties-panel-header-label", + children: label + }) : null] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-header-actions", + children: documentationRef ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("a", { + rel: "noopener", + class: "bio-properties-panel-header-link", + href: documentationRef, + title: "Open documentation", + target: "_blank", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ExternalLinkIcon, {}) + }) : null + })] + }); +} + +const DescriptionContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + description: {}, + getDescriptionForId: () => {} +}); + +const ErrorsContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + errors: {} +}); + +/** + * @typedef {Function} callback + * + * @example + * + * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => { + * // ... + * }); + * + * @param {Object} context + * @param {boolean} [context.focus] + * + * @returns void + */ - var groupVisible = false; +const EventContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + eventBus: null +}); - var groupNode = domQuery('[data-group=' + group.id + ']', tabNode); +const LayoutContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + layout: {}, + setLayout: () => {}, + getLayoutForKey: () => {}, + setLayoutForKey: () => {} +}); - forEach(group.entries, function(entry) { +const TooltipContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + tooltip: {}, + getTooltipForId: () => {} +}); - var entryNode = domQuery('[data-entry="' + entry.id + '"]', groupNode); +/** + * Accesses the global TooltipContext and returns a tooltip for a given id and element. + * + * @example + * ```jsx + * function TextField(props) { + * const tooltip = useTooltipContext('input1', element); + * } + * ``` + * + * @param {string} id + * @param {object} element + * + * @returns {string} + */ +function useTooltipContext(id, element) { + const { + getTooltipForId + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(TooltipContext); + return getTooltipForId(id, element); +} + +function TooltipWrapper(props) { + const { + forId, + element + } = props; + const contextDescription = useTooltipContext(forId, element); + const value = props.value || contextDescription; + if (!value) { + return props.children; + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Tooltip, { + ...props, + value: value, + forId: prefixId$9(forId) + }); +} +function Tooltip(props) { + const { + forId, + value, + parent, + direction = 'right', + position + } = props; + const [visible, setShow] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [focusedViaKeyboard, setFocusedViaKeyboard] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + let timeout = null; + const wrapperRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const tooltipRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const showTooltip = async event => { + const show = () => setShow(true); + if (!visible && !timeout) { + if (event instanceof MouseEvent) { + timeout = setTimeout(show, 200); + } else { + show(); + setFocusedViaKeyboard(true); + } + } + }; + const hideTooltip = () => { + setShow(false); + setFocusedViaKeyboard(false); + }; + const hideTooltipViaEscape = e => { + e.code === 'Escape' && hideTooltip(); + }; + const isTooltipHovered = ({ + x, + y + }) => { + const tooltip = tooltipRef.current; + const wrapper = wrapperRef.current; + return tooltip && (inBounds(x, y, wrapper.getBoundingClientRect()) || inBounds(x, y, tooltip.getBoundingClientRect())); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + current + } = wrapperRef; + if (!current) { + return; + } + const hideHoveredTooltip = e => { + const isFocused = document.activeElement === wrapperRef.current || document.activeElement.closest('.bio-properties-panel-tooltip'); + if (visible && !isTooltipHovered({ + x: e.x, + y: e.y + }) && !(isFocused && focusedViaKeyboard)) { + hideTooltip(); + } + }; + const hideFocusedTooltip = e => { + const { + relatedTarget + } = e; + const isTooltipChild = el => !!el.closest('.bio-properties-panel-tooltip'); + if (visible && !isHovered(wrapperRef.current) && relatedTarget && !isTooltipChild(relatedTarget)) { + hideTooltip(); + } + }; + document.addEventListener('wheel', hideHoveredTooltip); + document.addEventListener('focusout', hideFocusedTooltip); + document.addEventListener('mousemove', hideHoveredTooltip); + return () => { + document.removeEventListener('wheel', hideHoveredTooltip); + document.removeEventListener('mousemove', hideHoveredTooltip); + document.removeEventListener('focusout', hideFocusedTooltip); + }; + }, [wrapperRef.current, visible, focusedViaKeyboard]); + const renderTooltip = () => { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: `bio-properties-panel-tooltip ${direction}`, + role: "tooltip", + id: "bio-properties-panel-tooltip", + "aria-labelledby": forId, + style: position || getTooltipPosition(wrapperRef.current), + ref: tooltipRef, + onClick: e => e.stopPropagation(), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-tooltip-content", + children: value + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-tooltip-arrow" + })] + }); + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-tooltip-wrapper", + tabIndex: "0", + ref: wrapperRef, + onMouseEnter: showTooltip, + onMouseLeave: () => { + clearTimeout(timeout); + timeout = null; + }, + onFocus: showTooltip, + onKeyDown: hideTooltipViaEscape, + children: [props.children, visible ? parent ? (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.createPortal)(renderTooltip(), parent.current) : renderTooltip() : null] + }); +} + +// helper +function inBounds(x, y, bounds) { + const { + top, + right, + bottom, + left + } = bounds; + return x >= left && x <= right && y >= top && y <= bottom; +} +function getTooltipPosition(refElement) { + const refPosition = refElement.getBoundingClientRect(); + const right = `calc(100% - ${refPosition.x}px)`; + const top = `${refPosition.top - 10}px`; + return `right: ${right}; top: ${top};`; +} +function isHovered(element) { + return element.matches(':hover'); +} +function prefixId$9(id) { + return `bio-properties-panel-${id}`; +} + +/** + * Accesses the global DescriptionContext and returns a description for a given id and element. + * + * @example + * ```jsx + * function TextField(props) { + * const description = useDescriptionContext('input1', element); + * } + * ``` + * + * @param {string} id + * @param {object} element + * + * @returns {string} + */ +function useDescriptionContext(id, element) { + const { + getDescriptionForId + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(DescriptionContext); + return getDescriptionForId(id, element); +} + +function useError(id) { + const { + errors + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(ErrorsContext); + return errors[id]; +} +function useErrors() { + const { + errors + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(ErrorsContext); + return errors; +} + +/** + * Subscribe to an event immediately. Update subscription after inputs changed. + * + * @param {string} event + * @param {Function} callback + */ +function useEvent(event, callback, eventBus) { + const eventContext = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(EventContext); + if (!eventBus) { + ({ + eventBus + } = eventContext); + } + const didMount = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + + // (1) subscribe immediately + if (eventBus && !didMount.current) { + eventBus.on(event, callback); + } + + // (2) update subscription after inputs changed + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (eventBus && didMount.current) { + eventBus.on(event, callback); + } + didMount.current = true; + return () => { + if (eventBus) { + eventBus.off(event, callback); + } + }; + }, [callback, event, eventBus]); +} + +const KEY_LENGTH = 6; + +/** + * Create a persistent key factory for plain objects without id. + * + * @example + * ```jsx + * function List({ objects }) { + * const getKey = useKeyFactory(); + * return (
    { + * objects.map(obj => { + * const key = getKey(obj); + * return
  1. obj.name
  2. + * }) + * }
); + * } + * ``` + * + * @param {any[]} dependencies + * @returns {(element: object) => string} + */ +function useKeyFactory(dependencies = []) { + const map = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => new Map(), dependencies); + const getKey = el => { + let key = map.get(el); + if (!key) { + key = Math.random().toString().slice(-KEY_LENGTH); + map.set(el, key); + } + return key; + }; + return getKey; +} + +/** + * Creates a state that persists in the global LayoutContext. + * + * @example + * ```jsx + * function Group(props) { + * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false); + * } + * ``` + * + * @param {(string|number)[]} path + * @param {any} [defaultValue] + * + * @returns {[ any, Function ]} + */ +function useLayoutState(path, defaultValue) { + const { + getLayoutForKey, + setLayoutForKey + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const layoutForKey = getLayoutForKey(path, defaultValue); + const setState = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newValue => { + setLayoutForKey(path, newValue); + }, [setLayoutForKey]); + return [layoutForKey, setState]; +} + +/** + * @pinussilvestrus: we need to introduce our own hook to persist the previous + * state on updates. + * + * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state + */ - var entryVisible = isEntryVisible(entry); +function usePrevious(value) { + const ref = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + ref.current = value; + }); + return ref.current; +} - groupVisible = groupVisible || entryVisible; +/** + * Subscribe to `propertiesPanel.showEntry`. + * + * @param {string} id + * + * @returns {import('preact').Ref} + */ +function useShowEntryEvent(id) { + const { + onShow + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const ref = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const focus = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const onShowEntry = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(event => { + if (event.id === id) { + onShow(); + if (!focus.current) { + focus.current = true; + } + } + }, [id]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (focus.current && ref.current) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(ref.current.focus)) { + ref.current.focus(); + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(ref.current.select)) { + ref.current.select(); + } + focus.current = false; + } + }); + useEvent('propertiesPanel.showEntry', onShowEntry); + return ref; +} + +/** + * @callback setSticky + * @param {boolean} value + */ - toggleVisible(entryNode, entryVisible); +/** + * Use IntersectionObserver to identify when DOM element is in sticky mode. + * If sticky is observered setSticky(true) will be called. + * If sticky mode is left, setSticky(false) will be called. + * + * + * @param {Object} ref + * @param {string} scrollContainerSelector + * @param {setSticky} setSticky + */ +function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) { + const [scrollContainer, setScrollContainer] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)((0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(scrollContainerSelector)); + const updateScrollContainer = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + const newScrollContainer = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(scrollContainerSelector); + if (newScrollContainer !== scrollContainer) { + setScrollContainer(newScrollContainer); + } + }, [scrollContainerSelector, scrollContainer]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + updateScrollContainer(); + }, [updateScrollContainer]); + useEvent('propertiesPanel.attach', updateScrollContainer); + useEvent('propertiesPanel.detach', updateScrollContainer); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const Observer = IntersectionObserver; + + // return early if IntersectionObserver is not available + if (!Observer) { + return; + } + + // TODO(@barmac): test this + if (!ref.current || !scrollContainer) { + return; + } + const observer = new Observer(entries => { + // scroll container is unmounted, do not update sticky state + if (scrollContainer.scrollHeight === 0) { + return; + } + entries.forEach(entry => { + if (entry.intersectionRatio < 1) { + setSticky(true); + } else if (entry.intersectionRatio === 1) { + setSticky(false); + } + }); + }, { + root: scrollContainer, + rootMargin: '0px 0px 999999% 0px', + // Use bottom margin to avoid stickyness when scrolling out to bottom + threshold: [1] + }); + observer.observe(ref.current); + + // Unobserve if unmounted + return () => { + observer.unobserve(ref.current); + }; + }, [ref.current, scrollContainer, setSticky]); +} + +/** + * Creates a static function reference with changing body. + * This is necessary when external libraries require a callback function + * that has references to state variables. + * + * Usage: + * const callback = useStaticCallback((val) => {val === currentState}); + * + * The `callback` reference is static and can be safely used in external + * libraries or as a prop that does not cause rerendering of children. + * + * @param {Function} callback function with changing reference + * @returns {Function} static function reference + */ +function useStaticCallback(callback) { + const callbackRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(callback); + callbackRef.current = callback; + return (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)((...args) => callbackRef.current(...args), []); +} + +function Group(props) { + const { + element, + entries = [], + id, + label, + shouldOpen = false + } = props; + const groupRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = useLayoutState(['groups', id, 'open'], shouldOpen); + const onShow = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => setOpen(true), [setOpen]); + const toggleOpen = () => setOpen(!open); + const [edited, setEdited] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [sticky, setSticky] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + + // set edited state depending on all entries + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + // TODO(@barmac): replace with CSS when `:has()` is supported in all major browsers, or rewrite as in https://github.com/camunda/camunda-modeler/issues/3815#issuecomment-1733038161 + const scheduled = requestAnimationFrame(() => { + const hasOneEditedEntry = entries.find(entry => { + const { + id, + isEdited + } = entry; + const entryNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(`[data-entry-id="${id}"]`); + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(isEdited) || !entryNode) { + return false; + } + const inputNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)('.bio-properties-panel-input', entryNode); + return isEdited(inputNode); + }); + setEdited(hasOneEditedEntry); + }); + return () => cancelAnimationFrame(scheduled); + }, [entries, setEdited]); + + // set error state depending on all entries + const allErrors = useErrors(); + const hasErrors = entries.some(entry => allErrors[entry.id]); + + // set css class when group is sticky to top + useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky); + const propertiesPanelContext = { + ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-group", + "data-group-id": 'group-' + id, + ref: groupRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''), + onClick: toggleOpen, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: props.tooltip ? null : label, + "data-title": label, + class: "bio-properties-panel-group-header-title", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: props.tooltip, + forId: 'group-' + id, + element: element, + parent: groupRef, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-group-header-buttons", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DataMarker, { + edited: edited, + hasErrors: hasErrors + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Toggle section", + class: "bio-properties-panel-group-header-button bio-properties-panel-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + })] + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-entries', open ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: entries.map(entry => { + const { + component: Component, + id + } = entry; + return (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createElement)(Component, { + ...entry, + element: element, + key: id + }); + }) + }) + })] + }); +} +function DataMarker(props) { + const { + edited, + hasErrors + } = props; + if (hasErrors) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: "Section contains an error", + class: "bio-properties-panel-dot bio-properties-panel-dot--error" + }); + } + if (edited) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: "Section contains data", + class: "bio-properties-panel-dot" + }); + } + return null; +} + +/** + * @typedef { { + * text: (element: object) => string, + * icon?: (element: Object) => import('preact').Component + * } } PlaceholderDefinition + * + * @param { PlaceholderDefinition } props + */ +function Placeholder(props) { + const { + text, + icon: Icon + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel open", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("section", { + class: "bio-properties-panel-placeholder", + children: [Icon && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Icon, { + class: "bio-properties-panel-placeholder-icon" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p", { + class: "bio-properties-panel-placeholder-text", + children: text + })] + }) + }); +} + +function Description(props) { + const { + element, + forId, + value + } = props; + const contextDescription = useDescriptionContext(forId, element); + const description = value || contextDescription; + if (description) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-description", + children: description + }); + } +} + +const noop$6 = () => {}; + +/** + * Buffer `.focus()` calls while the editor is not initialized. + * Set Focus inside when the editor is ready. + */ +const useBufferedFocus$1 = function (editor, ref) { + const [buffer, setBuffer] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); + ref.current = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + focus: offset => { + if (editor) { + editor.focus(offset); + } else { + if (typeof offset === 'undefined') { + offset = Infinity; + } + setBuffer(offset); + } + } + }), [editor]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof buffer !== 'undefined' && editor) { + editor.focus(buffer); + setBuffer(false); + } + }, [editor, buffer]); +}; +const CodeEditor$1 = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + onInput, + disabled, + tooltipContainer, + enableGutters, + value, + onLint = noop$6, + onPopupOpen = noop$6, + popupOpen, + contentAttributes = {}, + hostLanguage = null, + singleLine = false + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const [editor, setEditor] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(); + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value || ''); + useBufferedFocus$1(editor, ref); + const handleInput = useStaticCallback(newValue => { + onInput(newValue); + setLocalValue(newValue); + }); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let editor; + editor = new feelers__WEBPACK_IMPORTED_MODULE_5__.FeelersEditor({ + container: inputRef.current, + onChange: handleInput, + value: localValue, + onLint, + contentAttributes, + tooltipContainer, + enableGutters, + hostLanguage, + singleLine + }); + setEditor(editor); + return () => { + onLint([]); + inputRef.current.innerHTML = ''; + setEditor(null); + }; + }, []); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!editor) { + return; + } + if (value === localValue) { + return; + } + editor.setValue(value); + setLocalValue(value); + }, [value]); + const handleClick = () => { + ref.current.focus(); + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-feelers-editor-container', popupOpen ? 'popupOpen' : null), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-feelers-editor__open-popup-placeholder", + children: "Opened in editor" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + name: props.name, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-feelers-editor bio-properties-panel-input', localValue ? 'edited' : null, disabled ? 'disabled' : null), + ref: inputRef, + onClick: handleClick + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Open pop-up editor", + class: "bio-properties-panel-open-feel-popup", + onClick: () => onPopupOpen('feelers'), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ExternalLinkIcon, {}) + })] + }); +}); + +const noop$5 = () => {}; + +/** + * Buffer `.focus()` calls while the editor is not initialized. + * Set Focus inside when the editor is ready. + */ +const useBufferedFocus = function (editor, ref) { + const [buffer, setBuffer] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); + ref.current = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + focus: offset => { + if (editor) { + editor.focus(offset); + } else { + if (typeof offset === 'undefined') { + offset = Infinity; + } + setBuffer(offset); + } + } + }), [editor]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof buffer !== 'undefined' && editor) { + editor.focus(buffer); + setBuffer(false); + } + }, [editor, buffer]); +}; +const CodeEditor = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + enableGutters, + value, + onInput, + onFeelToggle = noop$5, + onLint = noop$5, + onPopupOpen = noop$5, + popupOpen, + disabled, + tooltipContainer, + variables + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const [editor, setEditor] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(); + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value || ''); + useBufferedFocus(editor, ref); + const handleInput = useStaticCallback(newValue => { + onInput(newValue); + setLocalValue(newValue); + }); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let editor; + + /* Trigger FEEL toggle when + * + * - `backspace` is pressed + * - AND the cursor is at the beginning of the input + */ + const onKeyDown = e => { + if (e.key !== 'Backspace' || !editor) { + return; + } + const selection = editor.getSelection(); + const range = selection.ranges[selection.mainIndex]; + if (range.from === 0 && range.to === 0) { + onFeelToggle(); + } + }; + editor = new _bpmn_io_feel_editor__WEBPACK_IMPORTED_MODULE_6__["default"]({ + container: inputRef.current, + onChange: handleInput, + onKeyDown: onKeyDown, + onLint: onLint, + tooltipContainer: tooltipContainer, + value: localValue, + variables: variables, + extensions: [...(enableGutters ? [(0,_codemirror_view__WEBPACK_IMPORTED_MODULE_9__.lineNumbers)()] : []), _codemirror_view__WEBPACK_IMPORTED_MODULE_9__.EditorView.lineWrapping] + }); + setEditor(editor); + return () => { + onLint([]); + inputRef.current.innerHTML = ''; + setEditor(null); + }; + }, []); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!editor) { + return; + } + if (value === localValue) { + return; + } + editor.setValue(value); + setLocalValue(value); + }, [value]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!editor) { + return; + } + editor.setVariables(variables); + }, [variables]); + const handleClick = () => { + ref.current.focus(); + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-feel-editor-container', disabled ? 'disabled' : null, popupOpen ? 'popupOpen' : null), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-feel-editor__open-popup-placeholder", + children: "Opened in editor" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + name: props.name, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-input', localValue ? 'edited' : null), + ref: inputRef, + onClick: handleClick + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Open pop-up editor", + class: "bio-properties-panel-open-feel-popup", + onClick: () => onPopupOpen(), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(PopupIcon, {}) + })] + }); +}); + +function FeelIndicator(props) { + const { + active + } = props; + if (!active) { + return null; + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", { + class: "bio-properties-panel-feel-indicator", + children: "=" + }); +} + +const noop$4 = () => {}; + +/** + * @param {Object} props + * @param {Object} props.label + * @param {String} props.feel + */ +function FeelIcon(props) { + const { + feel = false, + active, + disabled = false, + onClick = noop$4 + } = props; + const feelRequiredLabel = 'FEEL expression is mandatory'; + const feelOptionalLabel = `Click to ${active ? 'remove' : 'set a'} dynamic value with FEEL expression`; + const handleClick = e => { + onClick(e); + + // when pointer event was created from keyboard, keep focus on button + if (!e.pointerType) { + e.stopPropagation(); + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'), + onClick: handleClick, + disabled: feel === 'required' || disabled, + title: feel === 'required' ? feelRequiredLabel : feelOptionalLabel, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelIcon$1, {}) + }); +} + +const FeelPopupContext = (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createContext)({ + open: () => {}, + close: () => {}, + source: null +}); + +/** + * Add a dragger that calls back the passed function with + * { event, delta } on drag. + * + * @example + * + * function dragMove(event, delta) { + * // we are dragging (!!) + * } + * + * domElement.addEventListener('dragstart', dragger(dragMove)); + * + * @param {Function} fn + * @param {Element} [dragPreview] + * + * @return {Function} drag start callback function + */ +function createDragger(fn, dragPreview) { + let self; + let startX, startY; + + /** drag start */ + function onDragStart(event) { + self = this; + startX = event.clientX; + startY = event.clientY; + + // (1) prevent preview image + if (event.dataTransfer) { + event.dataTransfer.setDragImage(dragPreview || emptyCanvas(), 0, 0); + } + + // (2) setup drag listeners + + // attach drag + cleanup event + // we need to do this to make sure we track cursor + // movements before we reach other drag event handlers, + // e.g. in child containers. + document.addEventListener('dragover', onDrag, true); + document.addEventListener('dragenter', preventDefault, true); + document.addEventListener('dragend', onEnd); + document.addEventListener('drop', preventDefault); + } + function onDrag(event) { + const delta = { + x: event.clientX - startX, + y: event.clientY - startY + }; + + // call provided fn with event, delta + return fn.call(self, event, delta); + } + function onEnd() { + document.removeEventListener('dragover', onDrag, true); + document.removeEventListener('dragenter', preventDefault, true); + document.removeEventListener('dragend', onEnd); + document.removeEventListener('drop', preventDefault); + } + return onDragStart; +} +function preventDefault(event) { + event.preventDefault(); + event.stopPropagation(); +} +function emptyCanvas() { + return (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.domify)(''); +} + +const noop$3 = () => {}; + +/** + * A generic popup component. + * + * @param {Object} props + * @param {HTMLElement} [props.container] + * @param {string} [props.className] + * @param {boolean} [props.delayInitialFocus] + * @param {{x: number, y: number}} [props.position] + * @param {number} [props.width] + * @param {number} [props.height] + * @param {Function} props.onClose + * @param {Function} [props.onPostActivate] + * @param {Function} [props.onPostDeactivate] + * @param {boolean} [props.returnFocus] + * @param {boolean} [props.closeOnEscape] + * @param {string} props.title + * @param {Ref} [ref] + */ +function PopupComponent(props, globalRef) { + const { + container, + className, + delayInitialFocus, + position, + width, + height, + onClose, + onPostActivate = noop$3, + onPostDeactivate = noop$3, + returnFocus = true, + closeOnEscape = true, + title + } = props; + const focusTrapRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const localRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const popupRef = globalRef || localRef; + const containerNode = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getContainerNode(container), [container]); + const handleKeydown = event => { + // do not allow keyboard events to bubble + event.stopPropagation(); + if (closeOnEscape && event.key === 'Escape') { + onClose(); + } + }; + + // re-activate focus trap on focus + const handleFocus = () => { + if (focusTrapRef.current) { + focusTrapRef.current.activate(); + } + }; + let style = {}; + if (position) { + style = { + ...style, + top: position.top + 'px', + left: position.left + 'px' + }; + } + if (width) { + style.width = width + 'px'; + } + if (height) { + style.height = height + 'px'; + } + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (popupRef.current) { + popupRef.current.addEventListener('focusin', handleFocus); + } + return () => { + popupRef.current.removeEventListener('focusin', handleFocus); + }; + }, [popupRef]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (popupRef.current) { + focusTrapRef.current = focus_trap__WEBPACK_IMPORTED_MODULE_10__.createFocusTrap(popupRef.current, { + clickOutsideDeactivates: true, + delayInitialFocus, + fallbackFocus: popupRef.current, + onPostActivate, + onPostDeactivate, + returnFocusOnDeactivate: returnFocus + }); + focusTrapRef.current.activate(); + } + return () => focusTrapRef.current && focusTrapRef.current.deactivate(); + }, [popupRef]); + useEvent('propertiesPanel.detach', onClose); + return (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.createPortal)((0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + "aria-label": title, + tabIndex: -1, + ref: popupRef, + onKeyDown: handleKeydown, + role: "dialog", + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-popup', className), + style: style, + children: props.children + }), containerNode || document.body); +} +const Popup = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(PopupComponent); +Popup.Title = Title; +Popup.Body = Body; +Popup.Footer = Footer; +function Title(props) { + const { + children, + className, + draggable, + emit = () => {}, + title, + ...rest + } = props; + + // we can't use state as we need to + // manipulate this inside dragging events + const context = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + startPosition: null, + newPosition: null + }); + const dragPreviewRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const titleRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const onMove = (event, delta) => { + cancel(event); + const { + x: dx, + y: dy + } = delta; + const newPosition = { + x: context.current.startPosition.x + dx, + y: context.current.startPosition.y + dy + }; + const popupParent = getPopupParent(titleRef.current); + popupParent.style.top = newPosition.y + 'px'; + popupParent.style.left = newPosition.x + 'px'; + + // notify interested parties + emit('dragover', { + newPosition, + delta + }); + }; + const onMoveStart = event => { + // initialize drag handler + const onDragStart = createDragger(onMove, dragPreviewRef.current); + onDragStart(event); + event.stopPropagation(); + const popupParent = getPopupParent(titleRef.current); + const bounds = popupParent.getBoundingClientRect(); + context.current.startPosition = { + x: bounds.left, + y: bounds.top + }; + + // notify interested parties + emit('dragstart'); + }; + const onMoveEnd = () => { + context.current.newPosition = null; + + // notify interested parties + emit('dragend'); + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-popup__header', draggable && 'draggable', className), + ref: titleRef, + draggable: draggable, + onDragStart: onMoveStart, + onDragEnd: onMoveEnd, + ...rest, + children: [draggable && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment, { + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + ref: dragPreviewRef, + class: "bio-properties-panel-popup__drag-preview" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-popup__drag-handle", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DragIcon, {}) + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-popup__title", + children: title + }), children] + }); +} +function Body(props) { + const { + children, + className, + ...rest + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-popup__body', className), + ...rest, + children: children + }); +} +function Footer(props) { + const { + children, + className, + ...rest + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-popup__footer', className), + ...rest, + children: props.children + }); +} + +// helpers ////////////////////// + +function getPopupParent(node) { + return node.closest('.bio-properties-panel-popup'); +} +function cancel(event) { + event.preventDefault(); + event.stopPropagation(); +} +function getContainerNode(node) { + if (typeof node === 'string') { + return (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(node); + } + return node; +} + +const FEEL_POPUP_WIDTH = 700; +const FEEL_POPUP_HEIGHT = 250; + +/** + * FEEL popup component, built as a singleton. Emits lifecycle events as follows: + * - `feelPopup.open` - fired before the popup is mounted + * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup + * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup + * - `feelPopup.closed` - fired after the popup is unmounted + */ +function FEELPopupRoot(props) { + const { + element, + eventBus = { + fire() {}, + on() {}, + off() {} + }, + popupContainer + } = props; + const prevElement = usePrevious(element); + const [popupConfig, setPopupConfig] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)({}); + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [source, setSource] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [sourceElement, setSourceElement] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const emit = (type, context) => { + eventBus.fire('feelPopup.' + type, context); + }; + const isOpen = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + return !!open; + }, [open]); + useUpdateEffect(() => { + if (!open) { + emit('closed'); + } + }, [open]); + const handleOpen = (entryId, config, _sourceElement) => { + setSource(entryId); + setPopupConfig(config); + setOpen(true); + setSourceElement(_sourceElement); + emit('open'); + }; + const handleClose = (event = {}) => { + const { + id + } = event; + if (id && id !== source) { + return; + } + setOpen(false); + setSource(null); + }; + const feelPopupContext = { + open: handleOpen, + close: handleClose, + source + }; + + // close popup on element change, cf. https://github.com/bpmn-io/properties-panel/issues/270 + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (element && prevElement && element !== prevElement) { + handleClose(); + } + }, [element]); + + // allow close and open via events + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const handlePopupOpen = context => { + const { + entryId, + popupConfig, + sourceElement + } = context; + handleOpen(entryId, popupConfig, sourceElement); + }; + const handleIsOpen = () => { + return isOpen(); + }; + eventBus.on('feelPopup._close', handleClose); + eventBus.on('feelPopup._open', handlePopupOpen); + eventBus.on('feelPopup._isOpen', handleIsOpen); + return () => { + eventBus.off('feelPopup._close', handleClose); + eventBus.off('feelPopup._open', handleOpen); + eventBus.off('feelPopup._isOpen', handleIsOpen); + }; + }, [eventBus, isOpen]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(FeelPopupContext.Provider, { + value: feelPopupContext, + children: [open && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelPopupComponent, { + onClose: handleClose, + container: popupContainer, + sourceElement: sourceElement, + emit: emit, + ...popupConfig + }), props.children] + }); +} +function FeelPopupComponent(props) { + const { + container, + id, + hostLanguage, + onInput, + onClose, + position, + singleLine, + sourceElement, + title, + tooltipContainer, + type, + value, + variables, + emit + } = props; + const editorRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const popupRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const isAutoCompletionOpen = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const handleSetReturnFocus = () => { + sourceElement && sourceElement.focus(); + }; + const onKeyDownCapture = event => { + // we use capture here to make sure we handle the event before the editor does + if (event.key === 'Escape') { + isAutoCompletionOpen.current = autoCompletionOpen(event.target); + } + }; + const onKeyDown = event => { + if (event.key === 'Escape') { + // close popup only if auto completion is not open + // we need to do check this because the editor is not + // stop propagating the keydown event + // cf. https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322/5 + if (!isAutoCompletionOpen.current) { + onClose(); + isAutoCompletionOpen.current = false; + } + } + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + emit('opened', { + domNode: popupRef.current + }); + return () => emit('close', { + domNode: popupRef.current + }); + }, []); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + // Set focus on editor when popup is opened + if (editorRef.current) { + editorRef.current.focus(); + } + }, [editorRef]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(Popup, { + container: container, + className: "bio-properties-panel-feel-popup", + emit: emit, + position: position, + title: title, + onClose: onClose + + // handle focus manually on deactivate + , + returnFocus: false, + closeOnEscape: false, + delayInitialFocus: false, + onPostDeactivate: handleSetReturnFocus, + height: FEEL_POPUP_HEIGHT, + width: FEEL_POPUP_WIDTH, + ref: popupRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(Popup.Title, { + title: title, + emit: emit, + draggable: true, + children: [type === 'feel' && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("a", { + href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/", + target: "_blank", + class: "bio-properties-panel-feel-popup__title-link", + children: ["Learn FEEL expressions", (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(HelpIcon, {})] + }), type === 'feelers' && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("a", { + href: "https://docs.camunda.io/docs/components/modeler/forms/configuration/forms-config-templating-syntax/", + target: "_blank", + class: "bio-properties-panel-feel-popup__title-link", + children: ["Learn templating", (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(HelpIcon, {})] + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Popup.Body, { + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + onKeyDownCapture: onKeyDownCapture, + onKeyDown: onKeyDown, + class: "bio-properties-panel-feel-popup__body", + children: [type === 'feel' && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CodeEditor, { + enableGutters: true, + id: prefixId$8(id), + name: id, + onInput: onInput, + value: value, + variables: variables, + ref: editorRef, + tooltipContainer: tooltipContainer + }), type === 'feelers' && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CodeEditor$1, { + id: prefixId$8(id), + contentAttributes: { + 'aria-label': title + }, + enableGutters: true, + hostLanguage: hostLanguage, + name: id, + onInput: onInput, + value: value, + ref: editorRef, + singleLine: singleLine, + tooltipContainer: tooltipContainer + })] + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Popup.Footer, { + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + onClick: () => onClose(), + title: "Close pop-up editor", + class: "bio-properties-panel-feel-popup__close-btn", + children: "Close" + }) + })] + }); +} + +// helpers ///////////////// + +function prefixId$8(id) { + return `bio-properties-panel-${id}`; +} +function autoCompletionOpen(element) { + return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete'); +} + +/** + * This hook behaves like useEffect, but does not trigger on the first render. + * + * @param {Function} effect + * @param {Array} deps + */ +function useUpdateEffect(effect, deps) { + const isMounted = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isMounted.current) { + return effect(); + } else { + isMounted.current = true; + } + }, deps); +} + +function ToggleSwitch(props) { + const { + id, + label, + onInput, + value, + switcherLabel, + inline, + onFocus, + onBlur, + inputRef, + tooltip + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const handleInputCallback = async () => { + onInput(!value); + }; + const handleInput = e => { + handleInputCallback(); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-toggle-switch', { + inline + }), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + class: "bio-properties-panel-label", + for: prefixId$7(id), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-field-wrapper", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label", { + class: "bio-properties-panel-toggle-switch__switcher", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + ref: inputRef, + id: prefixId$7(id), + class: "bio-properties-panel-input", + type: "checkbox", + onFocus: onFocus, + onBlur: onBlur, + name: id, + onInput: handleInput, + checked: !!localValue + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", { + class: "bio-properties-panel-toggle-switch__slider" + })] + }), switcherLabel && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p", { + class: "bio-properties-panel-toggle-switch__label", + children: switcherLabel + })] + })] + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {String} props.label + * @param {String} props.switcherLabel + * @param {Boolean} props.inline + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {string|import('preact').Component} props.tooltip + */ +function ToggleSwitchEntry(props) { + const { + element, + id, + description, + label, + switcherLabel, + inline, + getValue, + setValue, + onFocus, + onBlur, + tooltip + } = props; + const value = getValue(element); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-entry bio-properties-panel-toggle-switch-entry", + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ToggleSwitch, { + id: id, + label: label, + value: value, + onInput: setValue, + onFocus: onFocus, + onBlur: onBlur, + switcherLabel: switcherLabel, + inline: inline, + tooltip: tooltip, + element: element + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$8(node) { + return node && !!node.checked; +} + +// helpers ///////////////// + +function prefixId$7(id) { + return `bio-properties-panel-${id}`; +} + +function NumberField(props) { + const { + debounce, + disabled, + displayLabel = true, + id, + inputRef, + label, + max, + min, + onInput, + step, + value = '', + onFocus, + onBlur + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(target => { + if (target.validity.valid) { + onInput(target.value ? parseFloat(target.value) : undefined); + } + }); + }, [onInput, debounce]); + const handleInput = e => { + handleInputCallback(e.target); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-numberfield", + children: [displayLabel && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + for: prefixId$6(id), + class: "bio-properties-panel-label", + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + id: prefixId$6(id), + ref: inputRef, + type: "number", + name: id, + spellCheck: "false", + autoComplete: "off", + disabled: disabled, + class: "bio-properties-panel-input", + max: max, + min: min, + onInput: handleInput, + onFocus: onFocus, + onBlur: onBlur, + step: step, + value: localValue + })] + }); +} + +/** + * @param {Object} props + * @param {Boolean} props.debounce + * @param {String} props.description + * @param {Boolean} props.disabled + * @param {Object} props.element + * @param {Function} props.getValue + * @param {String} props.id + * @param {String} props.label + * @param {String} props.max + * @param {String} props.min + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {String} props.step + * @param {Function} props.validate + */ +function NumberFieldEntry(props) { + const { + debounce, + description, + disabled, + element, + getValue, + id, + label, + max, + min, + setValue, + step, + onFocus, + onBlur, + validate + } = props; + const globalError = useError(id); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setLocalError(newValidationError); + } + }, [value, validate]); + const onInput = newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + setValue(newValue, newValidationError); + setLocalError(newValidationError); + }; + const error = globalError || localError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(NumberField, { + debounce: debounce, + disabled: disabled, + id: id, + label: label, + onFocus: onFocus, + onBlur: onBlur, + onInput: onInput, + max: max, + min: min, + step: step, + value: value + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$7(node) { + return node && !!node.value; +} + +// helpers ///////////////// + +function prefixId$6(id) { + return `bio-properties-panel-${id}`; +} + +const noop$2 = () => {}; +function FeelTextfieldComponent(props) { + const { + debounce, + id, + element, + label, + hostLanguage, + onInput, + onError, + feel, + value = '', + disabled = false, + variables, + singleLine, + tooltipContainer, + OptionalComponent = OptionalFeelInput, + tooltip + } = props; + const [localValue, _setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const editorRef = useShowEntryEvent(id); + const containerRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const feelActive = (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isString)(localValue) && localValue.startsWith('=') || feel === 'required'; + const feelOnlyValue = (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isString)(localValue) && localValue.startsWith('=') ? localValue.substring(1) : localValue; + const [focus, _setFocus] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); + const { + open: openPopup, + source: popupSource + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(FeelPopupContext); + const popuOpen = popupSource === id; + const setFocus = (offset = 0) => { + const hasFocus = containerRef.current.contains(document.activeElement); + + // Keep caret position if it is already focused, otherwise focus at the end + const position = hasFocus ? document.activeElement.selectionStart : Infinity; + _setFocus(position + offset); + }; + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(newValue => { + onInput(newValue); + }); + }, [onInput, debounce]); + const setLocalValue = newValue => { + _setLocalValue(newValue); + if (typeof newValue === 'undefined' || newValue === '' || newValue === '=') { + handleInputCallback(undefined); + } else { + handleInputCallback(newValue); + } + }; + const handleFeelToggle = useStaticCallback(() => { + if (feel === 'required') { + return; + } + if (!feelActive) { + setLocalValue('=' + localValue); + } else { + setLocalValue(feelOnlyValue); + } + }); + const handleLocalInput = newValue => { + if (feelActive) { + newValue = '=' + newValue; + } + if (newValue === localValue) { + return; + } + setLocalValue(newValue); + if (!feelActive && (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isString)(newValue) && newValue.startsWith('=')) { + // focus is behind `=` sign that will be removed + setFocus(-1); + } + }; + const handleLint = useStaticCallback(lint => { + if (!(lint && lint.length)) { + onError(undefined); + return; + } + onError('Unparsable FEEL expression.'); + }); + const handlePopupOpen = (type = 'feel') => { + const popupOptions = { + id, + hostLanguage, + onInput: handleLocalInput, + position: calculatePopupPosition(containerRef.current), + singleLine, + title: getPopupTitle(element, label), + tooltipContainer, + type, + value: feelOnlyValue, + variables + }; + openPopup(id, popupOptions, editorRef.current); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof focus !== 'undefined') { + editorRef.current.focus(focus); + _setFocus(undefined); + } + }, [focus]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + + // External value change removed content => keep FEEL configuration + if (!value) { + setLocalValue(feelActive ? '=' : ''); + return; + } + setLocalValue(value); + }, [value]); + + // copy-paste integration + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const copyHandler = event => { + if (!feelActive) { + return; + } + event.clipboardData.setData('application/FEEL', event.clipboardData.getData('text')); + }; + const pasteHandler = event => { + if (feelActive || popuOpen) { + return; + } + const data = event.clipboardData.getData('application/FEEL'); + if (data) { + setTimeout(() => { + handleFeelToggle(); + setFocus(); + }); + } + }; + containerRef.current.addEventListener('copy', copyHandler); + containerRef.current.addEventListener('cut', copyHandler); + containerRef.current.addEventListener('paste', pasteHandler); + return () => { + containerRef.current.removeEventListener('copy', copyHandler); + containerRef.current.removeEventListener('cut', copyHandler); + containerRef.current.removeEventListener('paste', pasteHandler); + }; + }, [containerRef, feelActive, handleFeelToggle, setFocus]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-feel-entry', { + 'feel-active': feelActive + }), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label", { + for: prefixId$5(id), + class: "bio-properties-panel-label", + onClick: () => setFocus(), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelIcon, { + label: label, + feel: feel, + onClick: handleFeelToggle, + active: feelActive + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-feel-container", + ref: containerRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelIndicator, { + active: feelActive, + disabled: feel !== 'optional' || disabled, + onClick: handleFeelToggle + }), feelActive ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CodeEditor, { + id: prefixId$5(id), + name: id, + onInput: handleLocalInput, + disabled: disabled, + popupOpen: popuOpen, + onFeelToggle: () => { + handleFeelToggle(); + setFocus(true); + }, + onLint: handleLint, + onPopupOpen: handlePopupOpen, + value: feelOnlyValue, + variables: variables, + ref: editorRef, + tooltipContainer: tooltipContainer + }) : (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(OptionalComponent, { + ...props, + popupOpen: popuOpen, + onInput: handleLocalInput, + contentAttributes: { + 'id': prefixId$5(id), + 'aria-label': label + }, + value: localValue, + ref: editorRef, + onPopupOpen: handlePopupOpen, + containerRef: containerRef + })] + })] + }); +} +const FeelTextfield = withAutoClosePopup(FeelTextfieldComponent); +const OptionalFeelInput = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + id, + disabled, + onInput, + value, + onFocus, + onBlur + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + + // To be consistent with the FEEL editor, set focus at start of input + // this ensures clean editing experience when switching with the keyboard + ref.current = { + focus: position => { + const input = inputRef.current; + if (!input) { + return; + } + input.focus(); + if (typeof position === 'number') { + if (position > value.length) { + position = value.length; + } + input.setSelectionRange(position, position); + } + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + id: prefixId$5(id), + type: "text", + ref: inputRef, + name: id, + spellCheck: "false", + autoComplete: "off", + disabled: disabled, + class: "bio-properties-panel-input", + onInput: e => onInput(e.target.value), + onFocus: onFocus, + onBlur: onBlur, + value: value || '' + }); +}); +const OptionalFeelNumberField = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + id, + debounce, + disabled, + onInput, + value, + min, + max, + step, + onFocus, + onBlur + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + + // To be consistent with the FEEL editor, set focus at start of input + // this ensures clean editing experience when switching with the keyboard + ref.current = { + focus: position => { + const input = inputRef.current; + if (!input) { + return; + } + input.focus(); + if (typeof position === 'number' && position !== Infinity) { + if (position > value.length) { + position = value.length; + } + input.setSelectionRange(position, position); + } + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(NumberField, { + id: id, + debounce: debounce, + disabled: disabled, + displayLabel: false, + inputRef: inputRef, + max: max, + min: min, + onInput: onInput, + step: step, + value: value, + onFocus: onFocus, + onBlur: onBlur + }); +}); +const OptionalFeelTextArea = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + id, + disabled, + onInput, + value, + onFocus, + onBlur + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + + // To be consistent with the FEEL editor, set focus at start of input + // this ensures clean editing experience when switching with the keyboard + ref.current = { + focus: () => { + const input = inputRef.current; + if (!input) { + return; + } + input.focus(); + input.setSelectionRange(0, 0); + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("textarea", { + id: prefixId$5(id), + type: "text", + ref: inputRef, + name: id, + spellCheck: "false", + autoComplete: "off", + disabled: disabled, + class: "bio-properties-panel-input", + onInput: e => onInput(e.target.value), + onFocus: onFocus, + onBlur: onBlur, + value: value || '', + "data-gramm": "false" + }); +}); +const OptionalFeelToggleSwitch = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + id, + onInput, + value, + onFocus, + onBlur, + switcherLabel + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + + // To be consistent with the FEEL editor, set focus at start of input + // this ensures clean editing experience when switching with the keyboard + ref.current = { + focus: () => { + const input = inputRef.current; + if (!input) { + return; + } + input.focus(); + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ToggleSwitch, { + id: id, + value: value, + inputRef: inputRef, + onInput: onInput, + onFocus: onFocus, + onBlur: onBlur, + switcherLabel: switcherLabel + }); +}); +const OptionalFeelCheckbox = (0,_preact_compat__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { + const { + id, + disabled, + onInput, + value, + onFocus, + onBlur + } = props; + const inputRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const handleChange = ({ + target + }) => { + onInput(target.checked); + }; + + // To be consistent with the FEEL editor, set focus at start of input + // this ensures clean editing experience when switching with the keyboard + ref.current = { + focus: () => { + const input = inputRef.current; + if (!input) { + return; + } + input.focus(); + } + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + ref: inputRef, + id: prefixId$5(id), + name: id, + onFocus: onFocus, + onBlur: onBlur, + type: "checkbox", + class: "bio-properties-panel-input", + onChange: handleChange, + checked: value, + disabled: disabled + }); +}); + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {string|import('preact').Component} props.tooltip + */ +function FeelEntry(props) { + const { + element, + id, + description, + debounce, + disabled, + feel, + label, + getValue, + setValue, + tooltipContainer, + hostLanguage, + singleLine, + validate, + show = noop$2, + example, + variables, + onFocus, + onBlur, + tooltip + } = props; + const [validationError, setValidationError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setValidationError(newValidationError); + } + }, [value, validate]); + const onInput = useStaticCallback(newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + + // don't create multiple commandStack entries for the same value + if (newValue !== value) { + setValue(newValue, newValidationError); + } + setValidationError(newValidationError); + }); + const onError = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(err => { + setLocalError(err); + }, []); + const temporaryError = useError(id); + const error = temporaryError || localError || validationError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()(props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact__WEBPACK_IMPORTED_MODULE_3__.createElement)(FeelTextfield, { + ...props, + debounce: debounce, + disabled: disabled, + feel: feel, + id: id, + key: element, + label: label, + onInput: onInput, + onError: onError, + onFocus: onFocus, + onBlur: onBlur, + example: example, + hostLanguage: hostLanguage, + singleLine: singleLine, + show: show, + value: value, + variables: variables, + tooltipContainer: tooltipContainer, + OptionalComponent: props.OptionalComponent, + tooltip: tooltip + }), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {String} props.max + * @param {String} props.min + * @param {String} props.step + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + */ +function FeelNumberEntry(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelEntry, { + class: "bio-properties-panel-feel-number", + OptionalComponent: OptionalFeelNumberField, + ...props + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + */ +function FeelTextAreaEntry(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelEntry, { + class: "bio-properties-panel-feel-textarea", + OptionalComponent: OptionalFeelTextArea, + ...props + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + */ +function FeelToggleSwitchEntry(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelEntry, { + class: "bio-properties-panel-feel-toggle-switch", + OptionalComponent: OptionalFeelToggleSwitch, + ...props + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + */ +function FeelCheckboxEntry(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelEntry, { + class: "bio-properties-panel-feel-checkbox", + OptionalComponent: OptionalFeelCheckbox, + ...props + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {String} props.hostLanguage + * @param {Boolean} props.singleLine + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {Boolean} props.feel + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + * @param {Function} props.example + * @param {Function} props.variables + * @param {Function} props.onFocus + * @param {Function} props.onBlur + */ +function FeelTemplatingEntry(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FeelEntry, { + class: "bio-properties-panel-feel-templating", + OptionalComponent: CodeEditor$1, + ...props + }); +} +function isEdited$6(node) { + if (!node) { + return false; + } + if (node.type === 'checkbox') { + return !!node.checked || node.classList.contains('edited'); + } + return !!node.value || node.classList.contains('edited'); +} + +// helpers ///////////////// + +function prefixId$5(id) { + return `bio-properties-panel-${id}`; +} +function calculatePopupPosition(element) { + const { + top, + left + } = element.getBoundingClientRect(); + return { + left: left - FEEL_POPUP_WIDTH - 20, + top: top + }; +} + +// todo(pinussilvestrus): make this configurable in the future +function getPopupTitle(element, label) { + let popupTitle = ''; + if (element && element.type) { + popupTitle = `${element.type} / `; + } + return `${popupTitle}${label}`; +} +function withAutoClosePopup(Component) { + return function (props) { + const { + id + } = props; + const { + close + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(FeelPopupContext); + const closePopup = useStaticCallback(close); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + return () => { + closePopup({ + id + }); + }; + }, []); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Component, { + ...props + }); + }; +} + +const DEFAULT_LAYOUT = {}; +const DEFAULT_DESCRIPTION = {}; +const DEFAULT_TOOLTIP = {}; + +/** + * @typedef { { + * component: import('preact').Component, + * id: String, + * isEdited?: Function + * } } EntryDefinition + * + * @typedef { { + * autoFocusEntry: String, + * autoOpen?: Boolean, + * entries: Array, + * id: String, + * label: String, + * remove: (event: MouseEvent) => void + * } } ListItemDefinition + * + * @typedef { { + * add: (event: MouseEvent) => void, + * component: import('preact').Component, + * element: Object, + * id: String, + * items: Array, + * label: String, + * shouldSort?: Boolean, + * shouldOpen?: Boolean + * } } ListGroupDefinition + * + * @typedef { { + * component?: import('preact').Component, + * entries: Array, + * id: String, + * label: String, + * shouldOpen?: Boolean + * } } GroupDefinition + * + * @typedef { { + * [id: String]: GetDescriptionFunction + * } } DescriptionConfig + * + * @typedef { { + * [id: String]: GetTooltipFunction + * } } TooltipConfig + * + * @callback { { + * @param {string} id + * @param {Object} element + * @returns {string} + * } } GetDescriptionFunction + * + * @callback { { + * @param {string} id + * @param {Object} element + * @returns {string} + * } } GetTooltipFunction + * + * @typedef { { + * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition, + * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition + * } } PlaceholderProvider + * + */ - var values = 'get' in entry ? entry.get(element, entryNode) : {}; +/** + * A basic properties panel component. Describes *how* content will be rendered, accepts + * data from implementor to describe *what* will be rendered. + * + * @param {Object} props + * @param {Object|Array} props.element + * @param {import('./components/Header').HeaderProvider} props.headerProvider + * @param {PlaceholderProvider} [props.placeholderProvider] + * @param {Array} props.groups + * @param {Object} [props.layoutConfig] + * @param {Function} [props.layoutChanged] + * @param {DescriptionConfig} [props.descriptionConfig] + * @param {Function} [props.descriptionLoaded] + * @param {TooltipConfig} [props.tooltipConfig] + * @param {Function} [props.tooltipLoaded] + * @param {HTMLElement} [props.feelPopupContainer] + * @param {Object} [props.eventBus] + */ +function PropertiesPanel(props) { + const { + element, + headerProvider, + placeholderProvider, + groups, + layoutConfig, + layoutChanged, + descriptionConfig, + descriptionLoaded, + tooltipConfig, + tooltipLoaded, + feelPopupContainer, + eventBus + } = props; + + // set-up layout context + const [layout, setLayout] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(createLayout(layoutConfig)); + + // react to external changes in the layout config + useUpdateLayoutEffect(() => { + const newLayout = createLayout(layoutConfig); + setLayout(newLayout); + }, [layoutConfig]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof layoutChanged === 'function') { + layoutChanged(layout); + } + }, [layout, layoutChanged]); + const getLayoutForKey = (key, defaultValue) => { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.get)(layout, key, defaultValue); + }; + const setLayoutForKey = (key, config) => { + const newLayout = (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.assign)({}, layout); + (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.set)(newLayout, key, config); + setLayout(newLayout); + }; + const layoutContext = { + layout, + setLayout, + getLayoutForKey, + setLayoutForKey + }; + + // set-up description context + const description = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => createDescriptionContext(descriptionConfig), [descriptionConfig]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof descriptionLoaded === 'function') { + descriptionLoaded(description); + } + }, [description, descriptionLoaded]); + const getDescriptionForId = (id, element) => { + return description[id] && description[id](element); + }; + const descriptionContext = { + description, + getDescriptionForId + }; + + // set-up tooltip context + const tooltip = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => createTooltipContext(tooltipConfig), [tooltipConfig]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof tooltipLoaded === 'function') { + tooltipLoaded(tooltip); + } + }, [tooltip, tooltipLoaded]); + const getTooltipForId = (id, element) => { + return tooltip[id] && tooltip[id](element); + }; + const tooltipContext = { + tooltip, + getTooltipForId + }; + const [errors, setErrors] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)({}); + const onSetErrors = ({ + errors + }) => setErrors(errors); + useEvent('propertiesPanel.setErrors', onSetErrors, eventBus); + const errorsContext = { + errors + }; + const eventContext = { + eventBus + }; + const propertiesPanelContext = { + element + }; + + // empty state + if (placeholderProvider && !element) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Placeholder, { + ...placeholderProvider.getEmpty() + }); + } + + // multiple state + if (placeholderProvider && (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isArray)(element)) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Placeholder, { + ...placeholderProvider.getMultiple() + }); + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ErrorsContext.Provider, { + value: errorsContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DescriptionContext.Provider, { + value: descriptionContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipContext.Provider, { + value: tooltipContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(LayoutContext.Provider, { + value: layoutContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(EventContext.Provider, { + value: eventContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(FEELPopupRoot, { + element: element, + eventBus: eventBus, + popupContainer: feelPopupContainer, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Header, { + element: element, + headerProvider: headerProvider + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-scroll-container", + children: groups.map(group => { + const { + component: Component = Group, + id + } = group; + return (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createElement)(Component, { + ...group, + key: id, + element: element + }); + }) + })] + }) + }) + }) + }) + }) + }) + }) + }); +} + +// helpers ////////////////// + +function createLayout(overrides = {}, defaults = DEFAULT_LAYOUT) { + return { + ...defaults, + ...overrides + }; +} +function createDescriptionContext(overrides = {}) { + return { + ...DEFAULT_DESCRIPTION, + ...overrides + }; +} +function createTooltipContext(overrides = {}) { + return { + ...DEFAULT_TOOLTIP, + ...overrides + }; +} + +// hooks ////////////////// + +/** + * This hook behaves like useLayoutEffect, but does not trigger on the first render. + * + * @param {Function} effect + * @param {Array} deps + */ +function useUpdateLayoutEffect(effect, deps) { + const isMounted = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => { + if (isMounted.current) { + return effect(); + } else { + isMounted.current = true; + } + }, deps); +} + +function DropdownButton(props) { + const { + class: className, + children, + menuItems = [] + } = props; + const dropdownRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const menuRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const close = () => setOpen(false); + function onDropdownToggle(event) { + if (menuRef.current && menuRef.current.contains(event.target)) { + return; + } + event.stopPropagation(); + setOpen(open => !open); + } + function onActionClick(event, action) { + event.stopPropagation(); + close(); + action(); + } + useGlobalClick([dropdownRef.current], () => close()); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-dropdown-button', { + open + }, className), + onClick: onDropdownToggle, + ref: dropdownRef, + children: [children, (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu", + ref: menuRef, + children: menuItems.map((item, index) => (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(MenuItem, { + onClick: onActionClick, + item: item + }, index)) + })] + }); +} +function MenuItem({ + item, + onClick +}) { + if (item.separator) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--separator" + }); + } + if (item.action) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--actionable", + onClick: event => onClick(event, item.action), + children: item.entry + }); + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu-item", + children: item.entry + }); +} + +/** + * + * @param {Array} ignoredElements + * @param {Function} callback + */ +function useGlobalClick(ignoredElements, callback) { + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + /** + * @param {MouseEvent} event + */ + function listener(event) { + if (ignoredElements.some(element => element && element.contains(event.target))) { + return; + } + callback(); + } + document.addEventListener('click', listener, { + capture: true + }); + return () => document.removeEventListener('click', listener, { + capture: true + }); + }, [...ignoredElements, callback]); +} + +function HeaderButton(props) { + const { + children = null, + class: classname, + onClick = () => {}, + ...otherProps + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + ...otherProps, + onClick: onClick, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-header-button', classname), + children: children + }); +} + +function CollapsibleEntry(props) { + const { + element, + entries = [], + id, + label, + open: shouldOpen, + remove + } = props; + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(shouldOpen); + const toggleOpen = () => setOpen(!open); + const { + onShow + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const propertiesPanelContext = { + ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow: (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + setOpen(true); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(onShow)) { + onShow(); + } + }, [onShow, setOpen]) + }; + + // todo(pinussilvestrus): translate once we have a translate mechanism for the core + const placeholderLabel = ''; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + "data-entry-id": id, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-collapsible-entry', open ? 'open' : ''), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-collapsible-entry-header", + onClick: toggleOpen, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: label || placeholderLabel, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-collapsible-entry-header-title', !label && 'empty'), + children: label || placeholderLabel + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Toggle list item", + class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + }), remove ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Delete item", + class: "bio-properties-panel-remove-entry", + onClick: remove, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DeleteIcon, {}) + }) : null] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: entries.map(entry => { + const { + component: Component, + id + } = entry; + return (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createElement)(Component, { + ...entry, + element: element, + key: id + }); + }) + }) + })] + }); +} + +function ListItem(props) { + const { + autoFocusEntry, + autoOpen + } = props; + + // focus specified entry on auto open + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (autoOpen && autoFocusEntry) { + const entry = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(`[data-entry-id="${autoFocusEntry}"]`); + const focusableInput = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)('.bio-properties-panel-input', entry); + if (focusableInput) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(focusableInput.select)) { + focusableInput.select(); + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(focusableInput.focus)) { + focusableInput.focus(); + } + } + } + }, [autoOpen, autoFocusEntry]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-list-item", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CollapsibleEntry, { + ...props, + open: autoOpen + }) + }); +} + +const noop$1 = () => {}; + +/** + * @param {import('../PropertiesPanel').ListGroupDefinition} props + */ +function ListGroup(props) { + const { + add, + element, + id, + items, + label, + shouldOpen = true, + shouldSort = true + } = props; + const groupRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = useLayoutState(['groups', id, 'open'], false); + const [sticky, setSticky] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const onShow = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => setOpen(true), [setOpen]); + const [ordering, setOrdering] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + const [newItemAdded, setNewItemAdded] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + + // Flag to mark that add button was clicked in the last render cycle + const [addTriggered, setAddTriggered] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const prevItems = usePrevious(items); + const prevElement = usePrevious(element); + const elementChanged = element !== prevElement; + const shouldHandleEffects = !elementChanged && (shouldSort || shouldOpen); + + // reset initial ordering when element changes (before first render) + if (elementChanged) { + setOrdering(createOrdering(shouldSort ? sortItems(items) : items)); + } + + // keep ordering in sync to items - and open changes + + // (0) set initial ordering from given items + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!prevItems || !shouldSort) { + setOrdering(createOrdering(items)); + } + }, [items, element]); + + // (1) items were added + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + // reset addTriggered flag + setAddTriggered(false); + if (shouldHandleEffects && prevItems && items.length > prevItems.length) { + let add = []; + items.forEach(item => { + if (!ordering.includes(item.id)) { + add.push(item.id); + } + }); + let newOrdering = ordering; + + // open if not open, configured and triggered by add button + // + // TODO(marstamm): remove once we refactor layout handling for listGroups. + // Ideally, opening should be handled as part of the `add` callback and + // not be a concern for the ListGroup component. + if (addTriggered && !open && shouldOpen) { + toggleOpen(); + } + + // filter when not open and configured + if (!open && shouldSort) { + newOrdering = createOrdering(sortItems(items)); + } + + // add new items on top or bottom depending on sorting behavior + newOrdering = newOrdering.filter(item => !add.includes(item)); + if (shouldSort) { + newOrdering.unshift(...add); + } else { + newOrdering.push(...add); + } + setOrdering(newOrdering); + setNewItemAdded(addTriggered); + } else { + setNewItemAdded(false); + } + }, [items, open, shouldHandleEffects, addTriggered]); + + // (2) sort items on open if shouldSort is set + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (shouldSort && open && !newItemAdded) { + setOrdering(createOrdering(sortItems(items))); + } + }, [open, shouldSort]); + + // (3) items were deleted + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (shouldHandleEffects && prevItems && items.length < prevItems.length) { + let keep = []; + ordering.forEach(o => { + if (getItem(items, o)) { + keep.push(o); + } + }); + setOrdering(keep); + } + }, [items, shouldHandleEffects]); + + // set css class when group is sticky to top + useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky); + const toggleOpen = () => setOpen(!open); + const hasItems = !!items.length; + const propertiesPanelContext = { + ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow + }; + const handleAddClick = e => { + setAddTriggered(true); + add(e); + }; + const allErrors = useErrors(); + const hasError = items.some(item => { + if (allErrors[item.id]) { + return true; + } + if (!item.entries) { + return; + } + + // also check if the error is nested, e.g. for name-value entries + return item.entries.some(entry => allErrors[entry.id]); + }); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-group", + "data-group-id": 'group-' + id, + ref: groupRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''), + onClick: hasItems ? toggleOpen : noop$1, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: props.tooltip ? null : label, + "data-title": label, + class: "bio-properties-panel-group-header-title", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: props.tooltip, + forId: 'group-' + id, + element: element, + parent: groupRef, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-group-header-buttons", + children: [add ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("button", { + type: "button", + title: "Create new list item", + class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry", + onClick: handleAddClick, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CreateIcon, {}), !hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", { + class: "bio-properties-panel-add-entry-label", + children: "Create" + }) : null] + }) : null, hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''), + children: items.length + }) : null, hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Toggle section", + class: "bio-properties-panel-group-header-button bio-properties-panel-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + }) : null] + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-list', open && hasItems ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: ordering.map((o, index) => { + const item = getItem(items, o); + if (!item) { + return; + } + const { + id + } = item; + + // if item was added, open it + // Existing items will not be affected as autoOpen is only applied on first render + const autoOpen = newItemAdded; + return (0,_preact__WEBPACK_IMPORTED_MODULE_3__.createElement)(ListItem, { + ...item, + autoOpen: autoOpen, + element: element, + index: index, + key: id + }); + }) + }) + })] + }); +} + +// helpers //////////////////// + +/** + * Sorts given items alphanumeric by label + */ +function sortItems(items) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.sortBy)(items, i => i.label.toLowerCase()); +} +function getItem(items, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.find)(items, i => i.id === id); +} +function createOrdering(items) { + return items.map(i => i.id); +} + +function Checkbox(props) { + const { + id, + label, + onChange, + disabled, + value = false, + onFocus, + onBlur, + tooltip + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const handleChangeCallback = ({ + target + }) => { + onChange(target.checked); + }; + const handleChange = e => { + handleChangeCallback(e); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + const ref = useShowEntryEvent(id); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-checkbox", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + ref: ref, + id: prefixId$4(id), + name: id, + onFocus: onFocus, + onBlur: onBlur, + type: "checkbox", + class: "bio-properties-panel-input", + onChange: handleChange, + checked: localValue, + disabled: disabled + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + for: prefixId$4(id), + class: "bio-properties-panel-label", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }) + })] + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {string|import('preact').Component} props.tooltip + * @param {boolean} [props.disabled] + */ +function CheckboxEntry(props) { + const { + element, + id, + description, + label, + getValue, + setValue, + disabled, + onFocus, + onBlur, + tooltip + } = props; + const value = getValue(element); + const error = useError(id); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-entry bio-properties-panel-checkbox-entry", + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Checkbox, { + disabled: disabled, + id: id, + label: label, + onChange: setValue, + onFocus: onFocus, + onBlur: onBlur, + value: value, + tooltip: tooltip, + element: element + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$5(node) { + return node && !!node.checked; +} + +// helpers ///////////////// + +function prefixId$4(id) { + return `bio-properties-panel-${id}`; +} + +const noop = () => {}; + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.tooltipContainer + * @param {Function} props.validate + * @param {Function} props.show + */ +function TemplatingEntry(props) { + const { + element, + id, + description, + debounce, + disabled, + label, + getValue, + setValue, + tooltipContainer, + validate, + show = noop + } = props; + const [validationError, setValidationError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setValidationError(newValidationError); + } + }, [value, validate]); + const onInput = useStaticCallback(newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + + // don't create multiple commandStack entries for the same value + if (newValue !== value) { + setValue(newValue, newValidationError); + } + setValidationError(newValidationError); + }); + const onError = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(err => { + setLocalError(err); + }, []); + const temporaryError = useError(id); + const error = localError || temporaryError || validationError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Templating, { + debounce: debounce, + disabled: disabled, + id: id, + label: label, + onInput: onInput, + onError: onError, + show: show, + value: value, + tooltipContainer: tooltipContainer + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function Templating(props) { + const { + debounce, + id, + label, + onInput, + onError, + value = '', + disabled = false, + tooltipContainer + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const editorRef = useShowEntryEvent(id); + const containerRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const [focus, _setFocus] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); + const setFocus = (offset = 0) => { + const hasFocus = containerRef.current.contains(document.activeElement); + + // Keep caret position if it is already focused, otherwise focus at the end + const position = hasFocus ? document.activeElement.selectionStart : Infinity; + _setFocus(position + offset); + }; + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(newValue => onInput(newValue.length ? newValue : undefined)); + }, [onInput, debounce]); + const handleInput = newValue => { + handleInputCallback(newValue); + setLocalValue(newValue); + }; + const handleLint = useStaticCallback(lint => { + const errors = lint && lint.length && lint.filter(e => e.severity === 'error') || []; + if (!errors.length) { + onError(undefined); + return; + } + const error = lint[0]; + const message = `${error.source}: ${error.message}`; + onError(message); + }); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof focus !== 'undefined') { + editorRef.current.focus(focus); + _setFocus(undefined); + } + }, [focus]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value ? value : ''); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-feelers", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + id: prefixIdLabel(id), + class: "bio-properties-panel-label", + onClick: () => setFocus(), + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-feelers-input", + ref: containerRef, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CodeEditor$1, { + name: id, + onInput: handleInput, + contentAttributes: { + 'aria-labelledby': prefixIdLabel(id) + }, + disabled: disabled, + onLint: handleLint, + value: localValue, + ref: editorRef, + tooltipContainer: tooltipContainer + }) + })] + }); +} +function isEdited$4(node) { + return node && (!!node.value || node.classList.contains('edited')); +} + +// helpers ///////////////// + +function prefixIdLabel(id) { + return `bio-properties-panel-feelers-${id}-label`; +} + +function List(props) { + const { + id, + element, + items = [], + component, + label = '', + open: shouldOpen, + onAdd, + onRemove, + autoFocusEntry, + compareFn, + ...restProps + } = props; + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(!!shouldOpen); + const hasItems = !!items.length; + const toggleOpen = () => hasItems && setOpen(!open); + const opening = !usePrevious(open) && open; + const elementChanged = usePrevious(element) !== element; + const shouldReset = opening || elementChanged; + const sortedItems = useSortedItems(items, compareFn, shouldReset); + const newItems = useNewItems(items, elementChanged); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (open && !hasItems) { + setOpen(false); + } + }, [open, hasItems]); + + /** + * @param {MouseEvent} event + */ + function addItem(event) { + event.stopPropagation(); + onAdd(); + if (!open) { + setOpen(true); + } + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + "data-entry-id": id, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', 'bio-properties-panel-list-entry', hasItems ? '' : 'empty', open ? 'open' : ''), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-list-entry-header", + onClick: toggleOpen, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: label, + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-list-entry-header-title', open && 'open'), + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-list-entry-header-buttons", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("button", { + type: "button", + title: "Create new list item", + onClick: addItem, + class: "bio-properties-panel-add-entry", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(CreateIcon, {}), !hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", { + class: "bio-properties-panel-add-entry-label", + children: "Create" + }) : null] + }), hasItems && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`, + class: "bio-properties-panel-list-badge", + children: items.length + }), hasItems && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Toggle list item", + class: "bio-properties-panel-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + })] + })] + }), hasItems && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(ItemsList, { + ...restProps, + autoFocusEntry: autoFocusEntry, + component: component, + element: element, + id: id, + items: sortedItems, + newItems: newItems, + onRemove: onRemove, + open: open + })] + }); +} +function ItemsList(props) { + const { + autoFocusEntry, + component: Component, + element, + id, + items, + newItems, + onRemove, + open, + ...restProps + } = props; + const getKey = useKeyFactory(); + const newItem = newItems[0]; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (newItem && autoFocusEntry) { + // (0) select the parent entry (containing all list items) + const entry = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(`[data-entry-id="${id}"]`); + + // (1) select the first input or a custom element to be focussed + const selector = typeof autoFocusEntry === 'boolean' ? '.bio-properties-panel-input' : autoFocusEntry; + const focusableInput = (0,min_dom__WEBPACK_IMPORTED_MODULE_8__.query)(selector, entry); + + // (2) set focus + if (focusableInput) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(focusableInput.select)) { + focusableInput.select(); + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(focusableInput.focus)) { + focusableInput.focus(); + } + } + } + }, [newItem, autoFocusEntry, id]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("ol", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-list-entry-items', open ? 'open' : ''), + children: items.map((item, index) => { + const key = getKey(item); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li", { + class: "bio-properties-panel-list-entry-item", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Component, { + ...restProps, + element: element, + id: id, + index: index, + item: item, + open: item === newItem + }), onRemove && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", { + type: "button", + title: "Delete item", + class: "bio-properties-panel-remove-entry bio-properties-panel-remove-list-entry", + onClick: () => onRemove && onRemove(item), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DeleteIcon, {}) + })] + }, key); + }) + }); +} + +/** + * Place new items in the beginning of the list and sort the rest with provided function. + * + * @template Item + * @param {Item[]} currentItems + * @param {(a: Item, b: Item) => 0 | 1 | -1} [compareFn] function used to sort items + * @param {boolean} [shouldReset=false] set to `true` to reset state of the hook + * @returns {Item[]} + */ +function useSortedItems(currentItems, compareFn, shouldReset = false) { + const itemsRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(currentItems.slice()); + + // (1) Reset and optionally sort. + if (shouldReset) { + itemsRef.current = currentItems.slice(); + if (compareFn) { + itemsRef.current.sort(compareFn); + } + } else { + const items = itemsRef.current; + + // (2) Add new item to the list. + for (const item of currentItems) { + if (!items.includes(item)) { + // Unshift or push depending on whether we have a compareFn + compareFn ? items.unshift(item) : items.push(item); + } + } + + // (3) Filter out removed items. + itemsRef.current = items.filter(item => currentItems.includes(item)); + } + return itemsRef.current; +} +function useNewItems(items = [], shouldReset) { + const previousItems = usePrevious(items.slice()) || []; + if (shouldReset) { + return []; + } + return previousItems ? items.filter(item => !previousItems.includes(item)) : []; +} + +function Select(props) { + const { + id, + label, + onChange, + options = [], + value = '', + disabled, + onFocus, + onBlur, + tooltip + } = props; + const ref = useShowEntryEvent(id); + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const handleChangeCallback = ({ + target + }) => { + onChange(target.value); + }; + const handleChange = e => { + handleChangeCallback(e); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-select", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + for: prefixId$3(id), + class: "bio-properties-panel-label", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("select", { + ref: ref, + id: prefixId$3(id), + name: id, + class: "bio-properties-panel-input", + onInput: handleChange, + onFocus: onFocus, + onBlur: onBlur, + value: localValue, + disabled: disabled, + children: options.map((option, idx) => { + if (option.children) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("optgroup", { + label: option.label, + children: option.children.map((child, idx) => (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("option", { + value: child.value, + disabled: child.disabled, + children: child.label + }, idx)) + }, idx); + } + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("option", { + value: option.value, + disabled: option.disabled, + children: option.label + }, idx); + }) + })] + }); +} + +/** + * @param {object} props + * @param {object} props.element + * @param {string} props.id + * @param {string} [props.description] + * @param {string} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {Function} props.getOptions + * @param {boolean} [props.disabled] + * @param {Function} [props.validate] + * @param {string|import('preact').Component} props.tooltip + */ +function SelectEntry(props) { + const { + element, + id, + description, + label, + getValue, + setValue, + getOptions, + disabled, + onFocus, + onBlur, + validate, + tooltip + } = props; + const options = getOptions(element); + const globalError = useError(id); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setLocalError(newValidationError); + } + }, [value, validate]); + const onChange = newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + setValue(newValue, newValidationError); + setLocalError(newValidationError); + }; + const error = globalError || localError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Select, { + id: id, + label: label, + value: value, + onChange: onChange, + onFocus: onFocus, + onBlur: onBlur, + options: options, + disabled: disabled, + tooltip: tooltip, + element: element + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$3(node) { + return node && !!node.value; +} + +// helpers ///////////////// + +function prefixId$3(id) { + return `bio-properties-panel-${id}`; +} + +function Simple(props) { + const { + debounce, + disabled, + element, + getValue, + id, + onBlur, + onFocus, + setValue + } = props; + const value = getValue(element); + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(target => setValue(target.value.length ? target.value : undefined)); + }, [setValue, debounce]); + const handleInput = e => { + handleInputCallback(e.target); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-simple", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + id: prefixId$2(id), + type: "text", + name: id, + spellCheck: "false", + autoComplete: "off", + disabled: disabled, + class: "bio-properties-panel-input", + onInput: handleInput, + "aria-label": localValue || '', + onFocus: onFocus, + onBlur: onBlur, + value: localValue + }, element) + }); +} +function isEdited$2(node) { + return node && !!node.value; +} + +// helpers ///////////////// + +function prefixId$2(id) { + return `bio-properties-panel-${id}`; +} + +function resizeToContents(element) { + element.style.height = 'auto'; + + // a 2px pixel offset is required to prevent scrollbar from + // appearing on OS with a full length scroll bar (Windows/Linux) + element.style.height = `${element.scrollHeight + 2}px`; +} +function TextArea(props) { + const { + id, + label, + debounce, + onInput, + value = '', + disabled, + monospace, + onFocus, + onBlur, + autoResize, + rows = autoResize ? 1 : 2, + tooltip + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + const ref = useShowEntryEvent(id); + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(target => onInput(target.value.length ? target.value : undefined)); + }, [onInput, debounce]); + const handleInput = e => { + handleInputCallback(e.target); + autoResize && resizeToContents(e.target); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => { + autoResize && resizeToContents(ref.current); + }, []); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-textarea", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + for: prefixId$1(id), + class: "bio-properties-panel-label", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("textarea", { + ref: ref, + id: prefixId$1(id), + name: id, + spellCheck: "false", + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''), + onInput: handleInput, + onFocus: onFocus, + onBlur: onBlur, + rows: rows, + value: localValue, + disabled: disabled, + "data-gramm": "false" + })] + }); +} + +/** + * @param {object} props + * @param {object} props.element + * @param {string} props.id + * @param {string} props.description + * @param {boolean} props.debounce + * @param {string} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {number} props.rows + * @param {boolean} props.monospace + * @param {Function} [props.validate] + * @param {boolean} [props.disabled] + */ +function TextAreaEntry(props) { + const { + element, + id, + description, + debounce, + label, + getValue, + setValue, + rows, + monospace, + disabled, + validate, + onFocus, + onBlur, + autoResize, + tooltip + } = props; + const globalError = useError(id); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setLocalError(newValidationError); + } + }, [value, validate]); + const onInput = newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + setValue(newValue, newValidationError); + setLocalError(newValidationError); + }; + const error = globalError || localError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TextArea, { + id: id, + label: label, + value: value, + onInput: onInput, + onFocus: onFocus, + onBlur: onBlur, + rows: rows, + debounce: debounce, + monospace: monospace, + disabled: disabled, + autoResize: autoResize, + tooltip: tooltip, + element: element + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$1(node) { + return node && !!node.value; +} + +// helpers ///////////////// + +function prefixId$1(id) { + return `bio-properties-panel-${id}`; +} + +function Textfield(props) { + const { + debounce, + disabled = false, + id, + label, + onInput, + onFocus, + onBlur, + value = '', + tooltip + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value || ''); + const ref = useShowEntryEvent(id); + const handleInputCallback = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return debounce(target => onInput(target.value.length ? target.value : undefined)); + }, [onInput, debounce]); + const handleInput = e => { + handleInputCallback(e.target); + setLocalValue(e.target.value); + }; + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + setLocalValue(value); + }, [value]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: "bio-properties-panel-textfield", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label", { + for: prefixId(id), + class: "bio-properties-panel-label", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(TooltipWrapper, { + value: tooltip, + forId: id, + element: props.element, + children: label + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", { + ref: ref, + id: prefixId(id), + type: "text", + name: id, + spellCheck: "false", + autoComplete: "off", + disabled: disabled, + class: "bio-properties-panel-input", + onInput: handleInput, + onFocus: onFocus, + onBlur: onBlur, + value: localValue + })] + }); +} + +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {Boolean} props.debounce + * @param {Boolean} props.disabled + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {Function} props.onFocus + * @param {Function} props.onBlur + * @param {string|import('preact').Component} props.tooltip + * @param {Function} props.validate + */ +function TextfieldEntry(props) { + const { + element, + id, + description, + debounce, + disabled, + label, + getValue, + setValue, + validate, + onFocus, + onBlur, + tooltip + } = props; + const globalError = useError(id); + const [localError, setLocalError] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let value = getValue(element); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + const newValidationError = validate(value) || null; + setLocalError(newValidationError); + } + }, [value, validate]); + const onInput = newValue => { + let newValidationError = null; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isFunction)(validate)) { + newValidationError = validate(newValue) || null; + } + setValue(newValue, newValidationError); + setLocalError(newValidationError); + }; + const error = globalError || localError; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-entry', error ? 'has-error' : ''), + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Textfield, { + debounce: debounce, + disabled: disabled, + id: id, + label: label, + onInput: onInput, + onFocus: onFocus, + onBlur: onBlur, + value: value, + tooltip: tooltip, + element: element + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited(node) { + return node && !!node.value; +} + +// helpers ///////////////// + +function prefixId(id) { + return `bio-properties-panel-${id}`; +} + +const DEFAULT_DEBOUNCE_TIME = 300; +function debounceInput(debounceDelay) { + return function _debounceInput(fn) { + if (debounceDelay !== false) { + var debounceTime = (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.isNumber)(debounceDelay) ? debounceDelay : DEFAULT_DEBOUNCE_TIME; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_7__.debounce)(fn, debounceTime); + } else { + return fn; + } + }; +} +debounceInput.$inject = ['config.debounceInput']; + +var index$1 = { + debounceInput: ['factory', debounceInput] +}; + +class FeelPopupModule { + constructor(eventBus) { + this._eventBus = eventBus; + } + + /** + * Check if the FEEL popup is open. + * @return {Boolean} + */ + isOpen() { + return this._eventBus.fire('feelPopup._isOpen'); + } - if (values instanceof Array) { - var listEntryContainer = domQuery('[data-list-entry-container]', entryNode); - var existingElements = listEntryContainer.children || []; + /** + * Open the FEEL popup. + * + * @param {String} entryId + * @param {Object} popupConfig + * @param {HTMLElement} sourceElement + */ + open(entryId, popupConfig, sourceElement) { + return this._eventBus.fire('feelPopup._open', { + entryId, + popupConfig, + sourceElement + }); + } + + /** + * Close the FEEL popup. + */ + close() { + return this._eventBus.fire('feelPopup._close'); + } +} +FeelPopupModule.$inject = ['eventBus']; + +var index = { + feelPopup: ['type', FeelPopupModule] +}; + + +//# sourceMappingURL=index.esm.js.map + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/properties-panel/preact/compat/dist/compat.module.js": +/*!*************************************************************************************!*\ + !*** ../node_modules/@bpmn-io/properties-panel/preact/compat/dist/compat.module.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Children: () => (/* binding */ A), +/* harmony export */ Component: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.Component), +/* harmony export */ Fragment: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.Fragment), +/* harmony export */ PureComponent: () => (/* binding */ E), +/* harmony export */ StrictMode: () => (/* binding */ mn), +/* harmony export */ Suspense: () => (/* binding */ L), +/* harmony export */ SuspenseList: () => (/* binding */ M), +/* harmony export */ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => (/* binding */ on), +/* harmony export */ cloneElement: () => (/* binding */ sn), +/* harmony export */ createContext: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.createContext), +/* harmony export */ createElement: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.createElement), +/* harmony export */ createFactory: () => (/* binding */ cn), +/* harmony export */ createPortal: () => (/* binding */ j), +/* harmony export */ createRef: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.createRef), +/* harmony export */ "default": () => (/* binding */ wn), +/* harmony export */ findDOMNode: () => (/* binding */ vn), +/* harmony export */ flushSync: () => (/* binding */ pn), +/* harmony export */ forwardRef: () => (/* binding */ N), +/* harmony export */ hydrate: () => (/* binding */ G), +/* harmony export */ isElement: () => (/* binding */ gn), +/* harmony export */ isFragment: () => (/* binding */ an), +/* harmony export */ isValidElement: () => (/* binding */ fn), +/* harmony export */ lazy: () => (/* binding */ D), +/* harmony export */ memo: () => (/* binding */ w), +/* harmony export */ render: () => (/* binding */ q), +/* harmony export */ startTransition: () => (/* binding */ yn), +/* harmony export */ unmountComponentAtNode: () => (/* binding */ hn), +/* harmony export */ unstable_batchedUpdates: () => (/* binding */ dn), +/* harmony export */ useCallback: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useCallback), +/* harmony export */ useContext: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useContext), +/* harmony export */ useDebugValue: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useDebugValue), +/* harmony export */ useDeferredValue: () => (/* binding */ _n), +/* harmony export */ useEffect: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect), +/* harmony export */ useErrorBoundary: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useErrorBoundary), +/* harmony export */ useId: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useId), +/* harmony export */ useImperativeHandle: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useImperativeHandle), +/* harmony export */ useInsertionEffect: () => (/* binding */ Sn), +/* harmony export */ useLayoutEffect: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect), +/* harmony export */ useMemo: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useMemo), +/* harmony export */ useReducer: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useReducer), +/* harmony export */ useRef: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useRef), +/* harmony export */ useState: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_1__.useState), +/* harmony export */ useSyncExternalStore: () => (/* binding */ Cn), +/* harmony export */ useTransition: () => (/* binding */ bn), +/* harmony export */ version: () => (/* binding */ ln) +/* harmony export */ }); +/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../.. */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../hooks */ "../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js"); +function g(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return!0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return!0;return!1}function E(n){this.props=n}function w(n,e){function r(n){var t=this.props.ref,r=t==n.ref;return!r&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!r:C(this.props,n)}function u(e){return this.shouldComponentUpdate=r,(0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(n,e)}return u.displayName="Memo("+(n.displayName||n.name)+")",u.prototype.isReactComponent=!0,u.__f=!0,u}(E.prototype=new ___WEBPACK_IMPORTED_MODULE_0__.Component).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var x=___WEBPACK_IMPORTED_MODULE_0__.options.__b;___WEBPACK_IMPORTED_MODULE_0__.options.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),x&&x(n)};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function N(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=R,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var k=function(n,t){return null==n?null:(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)((0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(n).map(t))},A={map:k,forEach:k,count:function(n){return n?(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(n).length:0},only:function(n){var t=(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(n);if(1!==t.length)throw"Children.only";return t[0]},toArray:___WEBPACK_IMPORTED_MODULE_0__.toChildArray},O=___WEBPACK_IMPORTED_MODULE_0__.options.__e;___WEBPACK_IMPORTED_MODULE_0__.options.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);O(n,t,e,r)};var T=___WEBPACK_IMPORTED_MODULE_0__.options.unmount;function F(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return F(n,t,e)})),n}function I(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return I(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function L(){this.__u=0,this.t=null,this.__b=null}function U(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function D(n){var e,r,u;function o(o){if(e||(e=n()).then(function(n){r=n.default||n},function(n){u=n}),u)throw u;if(!r)throw e;return (0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(r,o)}return o.displayName="Lazy",o.__f=!0,o}function M(){this.u=null,this.o=null}___WEBPACK_IMPORTED_MODULE_0__.options.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),T&&T(n)},(L.prototype=new ___WEBPACK_IMPORTED_MODULE_0__.Component).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=U(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l())};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=I(n,n.__c.__P,n.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i)},L.prototype.componentWillUnmount=function(){this.t=[]},L.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=F(this.__b,r,o.__O=o.__P)}this.__b=null}var i=e.__a&&(0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(___WEBPACK_IMPORTED_MODULE_0__.Fragment,null,n.fallback);return i&&(i.__u&=-33),[(0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(___WEBPACK_IMPORTED_MODULE_0__.Fragment,null,e.__a?null:n.children),i]};var V=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]>>1,1),e.i.removeChild(n)}}),(0,___WEBPACK_IMPORTED_MODULE_0__.render)((0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(W,{context:e.context},n.__v),e.l)}function j(n,e){var r=(0,___WEBPACK_IMPORTED_MODULE_0__.createElement)(P,{__v:n,i:e});return r.containerInfo=e,r}(M.prototype=new ___WEBPACK_IMPORTED_MODULE_0__.Component).__a=function(n){var t=this,e=U(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),V(t,n,r)):u()};e?e(o):o()}},M.prototype.render=function(n){this.u=null,this.o=new Map;var t=(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},M.prototype.componentDidUpdate=M.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){V(n,e,t)})};var z="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,B=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,H=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Z=/[A-Z0-9]/g,Y="undefined"!=typeof document,$=function(n){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function q(n,t,e){return null==t.__k&&(t.textContent=""),(0,___WEBPACK_IMPORTED_MODULE_0__.render)(n,t),"function"==typeof e&&e(),n?n.__c:null}function G(n,t,e){return (0,___WEBPACK_IMPORTED_MODULE_0__.hydrate)(n,t),"function"==typeof e&&e(),n?n.__c:null}___WEBPACK_IMPORTED_MODULE_0__.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(___WEBPACK_IMPORTED_MODULE_0__.Component.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})});var J=___WEBPACK_IMPORTED_MODULE_0__.options.event;function K(){}function Q(){return this.cancelBubble}function X(){return this.defaultPrevented}___WEBPACK_IMPORTED_MODULE_0__.options.event=function(n){return J&&(n=J(n)),n.persist=K,n.isPropagationStopped=Q,n.isDefaultPrevented=X,n.nativeEvent=n};var nn,tn={enumerable:!1,configurable:!0,get:function(){return this.class}},en=___WEBPACK_IMPORTED_MODULE_0__.options.vnode;___WEBPACK_IMPORTED_MODULE_0__.options.vnode=function(n){"string"==typeof n.type&&function(n){var t=n.props,e=n.type,u={};for(var o in t){var i=t[o];if(!("value"===o&&"defaultValue"in t&&null==i||Y&&"children"===o&&"noscript"===e||"class"===o||"className"===o)){var l=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===i?i="":"ondoubleclick"===l?o="ondblclick":"onchange"!==l||"input"!==e&&"textarea"!==e||$(t.type)?"onfocus"===l?o="onfocusin":"onblur"===l?o="onfocusout":H.test(o)?o=l:-1===e.indexOf("-")&&B.test(o)?o=o.replace(Z,"-$&").toLowerCase():null===i&&(i=void 0):l=o="oninput","oninput"===l&&u[o=l]&&(o="oninputCapture"),u[o]=i}}"select"==e&&u.multiple&&Array.isArray(u.value)&&(u.value=(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value)})),"select"==e&&null!=u.defaultValue&&(u.value=(0,___WEBPACK_IMPORTED_MODULE_0__.toChildArray)(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value})),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,"className",tn)):(t.className&&!t.class||t.class&&t.className)&&(u.class=u.className=t.className),n.props=u}(n),n.$$typeof=z,en&&en(n)};var rn=___WEBPACK_IMPORTED_MODULE_0__.options.__r;___WEBPACK_IMPORTED_MODULE_0__.options.__r=function(n){rn&&rn(n),nn=n.__c};var un=___WEBPACK_IMPORTED_MODULE_0__.options.diffed;___WEBPACK_IMPORTED_MODULE_0__.options.diffed=function(n){un&&un(n);var t=n.props,e=n.__e;null!=e&&"textarea"===n.type&&"value"in t&&t.value!==e.value&&(e.value=null==t.value?"":t.value),nn=null};var on={ReactCurrentDispatcher:{current:{readContext:function(n){return nn.__n[n.__c].props.value}}}},ln="17.0.2";function cn(n){return ___WEBPACK_IMPORTED_MODULE_0__.createElement.bind(null,n)}function fn(n){return!!n&&n.$$typeof===z}function an(n){return fn(n)&&n.type===___WEBPACK_IMPORTED_MODULE_0__.Fragment}function sn(n){return fn(n)?___WEBPACK_IMPORTED_MODULE_0__.cloneElement.apply(null,arguments):n}function hn(n){return!!n.__k&&((0,___WEBPACK_IMPORTED_MODULE_0__.render)(null,n),!0)}function vn(n){return n&&(n.base||1===n.nodeType&&n)||null}var dn=function(n,t){return n(t)},pn=function(n,t){return n(t)},mn=___WEBPACK_IMPORTED_MODULE_0__.Fragment;function yn(n){n()}function _n(n){return n}function bn(){return[!1,yn]}var Sn=_hooks__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect,gn=fn;function Cn(n,t){var e=t(),r=(0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useState)({h:{__:e,v:t}}),u=r[0].h,o=r[1];return (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect)(function(){u.__=e,u.v=t,En(u)&&o({h:u})},[n,e,t]),(0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function(){return En(u)&&o({h:u}),n(function(){En(u)&&o({h:u})})},[n]),e}function En(n){var t,e,r=n.v,u=n.__;try{var o=r();return!((t=u)===(e=o)&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return!0}}var wn={useState:_hooks__WEBPACK_IMPORTED_MODULE_1__.useState,useId:_hooks__WEBPACK_IMPORTED_MODULE_1__.useId,useReducer:_hooks__WEBPACK_IMPORTED_MODULE_1__.useReducer,useEffect:_hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect,useLayoutEffect:_hooks__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect,useInsertionEffect:Sn,useTransition:bn,useDeferredValue:_n,useSyncExternalStore:Cn,startTransition:yn,useRef:_hooks__WEBPACK_IMPORTED_MODULE_1__.useRef,useImperativeHandle:_hooks__WEBPACK_IMPORTED_MODULE_1__.useImperativeHandle,useMemo:_hooks__WEBPACK_IMPORTED_MODULE_1__.useMemo,useCallback:_hooks__WEBPACK_IMPORTED_MODULE_1__.useCallback,useContext:_hooks__WEBPACK_IMPORTED_MODULE_1__.useContext,useDebugValue:_hooks__WEBPACK_IMPORTED_MODULE_1__.useDebugValue,version:"17.0.2",Children:A,render:q,hydrate:G,unmountComponentAtNode:hn,createPortal:j,createElement:___WEBPACK_IMPORTED_MODULE_0__.createElement,createContext:___WEBPACK_IMPORTED_MODULE_0__.createContext,createFactory:cn,cloneElement:sn,createRef:___WEBPACK_IMPORTED_MODULE_0__.createRef,Fragment:___WEBPACK_IMPORTED_MODULE_0__.Fragment,isValidElement:fn,isElement:gn,isFragment:an,findDOMNode:vn,Component:___WEBPACK_IMPORTED_MODULE_0__.Component,PureComponent:E,memo:w,forwardRef:N,flushSync:pn,unstable_batchedUpdates:dn,StrictMode:mn,Suspense:L,SuspenseList:M,lazy:D,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:on}; +//# sourceMappingURL=compat.module.js.map + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js": +/*!******************************************************************************!*\ + !*** ../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Component: () => (/* binding */ b), +/* harmony export */ Fragment: () => (/* binding */ g), +/* harmony export */ cloneElement: () => (/* binding */ E), +/* harmony export */ createContext: () => (/* binding */ F), +/* harmony export */ createElement: () => (/* binding */ y), +/* harmony export */ createRef: () => (/* binding */ _), +/* harmony export */ h: () => (/* binding */ y), +/* harmony export */ hydrate: () => (/* binding */ B), +/* harmony export */ isValidElement: () => (/* binding */ t), +/* harmony export */ options: () => (/* binding */ l), +/* harmony export */ render: () => (/* binding */ q), +/* harmony export */ toChildArray: () => (/* binding */ $) +/* harmony export */ }); +var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;lu&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0; +//# sourceMappingURL=preact.module.js.map + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js": +/*!***********************************************************************************!*\ + !*** ../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useCallback: () => (/* binding */ T), +/* harmony export */ useContext: () => (/* binding */ q), +/* harmony export */ useDebugValue: () => (/* binding */ x), +/* harmony export */ useEffect: () => (/* binding */ p), +/* harmony export */ useErrorBoundary: () => (/* binding */ P), +/* harmony export */ useId: () => (/* binding */ V), +/* harmony export */ useImperativeHandle: () => (/* binding */ A), +/* harmony export */ useLayoutEffect: () => (/* binding */ y), +/* harmony export */ useMemo: () => (/* binding */ F), +/* harmony export */ useReducer: () => (/* binding */ s), +/* harmony export */ useRef: () => (/* binding */ _), +/* harmony export */ useState: () => (/* binding */ h) +/* harmony export */ }); +/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../.. */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +var t,r,u,i,o=0,f=[],c=[],e=___WEBPACK_IMPORTED_MODULE_0__.options.__b,a=___WEBPACK_IMPORTED_MODULE_0__.options.__r,v=___WEBPACK_IMPORTED_MODULE_0__.options.diffed,l=___WEBPACK_IMPORTED_MODULE_0__.options.__c,m=___WEBPACK_IMPORTED_MODULE_0__.options.unmount;function d(t,u){___WEBPACK_IMPORTED_MODULE_0__.options.__h&&___WEBPACK_IMPORTED_MODULE_0__.options.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!___WEBPACK_IMPORTED_MODULE_0__.options.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!___WEBPACK_IMPORTED_MODULE_0__.options.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){___WEBPACK_IMPORTED_MODULE_0__.options.useDebugValue&&___WEBPACK_IMPORTED_MODULE_0__.options.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],___WEBPACK_IMPORTED_MODULE_0__.options.__e(r,t.__v)}}___WEBPACK_IMPORTED_MODULE_0__.options.__b=function(n){r=null,e&&e(n)},___WEBPACK_IMPORTED_MODULE_0__.options.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r},___WEBPACK_IMPORTED_MODULE_0__.options.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===___WEBPACK_IMPORTED_MODULE_0__.options.requestAnimationFrame||((i=___WEBPACK_IMPORTED_MODULE_0__.options.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},___WEBPACK_IMPORTED_MODULE_0__.options.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],___WEBPACK_IMPORTED_MODULE_0__.options.__e(u,t.__v)}}),l&&l(t,r)},___WEBPACK_IMPORTED_MODULE_0__.options.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&___WEBPACK_IMPORTED_MODULE_0__.options.__e(r,u.__v))};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return"function"==typeof t?t(n):t} +//# sourceMappingURL=hooks.module.js.map + + +/***/ }), + +/***/ "../node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js": +/*!**********************************************************************************************!*\ + !*** ../node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Fragment: () => (/* reexport safe */ ___WEBPACK_IMPORTED_MODULE_0__.Fragment), +/* harmony export */ jsx: () => (/* binding */ u), +/* harmony export */ jsxAttr: () => (/* binding */ l), +/* harmony export */ jsxDEV: () => (/* binding */ u), +/* harmony export */ jsxEscape: () => (/* binding */ _), +/* harmony export */ jsxTemplate: () => (/* binding */ a), +/* harmony export */ jsxs: () => (/* binding */ u) +/* harmony export */ }); +/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../.. */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CloudElementTemplatesCoreModule: () => (/* binding */ coreModule$1), +/* harmony export */ CloudElementTemplatesLinterPlugin: () => (/* binding */ ElementTemplateLinterPlugin), +/* harmony export */ CloudElementTemplatesPropertiesProviderModule: () => (/* binding */ index$1), +/* harmony export */ CloudElementTemplatesValidator: () => (/* binding */ Validator), +/* harmony export */ ElementTemplatesCoreModule: () => (/* binding */ coreModule), +/* harmony export */ ElementTemplatesPropertiesProviderModule: () => (/* binding */ index) +/* harmony export */ }); +/* harmony import */ var bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! bpmn-js/lib/util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! uuid */ "../node_modules/uuid/dist/esm-browser/v4.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var semver_compare__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! semver-compare */ "../node_modules/semver-compare/index.js"); +/* harmony import */ var semver_compare__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(semver_compare__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @bpmn-io/element-templates-validator */ "../node_modules/@bpmn-io/element-templates-validator/dist/index.js"); +/* harmony import */ var ids__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ids */ "../node_modules/ids/dist/index.esm.js"); +/* harmony import */ var bpmn_js_lib_features_label_editing_LabelUtil__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! bpmn-js/lib/features/label-editing/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var bpmn_js_lib_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! bpmn-js/lib/util/DrilldownUtil */ "../node_modules/bpmn-js/lib/util/DrilldownUtil.js"); +/* harmony import */ var bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! bpmn-js/lib/util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! diagram-js/lib/command/CommandInterceptor */ "../node_modules/diagram-js/lib/command/CommandInterceptor.js"); +/* harmony import */ var diagram_js_lib_i18n_translate__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! diagram-js/lib/i18n/translate */ "../node_modules/diagram-js/lib/i18n/translate/index.js"); +/* harmony import */ var _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @bpmn-io/properties-panel */ "../node_modules/@bpmn-io/properties-panel/dist/index.esm.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! classnames */ "../node_modules/classnames/index.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! bpmn-js-properties-panel */ "../node_modules/bpmn-js-properties-panel/dist/index.esm.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact/jsx-runtime */ "../node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +/* harmony import */ var _bpmn_io_extract_process_variables_zeebe__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @bpmn-io/extract-process-variables/zeebe */ "../node_modules/@bpmn-io/extract-process-variables/zeebe/index.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact/hooks */ "../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var bpmnlint_lib_resolver_static_resolver__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! bpmnlint/lib/resolver/static-resolver */ "../node_modules/bpmnlint/lib/resolver/static-resolver.js"); +/* harmony import */ var bpmnlint_lib_resolver_static_resolver__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(bpmnlint_lib_resolver_static_resolver__WEBPACK_IMPORTED_MODULE_10__); - for (var i = 0; i < values.length; i++) { - var listValue = values[i]; - var listItemNode = existingElements[i]; - if (!listItemNode) { - listItemNode = domify(entry.createListEntryTemplate(listValue, i, listEntryContainer)); - listEntryContainer.appendChild(listItemNode); - } - domAttr(listItemNode, 'data-index', i); - self._bindTemplate(element, entry, listValue, listItemNode, i); - } - var entriesToRemove = existingElements.length - values.length; - for (var j = 0; j < entriesToRemove; j++) { - // remove orphaned element - listEntryContainer.removeChild(listEntryContainer.lastChild); - } - } else { - self._bindTemplate(element, entry, values, entryNode); - } - // update conditionally visible elements - self.updateState(entry, entryNode); - self.validate(entry, values, entryNode); - // remember initial state for later dirty checking - entry.oldValues = getFormControlValues(entryNode); - }); - if (typeof group.label === 'function') { - updateLabel(groupNode, '.group-label', group.label(element, groupNode)); - } - - groupVisible = groupVisible && isGroupVisible(group, element, groupNode); - - tabVisible = tabVisible || groupVisible; - - toggleVisible(groupNode, groupVisible); - }); - - tabVisible = tabVisible && isTabVisible(tab, element); - - toggleVisible(tabNode, tabVisible); - toggleVisible(tabLinkNode, tabVisible); - - checkActiveTabVisibility(tabNode, tabVisible); - }); - // inject elements id into header - updateLabel(panelNode, '[data-label-id]', getBusinessObject(element).id || ''); - }; - PropertiesPanel.prototype._createPanel = function(element, tabs) { - var self = this; - var panelNode = domify('
'), - headerNode = domify('
' + - '
' + - '' + - '
'), - tabBarNode = domify('
'), - tabLinksNode = domify(''), - tabContainerNode = domify('
'); - panelNode.appendChild(headerNode); - forEach(tabs, function(tab, tabIndex) { - if (!tab.id) { - throw new Error('tab must have an id'); - } - var tabNode = domify('
'), - tabLinkNode = domify(''); - var groups = tab.groups; - forEach(groups, function(group) { - if (!group.id) { - throw new Error('group must have an id'); - } - var groupNode = domify('
' + - '' + - '' + escapeHTML(group.label) + '' + - '
'); - // TODO(nre): use event delegation to handle that... - groupNode.querySelector('.group-toggle').addEventListener('click', function(evt) { - domClasses(groupNode).toggle('group-closed'); - evt.preventDefault(); - evt.stopPropagation(); - }); - groupNode.addEventListener('click', function(evt) { - if (!evt.defaultPrevented && domClasses(groupNode).has('group-closed')) { - domClasses(groupNode).remove('group-closed'); - } - }); - forEach(group.entries, function(entry) { +/** + * The BPMN 2.0 extension attribute name under + * which the element template ID is stored. + * + * @type {String} + */ +const TEMPLATE_ID_ATTR$1 = 'zeebe:modelerTemplate'; - if (!entry.id) { - throw new Error('entry must have an id'); - } +/** + * The BPMN 2.0 extension attribute name under + * which the element template version is stored. + * + * @type {String} + */ +const TEMPLATE_VERSION_ATTR$1 = 'zeebe:modelerTemplateVersion'; - var html = entry.html; +/** + * Get template id for a given diagram element. + * + * @param {djs.model.Base} element + * + * @return {String} + */ +function getTemplateId$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if (businessObject) { + return businessObject.get(TEMPLATE_ID_ATTR$1); + } +} + +/** + * Get template version for a given diagram element. + * + * @param {djs.model.Base} element + * + * @return {String} + */ +function getTemplateVersion$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if (businessObject) { + return businessObject.get(TEMPLATE_VERSION_ATTR$1); + } +} + +/** + * Find extension with given type in + * BPMN element, diagram element or ExtensionElement. + * + * @param {ModdleElement|djs.model.Base} element + * @param {String} type + * + * @return {ModdleElement} the extension + */ +function findExtension$1(element, type) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + let extensionElements; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:ExtensionElements')) { + extensionElements = businessObject; + } else { + extensionElements = businessObject.get('extensionElements'); + } + if (!extensionElements) { + return; + } + return extensionElements.get('values').find(value => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(value, type); + }); +} +function findZeebeProperty(zeebeProperties, binding) { + return zeebeProperties.get('properties').find(value => { + return value.name === binding.name; + }); +} +function findInputParameter$1(ioMapping, binding) { + const parameters = ioMapping.get('inputParameters'); + return parameters.find(parameter => { + return parameter.target === binding.name; + }); +} +function findOutputParameter$1(ioMapping, binding) { + const parameters = ioMapping.get('outputParameters'); + return parameters.find(parameter => { + return parameter.source === binding.source; + }); +} +function findTaskHeader(taskHeaders, binding) { + const headers = taskHeaders.get('values'); + return headers.find(header => { + return header.key === binding.key; + }); +} +function findMessage(businessObject) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:Event')) { + const eventDefinitions = businessObject.get('eventDefinitions'); + if (!eventDefinitions || !eventDefinitions.length) { + return; + } + businessObject = eventDefinitions[0]; + } + if (!businessObject) { + return; + } + return businessObject.get('messageRef'); +} +function getDefaultValue(property) { + if (property.value !== undefined) { + return property.value; + } + if (property.generatedValue) { + const { + type + } = property.generatedValue; + if (type === 'uuid') { + return (0,uuid__WEBPACK_IMPORTED_MODULE_12__["default"])(); + } + } +} + +/** + * The BPMN 2.0 extension attribute name under + * which the element template ID is stored. + * + * @type {String} + */ +const TEMPLATE_ID_ATTR = 'camunda:modelerTemplate'; - if (typeof html === 'string') { - html = domify(html); - } +/** + * The BPMN 2.0 extension attribute name under + * which the element template version is stored. + * + * @type {String} + */ +const TEMPLATE_VERSION_ATTR = 'camunda:modelerTemplateVersion'; - // unwrap jquery - if (html.get && html.constructor.prototype.jquery) { - html = html.get(0); - } +/** + * Get template id for a given diagram element. + * + * @param {djs.model.Base} element + * + * @return {String} + */ +function getTemplateId(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if (businessObject) { + return businessObject.get(TEMPLATE_ID_ATTR); + } +} + +/** + * Get template version for a given diagram element. + * + * @param {djs.model.Base} element + * + * @return {String} + */ +function getTemplateVersion(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if (businessObject) { + return businessObject.get(TEMPLATE_VERSION_ATTR); + } +} + +/** + * Find extension with given type in + * BPMN element, diagram element or ExtensionElement. + * + * @param {ModdleElement|djs.model.Base} element + * @param {String} type + * + * @return {ModdleElement} the extension + */ +function findExtension(element, type) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + let extensionElements; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:ExtensionElements')) { + extensionElements = businessObject; + } else { + extensionElements = businessObject.get('extensionElements'); + } + if (!extensionElements) { + return null; + } + return extensionElements.get('values').find(value => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(value, type); + }); +} +function findExtensions(element, types) { + const extensionElements = getExtensionElements(element); + if (!extensionElements) { + return []; + } + return extensionElements.get('values').filter(value => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(value, types); + }); +} +function findCamundaInOut(element, binding) { + const extensionElements = getExtensionElements(element); + if (!extensionElements) { + return; + } + const { + type + } = binding; + let matcher; + if (type === 'camunda:in') { + matcher = element => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'camunda:In') && isInOut(element, binding); + }; + } else if (type === 'camunda:out') { + matcher = element => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'camunda:Out') && isInOut(element, binding); + }; + } else if (type === 'camunda:in:businessKey') { + matcher = element => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'camunda:In') && 'businessKey' in element; + }; + } + return extensionElements.get('values').find(matcher); +} +function findCamundaProperty(camundaProperties, binding) { + return camundaProperties.get('values').find(value => { + return value.name === binding.name; + }); +} +function findInputParameter(inputOutput, binding) { + const parameters = inputOutput.get('inputParameters'); + return parameters.find(parameter => { + return parameter.name === binding.name; + }); +} +function findOutputParameter(inputOutput, binding) { + const parameters = inputOutput.get('outputParameters'); + return parameters.find(function (parameter) { + const { + value + } = parameter; + if (!binding.scriptFormat) { + return value === binding.source; + } + const definition = parameter.get('camunda:definition'); + if (!definition || binding.scriptFormat !== definition.get('camunda:scriptFormat')) { + return false; + } + return definition.get('camunda:value') === binding.source; + }); +} +function findCamundaErrorEventDefinition(element, errorRef) { + const errorEventDefinitions = findExtensions(element, ['camunda:ErrorEventDefinition']); + let error; + + // error ID has to start with + return errorEventDefinitions.find(definition => { + error = definition.get('bpmn:errorRef'); + if (error) { + return error.get('bpmn:id').startsWith(`Error_${errorRef}`); + } + }); +} + +// helpers ////////// + +function getExtensionElements(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:ExtensionElements')) { + return businessObject; + } else { + return businessObject.get('extensionElements'); + } +} +function isInOut(element, binding) { + if (binding.type === 'camunda:in') { + // find based on target attribute + if (binding.target) { + return element.target === binding.target; + } + } + if (binding.type === 'camunda:out') { + // find based on source / sourceExpression + if (binding.source) { + return element.source === binding.source; + } + if (binding.sourceExpression) { + return element.sourceExpression === binding.sourceExpression; + } + } + + // find based variables / local combination + if (binding.variables) { + return element.variables === 'all' && (binding.variables !== 'local' || element.local); + } +} + +/** + * Registry for element templates. + */ +let ElementTemplates$1 = class ElementTemplates { + constructor(commandStack, eventBus, modeling, injector) { + this._commandStack = commandStack; + this._eventBus = eventBus; + this._injector = injector; + this._modeling = modeling; + this._templates = {}; + } + + /** + * Get template with given ID and optional version or for element. + * + * @param {String|djs.model.Base} id + * @param {number} [version] + * + * @return {ElementTemplate} + */ + get(id, version) { + const templates = this._templates; + let element; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(id)) { + return null; + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(id)) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(version)) { + version = '_'; + } + if (templates[id] && templates[id][version]) { + return templates[id][version]; + } else { + return null; + } + } else { + element = id; + return this.get(this._getTemplateId(element), this._getTemplateVersion(element)); + } + } + + /** + * Get default template for given element. + * + * @param {djs.model.Base} element + * + * @return {ElementTemplate} + */ + getDefault(element) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(this.getAll(element), function (template) { + return template.isDefault; + }) || null; + } + + /** + * Get all templates (with given ID or applicable to element). + * + * @param {string|djs.model.Base} [id] + * @return {Array} + */ + getAll(id) { + return this._getTemplateVerions(id, { + includeDeprecated: true + }); + } + + /** + * Get all templates (with given ID or applicable to element) with the latest + * version. + * + * @param {String|djs.model.Base} [id] + * @param {{ deprecated?: boolean }} [options] + * + * @return {Array} + */ + getLatest(id, options = {}) { + return this._getTemplateVerions(id, { + ...options, + latest: true + }); + } + + /** + * Set templates. + * + * @param {Array} templates + */ + set(templates) { + this._templates = {}; + templates.forEach(template => { + const id = template.id, + version = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(template.version) ? '_' : template.version; + if (!this._templates[id]) { + this._templates[id] = { + latest: template + }; + } + this._templates[id][version] = template; + const latestVerions = this._templates[id].latest.version; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(latestVerions) || template.version > latestVerions) { + this._templates[id].latest = template; + } + }); + } + + /** + * @param {object|string|null} id + * @param { { latest?: boolean, deprecated?: boolean } [options] + * + * @return {Array} + */ + _getTemplateVerions(id, options = {}) { + const { + latest: latestOnly, + deprecated: includeDeprecated + } = options; + const templates = this._templates; + const getVersions = template => { + const { + latest, + ...versions + } = template; + return latestOnly ? !includeDeprecated && latest.deprecated ? [] : [latest] : (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.values)(versions); + }; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isNil)(id)) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.flatten)((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.values)(templates).map(getVersions)); + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isObject)(id)) { + const element = id; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.filter)(this._getTemplateVerions(null, options), function (template) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(element, template.appliesTo); + }) || []; + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(id)) { + return templates[id] && getVersions(templates[id]); + } + throw new Error('argument must be of type {string|djs.model.Base|undefined}'); + } + _getTemplateId(element) { + return getTemplateId(element); + } + _getTemplateVersion(element) { + return getTemplateVersion(element); + } + + /** + * Apply element template to a given element. + * + * @param {djs.model.Base} element + * @param {ElementTemplate} newTemplate + * + * @return {djs.model.Base} the updated element + */ + applyTemplate(element, newTemplate) { + let action = 'apply'; + let payload = { + element, + newTemplate + }; + const oldTemplate = this.get(element); + if (oldTemplate && !newTemplate) { + action = 'unlink'; + payload = { + element + }; + } + if (newTemplate && oldTemplate && newTemplate.id === oldTemplate.id) { + action = 'update'; + } + const context = { + element, + newTemplate, + oldTemplate + }; + this._commandStack.execute('propertiesPanel.camunda.changeTemplate', context); + this._eventBus.fire(`elementTemplates.${action}`, payload); + return context.element; + } + + /** + * Remove template from a given element. + * + * @param {djs.model.Base} element + * + * @return {djs.model.Base} the updated element + */ + removeTemplate(element) { + const eventBus = this._injector.get('eventBus'); + eventBus.fire('elementTemplates.remove', { + element + }); + const context = { + element + }; + this._commandStack.execute('propertiesPanel.removeTemplate', context); + return context.newElement; + } + + /** + * Unlink template from a given element. + * + * @param {djs.model.Base} element + * + * @return {djs.model.Base} the updated element + */ + unlinkTemplate(element) { + return this.applyTemplate(element, null); + } +}; +ElementTemplates$1.$inject = ['commandStack', 'eventBus', 'modeling', 'injector']; + +/** + * Registry for element templates. + */ +class ElementTemplates extends ElementTemplates$1 { + constructor(templateElementFactory, commandStack, eventBus, modeling, injector) { + super(commandStack, eventBus, modeling, injector); + this._templateElementFactory = templateElementFactory; + } + _getTemplateId(element) { + return getTemplateId$1(element); + } + _getTemplateVersion(element) { + return getTemplateVersion$1(element); + } + + /** + * Create an element based on an element template. + * + * @param {ElementTemplate} template + * @returns {djs.model.Base} + */ + createElement(template) { + if (!template) { + throw new Error('template is missing'); + } + const element = this._templateElementFactory.create(template); + return element; + } + + /** + * Apply element template to a given element. + * + * @param {djs.model.Base} element + * @param {ElementTemplate} newTemplate + * + * @return {djs.model.Base} the updated element + */ + applyTemplate(element, newTemplate) { + let action = 'apply'; + let payload = { + element, + newTemplate + }; + const oldTemplate = this.get(element); + if (oldTemplate && !newTemplate) { + action = 'unlink'; + payload = { + element + }; + } + if (newTemplate && oldTemplate && newTemplate.id === oldTemplate.id) { + action = 'update'; + } + const context = { + element, + newTemplate, + oldTemplate + }; + this._commandStack.execute('propertiesPanel.zeebe.changeTemplate', context); + this._eventBus.fire(`elementTemplates.${action}`, payload); + return context.element; + } +} +ElementTemplates.$inject = ['templateElementFactory', 'commandStack', 'eventBus', 'modeling', 'injector']; + +const SUPPORTED_SCHEMA_VERSION$1 = (0,_bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__.getSchemaVersion)(); +const MORPHABLE_TYPES = ['bpmn:Activity', 'bpmn:Event', 'bpmn:Gateway']; + +/** + * A element template validator. + */ +let Validator$1 = class Validator { + constructor(moddle) { + this._templatesById = {}; + this._validTemplates = []; + this._errors = []; + this._moddle = moddle; + } + + /** + * Adds the templates. + * + * @param {Array} templates + * + * @return {Validator} + */ + addAll(templates) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isArray)(templates)) { + this._logError('templates must be []'); + } else { + templates.forEach(this.add, this); + } + return this; + } + + /** + * Add the given element template, if it is valid. + * + * @param {TemplateDescriptor} template + * + * @return {Validator} + */ + add(template) { + const err = this._validateTemplate(template); + let id, version; + if (!err) { + id = template.id; + version = template.version || '_'; + if (!this._templatesById[id]) { + this._templatesById[id] = {}; + } + this._templatesById[id][version] = template; + this._validTemplates.push(template); + } + return this; + } + + /** + * Validate given template and return error (if any). + * + * @param {TemplateDescriptor} template + * + * @return {Error} validation error, if any + */ + _validateTemplate(template) { + let err; + const id = template.id, + version = template.version || '_', + schemaVersion = template.$schema && getSchemaVersion(template.$schema); + + // (1) compatibility + if (schemaVersion && semver_compare__WEBPACK_IMPORTED_MODULE_0___default()(SUPPORTED_SCHEMA_VERSION$1, schemaVersion) < 0) { + return this._logError(`unsupported element template schema version <${schemaVersion}>. Your installation only supports up to version <${SUPPORTED_SCHEMA_VERSION$1}>. Please update your installation`, template); + } + + // (2) versioning + if (this._templatesById[id] && this._templatesById[id][version]) { + if (version === '_') { + return this._logError(`template id <${id}> already used`, template); + } else { + return this._logError(`template id <${id}> and version <${version}> already used`, template); + } + } + + // (3) elementType validation + const elementTypeError = this._validateElementType(template); + if (elementTypeError) { + return elementTypeError; + } + + // (4) JSON schema compliance + const validationResult = (0,_bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__.validate)(template); + const { + errors, + valid + } = validationResult; + if (!valid) { + err = new Error('invalid template'); + filteredSchemaErrors(errors).forEach(error => { + this._logError(error.message, template); + }); + } + return err; + } + + /** + * Validate elementType for given template and return error (if any). + * + * @param {TemplateDescriptor} template + * + * @return {Error} validation error, if any + */ + _validateElementType(template) { + if (template.elementType && template.appliesTo) { + const elementType = template.elementType.value, + appliesTo = template.appliesTo; + + // (3.1) template can be applied to elementType + // prevents cases where the elementType is not part of appliesTo + if (!appliesTo.find(type => this._isType(elementType, type))) { + return this._logError(`template does not apply to requested element type <${elementType}>`, template); + } + + // (3.2) template only applies to same type of element + // prevent elementTemplates to morph into incompatible types, e.g. Task -> SequenceFlow + for (const sourceType of appliesTo) { + if (!this._canMorph(sourceType, elementType)) { + return this._logError(`can not morph <${sourceType}> into <${elementType}>`, template); + } + } + } + } + + /** + * Check if given type is a subtype of given base type. + * + * @param {String} type + * @param {String} baseType + * @returns {Boolean} + */ + _isType(type, baseType) { + const moddleType = this._moddle.getType(type); + return moddleType && baseType in this._moddle.getElementDescriptor(moddleType).allTypesByName; + } - var entryNode = domify('
'); + /** + * Checks if a given type can be morphed into another type. + * + * @param {String} sourceType + * @param {String} targetType + * @returns {Boolean} + */ + _canMorph(sourceType, targetType) { + if (sourceType === targetType) { + return true; + } + const baseType = MORPHABLE_TYPES.find(type => this._isType(sourceType, type)); + if (!baseType) { + return false; + } + return this._isType(targetType, baseType); + } + + /** + * Log an error for the given template + * + * @param {(String|Error)} err + * @param {TemplateDescriptor} template + * + * @return {Error} logged validation errors + */ + _logError(err, template) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(err)) { + if (template) { + const { + id, + name + } = template; + err = `template(id: <${id}>, name: <${name}>): ${err}`; + } + err = new Error(err); + } + this._errors.push(err); + return err; + } + getErrors() { + return this._errors; + } + getValidTemplates() { + return this._validTemplates; + } +}; + +// helpers ////////// + +/** + * Extract schema version from schema URI + * + * @param {String} schemaUri - for example https://unpkg.com/@camunda/element-templates-json-schema@99.99.99/resources/schema.json + * + * @return {String} for example '99.99.99' + */ +function getSchemaVersion(schemaUri) { + const re = /\d+\.\d+\.\d+/g; + const match = schemaUri.match(re); + return match === null ? undefined : match[0]; +} + +/** + * Extract only relevant errors of the validation result. + * + * The JSON Schema we use under the hood produces more errors than we need for a + * detected schema violation (for example, unmatched sub-schemas, if-then-rules, + * `oneOf`-definitions ...). + * + * We call these errors "relevant" that have a custom error message defined by us OR + * are basic data type errors. + * + * @param {Array} schemaErrors + * + * @return {Array} + */ +function filteredSchemaErrors(schemaErrors) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.filter)(schemaErrors, err => { + const { + dataPath, + keyword + } = err; + + // (1) regular errors are customized from the schema + if (keyword === 'errorMessage') { + return true; + } + + // (2) data type errors + // ignore type errors nested in scopes + if (keyword === 'type' && dataPath && !dataPath.startsWith('/scopes/')) { + return true; + } + return false; + }); +} + +const SUPPORTED_SCHEMA_VERSION = (0,_bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__.getZeebeSchemaVersion)(); +const SUPPORTED_SCHEMA_PACKAGE = (0,_bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__.getZeebeSchemaPackage)(); + +/** + * A Camunda Cloud element template validator. + */ +class Validator extends Validator$1 { + constructor(moddle) { + super(moddle); + } - forEach(entry.cssClasses || [], function(cssClass) { - domClasses(entryNode).add(cssClass); - }); + /** + * Validate given template and return error (if any). + * + * @param {TemplateDescriptor} template + * + * @return {Error} validation error, if any + */ + _validateTemplate(template) { + let err; + const id = template.id, + version = template.version || '_', + schema = template.$schema, + schemaVersion = schema && getSchemaVersion(schema); + + // (1) $schema attribute defined + if (!schema) { + return this._logError('missing $schema attribute.', template); + } + if (!this.isSchemaValid(schema)) { + return this._logError(`unsupported $schema attribute <${schema}>.`, template); + } + + // (2) compatibility + if (schemaVersion && semver_compare__WEBPACK_IMPORTED_MODULE_0___default()(SUPPORTED_SCHEMA_VERSION, schemaVersion) < 0) { + return this._logError(`unsupported element template schema version <${schemaVersion}>. Your installation only supports up to version <${SUPPORTED_SCHEMA_VERSION}>. Please update your installation`, template); + } + + // (3) versioning + if (this._templatesById[id] && this._templatesById[id][version]) { + if (version === '_') { + return this._logError(`template id <${id}> already used`, template); + } else { + return this._logError(`template id <${id}> and version <${version}> already used`, template); + } + } + + // (4) elementType validation + const elementTypeError = this._validateElementType(template); + if (elementTypeError) { + return elementTypeError; + } + + // (5) JSON schema compliance + const validationResult = (0,_bpmn_io_element_templates_validator__WEBPACK_IMPORTED_MODULE_1__.validateZeebe)(template); + const { + errors, + valid + } = validationResult; + if (!valid) { + err = new Error('invalid template'); + filteredSchemaErrors(errors).forEach(error => { + this._logError(error.message, template); + }); + } + return err; + } + isSchemaValid(schema) { + return schema && schema.includes(SUPPORTED_SCHEMA_PACKAGE); + } +} + +/** + * The guy responsible for template loading. + * + * Provide the actual templates via the `config.elementTemplates`. + * + * That configuration can either be an array of template + * descriptors or a node style callback to retrieve + * the templates asynchronously. + * + * @param {Array|Function} loadTemplates + * @param {EventBus} eventBus + * @param {ElementTemplates} elementTemplates + * @param {Moddle} moddle + */ +let ElementTemplatesLoader$1 = class ElementTemplatesLoader { + constructor(loadTemplates, eventBus, elementTemplates, moddle) { + this._loadTemplates = loadTemplates; + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._moddle = moddle; + eventBus.on('diagram.init', () => { + this.reload(); + }); + } + reload() { + const loadTemplates = this._loadTemplates; + + // no templates specified + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(loadTemplates)) { + return; + } + + // template loader function specified + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isFunction)(loadTemplates)) { + return loadTemplates((err, templates) => { + if (err) { + return this.templateErrors([err]); + } + this.setTemplates(templates); + }); + } + + // templates array specified + if (loadTemplates.length) { + return this.setTemplates(loadTemplates); + } + } + setTemplates(templates) { + const elementTemplates = this._elementTemplates, + moddle = this._moddle; + const validator = new Validator$1(moddle).addAll(templates); + const errors = validator.getErrors(), + validTemplates = validator.getValidTemplates(); + elementTemplates.set(validTemplates); + if (errors.length) { + this.templateErrors(errors); + } + this.templatesChanged(); + } + templatesChanged() { + this._eventBus.fire('elementTemplates.changed'); + } + templateErrors(errors) { + this._eventBus.fire('elementTemplates.errors', { + errors: errors + }); + } +}; +ElementTemplatesLoader$1.$inject = ['config.elementTemplates', 'eventBus', 'elementTemplates', 'moddle']; + +class ElementTemplatesLoader extends ElementTemplatesLoader$1 { + constructor(loadTemplates, eventBus, elementTemplates, moddle) { + super(loadTemplates, eventBus, elementTemplates, moddle); + this._elementTemplates = elementTemplates; + } + setTemplates(templates) { + const elementTemplates = this._elementTemplates, + moddle = this._moddle; + const validator = new Validator(moddle).addAll(templates); + const errors = validator.getErrors(), + validTemplates = validator.getValidTemplates(); + elementTemplates.set(validTemplates); + if (errors.length) { + this.templateErrors(errors); + } + this.templatesChanged(); + } +} +ElementTemplatesLoader.$inject = ['config.elementTemplates', 'eventBus', 'elementTemplates', 'moddle']; + +/** + * Create a new element and set its parent. + * + * @param {String} elementType of the new element + * @param {Object} properties of the new element in key-value pairs + * @param {moddle.object} parent of the new element + * @param {BpmnFactory} factory which creates the new element + * + * @returns {djs.model.Base} element which is created + */ +function createElement(elementType, properties, parent, factory) { + const element = factory.create(elementType, properties); + if (parent) { + element.$parent = parent; + } + return element; +} + +/** + * generate a semantic id with given prefix + */ +function nextId(prefix) { + const ids = new ids__WEBPACK_IMPORTED_MODULE_2__["default"]([32, 32, 1]); + return ids.nextPrefixed(prefix); +} +function getRoot(businessObject) { + let parent = businessObject; + while (parent.$parent) { + parent = parent.$parent; + } + return parent; +} +function filterElementsByType(objectList, type) { + const list = objectList || []; + return list.filter(element => (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, type)); +} +function findRootElementsByType(businessObject, referencedType) { + const root = getRoot(businessObject); + return filterElementsByType(root.get('rootElements'), referencedType); +} +function findRootElementById(businessObject, type, id) { + const elements = findRootElementsByType(businessObject, type); + return elements.find(element => element.id === id); +} + +/** + * Create an input parameter representing the given + * binding and value. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createInputParameter$1(binding, value, bpmnFactory) { + const { + name + } = binding; + return bpmnFactory.create('zeebe:Input', { + source: value, + target: name + }); +} + +/** + * Create an output parameter representing the given + * binding and value. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createOutputParameter$1(binding, value, bpmnFactory) { + const { + source + } = binding; + return bpmnFactory.create('zeebe:Output', { + source, + target: value + }); +} + +/** + * Create a task header representing the given + * binding and value. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createTaskHeader(binding, value, bpmnFactory) { + const { + key + } = binding; + return bpmnFactory.create('zeebe:Header', { + key, + value + }); +} + +/** + * Create a task definition representing the given value. + * + * @param {object} attrs + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createTaskDefinition(attrs = {}, bpmnFactory) { + return bpmnFactory.create('zeebe:TaskDefinition', attrs); +} - entryNode.appendChild(html); +/** + * Create zeebe:Property from the given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createZeebeProperty(binding, value = '', bpmnFactory) { + const { + name + } = binding; + return bpmnFactory.create('zeebe:Property', { + name, + value + }); +} + +/** + * Create a called element representing the given value. + * + * @param {object} attrs + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCalledElement(attrs = {}, bpmnFactory) { + return bpmnFactory.create('zeebe:CalledElement', attrs); +} - groupNode.appendChild(entryNode); +/** + * Retrieves whether an element should be updated for a given property. + * + * That matches once + * a) the property value is not empty, or + * b) the property is not optional + * + * @param {String} value + * @param {Object} property + * @returns {Boolean} + */ +function shouldUpdate(value, property) { + const { + optional + } = property; + return value || !optional; +} + +/** + * Gets or, in case not existent, creates extension element for given element. + * + * @param {djs.model.Base} element + * @param {String} type + * @param {BpmnFactory} bpmnFactory + * @returns {ModdleElement} + */ +function ensureExtension(element, type, bpmnFactory) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', {}, businessObject, bpmnFactory); + businessObject.set('extensionElements', extensionElements); + } + let extension = findExtension$1(extensionElements, type); + if (!extension) { + extension = bpmnFactory.create(type); + extension.$parent = extensionElements; + extensionElements.get('values').push(extension); + } + return extension; +} + +const PROPERTY_TYPE$1 = 'property'; +const ZEBBE_PROPERTY_TYPE = 'zeebe:property'; +const ZEBBE_INPUT_TYPE = 'zeebe:input'; +const ZEEBE_OUTPUT_TYPE = 'zeebe:output'; +const ZEEBE_PROPERTY_TYPE = 'zeebe:property'; +const ZEEBE_TASK_DEFINITION_TYPE_TYPE = 'zeebe:taskDefinition:type'; +const ZEEBE_TASK_DEFINITION = 'zeebe:taskDefinition'; +const ZEEBE_TASK_HEADER_TYPE = 'zeebe:taskHeader'; +const MESSAGE_PROPERTY_TYPE = 'bpmn:Message#property'; +const MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE = 'bpmn:Message#zeebe:subscription#property'; +const ZEEBE_CALLED_ELEMENT = 'zeebe:calledElement'; +const EXTENSION_BINDING_TYPES$1 = [MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE, ZEBBE_INPUT_TYPE, ZEEBE_OUTPUT_TYPE, ZEEBE_PROPERTY_TYPE, ZEEBE_TASK_DEFINITION_TYPE_TYPE, ZEEBE_TASK_DEFINITION, ZEEBE_TASK_HEADER_TYPE, ZEEBE_CALLED_ELEMENT]; +const TASK_DEFINITION_TYPES = [ZEEBE_TASK_DEFINITION_TYPE_TYPE, ZEEBE_TASK_DEFINITION]; +const IO_BINDING_TYPES$1 = [ZEBBE_INPUT_TYPE, ZEEBE_OUTPUT_TYPE]; +const MESSAGE_BINDING_TYPES = [MESSAGE_PROPERTY_TYPE, MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE]; +const PROPERTY_BINDING_TYPES = [PROPERTY_TYPE$1, MESSAGE_PROPERTY_TYPE]; + +function getTaskDefinitionPropertyName(binding) { + return binding.type === ZEEBE_TASK_DEFINITION_TYPE_TYPE ? 'type' : binding.property; +} + +function removeRootElement(rootElement, injector) { + const modeling = injector.get('modeling'), + canvas = injector.get('canvas'), + bpmnjs = injector.get('bpmnjs'); + const element = canvas.getRootElement(), + definitions = bpmnjs.getDefinitions(), + rootElements = definitions.get('rootElements'); + const newRootElements = rootElements.filter(e => e !== rootElement); + + // short-circuit to prevent unnecessary updates + if (newRootElements.length === rootElements.length) { + return; + } + modeling.updateModdleProperties(element, definitions, { + rootElements: newRootElements + }); +} + +/** + * Remove message from element and the diagram. + * + * @param {import('bpmn-js/lib/model/Types').Element} element + * @param {import('didi').Injector} injector + */ +function removeMessage(element, injector) { + const modeling = injector.get('modeling'); + const bo = getReferringElement(element); + + // Event does not have an event definition + if (!bo) { + return; + } + const message = findMessage(bo); + if (!message) { + return; + } + modeling.updateModdleProperties(element, bo, { + messageRef: undefined + }); + removeRootElement(message, injector); +} +function getReferringElement(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(bo, 'bpmn:Event')) { + return bo.get('eventDefinitions')[0]; + } + return bo; +} + +/** + * Applies an element template to an element. Sets `zeebe:modelerTemplate` and + * `zeebe:modelerTemplateVersion`. + */ +let ChangeElementTemplateHandler$1 = class ChangeElementTemplateHandler { + constructor(bpmnFactory, bpmnReplace, commandStack, injector) { + this._bpmnFactory = bpmnFactory; + this._bpmnReplace = bpmnReplace; + + // Wrap commandStack and modeling to add hints to all commands + this._commandStackWrapper = { + execute: (event, context, ...rest) => { + commandStack.execute(event, { + hints: { + skipConditionUpdate: true + }, + ...context + }, ...rest); + } + }; + this._modelingWrapper = { + updateModdleProperties: (element, moddleElement, properties) => this._commandStackWrapper.execute('element.updateModdleProperties', { + element, + moddleElement, + properties + }), + updateProperties: (element, properties) => this._commandStackWrapper.execute('element.updateProperties', { + element, + properties + }) + }; + this._injector = injector; + } + + /** + * Change an element's template and update its properties as specified in `newTemplate`. Specify + * `oldTemplate` to update from one template to another. If `newTemplate` isn't specified the + * `zeebe:modelerTemplate` and `zeebe:modelerTemplateVersion` properties will be removed from + * the element. + * + * @param {Object} context + * @param {Object} context.element + * @param {Object} [context.oldTemplate] + * @param {Object} [context.newTemplate] + */ + preExecute(context) { + let newTemplate = context.newTemplate, + oldTemplate = context.oldTemplate; + let element = context.element; + + // update zeebe:modelerTemplate attribute + this._updateZeebeModelerTemplate(element, newTemplate); + + // update zeebe:modelerTemplateIcon + this._updateZeebeModelerTemplateIcon(element, newTemplate); + if (newTemplate) { + // update element type + element = context.element = this._updateElementType(element, oldTemplate, newTemplate); + + // update properties + this._updateProperties(element, oldTemplate, newTemplate); + + // update zeebe:TaskDefinition + this._updateZeebeTaskDefinition(element, oldTemplate, newTemplate); + + // update zeebe:Input and zeebe:Output properties + this._updateZeebeInputOutputParameterProperties(element, oldTemplate, newTemplate); + + // update zeebe:Header properties + this._updateZeebeTaskHeaderProperties(element, oldTemplate, newTemplate); + + // update zeebe:Property properties + this._updateZeebePropertyProperties(element, oldTemplate, newTemplate); + this._updateMessage(element, oldTemplate, newTemplate); + this._updateCalledElement(element, oldTemplate, newTemplate); + } + } + _getOrCreateExtensionElements(element, businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element)) { + const bpmnFactory = this._bpmnFactory, + modeling = this._modelingWrapper; + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = bpmnFactory.create('bpmn:ExtensionElements', { + values: [] + }); + extensionElements.$parent = businessObject; + modeling.updateModdleProperties(element, businessObject, { + extensionElements: extensionElements + }); + } + return extensionElements; + } + _updateZeebeModelerTemplate(element, newTemplate) { + const modeling = this._modelingWrapper; + modeling.updateProperties(element, { + 'zeebe:modelerTemplate': newTemplate && newTemplate.id, + 'zeebe:modelerTemplateVersion': newTemplate && newTemplate.version + }); + } + _updateZeebeModelerTemplateIcon(element, newTemplate) { + const modeling = this._modelingWrapper; + const icon = newTemplate && newTemplate.icon; + modeling.updateProperties(element, { + 'zeebe:modelerTemplateIcon': icon && icon.contents + }); + } + _updateProperties(element, oldTemplate, newTemplate) { + const commandStack = this._commandStackWrapper; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'property'; + }); + + // Remove old Properties if no new Properties specified + const propertiesToRemove = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === 'property' && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name); + }) || []; + if (propertiesToRemove.length) { + const payload = propertiesToRemove.reduce((properties, property) => { + properties[property.binding.name] = undefined; + return properties; + }, {}); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: payload + }); + } + if (!newProperties.length) { + return; + } + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newPropertyValue = getDefaultValue(newProperty), + changedElement = businessObject; + let properties = {}; + if (shouldKeepValue(changedElement, oldProperty, newProperty)) { + return; + } + properties[newBindingName] = newPropertyValue; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties + }); + }); + } + + /** + * Update `zeebe:TaskDefinition` properties of specified business object. This + * can only exist in `bpmn:ExtensionElements`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateZeebeTaskDefinition(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStackWrapper; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return TASK_DEFINITION_TYPES.includes(newBindingType); + }); + const businessObject = this._getOrCreateExtensionElements(element); + let taskDefinition = findExtension$1(businessObject, 'zeebe:TaskDefinition'); + + // (1) remove old task definition if no new properties specified + + if (!newProperties.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get('values'), taskDefinition) + } + }); + return; + } + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + newPropertyValue = getDefaultValue(newProperty), + newBinding = newProperty.binding, + propertyName = getTaskDefinitionPropertyName(newBinding); + + // (2) update old task definition + if (taskDefinition) { + if (!shouldKeepValue(taskDefinition, oldProperty, newProperty)) { + const properties = { + [propertyName]: newPropertyValue + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: taskDefinition, + properties + }); + } + } + + // (3) add new task definition + else { + const properties = { + [propertyName]: newPropertyValue + }; + taskDefinition = createTaskDefinition(properties, bpmnFactory); + taskDefinition.$parent = businessObject; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), taskDefinition] + } + }); + } + }); + + // (4) remove properties no longer templated + const oldProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return TASK_DEFINITION_TYPES.includes(oldBindingType) && !newProperties.find(newProperty => newProperty.binding.property === oldProperty.binding.property); + }) || []; + oldProperties.forEach(oldProperty => { + const properties = { + [oldProperty.binding.property]: undefined + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: taskDefinition, + properties + }); + }); + } + + /** + * Update `zeebe:Input` and `zeebe:Output` properties of specified business + * object. Both can only exist in `zeebe:ioMapping` which can exist in `bpmn:ExtensionElements`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateZeebeInputOutputParameterProperties(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStackWrapper; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'zeebe:input' || newBindingType === 'zeebe:output'; + }); + const businessObject = this._getOrCreateExtensionElements(element); + let ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping'); + + // (1) remove old mappings if no new specified + if (!newProperties.length) { + if (!ioMapping) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get('values'), ioMapping) + } + }); + } + if (!ioMapping) { + ioMapping = bpmnFactory.create('zeebe:IoMapping'); + ioMapping.$parent = businessObject; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), ioMapping] + } + }); + } + const oldInputs = ioMapping.get('zeebe:inputParameters') ? ioMapping.get('zeebe:inputParameters').slice() : []; + const oldOutputs = ioMapping.get('zeebe:outputParameters') ? ioMapping.get('zeebe:outputParameters').slice() : []; + let propertyName; + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + inputOrOutput = findBusinessObject(businessObject, newProperty), + newPropertyValue = getDefaultValue(newProperty), + newBinding = newProperty.binding, + newBindingType = newBinding.type; + let newInputOrOutput, properties; + + // (2) update old inputs and outputs + if (inputOrOutput) { + // (2a) exclude old inputs and outputs from cleanup, unless + // a) optional and has empty value, and + // b) not changed + if (shouldUpdate(newPropertyValue, newProperty) || shouldKeepValue(inputOrOutput, oldProperty, newProperty)) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(inputOrOutput, 'zeebe:Input')) { + remove$1(oldInputs, inputOrOutput); + } else { + remove$1(oldOutputs, inputOrOutput); + } + } + + // (2a) do updates (unless changed) + if (!shouldKeepValue(inputOrOutput, oldProperty, newProperty)) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(inputOrOutput, 'zeebe:Input')) { + properties = { + source: newPropertyValue + }; + } else { + properties = { + target: newPropertyValue + }; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOrOutput, + properties + }); + } + } + + // (3) add new inputs and outputs (unless optional) + else if (shouldUpdate(newPropertyValue, newProperty)) { + if (newBindingType === 'zeebe:input') { + propertyName = 'inputParameters'; + newInputOrOutput = createInputParameter$1(newBinding, newPropertyValue, bpmnFactory); + } else { + propertyName = 'outputParameters'; + newInputOrOutput = createOutputParameter$1(newBinding, newPropertyValue, bpmnFactory); + } + newInputOrOutput.$parent = ioMapping; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: ioMapping, + properties: { + [propertyName]: [...ioMapping.get(propertyName), newInputOrOutput] + } + }); + } + }); + + // (4) remove old inputs and outputs + if (oldInputs.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: ioMapping, + properties: { + inputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(ioMapping.get('inputParameters'), inputParameter => oldInputs.includes(inputParameter)) + } + }); + } + if (oldOutputs.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: ioMapping, + properties: { + outputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(ioMapping.get('outputParameters'), outputParameter => oldOutputs.includes(outputParameter)) + } + }); + } + } + + /** + * Update `zeebe:Header` properties of specified business + * object. Those can only exist in `zeebe:taskHeaders` which can exist in `bpmn:ExtensionElements`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateZeebeTaskHeaderProperties(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStackWrapper; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'zeebe:taskHeader'; + }); + const businessObject = this._getOrCreateExtensionElements(element); + let taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders'); + + // (1) remove old headers if no new specified + if (!newProperties.length) { + if (!taskHeaders) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get('values'), taskHeaders) + } + }); + } + if (!taskHeaders) { + taskHeaders = bpmnFactory.create('zeebe:TaskHeaders'); + taskHeaders.$parent = businessObject; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), taskHeaders] + } + }); + } + const oldHeaders = taskHeaders.get('zeebe:values') ? taskHeaders.get('zeebe:values').slice() : []; + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + oldHeader = findBusinessObject(businessObject, newProperty), + newPropertyValue = getDefaultValue(newProperty), + newBinding = newProperty.binding; + + // (2) update old headers + if (oldHeader) { + if (!shouldKeepValue(oldHeader, oldProperty, newProperty)) { + const properties = { + value: newPropertyValue + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldHeader, + properties + }); + } + remove$1(oldHeaders, oldHeader); + } + + // (3) add new (non-empty) headers + else if (newPropertyValue) { + const newHeader = createTaskHeader(newBinding, newPropertyValue, bpmnFactory); + newHeader.$parent = taskHeaders; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: taskHeaders, + properties: { + values: [...taskHeaders.get('values'), newHeader] + } + }); + } + }); + + // (4) remove old headers + if (oldHeaders.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: taskHeaders, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(taskHeaders.get('values'), header => oldHeaders.includes(header)) + } + }); + } + } + + /** + * Update zeebe:Property properties of zeebe:Properties extension element. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateZeebePropertyProperties(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStackWrapper; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'zeebe:property'; + }); + const businessObject = this._getOrCreateExtensionElements(element); + let zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties'); + + // (1) remove old zeebe:Properties if no new zeebe:Property properties + if (!newProperties.length) { + if (!zeebeProperties) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get('values'), zeebeProperties) + } + }); + } + if (!zeebeProperties) { + zeebeProperties = bpmnFactory.create('zeebe:Properties'); + zeebeProperties.$parent = businessObject; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), zeebeProperties] + } + }); + } + const oldZeebeProperties = zeebeProperties.get('properties') ? zeebeProperties.get('properties').slice() : []; + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + oldZeebeProperty = findBusinessObject(businessObject, newProperty), + newPropertyValue = getDefaultValue(newProperty), + newBinding = newProperty.binding; + + // (2) update old zeebe:Property + if (oldZeebeProperty) { + if (shouldUpdate(newPropertyValue, newProperty) || shouldKeepValue(oldZeebeProperty, oldProperty, newProperty)) { + remove$1(oldZeebeProperties, oldZeebeProperty); + } + if (!shouldKeepValue(oldZeebeProperty, oldProperty, newProperty)) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldZeebeProperty, + properties: { + value: newPropertyValue + } + }); + } + } + + // (3) add new zeebe:Property + else if (shouldUpdate(newPropertyValue, newProperty)) { + const newProperty = createZeebeProperty(newBinding, newPropertyValue, bpmnFactory); + newProperty.$parent = zeebeProperties; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: zeebeProperties, + properties: { + properties: [...zeebeProperties.get('properties'), newProperty] + } + }); + } + }); + + // (4) remove old zeebe:Property + if (oldZeebeProperties.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: zeebeProperties, + properties: { + properties: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(zeebeProperties.get('properties'), zeebeProperty => oldZeebeProperties.includes(zeebeProperty)) + } + }); + } + } + _updateMessage(element, oldTemplate, newTemplate) { + // update bpmn:Message properties + this._updateMessageProperties(element, oldTemplate, newTemplate); + + // update bpmn:Message zeebe:subscription properties + this._updateMessageZeebeSubscriptionProperties(element, oldTemplate, newTemplate); + this._updateZeebeModelerTemplateOnReferencedElement(element, oldTemplate, newTemplate); + if (!hasMessageProperties(newTemplate)) { + removeMessage(element, this._injector); + } + } + + /** + * Update bpmn:Message properties. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateMessageProperties(element, oldTemplate, newTemplate) { + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === MESSAGE_PROPERTY_TYPE; + }); + const removedProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === MESSAGE_PROPERTY_TYPE && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name); + }) || []; + let message = this._getMessage(element); + message && removedProperties.forEach(removedProperty => { + this._modelingWrapper.updateModdleProperties(element, message, { + [removedProperty.binding.name]: undefined + }); + }); + if (!newProperties.length) { + return; + } + message = this._getOrCreateMessage(element, newTemplate); + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newPropertyValue = getDefaultValue(newProperty), + changedElement = message; + let properties = {}; + if (shouldKeepValue(changedElement, oldProperty, newProperty)) { + return; + } + properties[newBindingName] = newPropertyValue; + this._modelingWrapper.updateModdleProperties(element, changedElement, properties); + }); + } + + /** + * Update bpmn:Message#zeebe:subscription properties. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateMessageZeebeSubscriptionProperties(element, oldTemplate, newTemplate) { + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE; + }); + const removedProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name); + }) || []; + if (!newProperties.length && !removedProperties.length) { + return; + } + const message = this._getOrCreateMessage(element, newTemplate); + const messageExtensionElements = this._getOrCreateExtensionElements(element, message); + const zeebeSubscription = this._getSubscription(element, message); + const propertiesToSet = newProperties.reduce((properties, newProperty) => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newPropertyValue = getDefaultValue(newProperty), + changedElement = zeebeSubscription; + if (shouldKeepValue(changedElement, oldProperty, newProperty)) { + return properties; + } + properties[newBindingName] = newPropertyValue; + return properties; + }, {}); + + // Update zeebe Subscription + if (zeebeSubscription) { + this._modelingWrapper.updateModdleProperties(element, zeebeSubscription, propertiesToSet); + } else { + // create new Subscription + const newSubscription = createElement('zeebe:Subscription', propertiesToSet, message, this._bpmnFactory); + this._modelingWrapper.updateModdleProperties(element, messageExtensionElements, { + values: [...messageExtensionElements.get('values'), newSubscription] + }); + } + + // Remove old properties + if (!oldTemplate || !zeebeSubscription) { + return; + } + const propertiesToRemove = removedProperties.reduce((properties, removedProperty) => { + properties[removedProperty.binding.name] = undefined; + return properties; + }, {}); + this._modelingWrapper.updateModdleProperties(element, zeebeSubscription, propertiesToRemove); + } + _updateZeebeModelerTemplateOnReferencedElement(element, oldTemplate, newTemplate) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const message = findMessage(businessObject); + if (!message) { + return; + } + if (getTemplateId$1(message) === newTemplate.id) { + return; + } + this._modelingWrapper.updateModdleProperties(element, message, { + 'zeebe:modelerTemplate': newTemplate.id + }); + } + _getSubscription(element, bo) { + const extensionElements = this._getOrCreateExtensionElements(element, bo); + const extension = findExtension$1(extensionElements, 'zeebe:Subscription'); + if (extension) { + return extension; + } + } + _getOrCreateMessage(element, template) { + return this._getMessage(element) || this._createMessage(element, template); + } + _createMessage(element, template) { + let bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(bo, 'bpmn:Event')) { + bo = bo.get('eventDefinitions')[0]; + } + const message = this._bpmnFactory.create('bpmn:Message', { + 'zeebe:modelerTemplate': template.id + }); + message.$parent = getRoot(bo); + this._modelingWrapper.updateModdleProperties(element, bo, { + messageRef: message + }); + return message; + } + _getMessage(element) { + let bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(bo, 'bpmn:Event')) { + bo = bo.get('eventDefinitions')[0]; + } + return bo && bo.get('messageRef'); + } + + /** + * Update `zeebe:CalledElement` properties of specified business object. This + * can only exist in `bpmn:ExtensionElements`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateCalledElement(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStackWrapper; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === ZEEBE_CALLED_ELEMENT; + }); + const businessObject = this._getOrCreateExtensionElements(element); + let calledElement = findExtension$1(businessObject, 'zeebe:CalledElement'); + + // (1) remove old called element if no new properties specified + if (!newProperties.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get('values'), calledElement) + } + }); + return; + } + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty$1(oldTemplate, newProperty), + newPropertyValue = getDefaultValue(newProperty), + propertyName = newProperty.binding.property; + + // (2) update old called element + if (calledElement) { + if (!shouldKeepValue(calledElement, oldProperty, newProperty)) { + const properties = { + [propertyName]: newPropertyValue + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: calledElement, + properties + }); + } + } + + // (3) add new called element + else { + const properties = { + [propertyName]: newPropertyValue + }; + calledElement = createCalledElement(properties, bpmnFactory); + calledElement.$parent = businessObject; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), calledElement] + } + }); + } + }); + + // (4) remove properties no longer templated + const oldProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === ZEEBE_CALLED_ELEMENT && !newProperties.find(newProperty => newProperty.binding.property === oldProperty.binding.property); + }) || []; + oldProperties.forEach(oldProperty => { + const properties = { + [oldProperty.binding.property]: undefined + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: calledElement, + properties + }); + }); + } + + /** + * Replaces the element with the specified elementType. + * Takes into account the eventDefinition for events. + * + * @param {djs.model.Base} element + * @param {Object} newTemplate + */ + _updateElementType(element, oldTemplate, newTemplate) { + // determine new task type + const newType = newTemplate.elementType; + if (!newType) { + return element; + } + const oldType = oldTemplate && oldTemplate.elementType; + + // Do not replace if the element type did not change + if (oldType && oldType.value === newType.value && oldType.eventDefinition === newType.eventDefinition) { + return element; + } + const replacement = { + type: newType.value + }; + if (newType.eventDefinition) { + replacement.eventDefinitionType = newType.eventDefinition; + } + const replacedElement = this._bpmnReplace.replaceElement(element, replacement); + return replacedElement; + } +}; +ChangeElementTemplateHandler$1.$inject = ['bpmnFactory', 'bpmnReplace', 'commandStack', 'injector']; + +// helpers ////////// + +/** + * Find business object matching specified property. + * + * @param {djs.model.Base|ModdleElement} element + * @param {Object} property + * + * @returns {ModdleElement} + */ +function findBusinessObject(element, property) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const binding = property.binding, + bindingType = binding.type; + if (TASK_DEFINITION_TYPES.includes(bindingType)) { + return findExtension$1(businessObject, 'zeebe:TaskDefinition'); + } + if (bindingType === 'zeebe:input' || bindingType === 'zeebe:output') { + const extensionElements = findExtension$1(businessObject, 'zeebe:IoMapping'); + if (!extensionElements) { + return; + } + if (bindingType === 'zeebe:input') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(extensionElements.get('zeebe:inputParameters'), function (input) { + return input.get('zeebe:target') === binding.name; + }); + } else { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(extensionElements.get('zeebe:outputParameters'), function (output) { + return output.get('zeebe:source') === binding.source; + }); + } + } + if (bindingType === 'zeebe:taskHeader') { + const extensionElements = findExtension$1(businessObject, 'zeebe:TaskHeaders'); + if (!extensionElements) { + return; + } + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(extensionElements.get('zeebe:values'), function (value) { + return value.get('zeebe:key') === binding.key; + }); + } + if (bindingType === 'zeebe:property') { + const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties'); + if (!zeebeProperties) { + return; + } + return zeebeProperties.get('properties').find(value => { + return value.get('name') === binding.name; + }); + } +} + +/** + * Find old property matching specified new property. + * + * @param {Object} oldTemplate + * @param {Object} newProperty + * + * @returns {Object} + */ +function findOldProperty$1(oldTemplate, newProperty) { + if (!oldTemplate) { + return; + } + const oldProperties = oldTemplate.properties, + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newBindingType = newBinding.type; + if (newBindingType === 'property') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + return oldBindingType === 'property' && oldBindingName === newBindingName; + }); + } + if (TASK_DEFINITION_TYPES.includes(newBindingType)) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldPropertyName = getTaskDefinitionPropertyName(oldBinding), + newPropertyName = getTaskDefinitionPropertyName(newBinding); + return oldPropertyName === newPropertyName; + }); + } + if (newBindingType === 'zeebe:input') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'zeebe:input') { + return; + } + return oldBindingName === newBindingName; + }); + } + if (newBindingType === 'zeebe:output') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'zeebe:output') { + return; + } + return oldBinding.source === newBinding.source; + }); + } + if (newBindingType === 'zeebe:taskHeader') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'zeebe:taskHeader') { + return; + } + return oldBinding.key === newBinding.key; + }); + } + if (newBindingType === 'zeebe:property') { + return oldProperties.find(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'zeebe:property') { + return; + } + return oldBinding.name === newBinding.name; + }); + } + if (newBindingType === MESSAGE_PROPERTY_TYPE) { + return oldProperties.find(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== MESSAGE_PROPERTY_TYPE) { + return; + } + return oldBinding.name === newBinding.name; + }); + } + if (newBindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) { + return oldProperties.find(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) { + return; + } + return oldBinding.name === newBinding.name; + }); + } +} + +/** + * Check whether the existing property should be keept. This is the case if + * - an old template was set and the value differs from the default + * - no template was set but the property was set manually + * + * @param {djs.model.Base|ModdleElement} element + * @param {Object} oldProperty + * @param {Object} newProperty + * + * @returns {boolean} + */ +function shouldKeepValue(element, oldProperty, newProperty) { + // "Hidden" values are treated as a constant + if (newProperty.type === 'Hidden') { + return false; + } + + // Dropdowns should keep existing configuration + // cf. https://github.com/bpmn-io/bpmn-js-properties-panel/issues/767 + if (newProperty.type === 'Dropdown') { + const currentValue = getPropertyValue$1(element, newProperty); + + // only keep value if old value is a valid option + return newProperty.choices && newProperty.choices.some(choice => choice.value === currentValue); + } + + // keep existing old property if + // user changed it from the original + if (oldProperty) { + return propertyChanged$1(element, oldProperty); + } + + // keep existing property value + return !!getPropertyValue$1(element, newProperty); +} + +/** + * Check whether property was changed after being set by template. + * + * @param {djs.model.Base|ModdleElement} element + * @param {Object} oldProperty + * + * @returns {boolean} + */ +function propertyChanged$1(element, oldProperty) { + const oldPropertyValue = oldProperty.value; + return getPropertyValue$1(element, oldProperty) !== oldPropertyValue; +} +function getPropertyValue$1(element, property) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if (!businessObject) { + return; + } + const binding = property.binding, + bindingName = binding.name, + bindingType = binding.type; + if (bindingType === 'property') { + return businessObject.get(bindingName); + } + if (TASK_DEFINITION_TYPES.includes(bindingType)) { + return businessObject.get(getTaskDefinitionPropertyName(binding)); + } + if (bindingType === 'zeebe:input') { + return businessObject.get('zeebe:source'); + } + if (bindingType === 'zeebe:output') { + return businessObject.get('zeebe:target'); + } + if (bindingType === 'zeebe:taskHeader') { + return businessObject.get('zeebe:value'); + } + if (bindingType === 'zeebe:property') { + return businessObject.get('zeebe:value'); + } + if (bindingType === MESSAGE_PROPERTY_TYPE) { + return businessObject.get(bindingName); + } + if (bindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) { + return businessObject.get(bindingName); + } +} +function remove$1(array, item) { + const index = array.indexOf(item); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(index)) { + return array; + } + array.splice(index, 1); + return array; +} +function hasMessageProperties(template) { + return template.properties.some(p => MESSAGE_BINDING_TYPES.includes(p.binding.type)); +} + +class RemoveElementTemplateHandler { + constructor(modeling, elementFactory, elementRegistry, canvas, bpmnFactory, replace, commandStack) { + this._modeling = modeling; + this._elementFactory = elementFactory; + this._elementRegistry = elementRegistry; + this._canvas = canvas; + this._bpmnFactory = bpmnFactory; + this._replace = replace; + this._commandStack = commandStack; + } + preExecute(context) { + const { + element + } = context; + if (element.parent) { + context.newElement = this._removeTemplate(element); + } else { + context.newElement = this._removeRootTemplate(element); + } + } + _removeTemplate(element) { + const replace = this._replace; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const type = businessObject.$type, + eventDefinitionType = this._getEventDefinitionType(businessObject); + const newBusinessObject = this._createBlankBusinessObject(element); + return replace.replaceElement(element, { + type: type, + businessObject: newBusinessObject, + eventDefinitionType: eventDefinitionType + }, { + createElementsBehavior: false + }); + } + + /** + * Remove template from a given element. + * + * @param {djs.model.Base} element + * + * @return {djs.model.Base} the updated element + */ + _removeRootTemplate(element) { + var modeling = this._modeling, + elementFactory = this._elementFactory, + elementRegistry = this._elementRegistry, + canvas = this._canvas; + + // We are inside a collapsed subprocess, move up to the parent before replacing the collapsed object + if ((0,bpmn_js_lib_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_14__.isPlane)(element)) { + const shapeId = (0,bpmn_js_lib_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_14__.getShapeIdFromPlane)(element); + const shape = elementRegistry.get(shapeId); + if (shape && shape !== element) { + canvas.setRootElement(canvas.findRoot(shape)); + return this._removeTemplate(shape); + } + } + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const type = businessObject.$type; + const newBusinessObject = this._createBlankBusinessObject(element); + const newRoot = elementFactory.create('root', { + type: type, + businessObject: newBusinessObject + }); + this._commandStack.execute('canvas.updateRoot', { + newRoot: newRoot, + oldRoot: element + }); + modeling.moveElements(element.children, { + x: 0, + y: 0 + }, newRoot); + return newRoot; + } + _getEventDefinitionType(businessObject) { + if (!businessObject.eventDefinitions) { + return null; + } + const eventDefinition = businessObject.eventDefinitions[0]; + if (!eventDefinition) { + return null; + } + return eventDefinition.$type; + } + _createBlankBusinessObject(element) { + const bpmnFactory = this._bpmnFactory; + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + newBo = bpmnFactory.create(bo.$type), + label = (0,bpmn_js_lib_features_label_editing_LabelUtil__WEBPACK_IMPORTED_MODULE_15__.getLabel)(element); + if (!label) { + return newBo; + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'bpmn:Group')) { + newBo.categoryValueRef = bpmnFactory.create('bpmn:CategoryValue'); + } + (0,bpmn_js_lib_features_label_editing_LabelUtil__WEBPACK_IMPORTED_MODULE_15__.setLabel)({ + businessObject: newBo + }, label); + return newBo; + } +} +RemoveElementTemplateHandler.$inject = ['modeling', 'elementFactory', 'elementRegistry', 'canvas', 'bpmnFactory', 'replace', 'commandStack']; + +/** + * A handler that combines and executes multiple commands. + * + * All updates are bundled on the command stack and executed in one step. + * This also makes it possible to revert the changes in one step. + * + * Example use case: remove the camunda:formKey attribute and in addition + * add all form fields needed for the camunda:formData property. + */ +class MultiCommandHandler { + constructor(commandStack) { + this._commandStack = commandStack; + } + preExecute(context) { + const commandStack = this._commandStack; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(context, function (command) { + commandStack.execute(command.cmd, command.context); + }); + } +} +MultiCommandHandler.$inject = ['commandStack']; + +function registerHandlers$1(commandStack, elementTemplates, eventBus) { + commandStack.registerHandler('element-templates.multi-command-executor', MultiCommandHandler); + commandStack.registerHandler('propertiesPanel.zeebe.changeTemplate', ChangeElementTemplateHandler$1); + commandStack.registerHandler('propertiesPanel.removeTemplate', RemoveElementTemplateHandler); + + // apply default element templates on shape creation + eventBus.on(['commandStack.shape.create.postExecuted'], function (event) { + const { + context: { + hints = {}, + shape + } + } = event; + if (hints.createElementsBehavior !== false) { + applyDefaultTemplate$1(shape, elementTemplates, commandStack); + } + }); + + // apply default element templates on connection creation + eventBus.on(['commandStack.connection.create.postExecuted'], function (event) { + const { + context: { + hints = {}, + connection + } + } = event; + if (hints.createElementsBehavior !== false) { + applyDefaultTemplate$1(connection, elementTemplates, commandStack); + } + }); +} +registerHandlers$1.$inject = ['commandStack', 'elementTemplates', 'eventBus']; +var commandsModule$1 = { + __init__: [registerHandlers$1] +}; +function applyDefaultTemplate$1(element, elementTemplates, commandStack) { + if (!elementTemplates.get(element) && elementTemplates.getDefault(element)) { + const command = 'propertiesPanel.zeebe.changeTemplate'; + const commandContext = { + element: element, + newTemplate: elementTemplates.getDefault(element) + }; + commandStack.execute(command, commandContext); + } +} + +class PropertyBindingProvider { + static create(element, options) { + const { + property + } = options; + const { + binding + } = property; + const { + name + } = binding; + const value = getDefaultValue(property); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + businessObject[name] = value; + } +} + +class TaskDefinitionTypeBindingProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const value = getDefaultValue(property); + const propertyName = getTaskDefinitionPropertyName(property.binding); + const taskDefinition = ensureExtension(element, 'zeebe:TaskDefinition', bpmnFactory); + taskDefinition.set(propertyName, value); + } +} + +class InputBindingProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const { + binding + } = property; + const value = getDefaultValue(property); + const ioMapping = ensureExtension(element, 'zeebe:IoMapping', bpmnFactory); + if (!shouldUpdate(value, property)) { + return; + } + const input = createInputParameter$1(binding, value, bpmnFactory); + input.$parent = ioMapping; + ioMapping.get('inputParameters').push(input); + } +} + +class OutputBindingProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const { + binding + } = property; + const value = getDefaultValue(property); + const ioMapping = ensureExtension(element, 'zeebe:IoMapping', bpmnFactory); + if (!shouldUpdate(value, property)) { + return; + } + const output = createOutputParameter$1(binding, value, bpmnFactory); + output.$parent = ioMapping; + ioMapping.get('outputParameters').push(output); + } +} + +class TaskHeaderBindingProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const { + binding + } = property; + const value = getDefaultValue(property); + const taskHeaders = ensureExtension(element, 'zeebe:TaskHeaders', bpmnFactory); + const header = createTaskHeader(binding, value, bpmnFactory); + header.$parent = taskHeaders; + taskHeaders.get('values').push(header); + } +} + +class ZeebePropertiesProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const { + binding + } = property; + const value = getDefaultValue(property); + const zeebeProperties = ensureExtension(element, 'zeebe:Properties', bpmnFactory); + if (!shouldUpdate(value, property)) { + return; + } + const zeebeProperty = createZeebeProperty(binding, value, bpmnFactory); + zeebeProperty.$parent = zeebeProperties; + zeebeProperties.get('properties').push(zeebeProperty); + } +} + +class MessagePropertyBindingProvider { + static create(element, options) { + const { + bpmnFactory, + property + } = options; + const { + binding + } = property; + const { + name + } = binding; + const value = getDefaultValue(property); + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:Event')) { + businessObject = businessObject.get('eventDefinitions')[0]; + } + let message = businessObject.get('messageRef'); + if (!message) { + message = bpmnFactory.create('bpmn:Message', { + 'zeebe:modelerTemplate': getTemplateId$1(element) + }); + businessObject.set('messageRef', message); + } + message.set(name, value); + } +} + +class MessageZeebeSubscriptionBindingProvider { + static create(element, options) { + const { + bpmnFactory, + property + } = options; + const { + binding + } = property; + const { + name + } = binding; + const value = getDefaultValue(property); + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:Event')) { + businessObject = businessObject.get('eventDefinitions')[0]; + } + let message = businessObject.get('messageRef'); + if (!message) { + message = bpmnFactory.create('bpmn:Message', { + 'zeebe:modelerTemplate': getTemplateId$1(element) + }); + businessObject.set('messageRef', message); + } + const subscription = ensureExtension(message, 'zeebe:Subscription', bpmnFactory); + if (!shouldUpdate(value, property)) { + return; + } + subscription.set(name, value); + } +} + +class CalledElementBindingProvider { + static create(element, options) { + const { + property, + bpmnFactory + } = options; + const { + binding + } = property; + const { + property: propertyName + } = binding; + const value = getDefaultValue(property); + const calledElement = ensureExtension(element, 'zeebe:CalledElement', bpmnFactory); + + // TODO(@barmac): remove if we decide to support propagation in templates + ensureNoPropagation(calledElement); + calledElement.set(propertyName, value); + } +} +function ensureNoPropagation(calledElement) { + calledElement.set('propagateAllChildVariables', false); + calledElement.set('propagateAllParentVariables', false); +} + +const PRIMITIVE_MODDLE_TYPES$1 = ['Boolean', 'Integer', 'String']; +function getPropertyValue(element, property, scope) { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const defaultValue = ''; + const { + binding + } = property; + const { + name, + property: bindingProperty, + type + } = binding; + + // property + if (type === 'property') { + const value = businessObject.get(name); + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(value)) { + return value; + } + return defaultValue; + } + + // zeebe:taskDefinition + if (TASK_DEFINITION_TYPES.includes(type)) { + const taskDefinition = findExtension$1(businessObject, 'zeebe:TaskDefinition'); + if (taskDefinition) { + if (type === ZEEBE_TASK_DEFINITION_TYPE_TYPE) { + return taskDefinition.get('type'); + } else if (type === ZEEBE_TASK_DEFINITION) { + return taskDefinition.get(bindingProperty); + } + } + return defaultValue; + } + if (IO_BINDING_TYPES$1.includes(type)) { + const ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping'); + if (!ioMapping) { + return defaultValue; + } + + // zeebe:Input + if (type === ZEBBE_INPUT_TYPE) { + const inputParameter = findInputParameter$1(ioMapping, binding); + if (inputParameter) { + return inputParameter.get('source'); + } + return defaultValue; + } + + // zeebe:Output + if (type === ZEEBE_OUTPUT_TYPE) { + const outputParameter = findOutputParameter$1(ioMapping, binding); + if (outputParameter) { + return outputParameter.get('target'); + } + return defaultValue; + } + } + + // zeebe:taskHeaders + if (type === ZEEBE_TASK_HEADER_TYPE) { + const taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders'); + if (!taskHeaders) { + return defaultValue; + } + const header = findTaskHeader(taskHeaders, binding); + if (header) { + return header.get('value'); + } + return defaultValue; + } + + // zeebe:Property + if (type === ZEEBE_PROPERTY_TYPE) { + const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties'); + if (zeebeProperties) { + const zeebeProperty = findZeebeProperty(zeebeProperties, binding); + if (zeebeProperty) { + return zeebeProperty.get('value'); + } + } + return defaultValue; + } + + // bpmn:Message#property + if (type === MESSAGE_PROPERTY_TYPE) { + const message = findMessage(businessObject); + const value = message ? message.get(name) : undefined; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(value)) { + return value; + } + return defaultValue; + } + + // bpmn:Message#zeebe:subscription#property + if (type === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) { + const message = findMessage(businessObject); + if (message) { + const subscription = findExtension$1(message, 'zeebe:Subscription'); + const value = subscription ? subscription.get(name) : undefined; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(value)) { + return subscription.get(name); + } + } + return defaultValue; + } + + // zeebe:calledElement + if (type === ZEEBE_CALLED_ELEMENT) { + const calledElement = findExtension$1(businessObject, 'zeebe:CalledElement'); + return calledElement ? calledElement.get(bindingProperty) : defaultValue; + } + + // should never throw as templates are validated beforehand + throw unknownBindingError$1(element, property); +} +const NO_OP = null; +function setPropertyValue(bpmnFactory, commandStack, element, property, value) { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const { + binding + } = property; + const { + name, + type + } = binding; + let extensionElements; + let propertyValue; + const commands = []; + const context = { + element, + property + }; + + // ensure message exists + if (MESSAGE_BINDING_TYPES.includes(type)) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:Event')) { + businessObject = businessObject.get('eventDefinitions')[0]; + } + let message = findMessage(businessObject); + if (!message) { + message = bpmnFactory.create('bpmn:Message', { + 'zeebe:modelerTemplate': getTemplateId$1(element) + }); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: businessObject, + properties: { + messageRef: message + } + } + }); + } + businessObject = message; + } + + // ensure extension elements + if (EXTENSION_BINDING_TYPES$1.includes(type)) { + extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', null, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } else { + commands.push(NO_OP); + } + } + + // property + if (PROPERTY_BINDING_TYPES.includes(type)) { + const propertyDescriptor = businessObject.$descriptor.propertiesByName[name]; + + // if property not created yet + if (!propertyDescriptor) { + // make sure we create the property + propertyValue = value || ''; + } else { + const { + type: propertyType + } = propertyDescriptor; + + // do not override non-primitive types + if (!PRIMITIVE_MODDLE_TYPES$1.includes(propertyType)) { + throw new Error(`cannot set property of type <${propertyType}>`); + } + if (propertyType === 'Boolean') { + propertyValue = !!value; + } else if (propertyType === 'Integer') { + propertyValue = parseInt(value, 10); + if (isNaN(propertyValue)) { + // do not set NaN value + propertyValue = undefined; + } + } else { + // make sure we don't remove the property + propertyValue = value || ''; + } + } + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(propertyValue)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: businessObject, + properties: { + [name]: propertyValue + } + } + }); + } else { + commands.push(NO_OP); + } + } + + // zeebe:taskDefinition + if (TASK_DEFINITION_TYPES.includes(type)) { + const oldTaskDefinition = findExtension$1(extensionElements, 'zeebe:TaskDefinition'), + propertyName = getTaskDefinitionPropertyName(binding), + properties = { + [propertyName]: value || '' + }; + if (oldTaskDefinition) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + properties, + moddleElement: oldTaskDefinition + } + }); + } else { + const newTaskDefinition = createTaskDefinition(properties, bpmnFactory); + newTaskDefinition.$parent = businessObject; + const values = extensionElements.get('values'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: extensionElements, + properties: { + values: [...values, newTaskDefinition] + } + } + }); + } + } + if (IO_BINDING_TYPES$1.includes(type)) { + let ioMapping = findExtension$1(extensionElements, 'zeebe:IoMapping'); + if (!ioMapping) { + ioMapping = createElement('zeebe:IoMapping', null, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), ioMapping] + } + } + }); + } + + // zeebe:Input + if (type === ZEBBE_INPUT_TYPE) { + const oldZeebeInputParameter = findInputParameter$1(ioMapping, binding); + const values = ioMapping.get('inputParameters').filter(value => value !== oldZeebeInputParameter); + + // do not persist empty parameters when configured as + if (shouldUpdate(value, property)) { + const newZeebeInputParameter = createInputParameter$1(binding, value, bpmnFactory); + values.push(newZeebeInputParameter); + } + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: ioMapping, + properties: { + inputParameters: [...values] + } + } + }); + } + + // zeebe:Output + if (type === ZEEBE_OUTPUT_TYPE) { + const oldZeebeOutputParameter = findOutputParameter$1(ioMapping, binding); + const values = ioMapping.get('outputParameters').filter(value => value !== oldZeebeOutputParameter); + + // do not persist empty parameters when configured as + if (shouldUpdate(value, property)) { + const newZeebeOutputParameter = createOutputParameter$1(binding, value, bpmnFactory); + values.push(newZeebeOutputParameter); + } + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: ioMapping, + properties: { + 'outputParameters': [...values] + } + } + }); + } + } + + // zeebe:taskHeaders + if (type === ZEEBE_TASK_HEADER_TYPE) { + let taskHeaders = findExtension$1(extensionElements, 'zeebe:TaskHeaders'); + if (!taskHeaders) { + taskHeaders = createElement('zeebe:TaskHeaders', null, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskHeaders] + } + } + }); + } + const oldTaskHeader = findTaskHeader(taskHeaders, binding); + const values = taskHeaders.get('values').filter(value => value !== oldTaskHeader); + + // do not persist task headers with empty value + if (!value) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: taskHeaders, + properties: { + values + } + } + }); + } else { + const newTaskHeader = createTaskHeader(binding, value, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: taskHeaders, + properties: { + values: [...values, newTaskHeader] + } + } + }); + } + } + + // zeebe:Property + if (type === ZEEBE_PROPERTY_TYPE) { + let zeebeProperties = findExtension$1(extensionElements, 'zeebe:Properties'); + if (!zeebeProperties) { + zeebeProperties = createElement('zeebe:Properties', null, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), zeebeProperties] + } + } + }); + } + const oldZeebeProperty = findZeebeProperty(zeebeProperties, binding); + const properties = zeebeProperties.get('properties').filter(property => property !== oldZeebeProperty); + if (shouldUpdate(value, property)) { + const newZeebeProperty = createZeebeProperty(binding, value, bpmnFactory); + properties.push(newZeebeProperty); + } + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: zeebeProperties, + properties: { + properties + } + } + }); + } + + // bpmn:Message#zeebe:subscription#property + if (type === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) { + let subscription = findExtension$1(extensionElements, 'zeebe:Subscription'); + const properties = { + [name]: value || '' + }; + if (subscription) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + properties, + moddleElement: subscription + } + }); + } else { + subscription = createElement('zeebe:Subscription', properties, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), subscription] + } + } + }); + } + } + + // zeebe:calledElement + if (type === ZEEBE_CALLED_ELEMENT) { + let calledElement = findExtension$1(element, 'zeebe:CalledElement'); + const propertyName = binding.property; + const properties = { + [propertyName]: value || '' + }; + if (calledElement) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + properties, + moddleElement: calledElement + } + }); + } else { + calledElement = createElement('zeebe:CalledElement', properties, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledElement] + } + } + }); + } + } + if (commands.length) { + const commandsToExecute = commands.filter(command => command !== NO_OP); + commandsToExecute.length && commandStack.execute('element-templates.multi-command-executor', commandsToExecute); + return; + } + + // should never throw as templates are validated beforehand + throw unknownBindingError$1(element, property); +} + +// TODO(@barmac): fix translate usage (https://github.com/bpmn-io/bpmn-js-element-templates/pull/53#issuecomment-1906203270) +function validateProperty(value, property, translate = defaultTranslate) { + const { + constraints = {}, + label + } = property; + const { + maxLength, + minLength, + notEmpty + } = constraints; + if (notEmpty && isEmpty(value)) { + return `${label} ${translate('must not be empty.')}`; + } + if (maxLength && (value || '').length > maxLength) { + return `${label} ${translate('must have max length {maxLength}.', { + maxLength + })}`; + } + if (minLength && (value || '').length < minLength) { + return `${label} ${translate('must have min length {minLength}.', { + minLength + })}`; + } + let { + pattern + } = constraints; + if (pattern) { + let message; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(pattern)) { + message = pattern.message; + pattern = pattern.value; + } + if (!matchesPattern$1(value, pattern)) { + if (message) { + return `${label} ${translate(message)}`; + } + return `${label} ${translate('must match pattern {pattern}.', { + pattern + })}`; + } + } +} + +// helpers +function unknownBindingError$1(element, property) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const id = businessObject.get('id'); + const { + binding + } = property; + const { + type + } = binding; + return new Error(`unknown binding <${type}> for element <${id}>, this should never happen`); +} +function isEmpty(value) { + if (typeof value === 'string') { + return !value.trim().length; + } + return value === undefined; +} +function matchesPattern$1(string, pattern) { + return new RegExp(pattern).test(string); +} +function defaultTranslate(template, replacements) { + replacements = replacements || {}; + return template.replace(/{([^}]+)}/g, function (_, key) { + return replacements[key] || '{' + key + '}'; + }); +} + +/** + * Based on conditions, remove properties from the template. + */ +function applyConditions(element, elementTemplate) { + const { + properties + } = elementTemplate; + const filteredProperties = properties.filter(property => { + return isPropertyAllowed(element, property) && isConditionMet(element, properties, property); + }); + return { + ...elementTemplate, + properties: filteredProperties + }; +} +function isConditionMet(element, properties, property) { + const { + condition + } = property; + + // If no condition is defined, return true. + if (!condition) { + return true; + } + + // multiple ("and") conditions + if (condition.allMatch) { + const conditions = condition.allMatch; + return conditions.every(condition => isSimpleConditionMet(element, properties, condition)); + } + + // single condition + return isSimpleConditionMet(element, properties, condition); +} +function isSimpleConditionMet(element, properties, condition) { + const { + property, + equals, + oneOf, + isActive + } = condition; + if (typeof isActive !== 'undefined') { + const relatedCondition = properties.find(p => p.id === property); + if (!relatedCondition) { + return !isActive; + } + return isActive ? isConditionMet(element, properties, relatedCondition) : !isConditionMet(element, properties, relatedCondition); + } + const propertyValue = getValue(element, properties, property); + if (equals) { + return propertyValue === equals; + } + if (oneOf) { + return oneOf.includes(propertyValue); + } + return false; +} +function getValue(element, properties, propertyId) { + const property = properties.find(p => p.id === propertyId); + if (!property) { + return; + } + return getPropertyValue(element, property); +} +function isPropertyAllowed(element, property) { + const { + binding + } = property; + const { + type + } = binding; + if (type === 'bpmn:Message#zeebe:subscription#property' && binding.name === 'correlationKey' && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'bpmn:StartEvent') && !(0,bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_16__.isEventSubProcess)(element.parent)) { + return false; + } + return true; +} + +class TemplateElementFactory { + constructor(bpmnFactory, elementFactory) { + this._bpmnFactory = bpmnFactory; + this._elementFactory = elementFactory; + this._providers = { + [PROPERTY_TYPE$1]: PropertyBindingProvider, + [ZEEBE_TASK_DEFINITION_TYPE_TYPE]: TaskDefinitionTypeBindingProvider, + [ZEEBE_TASK_DEFINITION]: TaskDefinitionTypeBindingProvider, + [ZEBBE_PROPERTY_TYPE]: ZeebePropertiesProvider, + [ZEBBE_INPUT_TYPE]: InputBindingProvider, + [ZEEBE_OUTPUT_TYPE]: OutputBindingProvider, + [ZEEBE_TASK_HEADER_TYPE]: TaskHeaderBindingProvider, + [MESSAGE_PROPERTY_TYPE]: MessagePropertyBindingProvider, + [MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE]: MessageZeebeSubscriptionBindingProvider, + [ZEEBE_CALLED_ELEMENT]: CalledElementBindingProvider + }; + } + + /** + * Create an element based on an element template. + * + * @param {ElementTemplate} template + * @returns {djs.model.Base} + */ + create(template) { + const { + properties + } = template; + + // (1) base shape + const element = this._createShape(template); + + // (2) apply template + this._setModelerTemplate(element, template); + + // (3) apply icon + if (hasIcon(template)) { + this._setModelerTemplateIcon(element, template); + } + + // (4) apply properties + this._applyProperties(element, properties); + return element; + } + _createShape(template) { + const { + appliesTo, + elementType = {} + } = template; + const elementFactory = this._elementFactory; + const attrs = { + type: elementType.value || appliesTo[0] + }; + + // apply eventDefinition + if (elementType.eventDefinition) { + attrs.eventDefinitionType = elementType.eventDefinition; + } + const element = elementFactory.createShape(attrs); + return element; + } + _ensureExtensionElements(element) { + const bpmnFactory = this._bpmnFactory; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = bpmnFactory.create('bpmn:ExtensionElements', { + values: [] + }); + extensionElements.$parent = businessObject; + businessObject.set('extensionElements', extensionElements); + } + return extensionElements; + } + _setModelerTemplate(element, template) { + const { + id, + version + } = template; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + businessObject.set('zeebe:modelerTemplate', id); + businessObject.set('zeebe:modelerTemplateVersion', version); + } + _setModelerTemplateIcon(element, template) { + const { + icon + } = template; + const { + contents + } = icon; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + businessObject.set('zeebe:modelerTemplateIcon', contents); + } + + /** + * Apply properties to a given element. + * + * @param {djs.model.Base} element + * @param {Array} properties + */ + _applyProperties(element, properties) { + const processedProperties = []; + properties.forEach(property => this._applyProperty(element, property, properties, processedProperties)); + } - // update conditionally visible elements - self.updateState(entry, entryNode); - }); + /** + * Apply a property and its parent properties to an element based on conditions. + * + * @param {djs.model.Base} element + * @param {Object} property + * @param {Array} properties + * @param {Array} processedProperties + */ + _applyProperty(element, property, properties, processedProperties) { + // skip if already processed + if (processedProperties.includes(property)) { + return; + } + + // apply dependant property first if not already applied + const dependentProperties = findDependentProperties(property, properties); + dependentProperties.forEach(property => this._applyProperty(element, property, properties, processedProperties)); + + // check condition and apply property if condition is met + if (isConditionMet(element, properties, property)) { + this._bindProperty(property, element); + } + processedProperties.push(property); + } + + /** + * Bind property to element. + * @param {Object} property + * @param {djs.Model.Base} element + */ + _bindProperty(property, element) { + const { + binding + } = property; + const { + type: bindingType + } = binding; + const bindingProvider = this._providers[bindingType]; + bindingProvider.create(element, { + property, + bpmnFactory: this._bpmnFactory + }); + } +} +TemplateElementFactory.$inject = ['bpmnFactory', 'elementFactory']; + +// helper //////////////// + +function hasIcon(template) { + const { + icon + } = template; + return !!(icon && icon.contents); +} +function findDependentProperties(property, properties) { + const { + condition + } = property; + if (!condition) { + return []; + } + const dependentProperty = findProperyById(properties, condition.property); + if (dependentProperty) { + return [dependentProperty]; + } + return []; +} +function findProperyById(properties, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(properties, function (property) { + return property.id === id; + }); +} + +var createModule = { + __init__: ['templateElementFactory'], + templateElementFactory: ['type', TemplateElementFactory] +}; + +const HIGH_PRIORITY = 2500; + +/** + * Checks the conditions of an element template and sets/resets the + * corresponding properties on the element. + */ +class ConditionalBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(eventBus, elementTemplates, commandStack, bpmnFactory, injector) { + super(eventBus); + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._commandStack = commandStack; + this._bpmnFactory = bpmnFactory; + this._injector = injector; + this.preExecute(['element.updateProperties', 'element.updateModdleProperties'], this._saveConditionalState, true, this); + this.postExecute(['element.updateProperties', 'element.updateModdleProperties', 'propertiesPanel.zeebe.changeTemplate', 'element.move'], this._applyConditions, true, this); + + // Apply Conditions before changing properties. This persists the template so we can check if conditions apply + // after upgrading the template. + this.preExecute(['propertiesPanel.zeebe.changeTemplate'], HIGH_PRIORITY, this._handleTemplateUpgrade, true, this); + } + _handleTemplateUpgrade(context) { + const { + element, + newTemplate + } = context; + if (!element || !newTemplate) { + return; + } + context.newTemplate = applyConditions(context.element, context.newTemplate); + } + _saveConditionalState(context) { + const { + element + } = context; + const template = this._elementTemplates.get(element); + if (!template) { + return; + } + context.oldTemplateWithConditions = applyConditions(element, template); + } + _applyConditions(context) { + const { + element + } = context; + const template = this._elementTemplates.get(element); + + // New Template is persisted before applying default values, + // new conditions might apply after the defaults are present. + const oldTemplate = context.oldTemplateWithConditions || context.newTemplate; + if (!template || !oldTemplate || template.id !== oldTemplate.id) { + return; + } + const newTemplate = applyConditions(element, template); + if (!hasDifferentPropertyBindings(newTemplate, oldTemplate)) { + return; + } + const changeContext = { + element, + newTemplate, + oldTemplate + }; + this._commandStack.execute('propertiesPanel.zeebe.changeTemplate', changeContext); + } +} +ConditionalBehavior.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory', 'injector']; + +// helpers + +function hasDifferentPropertyBindings(sourceTemplate, targetTemplate) { + return hasNewProperties(sourceTemplate, targetTemplate) || hasRemovedProperties(sourceTemplate, targetTemplate); +} +function hasNewProperties(sourceTemplate, targetTemplate) { + let properties = targetTemplate.properties; + return properties.some(targetProp => !sourceTemplate.properties.find(sourceProp => compareProps(sourceProp, targetProp))); +} +function hasRemovedProperties(oldTemplate, newTemplate) { + const oldProperties = getMissingProperties(newTemplate, oldTemplate); + + // ensure XML properties are mantained for properties with + // different conditions but same bindings + return oldProperties.some(property => !findPropertyWithBinding(newTemplate, property)); +} +function getMissingProperties(sourceTemplate, targetTemplate) { + let properties = targetTemplate.properties; + return properties.filter(targetProp => !sourceTemplate.properties.find(sourceProp => compareProps(sourceProp, targetProp))); +} +function compareProps(sourceProp, targetProp) { + return areBindingsEqual(sourceProp.binding, targetProp.binding) && equals(sourceProp.condition, targetProp.condition); +} +function findPropertyWithBinding(template, prop1) { + return template.properties.some(prop2 => areBindingsEqual(prop1.binding, prop2.binding)); +} +function normalizeReplacer$1(key, value) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isObject)(value)) { + const keys = Object.keys(value).sort(); + return keys.reduce((obj, key) => { + obj[key] = value[key]; + return obj; + }, {}); + } + return value; +} +function areBindingsEqual(binding1, binding2) { + binding1 = normalizeBinding(binding1); + binding2 = normalizeBinding(binding2); + return equals(binding1, binding2); +} + +/** + * Convert deprecated binding type to new type. + */ +function normalizeBinding(binding) { + if (binding.type === ZEEBE_TASK_DEFINITION_TYPE_TYPE) { + return { + ...binding, + type: ZEEBE_TASK_DEFINITION, + property: 'type' + }; + } + return binding; +} +function equals(a, b) { + return JSON.stringify(a, normalizeReplacer$1) === JSON.stringify(b, normalizeReplacer$1); +} + +/** + * This Behavior checks if the new element's type is in + * the list of elements the template applies to and unlinks + * it if not. + */ +let ReplaceBehavior$1 = class ReplaceBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(elementTemplates, injector) { + super(injector.get('eventBus')); + this.postExecuted('shape.replace', function (e) { + var context = e.context, + oldShape = context.oldShape, + oldBo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(oldShape), + newShape = context.newShape, + newBo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(newShape); + if (!oldBo.modelerTemplate) { + return; + } + const template = newBo.modelerTemplate; + const version = newBo.modelerTemplateVersion; + const elementTemplate = elementTemplates.get(template, version); + if (!elementTemplate) { + elementTemplates.unlinkTemplate(newShape); + return; + } + const { + appliesTo, + elementType + } = elementTemplate; + if (elementType) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(newShape, elementType.value) || shouldUnlinkEvent(newShape, elementType)) { + elementTemplates.unlinkTemplate(newShape); + } + return; + } + const allowed = appliesTo.reduce((allowed, type) => { + return allowed || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(newBo, type); + }, false); + if (!allowed) { + elementTemplates.unlinkTemplate(newShape); + } + }); + } +}; +ReplaceBehavior$1.$inject = ['elementTemplates', 'injector']; +function shouldUnlinkEvent(newShape, elementType) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(newShape, 'bpmn:Event')) { + return false; + } + const { + eventDefinition + } = elementType, + bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(newShape), + eventDefinitions = bo.get('eventDefinitions'); + if (!eventDefinition) { + return eventDefinitions.length !== 0; + } + return !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(eventDefinitions[0], eventDefinition); +} + +/** + * Restores the original order of the template properties + * on the moddle element. + */ +class UpdateTemplatePropertiesOrder extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(eventBus, elementTemplates, commandStack, bpmnFactory) { + super(eventBus); + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._commandStack = commandStack; + this._bpmnFactory = bpmnFactory; + this.postExecute(['element.updateProperties', 'element.updateModdleProperties'], this._updatePropertiesOrder, true, this); + } + _updatePropertiesOrder(context) { + const { + element + } = context; + const template = this._elementTemplates.get(element); + const businessObject = element.businessObject; + const commands = []; + if (!template) { + return; + } + const templateProperties = applyConditions(element, template).properties; + + // zeebe:Property + const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties'); + if (zeebeProperties) { + this._updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context); + } + + // zeebe:IoMapping + const ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping'); + if (ioMapping) { + // zeebe:Input + this._updateInputOrder(ioMapping, templateProperties, commands, context); + + // zeebe:Output + this._updateOutputOrder(ioMapping, templateProperties, commands, context); + } + + // zeebe:TaskHeaders + const taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders'); + if (taskHeaders) { + this._updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context); + } + if (commands.length) { + const commandsToExecute = commands.filter(command => command !== null); + commandsToExecute.length && this._commandStack.execute('element-templates.multi-command-executor', commandsToExecute); + return; + } + } + _updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context) { + const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:property' && prop.binding.name === propertyToFind.get('name')); + const properties = zeebeProperties.get('properties'); + if (properties.length < 1) return; + let newPropertiesOrder = [...properties]; + sortProperties(newPropertiesOrder, findIndex, templateProperties); + if (!arrayEquals(newPropertiesOrder, properties)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: zeebeProperties, + properties: { + properties: newPropertiesOrder + } + } + }); + } + } + _updateInputOrder(ioMapping, templateProperties, commands, context) { + const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:input' && prop.binding.name === propertyToFind.get('target')); + const inputParameters = ioMapping.get('inputParameters'); + if (inputParameters.length < 1) return; + let newInputOrder = [...inputParameters]; + sortProperties(newInputOrder, findIndex, templateProperties); + if (!arrayEquals(newInputOrder, inputParameters)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: ioMapping, + properties: { + inputParameters: newInputOrder + } + } + }); + } + } + _updateOutputOrder(ioMapping, templateProperties, commands, context) { + const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:output' && prop.binding.source === propertyToFind.get('source')); + const outputParameters = ioMapping.get('outputParameters'); + if (outputParameters.length < 1) return; + let newOutputOrder = [...outputParameters]; + sortProperties(newOutputOrder, findIndex, templateProperties); + if (!arrayEquals(newOutputOrder, outputParameters)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: ioMapping, + properties: { + outputParameters: newOutputOrder + } + } + }); + } + } + _updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context) { + const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:taskHeader' && prop.binding.key === propertyToFind.get('key')); + const headers = taskHeaders.get('zeebe:values'); + if (headers.length < 1) return; + let newHeadersOrder = [...headers]; + sortProperties(newHeadersOrder, findIndex, templateProperties); + if (!arrayEquals(newHeadersOrder, headers)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + ...context, + moddleElement: taskHeaders, + properties: { + values: newHeadersOrder + } + } + }); + } + } +} +UpdateTemplatePropertiesOrder.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory']; + +// helpers + +function normalizeReplacer(key, value) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isObject)(value)) { + const keys = Object.keys(value).sort(); + return keys.reduce((obj, key) => { + obj[key] = value[key]; + return obj; + }, {}); + } + return value; +} +function objectEquals(a, b) { + return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer); +} +function arrayEquals(a, b) { + return a.every((element, idx) => objectEquals(element, b[idx])); +} +function sortProperties(array, findIndex, templateProperties) { + return array.sort((a, b) => { + const aIndex = findIndex(templateProperties, a); + const bIndex = findIndex(templateProperties, b); + return aIndex - bIndex; + }); +} + +/** + * Handles referenced elements. + */ +class ReferencedElementBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(eventBus, elementTemplates, modeling, injector, moddleCopy, bpmnFactory) { + super(eventBus); + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._modeling = modeling; + this._injector = injector; + this.postExecuted(['element.updateProperties', 'element.updateModdleProperties'], this._handlePropertiesUpdate, true, this); + this.postExecuted('shape.replace', this._handleReplacement, true, this); + this.postExecuted('shape.delete', this._handleRemoval, true, this); + + // copy templated root element when pasting + eventBus.on('copyPaste.pasteElement', function (context) { + const { + referencedRootElement + } = context.descriptor; + if (!referencedRootElement) { + return; + } + if (!getTemplateId$1(referencedRootElement)) { + return; + } + context.descriptor.referencedRootElement = moddleCopy.copyElement(referencedRootElement, bpmnFactory.create(referencedRootElement.$type)); + }); + } + + /** + * Unlink referenced element when template is unlinked. + */ + _handlePropertiesUpdate(context) { + const { + element, + properties + } = context; + if (!canHaveReferencedElement(element)) { + return; + } + if (!(TEMPLATE_ID_ATTR$1 in properties) || (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(properties[TEMPLATE_ID_ATTR$1])) { + return; + } + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const message = findMessage(bo); + if (message && getTemplateId$1(message)) { + this._modeling.updateModdleProperties(element, message, { + [TEMPLATE_ID_ATTR$1]: null + }); + } + } + + /** + * Remove referenced element when template is removed. + * Keep referenced element when template is replaced. + */ + _handleReplacement(context) { + const { + oldShape, + newShape + } = context; + const oldTemplate = getTemplateId$1(oldShape), + newTemplate = getTemplateId$1(newShape); + if (!canHaveReferencedElement(oldShape) || !oldTemplate) { + return; + } + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(oldShape); + const message = findMessage(bo); + if (!message || !getTemplateId$1(message)) { + return; + } + if (!canHaveReferencedElement(newShape) || !newTemplate) { + removeRootElement(message, this._injector); + return; + } + this._addMessage(newShape, message); + } + _handleRemoval(context) { + const { + shape + } = context; + if (isLabel(shape)) { + return; + } + if (!canHaveReferencedElement(shape)) { + return; + } + if (!getTemplateId$1(shape)) { + return; + } + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(shape); + const message = findMessage(bo); + if (message && getTemplateId$1(message)) { + removeRootElement(message, this._injector); + } + } + _addMessage(element, message) { + const bo = getReferringElement(element); + this._modeling.updateModdleProperties(element, bo, { + 'messageRef': message + }); + } +} +ReferencedElementBehavior.$inject = ['eventBus', 'elementTemplates', 'modeling', 'injector', 'moddleCopy', 'bpmnFactory']; +function canHaveReferencedElement(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(element, ['bpmn:ReceiveTask', 'bpmn:SendTask', 'bpmn:Event']); +} +function isLabel(element) { + return element.type === 'label'; +} + +/** + * Handles generated value properties. + */ +class GeneratedValueBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(eventBus, elementTemplates, modeling, commandStack, bpmnFactory) { + super(eventBus); + this._eventBus = eventBus; + this._elementTemplates = elementTemplates; + this._modeling = modeling; + this.preExecute('shape.create', context => { + const element = context.shape; + const template = elementTemplates.get(element); + if (!template) { + return; + } + const generatedProps = template.properties.filter(p => p.generatedValue); + generatedProps.forEach(p => { + if (!getPropertyValue(element, p)) { + return; + } + const value = getDefaultValue(p); + setPropertyValue(bpmnFactory, commandStack, element, p, value); + }); + }, true); + } +} +GeneratedValueBehavior.$inject = ['eventBus', 'elementTemplates', 'modeling', 'commandStack', 'bpmnFactory']; + +/** + * Enforces no variable propagation for templated call activities. + */ +class CalledElementBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + /** + * @param {*} eventBus + * @param {*} modeling + * @param {import('../ElementTemplates').default} elementTemplates + */ + constructor(eventBus, modeling, elementTemplates) { + super(eventBus); + this._modeling = modeling; + this._elementTemplates = elementTemplates; + this.postExecuted(['element.updateProperties', 'element.updateModdleProperties'], this._ensureNoPropagation, true, this); + } + _ensureNoPropagation(context) { + const { + element + } = context; + if (!this._elementTemplates.get(element)) { + return; + } + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'bpmn:CallActivity')) { + return; + } + const calledElement = findExtension$1(element, 'zeebe:CalledElement'); + if (!calledElement) { + return; + } + for (const property of ['propagateAllChildVariables', 'propagateAllParentVariables']) { + if (calledElement.get(property) !== false) { + this._modeling.updateModdleProperties(element, calledElement, { + [property]: false + }); + } + } + } +} +CalledElementBehavior.$inject = ['eventBus', 'modeling', 'elementTemplates']; + +var behaviorModule$1 = { + __init__: ['elementTemplatesReplaceBehavior', 'elementTemplatesConditionalBehavior', 'elementTemplatesGeneratedValueBehavior', 'elementTemplatesReferencedElementBehavior', 'elementTemplatesUpdatePropertiesOrderBehavior', 'elementTemplatesCalledElementBehavior'], + elementTemplatesReplaceBehavior: ['type', ReplaceBehavior$1], + elementTemplatesConditionalBehavior: ['type', ConditionalBehavior], + elementTemplatesGeneratedValueBehavior: ['type', GeneratedValueBehavior], + elementTemplatesReferencedElementBehavior: ['type', ReferencedElementBehavior], + elementTemplatesUpdatePropertiesOrderBehavior: ['type', UpdateTemplatePropertiesOrder], + elementTemplatesCalledElementBehavior: ['type', CalledElementBehavior] +}; + +var coreModule$1 = { + __depends__: [commandsModule$1, behaviorModule$1, createModule], + __init__: ['elementTemplatesLoader'], + elementTemplates: ['type', ElementTemplates], + elementTemplatesLoader: ['type', ElementTemplatesLoader] +}; + +function getVersionOrDateFromTemplate(template) { + const metadata = template.metadata, + version = template.version; + if (metadata) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(metadata.created)) { + return toDateString(metadata.created); + } else if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(metadata.updated)) { + return toDateString(metadata.updated); + } + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(version)) { + return null; + } + return version; +} + +// helper /////////// + +/** + * Example: 01.01.1900 01:01 + * + * @param {number} timestamp + * @returns {string} + */ +function toDateString(timestamp) { + const date = new Date(timestamp); + const year = date.getFullYear(); + const month = withLeadingZeros(String(date.getMonth() + 1)); + const day = withLeadingZeros(String(date.getDate())); + const hours = withLeadingZeros(String(date.getHours())); + const minutes = withLeadingZeros(String(date.getMinutes())); + return day + '.' + month + '.' + year + ' ' + hours + ':' + minutes; +} +function withLeadingZeros(string) { + return leftPad(string, 2, '0'); +} +function leftPad(string, length, character) { + while (string.length < length) { + string = character + string; + } + return string; +} + +function createElementTemplatesGroup(props = {}) { + const { + getTemplateId: getTemplateId$1 = getTemplateId + } = props; + return function ElementTemplatesGroup(props) { + const { + id, + label, + element, + entries = [] + } = props; + const [open, setOpen] = (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.useLayoutState)(['groups', id, 'open'], false); + const empty = !entries.length; + const toggleOpen = () => !empty && setOpen(!open); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", { + class: "bio-properties-panel-group bio-properties-panel-templates-group", + "data-group-id": 'group-' + id, + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-header', { + empty, + open: open && !empty + }), + onClick: toggleOpen, + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + title: label, + class: "bio-properties-panel-group-header-title", + children: label + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", { + class: "bio-properties-panel-group-header-buttons", + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(TemplateGroupButtons, { + element: element, + getTemplateId: getTemplateId$1 + }), !empty && (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(SectionToggle, { + open: open + })] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_4___default()('bio-properties-panel-group-entries', { + open: open && !empty + }), + children: entries.map(entry => { + const { + component: Component, + id + } = entry; + return (0,_bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_7__.createElement)(Component, { + ...entry, + key: id, + element: element + }); + }) + })] + }); + }; +} +function SectionToggle({ + open +}) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + title: "Toggle section", + class: "bio-properties-panel-arrow", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + }); +} + +/** + * + * @param {object} props + * @param {object} props.element + * @param {function} props.getTemplateId + * @param {function} props.unlinkTemplate + * @param {function} props.updateTemplate + */ +function TemplateGroupButtons({ + element, + getTemplateId +}) { + const elementTemplates = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('elementTemplates'); + const templateState = getTemplateState(elementTemplates, element, getTemplateId); + if (templateState.type === 'NO_TEMPLATE') { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(SelectEntryTemplate, { + element: element + }); + } else if (templateState.type === 'KNOWN_TEMPLATE') { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(AppliedTemplate, { + element: element + }); + } else if (templateState.type === 'UNKNOWN_TEMPLATE') { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(UnknownTemplate, { + element: element + }); + } else if (templateState.type === 'DEPRECATED_TEMPLATE') { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(DeprecatedTemplate, { + element: element, + templateState: templateState + }); + } else if (templateState.type === 'OUTDATED_TEMPLATE') { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(OutdatedTemplate, { + element: element, + templateState: templateState + }); + } +} +function SelectEntryTemplate({ + element +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const eventBus = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('eventBus'); + const selectTemplate = () => eventBus.fire('elementTemplates.select', { + element + }); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + title: "Select a template", + class: "bio-properties-panel-select-template-button", + onClick: selectTemplate, + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.CreateIcon, {}), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + children: translate('Select') + })] + }); +} +function AppliedTemplate({ + element +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'), + elementTemplates = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('elementTemplates'); + const menuItems = [{ + entry: translate('Unlink'), + action: () => elementTemplates.unlinkTemplate(element) + }, { + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(RemoveTemplate, {}), + action: () => elementTemplates.removeTemplate(element) + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.DropdownButton, { + menuItems: menuItems, + class: "bio-properties-panel-applied-template-button", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + children: translate('Applied') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ArrowIcon, { + class: "bio-properties-panel-arrow-down" + })] + }) + }); +} +function RemoveTemplate() { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + class: "bio-properties-panel-remove-template", + children: translate('Remove') + }); +} +function UnknownTemplate({ + element +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'), + elementTemplates = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('elementTemplates'); + const menuItems = [{ + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(NotFoundText, {}) + }, { + separator: true + }, { + entry: translate('Unlink'), + action: () => elementTemplates.unlinkTemplate(element) + }, { + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(RemoveTemplate, {}), + action: () => elementTemplates.removeTemplate(element) + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.DropdownButton, { + menuItems: menuItems, + class: "bio-properties-panel-template-not-found", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + children: translate('Not found') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ArrowIcon, { + class: "bio-properties-panel-arrow-down" + })] + }) + }); +} +function NotFoundText() { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-template-not-found-text", + children: translate('The template applied was not found. Therefore, its properties cannot be shown. Unlink to access the data.') + }); +} + +/** + * + * @param {object} props + * @param {object} element + * @param {UnknownTemplate} templateState + * @param {function} unlinkTemplate + * @param {function} updateTemplate + */ +function OutdatedTemplate({ + element, + templateState +}) { + const { + newerTemplate + } = templateState; + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'), + elementTemplates = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('elementTemplates'); + const menuItems = [{ + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(UpdateAvailableText, { + newerTemplate: newerTemplate + }) + }, { + separator: true + }, { + entry: translate('Update'), + action: () => elementTemplates.applyTemplate(element, newerTemplate) + }, { + entry: translate('Unlink'), + action: () => elementTemplates.unlinkTemplate(element) + }, { + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(RemoveTemplate, {}), + action: () => elementTemplates.removeTemplate(element) + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.DropdownButton, { + menuItems: menuItems, + class: "bio-properties-panel-template-update-available", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + children: translate('Update available') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ArrowIcon, { + class: "bio-properties-panel-arrow-down" + })] + }) + }); +} +function UpdateAvailableText({ + newerTemplate +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const text = translate('A new version of the template is available: {templateVersion}', { + templateVersion: getVersionOrDateFromTemplate(newerTemplate) + }); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-template-update-available-text", + children: text + }); +} +function DeprecatedTemplate({ + element, + templateState +}) { + const { + template + } = templateState; + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'), + elementTemplates = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('elementTemplates'); + const menuItems = [{ + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(DeprecationWarning, { + template: template + }) + }, { + separator: true + }, { + entry: translate('Unlink'), + action: () => elementTemplates.unlinkTemplate(element) + }, { + entry: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(RemoveTemplate, {}), + action: () => elementTemplates.removeTemplate(element) + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.DropdownButton, { + menuItems: menuItems, + class: "bio-properties-panel-deprecated-template-button", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.HeaderButton, { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + children: translate('Deprecated') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ArrowIcon, { + class: "bio-properties-panel-arrow-down" + })] + }) + }); +} +function DeprecationWarning({ + template +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const { + message = translate('This template is deprecated.'), + documentationRef + } = template.deprecated; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", { + class: "bio-properties-panel-deprecated-template-text", + children: [message, documentationRef && (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, { + children: ["\xA0", (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("a", { + href: documentationRef, + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(DocumentationIcon, {}) + })] + })] + }); +} +function DocumentationIcon() { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("svg", { + width: "12", + height: "12", + viewBox: "0 0 12 12", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z", + fill: "#818798" + }) + }); +} + +// helper ////// + +/** + * Determine template state in the current element. + * + * @param {object} elementTemplates + * @param {object} element + * @param {function} getTemplateId + * @returns {TemplateState} + */ +function getTemplateState(elementTemplates, element, getTemplateId) { + const templateId = getTemplateId(element), + template = elementTemplates.get(element); + if (!templateId) { + return { + type: 'NO_TEMPLATE' + }; + } + if (!template) { + return { + type: 'UNKNOWN_TEMPLATE', + templateId + }; + } + if (template.deprecated) { + return { + type: 'DEPRECATED_TEMPLATE', + template + }; + } + const newerTemplate = elementTemplates.getLatest(templateId, { + deprecated: true + })[0]; + if (newerTemplate !== template) { + return { + type: 'OUTDATED_TEMPLATE', + template, + newerTemplate + }; + } + return { + type: 'KNOWN_TEMPLATE', + template + }; +} + +function TemplateProps({ + element, + elementTemplates +}) { + const template = elementTemplates.get(element); + if (!template) { + return []; + } + return [{ + id: 'template-name', + component: TemplateName, + template + }, { + id: 'template-version', + component: TemplateVersion, + template + }, { + id: 'template-description', + component: TemplateDescription, + template + }].filter(entry => !!entry.component); +} +function TemplateName({ + id, + template +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(TextEntry, { + id: id, + label: translate('Name'), + content: template.name + }); +} +function TemplateVersion({ + id, + template +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const version = getVersionOrDateFromTemplate(template); + return version ? (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(TextEntry, { + id: id, + label: translate('Version'), + content: version + }) : null; +} +function TemplateDescription({ + id, + template +}) { + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const { + description + } = template; + return description ? (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(TextEntry, { + id: id, + label: translate('Description'), + content: template.description + }) : null; +} +function TextEntry({ + id, + label, + content +}) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", { + "data-entry-id": id, + class: "bio-properties-panel-entry bio-properties-panel-text-entry", + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + class: "bio-properties-panel-label", + children: label + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", { + class: "bio-properties-panel-text-entry__content", + children: content + })] + }); +} + +var e, + o = {}; +function n(r, t, e) { + if (3 === r.nodeType) { + var o = "textContent" in r ? r.textContent : r.nodeValue || ""; + if (!1 !== n.options.trim) { + var a = 0 === t || t === e.length - 1; + if ((!(o = o.match(/^[\s\n]+$/g) && "all" !== n.options.trim ? " " : o.replace(/(^[\s\n]+|[\s\n]+$)/g, "all" === n.options.trim || a ? "" : " ")) || " " === o) && e.length > 1 && a) return null; + } + return o; + } + if (1 !== r.nodeType) return null; + var p = String(r.nodeName).toLowerCase(); + if ("script" === p && !n.options.allowScripts) return null; + var l, + s, + u = n.h(p, function (r) { + var t = r && r.length; + if (!t) return null; + for (var e = {}, o = 0; o < t; o++) { + var a = r[o], + i = a.name, + p = a.value; + "on" === i.substring(0, 2) && n.options.allowEvents && (p = new Function(p)), e[i] = p; + } + return e; + }(r.attributes), (s = (l = r.childNodes) && Array.prototype.map.call(l, n).filter(i)) && s.length ? s : null); + return n.visitor && n.visitor(u), u; +} +var a, + i = function (r) { + return r; + }, + p = {}; +function l(r) { + var t = (r.type || "").toLowerCase(), + e = l.map; + e && e.hasOwnProperty(t) ? (r.type = e[t], r.props = Object.keys(r.props || {}).reduce(function (t, e) { + var o; + return t[(o = e, o.replace(/-(.)/g, function (r, t) { + return t.toUpperCase(); + }))] = r.props[e], t; + }, {})) : r.type = t.replace(/[^a-z0-9-]/i, ""); +} +var Markup = (function (t) { + function i() { + t.apply(this, arguments); + } + return t && (i.__proto__ = t), (i.prototype = Object.create(t && t.prototype)).constructor = i, i.setReviver = function (r) { + a = r; + }, i.prototype.shouldComponentUpdate = function (r) { + var t = this.props; + return r.wrap !== t.wrap || r.type !== t.type || r.markup !== t.markup; + }, i.prototype.setComponents = function (r) { + if (this.map = {}, r) for (var t in r) if (r.hasOwnProperty(t)) { + var e = t.replace(/([A-Z]+)([A-Z][a-z0-9])|([a-z0-9]+)([A-Z])/g, "$1$3-$2$4").toLowerCase(); + this.map[e] = r[t]; + } + }, i.prototype.render = function (t) { + var i = t.wrap; + void 0 === i && (i = !0); + var s, + u = t.type, + c = t.markup, + m = t.components, + v = t.reviver, + f = t.onError, + d = t["allow-scripts"], + h$1 = t["allow-events"], + y = t.trim, + w = function (r, t) { + var e = {}; + for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && -1 === t.indexOf(o) && (e[o] = r[o]); + return e; + }(t, ["wrap", "type", "markup", "components", "reviver", "onError", "allow-scripts", "allow-events", "trim"]), + C = v || this.reviver || this.constructor.prototype.reviver || a || _bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_7__.h; + this.setComponents(m); + var g = { + allowScripts: d, + allowEvents: h$1, + trim: y + }; + try { + s = function (r, t, a, i, s) { + var u = function (r, t) { + var o, + n, + a, + i, + p = "html" === t ? "text/html" : "application/xml"; + "html" === t ? (i = "body", a = "\n" + r + "") : (i = "xml", a = '\n' + r + ""); + try { + o = new DOMParser().parseFromString(a, p); + } catch (r) { + n = r; + } + if (o || "html" !== t || ((o = e || (e = function () { + if (document.implementation && document.implementation.createHTMLDocument) return document.implementation.createHTMLDocument(""); + var r = document.createElement("iframe"); + return r.style.cssText = "position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;", r.setAttribute("sandbox", "allow-forms"), document.body.appendChild(r), r.contentWindow.document; + }())).open(), o.write(a), o.close()), o) { + var l = o.getElementsByTagName(i)[0], + s = l.firstChild; + return r && !s && (l.error = "Document parse failed."), s && "parsererror" === String(s.nodeName).toLowerCase() && (s.removeChild(s.firstChild), s.removeChild(s.lastChild), l.error = s.textContent || s.nodeValue || n || "Unknown error", l.removeChild(s)), l; + } + }(r, t); + if (u && u.error) throw new Error(u.error); + var c = u && u.body || u; + l.map = i || p; + var m = c && function (r, t, e, a) { + return n.visitor = t, n.h = e, n.options = a || o, n(r); + }(c, l, a, s); + return l.map = null, m && m.props && m.props.children || null; + }(c, u, C, this.map, g); + } catch (r) { + f ? f({ + error: r + }) : "undefined" != typeof console && console.error && console.error("preact-markup: " + r); + } + if (!1 === i) return s || null; + var x = w.hasOwnProperty("className") ? "className" : "class", + b = w[x]; + return b ? b.splice ? b.splice(0, 0, "markup") : "string" == typeof b ? w[x] += " markup" : "object" == typeof b && (b.markup = !0) : w[x] = "markup", C("div", w, s || null); + }, i; +})(_bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_7__.Component); + +/** + * Copied from existing form-js#Sanitizer + * cf. https://github.com/bpmn-io/form-js/blob/master/packages/form-js-viewer/src/render/components/Sanitizer.js + */ - tabNode.appendChild(groupNode); - }); +const NODE_TYPE_TEXT = 3, + NODE_TYPE_ELEMENT = 1; +const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong']; +const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src']; +const ALLOWED_URI_PATTERN = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape +const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g; // eslint-disable-line no-control-regex - tabLinksNode.appendChild(tabLinkNode); - tabContainerNode.appendChild(tabNode); - }); +const FORM_ELEMENT = document.createElement('form'); - tabBarNode.appendChild(tabLinksNode); +/** + * Sanitize a HTML string and return the cleaned, safe version. + * + * @param {string} html + * @return {string} + */ +function sanitizeHTML(html) { + const doc = new DOMParser().parseFromString(`\n
${html}`, 'text/html'); + doc.normalize(); + const element = doc.body.firstChild; + if (element) { + sanitizeNode( /** @type Element */element); + return new XMLSerializer().serializeToString(element); + } else { + // handle the case that document parsing + // does not work at all, due to HTML gibberish + return ''; + } +} + +/** + * Recursively sanitize a HTML node, potentially + * removing it, its children or attributes. + * + * Inspired by https://github.com/developit/snarkdown/issues/70 + * and https://github.com/cure53/DOMPurify. Simplified + * for our use-case. + * + * @param {Element} node + */ +function sanitizeNode(node) { + // allow text nodes + if (node.nodeType === NODE_TYPE_TEXT) { + return; + } + + // disallow all other nodes but Element + if (node.nodeType !== NODE_TYPE_ELEMENT) { + return node.remove(); + } + const lcTag = node.tagName.toLowerCase(); + + // disallow non-whitelisted tags + if (!ALLOWED_NODES.includes(lcTag)) { + return node.remove(); + } + const attributes = node.attributes; + + // clean attributes + for (let i = attributes.length; i--;) { + const attribute = attributes[i]; + const name = attribute.name; + const lcName = name.toLowerCase(); + + // normalize node value + const value = attribute.value.trim(); + node.removeAttribute(name); + const valid = isValidAttribute(lcTag, lcName, value); + if (valid) { + node.setAttribute(name, value); + } + } + + // force noopener on target="_blank" links + if (lcTag === 'a' && node.getAttribute('target') === '_blank' && node.getAttribute('rel') !== 'noopener') { + node.setAttribute('rel', 'noopener'); + } + for (let i = node.childNodes.length; i--;) { + sanitizeNode( /** @type Element */node.childNodes[i]); + } +} + +/** + * Validates attributes for validity. + * + * @param {string} lcTag + * @param {string} lcName + * @param {string} value + * @return {boolean} + */ +function isValidAttribute(lcTag, lcName, value) { + // disallow most attributes based on whitelist + if (!ALLOWED_ATTRIBUTES.includes(lcName)) { + return false; + } + + // disallow "DOM clobbering" / polution of document and wrapping form elements + if ((lcName === 'id' || lcName === 'name') && (value in document || value in FORM_ELEMENT)) { + return false; + } + if (lcName === 'target' && value !== '_blank') { + return false; + } + + // allow valid url links only + if (lcName === 'href' && !ALLOWED_URI_PATTERN.test(value.replace(ATTR_WHITESPACE_PATTERN, ''))) { + return false; + } + return true; +} + +function PropertyDescription(props) { + const { + description + } = props; + return description && (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Markup, { + markup: sanitizeHTML(description), + trim: false + }); +} + +function PropertyTooltip(props) { + const { + tooltip + } = props; + return tooltip && (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Markup, { + markup: sanitizeHTML(tooltip), + trim: false + }); +} + +function useServiceIfAvailable(service, fallback) { + const resolved = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)(service, false); + if (!resolved) { + return fallback; + } + return resolved; +} +function withVariableContext(Component) { + return props => { + const { + bpmnElement, + element + } = props; + const bo = (bpmnElement || element).businessObject; + const [variables, setVariables] = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_9__.useState)([]); + const eventBus = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('eventBus'); + const variableResolver = useServiceIfAvailable('variableResolver', { + getVariablesForElement: _bpmn_io_extract_process_variables_zeebe__WEBPACK_IMPORTED_MODULE_8__.getVariablesForElement + }); + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_9__.useEffect)(() => { + const extractVariables = async () => { + const variables = await variableResolver.getVariablesForElement(bo); + setVariables(variables.map(variable => { + return { + ...variable, + info: variable.info || variable.origin && 'Written in ' + variable.origin.map(origin => origin.name || origin.id).join(', ') + }; + })); + }; + + // The callback must return undefined, so the event propagation is not canceled. + // Cf. https://github.com/camunda/camunda-modeler/issues/3392 + const callback = () => { + extractVariables(); + }; + eventBus.on('commandStack.changed', callback); + callback(); + return () => { + eventBus.off('commandStack.changed', callback); + }; + }, [bo]); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Component, { + ...props, + variables: variables + }); + }; +} + +function withTooltipContainer(Component) { + return props => { + const tooltipContainer = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_9__.useMemo)(() => { + const config = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('config'); + return config && config.propertiesPanel && config.propertiesPanel.feelTooltipContainer; + }, []); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Component, { + ...props, + tooltipContainer: tooltipContainer + }); + }; +} + +const FeelEntry = withTooltipContainer(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.FeelEntry); +const FeelTextAreaEntry = withTooltipContainer(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.FeelTextAreaEntry); +const FeelEntryWithVariableContext = withVariableContext(FeelEntry); +const FeelTextAreaEntryWithVariableContext = withVariableContext(FeelTextAreaEntry); + +const DEFAULT_CUSTOM_GROUP$1 = { + id: 'ElementTemplates__CustomProperties', + label: 'Custom properties' +}; +function CustomProperties$1(props) { + const { + element, + elementTemplate + } = props; + const groups = []; + const { + id, + properties, + groups: propertyGroups + } = elementTemplate; + + // (1) group properties by group id + const groupedProperties = groupByGroupId$1(properties); + const defaultProps = []; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(groupedProperties, (properties, groupId) => { + const group = findCustomGroup$1(propertyGroups, groupId); + if (!group) { + return defaultProps.push(...properties); + } + addCustomGroup$1(groups, { + element, + id: `ElementTemplates__CustomProperties-${groupId}`, + label: group.label, + openByDefault: group.openByDefault, + properties: properties, + templateId: `${id}-${groupId}`, + tooltip: PropertyTooltip({ + tooltip: group.tooltip + }) + }); + }); + + // (2) add default custom props + if (defaultProps.length) { + addCustomGroup$1(groups, { + ...DEFAULT_CUSTOM_GROUP$1, + element, + properties: defaultProps, + templateId: id + }); + } + return groups; +} +function addCustomGroup$1(groups, props) { + const { + element, + id, + label, + openByDefault = true, + properties, + templateId, + tooltip + } = props; + const customPropertiesGroup = { + id, + label, + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.Group, + entries: [], + shouldOpen: openByDefault, + tooltip + }; + properties.forEach((property, index) => { + const entry = createCustomEntry$1(`custom-entry-${templateId}-${index}`, element, property); + if (entry) { + customPropertiesGroup.entries.push(entry); + } + }); + if (customPropertiesGroup.entries.length) { + groups.push(customPropertiesGroup); + } +} +function createCustomEntry$1(id, element, property) { + let { + type, + feel + } = property; + if (!type) { + type = getDefaultType$1(property); + } + if (type === 'Boolean') { + return { + id, + component: BooleanProperty$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isCheckboxEntryEdited, + property + }; + } + if (type === 'Dropdown') { + return { + id, + component: DropdownProperty$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isSelectEntryEdited, + property + }; + } + if (type === 'String') { + if (feel) { + return { + id, + component: FeelProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isFeelEntryEdited, + property + }; + } + return { + id, + component: StringProperty$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isTextFieldEntryEdited, + property + }; + } + if (type === 'Text') { + if (feel) { + return { + id, + component: FeelTextAreaProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isFeelEntryEdited, + property + }; + } + return { + id, + component: TextAreaProperty$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isTextAreaEntryEdited, + property + }; + } +} +function getDefaultType$1(property) { + const { + binding + } = property; + const { + type + } = binding; + if ([PROPERTY_TYPE$1, ZEEBE_TASK_DEFINITION_TYPE_TYPE, ZEEBE_TASK_DEFINITION, ZEBBE_INPUT_TYPE, ZEEBE_OUTPUT_TYPE, ZEEBE_PROPERTY_TYPE, ZEEBE_TASK_HEADER_TYPE].includes(type)) { + return 'String'; + } +} +function BooleanProperty$1(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.CheckboxEntry)({ + element, + getValue: propertyGetter$1(element, property), + id, + label, + description: PropertyDescription({ + description + }), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function DropdownProperty$1(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const getOptions = () => { + const { + choices, + optional + } = property; + let dropdownOptions = []; + dropdownOptions = choices.map(({ + name, + value + }) => { + return { + label: name, + value + }; + }); + if (optional) { + dropdownOptions = [{ + label: '', + value: undefined + }, ...dropdownOptions]; + } + return dropdownOptions; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.SelectEntry)({ + element, + id, + label, + getOptions, + description: PropertyDescription({ + description + }), + getValue: propertyGetter$1(element, property), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + validate: propertyValidator$1(translate, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function FeelTextAreaProperty(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + feel, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const TextAreaComponent = !isExternalProperty(property) ? FeelTextAreaEntryWithVariableContext : FeelTextAreaEntry; + return TextAreaComponent({ + debounce, + element, + getValue: propertyGetter$1(element, property), + id, + label, + feel, + description: PropertyDescription({ + description + }), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + validate: propertyValidator$1(translate, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function FeelProperty(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + feel, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const TextFieldComponent = !isExternalProperty(property) ? FeelEntryWithVariableContext : FeelEntry; + return TextFieldComponent({ + debounce, + element, + getValue: propertyGetter$1(element, property), + id, + label, + feel, + description: PropertyDescription({ + description + }), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + validate: propertyValidator$1(translate, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function StringProperty$1(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + feel, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextFieldEntry)({ + debounce, + element, + getValue: propertyGetter$1(element, property), + id, + label, + feel, + description: PropertyDescription({ + description + }), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + validate: propertyValidator$1(translate, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function TextAreaProperty$1(props) { + const { + element, + id, + property + } = props; + const { + description, + editable, + label, + feel, + language, + tooltip + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextAreaEntry)({ + debounce, + element, + id, + label, + feel, + monospace: !!language, + autoResize: true, + description: PropertyDescription({ + description + }), + getValue: propertyGetter$1(element, property), + setValue: propertySetter$1(bpmnFactory, commandStack, element, property), + validate: propertyValidator$1(translate, property), + disabled: editable === false, + tooltip: PropertyTooltip({ + tooltip + }) + }); +} +function propertyGetter$1(element, property) { + return function getValue() { + return getPropertyValue(element, property); + }; +} +function propertySetter$1(bpmnFactory, commandStack, element, property) { + return function setValue(value) { + return setPropertyValue(bpmnFactory, commandStack, element, property, value); + }; +} +function propertyValidator$1(translate, property) { + return value => validateProperty(value, property, translate); +} +function groupByGroupId$1(properties) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.groupBy)(properties, 'group'); +} +function findCustomGroup$1(groups, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(groups, g => g.id === id); +} + +/** + * Is the given property executed by the engine? + * + * @param { { binding: { type: string } } } property + * @return {boolean} + */ +function isExternalProperty(property) { + return ['zeebe:property', 'zeebe:taskHeader'].includes(property.binding.type); +} + +function ReferenceSelectEntry(props) { + const { + autoFocusEntry, + element, + getOptions + } = props; + const options = getOptions(element); + const prevOptions = (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.usePrevious)(options); + + // auto focus specifc other entry when options changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_9__.useEffect)(() => { + if (autoFocusEntry && prevOptions && options.length > prevOptions.length) { + const entry = (0,min_dom__WEBPACK_IMPORTED_MODULE_18__.query)(`[data-entry-id="${autoFocusEntry}"]`); + const focusableInput = (0,min_dom__WEBPACK_IMPORTED_MODULE_18__.query)('.bio-properties-panel-input', entry); + if (focusableInput) { + focusableInput.select(); + } + } + }, [options]); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.SelectEntry, { + ...props + }); +} + +function getEventDefinition(element, eventType) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const eventDefinitions = businessObject.get('eventDefinitions') || []; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(eventDefinitions, function (definition) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(definition, eventType); + }); +} +function isMessageSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'bpmn:ReceiveTask') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(element, ['bpmn:StartEvent', 'bpmn:EndEvent', 'bpmn:IntermediateThrowEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent']) && !!getMessageEventDefinition(element); +} +function getMessageEventDefinition(element) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(element, 'bpmn:ReceiveTask')) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + } + return getEventDefinition(element, 'bpmn:MessageEventDefinition'); +} +function getMessage(element) { + const messageEventDefinition = getMessageEventDefinition(element); + return messageEventDefinition && messageEventDefinition.get('messageRef'); +} +function getSignalEventDefinition(element) { + return getEventDefinition(element, 'bpmn:SignalEventDefinition'); +} + +const EMPTY_OPTION = ''; +const CREATE_NEW_OPTION = 'create-new'; + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - panelNode.appendChild(tabBarNode); - panelNode.appendChild(tabContainerNode); +/** + * @returns {Array} entries + */ +function MessageProps(props) { + const { + element + } = props; + if (!isMessageSupported(element)) { + return []; + } + return [{ + id: 'messageRef', + component: MessageRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isSelectEntryEdited + }]; +} +function MessageRef(props) { + const { + element + } = props; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'); + const modeling = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('modeling'); + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const messageEventDefinition = getMessageEventDefinition(element); + const getValue = () => { + const message = getMessage(element); + if (message) { + return message.get('id'); + } + return EMPTY_OPTION; + }; + const setValue = value => { + const root = getRoot(messageEventDefinition); + let message; + + // (1) create new message + if (value === CREATE_NEW_OPTION) { + const id = nextId('Message_'); + message = createElement('bpmn:Message', { + id, + name: id + }, root, bpmnFactory); + value = message.get('id'); + } + + // (2) update (or remove) messageRef + message = findRootElementById(messageEventDefinition, 'bpmn:Message', value) || message; + + // (3) commit all updates + return modeling.updateModdleProperties(element, messageEventDefinition, { + messageRef: message + }); + }; + const getOptions = () => { + let options = [{ + value: EMPTY_OPTION, + label: translate('') + }, { + value: CREATE_NEW_OPTION, + label: translate('Create new ...') + }]; + const messages = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), 'bpmn:Message'); + const filteredMessages = withoutTemplatedMessages(messages); + sortByName(filteredMessages).forEach(message => { + options.push({ + value: message.get('id'), + label: message.get('name') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'messageRef', + label: translate('Global message reference'), + autoFocusEntry: 'messageName', + getValue, + setValue, + getOptions + }); +} +function withoutTemplatedMessages(messages) { + return messages.filter(message => !message.get('zeebe:modelerTemplate')); +} + +// helper ///////////////////////// + +function sortByName(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +const LOWER_PRIORITY$1 = 300; +const ALWAYS_DISPLAYED_GROUPS = ['general', 'documentation', 'multiInstance']; +let ElementTemplatesPropertiesProvider$1 = class ElementTemplatesPropertiesProvider { + constructor(elementTemplates, propertiesPanel, injector) { + propertiesPanel.registerProvider(LOWER_PRIORITY$1, this); + this._elementTemplates = elementTemplates; + this._injector = injector; + } + getGroups(element) { + return groups => { + updateMessageGroup(groups, element); + if (!this._shouldShowTemplateProperties(element)) { + return groups; + } + + // (0) Copy provided groups + groups = groups.slice(); + const templatesGroup = { + element, + id: 'ElementTemplates__Template', + label: 'Template', + component: createElementTemplatesGroup({ + getTemplateId: getTemplateId$1 + }), + entries: TemplateProps({ + element, + elementTemplates: this._elementTemplates + }) + }; + + // (1) Add templates group + addGroupsAfter$1(ALWAYS_DISPLAYED_GROUPS, groups, [templatesGroup]); + let elementTemplate = this._elementTemplates.get(element); + if (elementTemplate) { + elementTemplate = applyConditions(element, elementTemplate); + const templateSpecificGroups = [].concat(CustomProperties$1({ + element, + elementTemplate + })); + + // (2) add template-specific properties groups + addGroupsAfter$1('ElementTemplates__Template', groups, templateSpecificGroups); + } + + // (3) apply entries visible + if (getTemplateId$1(element)) { + groups = filterWithEntriesVisible$1(elementTemplate || {}, groups); + } + return groups; + }; + } + _shouldShowTemplateProperties(element) { + return getTemplateId$1(element) || this._elementTemplates.getAll(element).length; + } +}; +ElementTemplatesPropertiesProvider$1.$inject = ['elementTemplates', 'propertiesPanel', 'injector']; + +// helper ///////////////////// + +function updateMessageGroup(groups, element) { + const messageGroup = findGroup(groups, 'message'); + if (!messageGroup) { + return; + } + messageGroup.entries = overrideGenericEntries(messageGroup.entries, MessageProps({ + element + })); +} +function findGroup(groups, id) { + return groups.find(g => g.id === id); +} +function overrideGenericEntries(oldEntries, newEntries) { + return oldEntries.map(oldEntry => newEntries.find(newEntry => newEntry.id === oldEntry.id) || oldEntry); +} + +/** + * + * @param {string|string[]} idOrIds + * @param {Array<{ id: string }} groups + * @param {Array<{ id: string }>} groupsToAdd + */ +function addGroupsAfter$1(idOrIds, groups, groupsToAdd) { + let ids = idOrIds; + if (!Array.isArray(idOrIds)) { + ids = [idOrIds]; + } + + // find index of last group with provided id + const index = groups.reduce((acc, group, index) => { + return ids.includes(group.id) ? index : acc; + }, -1); + if (index !== -1) { + groups.splice(index + 1, 0, ...groupsToAdd); + } else { + // add in the beginning if group with provided id is missing + groups.unshift(...groupsToAdd); + } +} +function filterWithEntriesVisible$1(template, groups) { + if (!template.entriesVisible) { + return groups.filter(group => { + return ALWAYS_DISPLAYED_GROUPS.includes(group.id) || group.id.startsWith('ElementTemplates__'); + }); + } + return groups; +} + +var propertiesProviderModule$1 = { + __depends__: [diagram_js_lib_i18n_translate__WEBPACK_IMPORTED_MODULE_19__["default"]], + __init__: ['elementTemplatesPropertiesProvider'], + elementTemplatesPropertiesProvider: ['type', ElementTemplatesPropertiesProvider$1] +}; + +var index$1 = { + __depends__: [coreModule$1, propertiesProviderModule$1] +}; + +/** + * Converts legacy scopes descriptor to newer supported array structure. + * + * For example, it transforms + * + * scopes: { + * 'camunda:Connector': + * { properties: [] + * } + * } + * + * to + * + * scopes: [ + * { + * type: 'camunda:Connector', + * properties: [] + * } + * ] + * + * @param {ScopesDescriptor} scopes + * + * @returns {Array} + */ +function handleLegacyScopes(scopes = []) { + const scopesAsArray = []; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isObject)(scopes)) { + return scopes; + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.keys)(scopes), function (scopeName) { + scopesAsArray.push((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + type: scopeName + }, scopes[scopeName])); + }); + return scopesAsArray; +} + +/** + * Create an input parameter representing the given + * binding and value. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createInputParameter(binding, value, bpmnFactory) { + const { + name, + scriptFormat + } = binding; + let parameterValue, parameterDefinition; + if (scriptFormat) { + parameterDefinition = bpmnFactory.create('camunda:Script', { + scriptFormat, + value + }); + } else { + parameterValue = value; + } + return bpmnFactory.create('camunda:InputParameter', { + name, + value: parameterValue, + definition: parameterDefinition + }); +} + +/** + * Create an output parameter representing the given + * binding and value. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createOutputParameter(binding, value, bpmnFactory) { + const { + scriptFormat, + source + } = binding; + let parameterValue, parameterDefinition; + if (scriptFormat) { + parameterDefinition = bpmnFactory.create('camunda:Script', { + scriptFormat, + value: source + }); + } else { + parameterValue = source; + } + return bpmnFactory.create('camunda:OutputParameter', { + name: value, + value: parameterValue, + definition: parameterDefinition + }); +} + +/** + * Create camunda property from the given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaProperty(binding, value = '', bpmnFactory) { + const { + name + } = binding; + return bpmnFactory.create('camunda:Property', { + name, + value + }); +} + +/** + * Create camunda:in element from given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaIn(binding, value, bpmnFactory) { + const attrs = createCamundaInOutAttrs(binding, value); + return bpmnFactory.create('camunda:In', attrs); +} - return panelNode; - }; +/** + * Create camunda:in with businessKey element from given binding. + * + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaInWithBusinessKey(value, bpmnFactory) { + return bpmnFactory.create('camunda:In', { + businessKey: value + }); +} + +/** + * Create camunda:out element from given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaOut(binding, value, bpmnFactory) { + const attrs = createCamundaInOutAttrs(binding, value); + return bpmnFactory.create('camunda:Out', attrs); +} - - - function setInputValue(node, value) { - - var contentEditable = isContentEditable(node); - - var oldValue = contentEditable ? node.innerText : node.value; - - var selection; - - // prevents input fields from having the value 'undefined' - if (value === undefined) { - value = ''; - } - - if (oldValue === value) { - return; - } - - // update selection on undo/redo - if (document.activeElement === node) { - selection = updateSelection(getSelection(node), oldValue, value); - } - - if (contentEditable) { - node.innerText = value; +/** + * Create camunda:executionListener element containing an inline script from given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaExecutionListener(binding, value, bpmnFactory) { + const { + event, + implementationType, + scriptFormat + } = binding; + + // To guarantee backwards compatibility scriptFormat is taken into account and has precedence before any other type + if (implementationType === 'script' || scriptFormat) { + return bpmnFactory.create('camunda:ExecutionListener', { + event, + script: bpmnFactory.create('camunda:Script', { + scriptFormat, + value + }) + }); + } + return bpmnFactory.create('camunda:ExecutionListener', { + event, + [implementationType]: value + }); +} + +/** + * Create camunda:field element containing string or expression from given binding. + * + * @param {PropertyBinding} binding + * @param {String} value + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaFieldInjection(binding, value, bpmnFactory) { + const DEFAULT_PROPS = { + 'string': undefined, + 'expression': undefined, + 'name': undefined + }; + const props = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, DEFAULT_PROPS); + const { + expression, + name + } = binding; + if (!expression) { + props.string = value; + } else { + props.expression = value; + } + props.name = name; + return bpmnFactory.create('camunda:Field', props); +} + +/** + * Create camunda:errorEventDefinition element containing expression and errorRef + * from given binding. + * + * @param {String} expression + * @param {ModdleElement} errorRef + * @param {ModdleElement} parent + * @param {BpmnFactory} bpmnFactory + * + * @return {ModdleElement} + */ +function createCamundaErrorEventDefinition(expression, errorRef, parent, bpmnFactory) { + const errorEventDefinition = bpmnFactory.create('camunda:ErrorEventDefinition', { + errorRef, + expression + }); + errorEventDefinition.$parent = parent; + return errorEventDefinition; +} + +/** + * Create bpmn:error element containing a specific error id given by a binding. + * + * @param {String} bindingErrorRef + * @param {ModdleElement} parent + * @param {BpmnFactory} bpmnFactory + * + * @return { ModdleElement } + */ +function createError(bindingErrorRef, parent, bpmnFactory) { + const error = bpmnFactory.create('bpmn:Error', { + // we need to later retrieve the error from a binding + id: nextId('Error_' + bindingErrorRef + '_') + }); + error.$parent = parent; + return error; +} + +// helpers ////////// + +/** + * Create properties for camunda:in and camunda:out types. + */ +function createCamundaInOutAttrs(binding, value) { + const properties = {}; + const { + expression, + source, + sourceExpression, + target, + type, + variables + } = binding; + + // explicitly cover all conditions as specified here: + // https://github.com/camunda/camunda-modeler/blob/develop/docs/element-templates/README.md#camundain + if (type === 'camunda:in') { + if (target && !expression && !variables) { + properties.target = target; + properties.source = value; + } else if (target && expression === true && !variables) { + properties.target = target; + properties.sourceExpression = value; + } else if (!target && !expression && variables === 'local') { + properties.local = true; + properties.variables = 'all'; + } else if (target && !expression && variables === 'local') { + properties.local = true; + properties.source = value; + properties.target = target; + } else if (target && expression && variables === 'local') { + properties.local = true; + properties.sourceExpression = value; + properties.target = target; + } else if (!target && !expression && variables === 'all') { + properties.variables = 'all'; + } else { + throw new Error('invalid configuration for camunda:in element template binding'); + } + } + + // explicitly cover all conditions as specified here: + // https://github.com/camunda/camunda-modeler/blob/develop/docs/element-templates/README.md#camundaout + if (type === 'camunda:out') { + if (source && !sourceExpression && !variables) { + properties.target = value; + properties.source = source; + } else if (!source && sourceExpression && !variables) { + properties.target = value; + properties.sourceExpression = sourceExpression; + } else if (!source && !sourceExpression && variables === 'all') { + properties.variables = 'all'; + } else if (source && !sourceExpression && variables === 'local') { + properties.local = true; + properties.source = source; + properties.target = value; + } else if (!source && sourceExpression && variables === 'local') { + properties.local = true; + properties.sourceExpression = sourceExpression; + properties.target = value; + } else if (!source && !sourceExpression && variables === 'local') { + properties.local = true; + properties.variables = 'all'; + } else { + throw new Error('invalid configuration for camunda:out element template binding'); + } + } + return properties; +} + +const CAMUNDA_SERVICE_TASK_LIKE = ['camunda:class', 'camunda:delegateExpression', 'camunda:expression']; + +/** + * Applies an element template to an element. Sets `camunda:modelerTemplate` and + * `camunda:modelerTemplateVersion`. + */ +class ChangeElementTemplateHandler { + constructor(bpmnFactory, bpmnReplace, commandStack, modeling) { + this._bpmnFactory = bpmnFactory; + this._bpmnReplace = bpmnReplace; + this._commandStack = commandStack; + this._modeling = modeling; + } + + /** + * Change an element's template and update its properties as specified in `newTemplate`. Specify + * `oldTemplate` to update from one template to another. If `newTemplate` isn't specified the + * `camunda:modelerTemplate` and `camunda:modelerTemplateVersion` properties will be removed from + * the element. + * + * @param {Object} context + * @param {Object} context.element + * @param {Object} [context.oldTemplate] + * @param {Object} [context.newTemplate] + */ + preExecute(context) { + const newTemplate = context.newTemplate, + oldTemplate = context.oldTemplate; + let element = context.element; + + // update camunda:modelerTemplate attribute + this._updateCamundaModelerTemplate(element, newTemplate); + if (newTemplate) { + element = context.element = this._updateTaskType(element, newTemplate); + + // update properties + this._updateProperties(element, oldTemplate, newTemplate); + + // update camunda:ExecutionListener properties + this._updateCamundaExecutionListenerProperties(element, newTemplate); + + // update camunda:Field properties + this._updateCamundaFieldProperties(element, oldTemplate, newTemplate); + + // update camunda:In and camunda:Out properties + this._updateCamundaInOutProperties(element, oldTemplate, newTemplate); + + // update camunda:InputParameter and camunda:OutputParameter properties + this._updateCamundaInputOutputParameterProperties(element, oldTemplate, newTemplate); + + // update camunda:Property properties + this._updateCamundaPropertyProperties(element, oldTemplate, newTemplate); + + // update camunda:ErrorEventDefinition properties + this._updateCamundaErrorEventDefinitionProperties(element, oldTemplate, newTemplate); + + // update properties for each scope + handleLegacyScopes(newTemplate.scopes).forEach(newScopeTemplate => { + this._updateScopeProperties(element, oldTemplate, newScopeTemplate, newTemplate); + }); + } + } + _getOrCreateExtensionElements(element) { + const bpmnFactory = this._bpmnFactory, + modeling = this._modeling; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = bpmnFactory.create('bpmn:ExtensionElements', { + values: [] + }); + extensionElements.$parent = businessObject; + modeling.updateProperties(element, { + extensionElements: extensionElements + }); + } + return extensionElements; + } + + /** + * Update `camunda:ErrorEventDefinition` properties of specified business object. Event + * definitions can only exist in `bpmn:ExtensionElements`. + * + * Ensures an bpmn:Error exists for the event definition. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateCamundaErrorEventDefinitionProperties(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:errorEventDefinition'; + }); + + // (1) do not override if no updates + if (!newProperties.length) { + return; + } + const extensionElements = this._getOrCreateExtensionElements(element); + const oldErrorEventDefinitions = findExtensions(element, ['camunda:ErrorEventDefinition']); + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + oldEventDefinition = oldProperty && findOldBusinessObject(extensionElements, oldProperty), + newBinding = newProperty.binding; + + // (2) update old event definitions + if (oldProperty && oldEventDefinition) { + if (!propertyChanged(oldEventDefinition, oldProperty)) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldEventDefinition, + properties: { + expression: newProperty.value + } + }); + } + remove(oldErrorEventDefinitions, oldEventDefinition); + } + + // (3) create new event definition + error + else { + const rootElement = getRoot((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element)), + newError = createError(newBinding.errorRef, rootElement, bpmnFactory), + newEventDefinition = createCamundaErrorEventDefinition(newProperty.value, newError, extensionElements, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: rootElement, + properties: { + rootElements: [...rootElement.get('rootElements'), newError] + } + }); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), newEventDefinition] + } + }); + } + }); + + // (4) remove old event definitions + if (oldErrorEventDefinitions.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(extensionElements.get('values'), value => oldErrorEventDefinitions.includes(value)) + } + }); + } + } + + /** + * Update `camunda:ExecutionListener` properties of specified business object. Execution listeners + * will always be overridden. Execution listeners can only exist in `bpmn:ExtensionElements`. + * + * @param {djs.model.Base} element + * @param {Object} newTemplate + */ + _updateCamundaExecutionListenerProperties(element, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:executionListener'; + }); + + // (1) do not override old execution listeners if no new execution listeners specified + if (!newProperties.length) { + return; + } + const extensionElements = this._getOrCreateExtensionElements(element); + + // (2) remove old execution listeners + const oldExecutionListeners = findExtensions(element, ['camunda:ExecutionListener']); + + // (3) add new execution listeners + const newExecutionListeners = newProperties.map(newProperty => { + const newBinding = newProperty.binding, + propertyValue = newProperty.value; + return createCamundaExecutionListener(newBinding, propertyValue, bpmnFactory); + }); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: [...(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(extensionElements.get('values'), value => oldExecutionListeners.includes(value)), ...newExecutionListeners] + } + }); + } + + /** + * Update `camunda:Field` properties of specified business object. + * If business object is `camunda:ExecutionListener` or `camunda:TaskListener` `fields` property + * will be updated. Otherwise `extensionElements.values` property will be updated. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + * @param {ModdleElement} businessObject + */ + _updateCamundaFieldProperties(element, oldTemplate, newTemplate, businessObject) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:field'; + }); + + // (1) do not override old fields if no new fields specified + if (!newProperties.length) { + return; + } + if (!businessObject) { + businessObject = this._getOrCreateExtensionElements(element); + } + const propertyName = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(businessObject, ['camunda:ExecutionListener', 'camunda:TaskListener']) ? 'fields' : 'values'; + const oldFields = findExtensions(element, ['camunda:Field']); + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + oldField = oldProperty && findOldBusinessObject(businessObject, oldProperty), + newBinding = newProperty.binding; + + // (2) update old fields + if (oldProperty && oldField) { + if (!propertyChanged(oldField, oldProperty)) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldField, + properties: { + string: newProperty.value + } + }); + } + remove(oldFields, oldField); + } + + // (3) add new fields + else { + const newCamundaFieldInjection = createCamundaFieldInjection(newBinding, newProperty.value, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + [propertyName]: [...businessObject.get(propertyName), newCamundaFieldInjection] + } + }); + } + }); + + // (4) remove old fields + if (oldFields.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + [propertyName]: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(businessObject.get(propertyName), value => oldFields.includes(value)) + } + }); + } + } + + /** + * Update `camunda:In` and `camunda:Out` properties of specified business object. Only + * `bpmn:CallActivity` and events with `bpmn:SignalEventDefinition` can have ins. Only + * `camunda:CallActivity` can have outs. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateCamundaInOutProperties(element, oldTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:in' || newBindingType === 'camunda:in:businessKey' || newBindingType === 'camunda:out'; + }); + + // (1) do not override old fields if no new fields specified + if (!newProperties.length) { + return; + } + + // get extension elements of either signal event definition or call activity + const extensionElements = this._getOrCreateExtensionElements(getSignalEventDefinition(element) || element); + const oldInsAndOuts = findExtensions(extensionElements, ['camunda:In', 'camunda:Out']); + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + oldBinding = oldProperty && oldProperty.binding, + oldInOurOut = oldProperty && findOldBusinessObject(extensionElements, oldProperty), + newPropertyValue = newProperty.value, + newBinding = newProperty.binding, + newBindingType = newBinding.type, + properties = {}; + let newInOrOut; + + // (2) update old ins and outs + if (oldProperty && oldInOurOut) { + if (!propertyChanged(oldInOurOut, oldProperty)) { + if (newBindingType === 'camunda:in') { + if (newBinding.expression) { + properties['camunda:sourceExpression'] = newPropertyValue; } else { - node.value = value; - } - - if (selection) { - setSelection(node, selection); - } - } - - function setSelectValue(node, value) { - if (value !== undefined) { - node.value = value; - } - } - - function setToggleValue(node, value) { - var nodeValue = node.value; - - node.checked = (value === nodeValue) || (!domAttr(node, 'value') && value); + properties['camunda:source'] = newPropertyValue; + } + } else if (newBindingType === 'camunda:in:businessKey') { + properties['camunda:businessKey'] = newPropertyValue; + } else if (newBindingType === 'camunda:out') { + properties['camunda:target'] = newPropertyValue; + } + } + + // update camunda:local property if it changed + if (oldBinding.local && !newBinding.local || !oldBinding.local && newBinding.local) { + properties.local = newBinding.local; + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.keys)(properties)) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldInOurOut, + properties + }); + } + remove(oldInsAndOuts, oldInOurOut); + } + + // (3) add new ins and outs + else { + if (newBindingType === 'camunda:in') { + newInOrOut = createCamundaIn(newBinding, newPropertyValue, bpmnFactory); + } else if (newBindingType === 'camunda:out') { + newInOrOut = createCamundaOut(newBinding, newPropertyValue, bpmnFactory); + } else if (newBindingType === 'camunda:in:businessKey') { + newInOrOut = createCamundaInWithBusinessKey(newPropertyValue, bpmnFactory); + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), newInOrOut] + } + }); + } + }); + + // (4) remove old ins and outs + if (oldInsAndOuts.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(extensionElements.get('values'), value => oldInsAndOuts.includes(value)) + } + }); + } + } + + /** + * Update `camunda:InputParameter` and `camunda:OutputParameter` properties of specified business + * object. Both can only exist in `camunda:InputOutput` which can exist in `bpmn:ExtensionElements` + * or `camunda:Connector`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + */ + _updateCamundaInputOutputParameterProperties(element, oldTemplate, newTemplate, businessObject) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:inputParameter' || newBindingType === 'camunda:outputParameter'; + }); + + // (1) do not override old inputs and outputs if no new inputs and outputs specified + if (!newProperties.length) { + return; + } + if (!businessObject) { + businessObject = this._getOrCreateExtensionElements(element); + } + let inputOutput; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'camunda:Connector')) { + inputOutput = businessObject.get('camunda:inputOutput'); + if (!inputOutput) { + inputOutput = bpmnFactory.create('camunda:InputOutput'); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + inputOutput + } + }); + } + } else { + inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + if (!inputOutput) { + inputOutput = bpmnFactory.create('camunda:InputOutput'); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), inputOutput] + } + }); + } + } + const oldInputs = inputOutput.get('camunda:inputParameters') ? inputOutput.get('camunda:inputParameters').slice() : []; + const oldOutputs = inputOutput.get('camunda:outputParameters') ? inputOutput.get('camunda:outputParameters').slice() : []; + let propertyName; + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + oldInputOrOutput = oldProperty && findOldBusinessObject(businessObject, oldProperty), + newPropertyValue = newProperty.value, + newBinding = newProperty.binding, + newBindingType = newBinding.type; + let newInputOrOutput, properties; + + // (2) update old inputs and outputs + if (oldProperty && oldInputOrOutput) { + if (!propertyChanged(oldInputOrOutput, oldProperty)) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(oldInputOrOutput, 'camunda:InputParameter')) { + properties = { + value: newPropertyValue + }; + } else { + properties = { + name: newPropertyValue + }; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldInputOrOutput, + properties + }); + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(oldInputOrOutput, 'camunda:InputParameter')) { + remove(oldInputs, oldInputOrOutput); + } else { + remove(oldOutputs, oldInputOrOutput); } + } - function setTextValue(node, value) { - node.textContent = value; + // (3) add new inputs and outputs + else { + if (newBindingType === 'camunda:inputParameter') { + propertyName = 'inputParameters'; + newInputOrOutput = createInputParameter(newBinding, newPropertyValue, bpmnFactory); + } else { + propertyName = 'outputParameters'; + newInputOrOutput = createOutputParameter(newBinding, newPropertyValue, bpmnFactory); + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOutput, + properties: { + [propertyName]: [...inputOutput.get(propertyName), newInputOrOutput] + } + }); + } + }); + + // (4) remove old inputs and outputs + if (oldInputs.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOutput, + properties: { + inputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(inputOutput.get('inputParameters'), inputParameter => oldInputs.includes(inputParameter)) + } + }); + } + if (oldOutputs.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOutput, + properties: { + outputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(inputOutput.get('outputParameters'), outputParameter => oldOutputs.includes(outputParameter)) + } + }); + } + } + _updateCamundaModelerTemplate(element, newTemplate) { + const modeling = this._modeling; + modeling.updateProperties(element, { + 'camunda:modelerTemplate': newTemplate && newTemplate.id, + 'camunda:modelerTemplateVersion': newTemplate && newTemplate.version + }); + } + + /** + * Update `camunda:Property` properties of specified business object. `camunda:Property` can only + * exist in `camunda:Properties`. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newTemplate + * @param {ModdleElement} businessObject + */ + _updateCamundaPropertyProperties(element, oldTemplate, newTemplate, businessObject) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'camunda:property'; + }); + + // (1) do not override old properties if no new properties specified + if (!newProperties.length) { + return; + } + if (businessObject) { + businessObject = this._getOrCreateExtensionElements(businessObject); + } else { + businessObject = this._getOrCreateExtensionElements(element); + } + let camundaProperties = findExtension(businessObject, 'camunda:Properties'); + if (!camundaProperties) { + camundaProperties = bpmnFactory.create('camunda:Properties'); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + values: [...businessObject.get('values'), camundaProperties] + } + }); + } + const oldCamundaProperties = camundaProperties.get('camunda:values') ? camundaProperties.get('camunda:values').slice() : []; + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + oldCamundaProperty = oldProperty && findOldBusinessObject(businessObject, oldProperty), + newPropertyValue = newProperty.value, + newBinding = newProperty.binding; + + // (2) update old properties + if (oldProperty && oldCamundaProperty) { + if (!propertyChanged(oldCamundaProperty, oldProperty)) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: oldCamundaProperty, + properties: { + value: newPropertyValue + } + }); + } + remove(oldCamundaProperties, oldCamundaProperty); + } + + // (3) add new properties + else { + const newCamundaProperty = createCamundaProperty(newBinding, newPropertyValue, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: camundaProperties, + properties: { + values: [...camundaProperties.get('values'), newCamundaProperty] + } + }); + } + }); + + // (4) remove old properties + if (oldCamundaProperties.length) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: camundaProperties, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(camundaProperties.get('values'), value => oldCamundaProperties.includes(value)) + } + }); + } + } + + /** + * Update `bpmn:conditionExpression` property of specified element. Since condition expression is + * is not primitive it needs special handling. + * + * @param {djs.model.Base} element + * @param {Object} oldProperty + * @param {Object} newProperty + */ + _updateConditionExpression(element, oldProperty, newProperty) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack, + modeling = this._modeling; + const newBinding = newProperty.binding, + newPropertyValue = newProperty.value; + if (!oldProperty) { + modeling.updateProperties(element, { + conditionExpression: bpmnFactory.create('bpmn:FormalExpression', { + body: newPropertyValue, + language: newBinding.scriptFormat + }) + }); + return; + } + const oldBinding = oldProperty.binding, + oldPropertyValue = oldProperty.value; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + conditionExpression = businessObject.get('bpmn:conditionExpression'); + const properties = {}; + if (conditionExpression.get('body') === oldPropertyValue) { + properties.body = newPropertyValue; + } + if (conditionExpression.get('language') === oldBinding.scriptFormat) { + properties.language = newBinding.scriptFormat; + } + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.keys)(properties).length) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: conditionExpression, + properties + }); + } + _updateProperties(element, oldTemplate, newTemplate, businessObject) { + const commandStack = this._commandStack; + const newProperties = newTemplate.properties.filter(newProperty => { + const newBinding = newProperty.binding, + newBindingType = newBinding.type; + return newBindingType === 'property'; + }); + const oldProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === 'property'; + }); + if (!newProperties.length) { + return; + } + if (!businessObject) { + businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + } + newProperties.forEach(newProperty => { + const oldProperty = findOldProperty(oldTemplate, newProperty), + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newPropertyValue = newProperty.value; + let changedElement, properties; + if (oldProperty) { + remove(oldProperties, oldProperty); + } + if (newBindingName === 'conditionExpression') { + this._updateConditionExpression(element, oldProperty, newProperty); + } else { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'bpmn:Error')) { + changedElement = businessObject; + } else { + changedElement = element; } - - function getSelection(node) { - - return isContentEditable(node) ? getContentEditableSelection(node) : { - start: node.selectionStart, - end: node.selectionEnd - }; + if (oldProperty && propertyChanged(changedElement, oldProperty)) { + return; } + properties = {}; + properties[newBindingName] = newPropertyValue; - function getContentEditableSelection(node) { - - var selection = window.getSelection(); - - var focusNode = selection.focusNode, - focusOffset = selection.focusOffset, - anchorOffset = selection.anchorOffset; - - if (!focusNode) { - throw new Error('not selected'); + // only one of `camunda:class`, `camunda:delegateExpression` and `camunda:expression` can be set + // TODO(philippfromme): ensuring only one of these properties is set at a time should be + // implemented in a behavior and not in this handler and properties panel UI + if (CAMUNDA_SERVICE_TASK_LIKE.indexOf(newBindingName) !== -1) { + CAMUNDA_SERVICE_TASK_LIKE.forEach(camundaServiceTaskLikeProperty => { + if (camundaServiceTaskLikeProperty !== newBindingName) { + properties[camundaServiceTaskLikeProperty] = undefined; } - - // verify we have selection on the current element - if (!node.contains(focusNode)) { - throw new Error('not selected'); - } - - return { - start: Math.min(focusOffset, anchorOffset), - end: Math.max(focusOffset, anchorOffset) - }; + }); } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties + }); + } + }); + + // remove old properties not present in new template + oldProperties && oldProperties.forEach(oldProperty => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + [oldProperty.binding.name]: null + } + }); + }); + } + + /** + * Update properties for a specified scope. + * + * @param {djs.model.Base} element + * @param {Object} oldTemplate + * @param {Object} newScopeTemplate + * @param {Object} newTemplate + */ + _updateScopeProperties(element, oldTemplate, newScopeTemplate, newTemplate) { + const bpmnFactory = this._bpmnFactory, + commandStack = this._commandStack; + const scopeName = newScopeTemplate.type; + let scopeElement; + scopeElement = findOldScopeElement(element, newScopeTemplate, newTemplate); + if (!scopeElement) { + scopeElement = bpmnFactory.create(scopeName); + } + const oldScopeTemplate = findOldScopeTemplate(newScopeTemplate, oldTemplate); + + // update properties + this._updateProperties(element, oldScopeTemplate, newScopeTemplate, scopeElement); + + // update camunda:ExecutionListener properties + this._updateCamundaExecutionListenerProperties(element, newScopeTemplate); + + // update camunda:In and camunda:Out properties + this._updateCamundaInOutProperties(element, oldScopeTemplate, newScopeTemplate); + + // update camunda:InputParameter and camunda:OutputParameter properties + this._updateCamundaInputOutputParameterProperties(element, oldScopeTemplate, newScopeTemplate, scopeElement); + + // update camunda:Field properties + this._updateCamundaFieldProperties(element, oldScopeTemplate, newScopeTemplate, scopeElement); + + // update camunda:Property properties + this._updateCamundaPropertyProperties(element, oldScopeTemplate, newScopeTemplate, scopeElement); + + // assume that root elements were already created in root by referenced event definition binding + if (isRootElementScope(scopeName)) { + return; + } + const extensionElements = this._getOrCreateExtensionElements(element); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), scopeElement] + } + }); + } + + /** + * Replaces the element with the specified elementType + * + * @param {djs.model.Base} element + * @param {Object} newTemplate + */ + _updateTaskType(element, newTemplate) { + // determine new task type + const newType = newTemplate.elementType; + if (!newType) { + return element; + } + + // don't replace Task that is already the correct type + if (element.$type === newType.value) { + return element; + } + return this._bpmnReplace.replaceElement(element, { + type: newType.value + }); + } +} +ChangeElementTemplateHandler.$inject = ['bpmnFactory', 'bpmnReplace', 'commandStack', 'modeling']; + +// helpers ////////// + +/** + * Find old business object matching specified old property. + * + * @param {djs.model.Base|ModdleElement} element + * @param {Object} oldProperty + * + * @returns {ModdleElement} + */ +function findOldBusinessObject(element, oldProperty) { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + propertyName; + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType === 'camunda:field') { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.isAny)(businessObject, ['camunda:ExecutionListener', 'camunda:TaskListener'])) { + propertyName = 'camunda:fields'; + } else { + propertyName = 'bpmn:values'; + } + if (!businessObject || !businessObject.get(propertyName) || !businessObject.get(propertyName).length) { + return; + } + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get(propertyName), function (oldBusinessObject) { + return oldBusinessObject.get('camunda:name') === oldBinding.name; + }); + } + if (oldBindingType === 'camunda:in') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('values'), function (oldBusinessObject) { + return oldBusinessObject.get('target') === oldBinding.target; + }); + } + if (oldBindingType === 'camunda:in:businessKey') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('values'), function (oldBusinessObject) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(oldBusinessObject.get('businessKey')); + }); + } + if (oldBindingType === 'camunda:out') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('values'), function (oldBusinessObject) { + return oldBusinessObject.get('source') === oldBinding.source || oldBusinessObject.get('sourceExpression') || oldBinding.sourceExpression; + }); + } + if (oldBindingType === 'camunda:inputParameter' || oldBindingType === 'camunda:outputParameter') { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(businessObject, 'camunda:Connector')) { + businessObject = businessObject.get('camunda:inputOutput'); + if (!businessObject) { + return; + } + } else { + businessObject = findExtension(businessObject, 'camunda:InputOutput'); + if (!businessObject) { + return; + } + } + if (oldBindingType === 'camunda:inputParameter') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('camunda:inputParameters'), function (oldBusinessObject) { + return oldBusinessObject.get('camunda:name') === oldBinding.name; + }); + } else { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('camunda:outputParameters'), function (oldBusinessObject) { + if (oldBinding.scriptFormat) { + const definition = oldBusinessObject.get('camunda:definition'); + return definition && definition.get('camunda:value') === oldBinding.source; + } else { + return oldBusinessObject.get('camunda:value') === oldBinding.source; + } + }); + } + } + if (oldBindingType === 'camunda:property') { + if (!businessObject || !businessObject.get('values') || !businessObject.get('values').length) { + return; + } + businessObject = findExtension(businessObject, 'camunda:Properties'); + if (!businessObject) { + return; + } + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(businessObject.get('values'), function (oldBusinessObject) { + return oldBusinessObject.get('camunda:name') === oldBinding.name; + }); + } + if (oldBindingType === 'camunda:errorEventDefinition') { + return findCamundaErrorEventDefinition(element, oldBinding.errorRef); + } +} + +/** + * Find old property matching specified new property. + * + * @param {Object} oldTemplate + * @param {Object} newProperty + * + * @returns {Object} + */ +function findOldProperty(oldTemplate, newProperty) { + if (!oldTemplate) { + return; + } + const oldProperties = oldTemplate.properties, + newBinding = newProperty.binding, + newBindingName = newBinding.name, + newBindingType = newBinding.type; + if (newBindingType === 'property') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + return oldBindingType === 'property' && oldBindingName === newBindingName; + }); + } + if (newBindingType === 'camunda:field') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + return oldBindingType === 'camunda:field' && oldBindingName === newBindingName; + }); + } + if (newBindingType === 'camunda:in') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'camunda:in') { + return; + } + + // always override if change from source to source expression or vice versa + if (oldBinding.expression && !newBinding.expression || !oldBinding.expression && newBinding.expression) { + return; + } + return oldBinding.target === newBinding.target; + }); + } + if (newBindingType === 'camunda:in:businessKey') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === 'camunda:in:businessKey'; + }); + } + if (newBindingType === 'camunda:out') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + return oldBindingType === 'camunda:out' && (oldBinding.source === newBinding.source || oldBinding.sourceExpression === newBinding.sourceExpression); + }); + } + if (newBindingType === 'camunda:inputParameter') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'camunda:inputParameter') { + return; + } + return oldBindingName === newBindingName && oldBinding.scriptFormat === newBinding.scriptFormat; + }); + } + if (newBindingType === 'camunda:outputParameter') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingType = oldBinding.type; + if (oldBindingType !== 'camunda:outputParameter') { + return; + } + return oldBinding.source === newBinding.source && oldBinding.scriptFormat === newBinding.scriptFormat; + }); + } + if (newBindingType === 'camunda:property') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type; + return oldBindingType === 'camunda:property' && oldBindingName === newBindingName; + }); + } + if (newBindingType === 'camunda:errorEventDefinition') { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(oldProperties, function (oldProperty) { + const newBindingRef = newBinding.errorRef, + oldBinding = oldProperty.binding, + oldBindingRef = oldBinding.errorRef, + oldBindingType = oldBinding.type; + return oldBindingType === 'camunda:errorEventDefinition' && oldBindingRef === newBindingRef; + }); + } +} +function findOldScopeElement(element, scopeTemplate, template) { + const scopeName = scopeTemplate.type, + id = scopeTemplate.id; + if (scopeName === 'camunda:Connector') { + return findExtension(element, 'camunda:Connector'); + } + if (scopeName === 'bpmn:Error') { + // (1) find by error event definition binding + const errorEventDefinitionBinding = findErrorEventDefinitionBinding(template, id); + if (!errorEventDefinitionBinding) { + return; + } + + // (2) find error event definition + const errorEventDefinition = findOldBusinessObject(element, errorEventDefinitionBinding); + if (!errorEventDefinition) { + return; + } + + // (3) retrieve referenced error + return errorEventDefinition.errorRef; + } +} +function isRootElementScope(scopeName) { + return ['bpmn:Error'].includes(scopeName); +} +function findOldScopeTemplate(scopeTemplate, oldTemplate) { + const scopeName = scopeTemplate.type, + scopeId = scopeTemplate.id, + scopes = oldTemplate && handleLegacyScopes(oldTemplate.scopes); + return scopes && (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(scopes, function (scope) { + if (isRootElementScope(scopeName)) { + return scope.id === scopeId; + } + return scope.type === scopeName; + }); +} +function findErrorEventDefinitionBinding(template, templateErrorId) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(template.properties, function (property) { + return property.binding.errorRef === templateErrorId; + }); +} + +/** + * Check whether property was changed after being set by template. + * + * @param {djs.model.Base|ModdleElement} element + * @param {Object} oldProperty + * + * @returns {boolean} + */ +function propertyChanged(element, oldProperty) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const oldBinding = oldProperty.binding, + oldBindingName = oldBinding.name, + oldBindingType = oldBinding.type, + oldPropertyValue = oldProperty.value; + let conditionExpression, definition; + if (oldBindingType === 'property') { + if (oldBindingName === 'conditionExpression') { + conditionExpression = businessObject.get('bpmn:conditionExpression'); + return conditionExpression.get('bpmn:body') !== oldPropertyValue; + } + return businessObject.get(oldBindingName) !== oldPropertyValue; + } + if (oldBindingType === 'camunda:field') { + return businessObject.get('camunda:string') !== oldPropertyValue; + } + if (oldBindingType === 'camunda:in') { + if (oldBinding.expression) { + return businessObject.get('sourceExpression') !== oldPropertyValue; + } else { + return businessObject.get('camunda:source') !== oldPropertyValue; + } + } + if (oldBindingType === 'camunda:in:businessKey') { + return businessObject.get('camunda:businessKey') !== oldPropertyValue; + } + if (oldBindingType === 'camunda:out') { + return businessObject.get('camunda:target') !== oldPropertyValue; + } + if (oldBindingType === 'camunda:inputParameter') { + if (oldBinding.scriptFormat) { + definition = businessObject.get('camunda:definition'); + return definition && definition.get('camunda:value') !== oldPropertyValue; + } else { + return businessObject.get('camunda:value') !== oldPropertyValue; + } + } + if (oldBindingType === 'camunda:outputParameter') { + return businessObject.get('camunda:name') !== oldPropertyValue; + } + if (oldBindingType === 'camunda:property') { + return businessObject.get('camunda:value') !== oldPropertyValue; + } + if (oldBindingType === 'camunda:errorEventDefinition') { + return businessObject.get('expression') !== oldPropertyValue; + } +} +function remove(array, item) { + const index = array.indexOf(item); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(index)) { + return array; + } + array.splice(index, 1); + return array; +} + +function registerHandlers(commandStack, elementTemplates, eventBus) { + commandStack.registerHandler('element-templates.multi-command-executor', MultiCommandHandler); + commandStack.registerHandler('propertiesPanel.camunda.changeTemplate', ChangeElementTemplateHandler); + commandStack.registerHandler('propertiesPanel.removeTemplate', RemoveElementTemplateHandler); + + // apply default element templates on shape creation + eventBus.on(['commandStack.shape.create.postExecuted'], function (event) { + const { + context: { + hints = {}, + shape + } + } = event; + if (hints.createElementsBehavior !== false) { + applyDefaultTemplate(shape, elementTemplates, commandStack); + } + }); + + // apply default element templates on connection creation + eventBus.on(['commandStack.connection.create.postExecuted'], function (event) { + const { + context: { + hints = {}, + connection + } + } = event; + if (hints.createElementsBehavior !== false) { + applyDefaultTemplate(connection, elementTemplates, commandStack); + } + }); +} +registerHandlers.$inject = ['commandStack', 'elementTemplates', 'eventBus']; +var commandsModule = { + __init__: [registerHandlers] +}; +function applyDefaultTemplate(element, elementTemplates, commandStack) { + if (!elementTemplates.get(element) && elementTemplates.getDefault(element)) { + const command = 'propertiesPanel.camunda.changeTemplate'; + const commandContext = { + element: element, + newTemplate: elementTemplates.getDefault(element) + }; + commandStack.execute(command, commandContext); + } +} + +/** + * This Behavior checks if the new element's type is in + * the list of elements the template applies to and unlinks + * it if not. + */ +class ReplaceBehavior extends diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_17__["default"] { + constructor(elementTemplates, injector) { + super(injector.get('eventBus')); + this.postExecuted('shape.replace', function (e) { + var context = e.context, + oldShape = context.oldShape, + oldBo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(oldShape), + newShape = context.newShape, + newBo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(newShape); + if (!oldBo.modelerTemplate) { + return; + } + const template = newBo.modelerTemplate; + const version = newBo.modelerTemplateVersion; + const elementTemplate = elementTemplates.get(template, version); + if (!elementTemplate) { + elementTemplates.unlinkTemplate(newShape, injector); + return; + } + const { + appliesTo, + elementType + } = elementTemplate; + if (elementType) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(newShape, elementType.value)) { + elementTemplates.unlinkTemplate(newShape, injector); + } + return; + } + const allowed = appliesTo.reduce((allowed, type) => { + return allowed || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(newBo, type); + }, false); + if (!allowed) { + elementTemplates.unlinkTemplate(newShape, injector); + } + }); + } +} +ReplaceBehavior.$inject = ['elementTemplates', 'injector']; + +var behaviorModule = { + __init__: ['elementTemplatesReplaceBehavior'], + elementTemplatesReplaceBehavior: ['type', ReplaceBehavior] +}; + +var coreModule = { + __depends__: [commandsModule, behaviorModule], + __init__: ['elementTemplatesLoader'], + elementTemplates: ['type', ElementTemplates$1], + elementTemplatesLoader: ['type', ElementTemplatesLoader$1] +}; + +const CAMUNDA_ERROR_EVENT_DEFINITION_TYPE$1 = 'camunda:errorEventDefinition'; +const CAMUNDA_EXECUTION_LISTENER_TYPE = 'camunda:executionListener'; +const CAMUNDA_FIELD_TYPE = 'camunda:field'; +const CAMUNDA_IN_BUSINESS_KEY_TYPE = 'camunda:in:businessKey'; +const CAMUNDA_IN_TYPE = 'camunda:in'; +const CAMUNDA_INPUT_PARAMETER_TYPE$1 = 'camunda:inputParameter'; +const CAMUNDA_OUT_TYPE = 'camunda:out'; +const CAMUNDA_OUTPUT_PARAMETER_TYPE$1 = 'camunda:outputParameter'; +const CAMUNDA_PROPERTY_TYPE = 'camunda:property'; +const PROPERTY_TYPE = 'property'; +const EXTENSION_BINDING_TYPES = [CAMUNDA_ERROR_EVENT_DEFINITION_TYPE$1, CAMUNDA_FIELD_TYPE, CAMUNDA_IN_TYPE, CAMUNDA_IN_BUSINESS_KEY_TYPE, CAMUNDA_INPUT_PARAMETER_TYPE$1, CAMUNDA_OUT_TYPE, CAMUNDA_OUTPUT_PARAMETER_TYPE$1, CAMUNDA_PROPERTY_TYPE]; +const IO_BINDING_TYPES = [CAMUNDA_INPUT_PARAMETER_TYPE$1, CAMUNDA_OUTPUT_PARAMETER_TYPE$1]; +const IN_OUT_BINDING_TYPES = [CAMUNDA_IN_BUSINESS_KEY_TYPE, CAMUNDA_IN_TYPE, CAMUNDA_OUT_TYPE]; + +const PRIMITIVE_MODDLE_TYPES = ['Boolean', 'Integer', 'String']; +const DEFAULT_CUSTOM_GROUP = { + id: 'ElementTemplates__CustomProperties', + label: 'Custom properties' +}; +function CustomProperties(props) { + const { + element, + elementTemplate + } = props; + const groups = []; + const { + id, + properties, + groups: propertyGroups, + scopes + } = elementTemplate; + + // (1) group properties by group id + const groupedProperties = groupByGroupId(properties); + const defaultProps = []; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(groupedProperties, (properties, groupId) => { + const group = findCustomGroup(propertyGroups, groupId); + if (!group) { + return defaultProps.push(...properties); + } + addCustomGroup(groups, { + element, + id: `ElementTemplates__CustomProperties-${groupId}`, + label: group.label, + properties: properties, + templateId: `${id}-${groupId}` + }); + }); + + // (2) add default custom props + if (defaultProps.length) { + addCustomGroup(groups, { + ...DEFAULT_CUSTOM_GROUP, + element, + properties: defaultProps, + templateId: id + }); + } + + // (3) add custom scopes props + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isArray)(scopes)) { + scopes.forEach(scope => { + const { + properties, + type + } = scope; + const id = type.replace(/:/g, '-'); + addCustomGroup(groups, { + element, + id: `ElementTemplates__CustomGroup-${id}`, + label: `Custom properties for scope <${type}>`, + properties, + templateId: id, + scope + }); + }); + } + return groups; +} +function addCustomGroup(groups, props) { + const { + element, + id, + label, + properties, + scope, + templateId + } = props; + const customPropertiesGroup = { + id, + label, + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.Group, + entries: [], + shouldOpen: true + }; + properties.forEach((property, index) => { + const entry = createCustomEntry(`custom-entry-${templateId}-${index}`, element, property, scope); + if (entry) { + customPropertiesGroup.entries.push(entry); + } + }); + if (customPropertiesGroup.entries.length) { + groups.push(customPropertiesGroup); + } +} +function createCustomEntry(id, element, property, scope) { + let { + type + } = property; + if (!type) { + type = getDefaultType(property); + } + if (type === 'Boolean') { + return { + id, + component: BooleanProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isCheckboxEntryEdited, + property, + scope + }; + } + if (type === 'Dropdown') { + return { + id, + component: DropdownProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isSelectEntryEdited, + property, + scope + }; + } + if (type === 'String') { + return { + id, + component: StringProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isTextFieldEntryEdited, + property, + scope + }; + } + if (type === 'Text') { + return { + id, + component: TextAreaProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.isTextAreaEntryEdited, + property, + scope + }; + } +} +function getDefaultType(property) { + const { + binding + } = property; + const { + type + } = binding; + if ([PROPERTY_TYPE, CAMUNDA_PROPERTY_TYPE, CAMUNDA_IN_TYPE, CAMUNDA_IN_BUSINESS_KEY_TYPE, CAMUNDA_OUT_TYPE, CAMUNDA_FIELD_TYPE].includes(type)) { + return 'String'; + } + if (type === CAMUNDA_EXECUTION_LISTENER_TYPE) { + return 'Hidden'; + } +} +function BooleanProperty(props) { + const { + element, + id, + property, + scope + } = props; + const { + description, + editable, + label + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.CheckboxEntry)({ + element, + getValue: propertyGetter(element, property, scope), + id, + label, + description: PropertyDescription({ + description + }), + setValue: propertySetter(bpmnFactory, commandStack, element, property, scope), + disabled: editable === false + }); +} +function DropdownProperty(props) { + const { + element, + id, + property, + scope + } = props; + const { + description, + editable, + label + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const getOptions = () => { + const { + choices + } = property; + return choices.map(({ + name, + value + }) => { + return { + label: name, + value + }; + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.SelectEntry)({ + element, + id, + label, + getOptions, + description: PropertyDescription({ + description + }), + getValue: propertyGetter(element, property, scope), + setValue: propertySetter(bpmnFactory, commandStack, element, property, scope), + disabled: editable === false, + validate: propertyValidator(translate, property) + }); +} +function StringProperty(props) { + const { + element, + id, + property, + scope + } = props; + const { + description, + editable, + label + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextFieldEntry)({ + debounce, + element, + getValue: propertyGetter(element, property, scope), + id, + label, + description: PropertyDescription({ + description + }), + setValue: propertySetter(bpmnFactory, commandStack, element, property, scope), + validate: propertyValidator(translate, property), + disabled: editable === false + }); +} +function TextAreaProperty(props) { + const { + element, + id, + property, + scope + } = props; + const { + description, + editable, + label + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextAreaEntry)({ + debounce, + element, + id, + label, + description: PropertyDescription({ + description + }), + getValue: propertyGetter(element, property, scope), + setValue: propertySetter(bpmnFactory, commandStack, element, property, scope), + disabled: editable === false, + validate: propertyValidator(translate, property) + }); +} +function propertyGetter(element, property, scope) { + return function getValue() { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const { + binding, + value: defaultValue = '' + } = property; + const { + name, + type + } = binding; + if (scope) { + businessObject = getScopeBusinessObject(businessObject, scope); + if (!businessObject) { + return defaultValue; + } + } + + // property + if (type === 'property') { + const value = businessObject.get(name); + if (name === 'conditionExpression') { + if (value) { + return value.get('body'); + } + return defaultValue; + } else { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(value)) { + return value; + } + return defaultValue; + } + } + + // camunda:ErrorEventDefinition + if (type === CAMUNDA_ERROR_EVENT_DEFINITION_TYPE$1) { + const { + errorRef + } = binding; + const errorEventDefinition = findCamundaErrorEventDefinition(businessObject, errorRef); + if (errorEventDefinition) { + return errorEventDefinition.get('camunda:expression'); + } else { + return ''; + } + } + + // camunda:Field + if (type === CAMUNDA_FIELD_TYPE) { + const camundaFields = findExtensions(businessObject, ['camunda:Field']); + const camundaField = camundaFields.find(camundaField => { + return camundaField.get('camunda:name') === name; + }); + if (camundaField) { + return camundaField.get('camunda:string') || camundaField.get('camunda:expression'); + } else { + return ''; + } + } + + // camunda:Property + if (type === CAMUNDA_PROPERTY_TYPE) { + let camundaProperties; + if (scope) { + // TODO(philippfromme): as only bpmn:Error and camunda:Connector are supported this code is practically dead + camundaProperties = businessObject.get('properties'); + } else { + camundaProperties = findExtension(businessObject, 'camunda:Properties'); + } + if (camundaProperties) { + const camundaProperty = findCamundaProperty(camundaProperties, binding); + if (camundaProperty) { + return camundaProperty.get('camunda:value'); + } + } + return defaultValue; + } + if (IO_BINDING_TYPES.includes(type)) { + let inputOutput; + if (scope) { + inputOutput = businessObject.get('inputOutput'); + } else { + inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + } + if (!inputOutput) { + return defaultValue; + } + + // camunda:InputParameter + if (type === CAMUNDA_INPUT_PARAMETER_TYPE$1) { + const inputParameter = findInputParameter(inputOutput, binding); + if (inputParameter) { + const { + scriptFormat + } = binding; + if (scriptFormat) { + const definition = inputParameter.get('camunda:definition'); + if (definition) { + return definition.get('camunda:value'); + } + } else { + return inputParameter.get('value') || ''; + } + } + return defaultValue; + } + + // camunda:OutputParameter + if (type === CAMUNDA_OUTPUT_PARAMETER_TYPE$1) { + const outputParameter = findOutputParameter(inputOutput, binding); + if (outputParameter) { + return outputParameter.get('camunda:name'); + } + return defaultValue; + } + } + + // camunda:In and camunda:Out + if (IN_OUT_BINDING_TYPES.includes(type)) { + const camundaInOut = findCamundaInOut(businessObject, binding); + if (camundaInOut) { + if (type === CAMUNDA_IN_BUSINESS_KEY_TYPE) { + return camundaInOut.get('camunda:businessKey'); + } else if (type === CAMUNDA_OUT_TYPE) { + return camundaInOut.get('camunda:target'); + } else if (type === CAMUNDA_IN_TYPE) { + const { + expression + } = binding; + if (expression) { + return camundaInOut.get('camunda:sourceExpression'); + } else { + return camundaInOut.get('camunda:source'); + } + } + } + return defaultValue; + } + + // should never throw as templates are validated beforehand + throw unknownBindingError(element, property); + }; +} +function propertySetter(bpmnFactory, commandStack, element, property, scope) { + return function setValue(value) { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const { + binding + } = property; + const { + name, + type + } = binding; + const rootElement = getRoot(businessObject); + let extensionElements; + let propertyValue; + const commands = []; + if (EXTENSION_BINDING_TYPES.includes(type)) { + extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', null, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + } + if (scope) { + businessObject = getScopeBusinessObject(businessObject, scope); + if (!businessObject) { + // bpmn:Error + if (scope.type === 'bpmn:Error') { + businessObject = createError(scope.id, rootElement, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: rootElement, + properties: { + rootElements: [...rootElement.get('rootElements'), businessObject] + } + } + }); + } else { + businessObject = createElement(scope.type, null, element, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), businessObject] + } + } + }); + } + } + } + + // property + if (type === 'property') { + if (name === 'conditionExpression') { + const { + scriptFormat + } = binding; + propertyValue = createElement('bpmn:FormalExpression', { + body: value, + language: scriptFormat + }, businessObject, bpmnFactory); + } else { + const propertyDescriptor = businessObject.$descriptor.propertiesByName[name]; + const { + type: propertyType + } = propertyDescriptor; + + // do not override non-primitive types + if (!PRIMITIVE_MODDLE_TYPES.includes(propertyType)) { + throw new Error(`cannot set property of type <${propertyType}>`); + } + if (propertyType === 'Boolean') { + propertyValue = !!value; + } else if (propertyType === 'Integer') { + propertyValue = parseInt(value, 10); + if (isNaN(propertyValue)) { + // do not set NaN value + propertyValue = undefined; + } + } else { + // make sure we don't remove the property + propertyValue = value || ''; + } + } + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isUndefined)(propertyValue)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + [name]: propertyValue + } + } + }); + } + } + + // camunda:ErrorEventDefinition + if (type === CAMUNDA_ERROR_EVENT_DEFINITION_TYPE$1) { + const { + errorRef + } = binding; + const oldCamundaErrorEventDefinition = findCamundaErrorEventDefinition(businessObject, errorRef); + if (oldCamundaErrorEventDefinition) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: oldCamundaErrorEventDefinition, + properties: { + 'camunda:expression': value + } + } + }); + } else { + const newError = createError(binding.errorRef, rootElement, bpmnFactory), + newCamundaErrorEventDefinition = createCamundaErrorEventDefinition(value, newError, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: rootElement, + properties: { + rootElements: [...rootElement.get('rootElements'), newError] + } + } + }); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), newCamundaErrorEventDefinition] + } + } + }); + } + } + + // camunda:Field + if (type === CAMUNDA_FIELD_TYPE) { + const oldCamundaFields = findExtensions(businessObject, ['camunda:Field']); + const newCamundaFields = []; + if (oldCamundaFields.length) { + oldCamundaFields.forEach(camundaField => { + if (camundaField.name === name) { + newCamundaFields.push(createCamundaFieldInjection(binding, value, bpmnFactory)); + } else { + newCamundaFields.push(camundaField); + } + }); + } else { + newCamundaFields.push(createCamundaFieldInjection(binding, value, bpmnFactory)); + } + const values = extensionElements.get('values').filter(value => !oldCamundaFields.includes(value)); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...values, ...newCamundaFields] + } + } + }); + } + + // camunda:Property + if (type === CAMUNDA_PROPERTY_TYPE) { + let camundaProperties; + if (scope) { + camundaProperties = businessObject.get('properties'); + } else { + camundaProperties = findExtension(extensionElements, 'camunda:Properties'); + } + if (!camundaProperties) { + camundaProperties = createElement('camunda:Properties', null, businessObject, bpmnFactory); + if (scope) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + properties: camundaProperties + } + } + }); + } else { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), camundaProperties] + } + } + }); + } + } + const oldCamundaProperty = findCamundaProperty(camundaProperties, binding); + const newCamundaProperty = createCamundaProperty(binding, value, bpmnFactory); + const values = camundaProperties.get('values').filter(value => value !== oldCamundaProperty); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: camundaProperties, + properties: { + values: [...values, newCamundaProperty] + } + } + }); + } + if (IO_BINDING_TYPES.includes(type)) { + let inputOutput; + if (scope) { + inputOutput = businessObject.get('inputOutput'); + } else { + inputOutput = findExtension(extensionElements, 'camunda:InputOutput'); + } + if (!inputOutput) { + inputOutput = createElement('camunda:InputOutput', null, businessObject, bpmnFactory); + if (scope) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + inputOutput + } + } + }); + } else { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), inputOutput] + } + } + }); + } + } + + // camunda:InputParameter + if (type === CAMUNDA_INPUT_PARAMETER_TYPE$1) { + const oldCamundaInputParameter = findInputParameter(inputOutput, binding); + const newCamundaInputParameter = createInputParameter(binding, value, bpmnFactory); + const values = inputOutput.get('camunda:inputParameters').filter(value => value !== oldCamundaInputParameter); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: inputOutput, + properties: { + 'camunda:inputParameters': [...values, newCamundaInputParameter] + } + } + }); + } + + // camunda:OutputParameter + if (type === CAMUNDA_OUTPUT_PARAMETER_TYPE$1) { + const oldCamundaOutputParameter = findOutputParameter(inputOutput, binding); + const newCamundaOutputParameter = createOutputParameter(binding, value, bpmnFactory); + const values = inputOutput.get('camunda:outputParameters').filter(value => value !== oldCamundaOutputParameter); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: inputOutput, + properties: { + 'camunda:outputParameters': [...values, newCamundaOutputParameter] + } + } + }); + } + } + + // camunda:In and camunda:Out + if (IN_OUT_BINDING_TYPES.includes(type)) { + const oldCamundaInOut = findCamundaInOut(businessObject, binding); + let newCamundaInOut; + if (type === CAMUNDA_IN_TYPE) { + newCamundaInOut = createCamundaIn(binding, value, bpmnFactory); + } else if (type === CAMUNDA_OUT_TYPE) { + newCamundaInOut = createCamundaOut(binding, value, bpmnFactory); + } else { + newCamundaInOut = createCamundaInWithBusinessKey(value, bpmnFactory); + } + const values = extensionElements.get('values').filter(value => value !== oldCamundaInOut); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...values, newCamundaInOut] + } + } + }); + } + if (commands.length) { + commandStack.execute('element-templates.multi-command-executor', commands); + return; + } + + // should never throw as templates are validated beforehand + throw unknownBindingError(element, property); + }; +} +function propertyValidator(translate, property) { + return function validate(value) { + const { + constraints = {} + } = property; + const { + maxLength, + minLength, + notEmpty + } = constraints; + if (notEmpty && isEmptyString(value)) { + return translate('Must not be empty.'); + } + if (maxLength && value.length > maxLength) { + return translate('Must have max length {maxLength}.', { + maxLength + }); + } + if (minLength && value.length < minLength) { + return translate('Must have min length {minLength}.', { + minLength + }); + } + let { + pattern + } = constraints; + if (pattern) { + let message; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(pattern)) { + message = pattern.message; + pattern = pattern.value; + } + if (!matchesPattern(value, pattern)) { + return message || translate('Must match pattern {pattern}.', { + pattern + }); + } + } + }; +} +function getScopeBusinessObject(businessObject, scope) { + const { + id, + type + } = scope; + if (type === 'bpmn:Error') { + // retrieve error through referenced error event definition + const errorEventDefinition = findCamundaErrorEventDefinition(businessObject, id); + if (errorEventDefinition) { + return errorEventDefinition.get('errorRef'); + } + } + return findExtension(businessObject, type); +} +function unknownBindingError(element, property) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const id = businessObject.get('id'); + const { + binding + } = property; + const { + type + } = binding; + return new Error(`unknown binding <${type}> for element <${id}>, this should never happen`); +} +function isEmptyString(string) { + return !string || !string.trim().length; +} +function matchesPattern(string, pattern) { + return new RegExp(pattern).test(string); +} +function groupByGroupId(properties) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.groupBy)(properties, 'group'); +} +function findCustomGroup(groups, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(groups, g => g.id === id); +} + +function ErrorProperties(props) { + const { + element, + index, + property, + groups + } = props; + const { + binding, + label + } = property; + const { + errorRef + } = binding; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + errorEventDefinitions = findExtensions(businessObject, ['camunda:ErrorEventDefinition']); + if (!errorEventDefinitions.length) { + return; + } + const errorEventDefinition = findCamundaErrorEventDefinition(element, errorRef); + const id = `${element.id}-error-${index}`; + let entries = []; + const errorGroup = groups.find(({ + id + }) => id === 'CamundaPlatform__Errors'); + const originalItem = errorGroup.items.find(({ + entries + }) => entries[0].errorEventDefinition === errorEventDefinition); + entries = originalItem.entries; + + // (1) remove global error referenced entry + // entries.shift(); + entries = removeEntry$1(entries, '-errorRef'); + + // (2) remove throw expression input + // entries.pop(); + entries = removeEntry$1(entries, '-expression'); + + // (3) add disabled throw expression input + entries.push({ + id: `${id}-expression`, + component: Expression, + errorEventDefinition, + property + }); + const item = { + id, + label: label || getErrorLabel(errorEventDefinition), + entries + }; + return item; +} +function Expression(props) { + const { + errorEventDefinition, + id + } = props; + const translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'); + const setValue = () => {}; + const getValue = () => { + return errorEventDefinition.get('camunda:expression'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextFieldEntry)({ + element: errorEventDefinition, + id, + label: translate('Throw expression'), + getValue, + setValue, + debounce, + disabled: true + }); +} +function removeEntry$1(entries, suffix) { + const entry = entries.find(({ + id + }) => id.endsWith(suffix)); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(entries, entry); +} +function getErrorLabel(errorEventDefinition) { + const error = errorEventDefinition.get('errorRef'); + if (!error) { + return ''; + } + const errorCode = error.get('errorCode'), + name = error.get('name') || ''; + if (errorCode) { + return `${name} (code = ${errorCode})`; + } + return name; +} + +function InputProperties(props) { + const { + element, + index, + property, + groups + } = props; + const { + binding, + description, + label + } = property; + const { + name + } = binding; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + const inputParameter = inputOutput && findInputParameter(inputOutput, binding); + const id = `${element.id}-inputParameter-${index}`; + let entries = []; + if (inputParameter) { + const inputGroup = groups.find(({ + id + }) => id === 'CamundaPlatform__Input'); + const item = inputGroup.items.find(({ + entries + }) => entries[0].parameter === inputParameter); + entries = item.entries; + + // (1) remove name entry + entries = removeEntry(entries, '-name'); + } + + // (2) add local variable assignment entry + entries.unshift({ + id: `${id}-local-variable-assignment`, + component: LocalVariableAssignment, + inputParameter, + property + }); + + // (3) add description entry + if (description) { + entries.unshift({ + id: `${id}-description`, + component: Description$1, + text: description + }); + } + + // @barmac: binding#name is required so there is no third option + const item = { + id, + label: label || name, + entries + }; + return item; +} + +// TODO(philippfromme): add text entry to properties-panel +function Description$1(props) { + const { + id, + text + } = props; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-entry", + "data-entry-id": id, + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-description", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(PropertyDescription, { + description: text + }) + }) + }); +} +function LocalVariableAssignment(props) { + const { + element, + id, + property, + inputParameter + } = props; + const { + binding + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + modeling = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('modeling'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const getValue = () => { + return inputParameter; + }; + const setValue = value => { + if (value) { + addInputParameter(element, property, bpmnFactory, modeling); + } else { + removeInputParameter(element, binding, modeling); + } + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ToggleSwitchEntry)({ + id, + label: translate('Local variable assignment'), + switcherLabel: inputParameter ? translate('On') : translate('Off'), + description: inputParameter ? '' : translate('Parameter won\'t be created as local variable.'), + getValue, + setValue + }); +} +function addInputParameter(element, property, bpmnFactory, modeling) { + const { + binding, + value + } = property; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const extensionElements = businessObject.get('extensionElements'); + const inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + let updatedBusinessObject, update; + if (!extensionElements) { + updatedBusinessObject = businessObject; + const extensionElements = createExtensionElements$1(businessObject, bpmnFactory), + inputOutput = createInputOutput$1(binding, value, bpmnFactory, extensionElements); + extensionElements.values.push(inputOutput); + update = { + extensionElements + }; + } else if (!inputOutput) { + updatedBusinessObject = extensionElements; + const inputOutput = createInputOutput$1(binding, value, bpmnFactory, extensionElements); + update = { + values: extensionElements.get('values').concat(inputOutput) + }; + } else { + updatedBusinessObject = inputOutput; + const inputParameter = createInputParameter(binding, value, bpmnFactory); + inputParameter.$parent = inputOutput; + update = { + inputParameters: inputOutput.get('camunda:inputParameters').concat(inputParameter) + }; + } + modeling.updateModdleProperties(element, updatedBusinessObject, update); +} +function removeInputParameter(element, binding, modeling) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const inputOutput = findExtension(businessObject, 'camunda:InputOutput'), + inputParameters = inputOutput.get('camunda:inputParameters'); + const inputParameter = findInputParameter(inputOutput, binding); + modeling.updateModdleProperties(element, inputOutput, { + inputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(inputParameters, inputParameter) + }); +} +function removeEntry(entries, suffix) { + const entry = entries.find(({ + id + }) => id.endsWith(suffix)); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(entries, entry); +} +function createExtensionElements$1(businessObject, bpmnFactory) { + return createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); +} +function createInputOutput$1(binding, value, bpmnFactory, extensionElements) { + const inputParameter = createInputParameter(binding, value, bpmnFactory); + const inputOutput = createElement('camunda:InputOutput', { + inputParameters: [inputParameter], + outputParameters: [] + }, extensionElements, bpmnFactory); + inputParameter.$parent = inputOutput; + return inputOutput; +} + +const SPACE_REGEX = /\s/; +function containsSpace(value) { + return SPACE_REGEX.test(value); +} + +function OutputProperties(props) { + const { + element, + index, + injector, + property + } = props; + const { + binding, + description, + label + } = property; + const { + name + } = binding; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element), + inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + const translate = injector.get('translate'); + const outputParameter = inputOutput && findOutputParameter(inputOutput, binding); + const id = `${element.id}-outputParameter-${index}`; + let entries = []; + + // (1) add description entry + if (description) { + entries.push({ + id: `${id}-description`, + component: Description, + text: description + }); + } + + // (2) add local variable assignment entry + entries.push({ + id: `${id}-local-variable-assignment`, + component: ProcessVariableAssignment, + outputParameter, + property + }); + if (outputParameter) { + // (3) add assign to process variable entry + entries.push({ + id: `${id}-assign-to-process-variable`, + component: AssignToProcessVariable, + property + }); + } + const item = { + id, + label: label || name || translate(''), + entries + }; + return item; +} + +// TODO(philippfromme): add text entry to properties-panel +function Description(props) { + const { + id, + text + } = props; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-entry", + "data-entry-id": id, + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", { + class: "bio-properties-panel-description", + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(PropertyDescription, { + description: text + }) + }) + }); +} +function ProcessVariableAssignment(props) { + const { + element, + id, + property, + outputParameter + } = props; + const { + binding + } = property; + const bpmnFactory = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('bpmnFactory'), + modeling = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('modeling'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const getValue = () => { + return outputParameter; + }; + const setValue = value => { + if (value) { + addOutputParameter(element, property, bpmnFactory, modeling); + } else { + removeOutputParameter(element, binding, modeling); + } + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ToggleSwitchEntry)({ + id, + label: translate('Process variable assignment'), + switcherLabel: outputParameter ? translate('On') : translate('Off'), + description: outputParameter ? '' : translate('Parameter won\'t be available in process scope.'), + getValue, + setValue + }); +} +function AssignToProcessVariable(props) { + const { + element, + id, + property + } = props; + const { + binding + } = property; + const inputOutput = findExtension(element, 'camunda:InputOutput'), + outputParameter = findOutputParameter(inputOutput, binding); + const commandStack = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('commandStack'), + debounce = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('debounceInput'), + translate = (0,bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.useService)('translate'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: outputParameter, + properties: { + name: value + } + }); + }; + const getValue = () => { + return outputParameter.get('camunda:name'); + }; + const validate = value => { + if (!value) { + return translate('Process variable name must not be empty.'); + } else if (containsSpace(value)) { + return translate('Process variable name must not contain spaces.'); + } + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.TextFieldEntry)({ + debounce, + element: outputParameter, + id, + label: translate('Assign to process variable'), + getValue, + setValue, + validate + }); +} +function addOutputParameter(element, property, bpmnFactory, modeling) { + const { + binding, + value + } = property; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const extensionElements = businessObject.get('extensionElements'); + const inputOutput = findExtension(businessObject, 'camunda:InputOutput'); + let updatedBusinessObject, update; + if (!extensionElements) { + updatedBusinessObject = businessObject; + const extensionElements = createExtensionElements(businessObject, bpmnFactory), + inputOutput = createInputOutput(binding, value, bpmnFactory, extensionElements); + extensionElements.values.push(inputOutput); + update = { + extensionElements + }; + } else if (!inputOutput) { + updatedBusinessObject = extensionElements; + const inputOutput = createInputOutput(binding, value, bpmnFactory, extensionElements); + update = { + values: extensionElements.get('values').concat(inputOutput) + }; + } else { + updatedBusinessObject = inputOutput; + const outputParameter = createOutputParameter(binding, value, bpmnFactory); + outputParameter.$parent = inputOutput; + update = { + outputParameters: inputOutput.get('camunda:outputParameters').concat(outputParameter) + }; + } + modeling.updateModdleProperties(element, updatedBusinessObject, update); +} +function removeOutputParameter(element, binding, modeling) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.getBusinessObject)(element); + const inputOutput = findExtension(businessObject, 'camunda:InputOutput'), + outputParameters = inputOutput.get('camunda:outputParameters'); + const outputParameter = findOutputParameter(inputOutput, binding); + modeling.updateModdleProperties(element, inputOutput, { + outputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.without)(outputParameters, outputParameter) + }); +} +function createExtensionElements(businessObject, bpmnFactory) { + return createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); +} +function createInputOutput(binding, value, bpmnFactory, extensionElements) { + const outputParameter = createOutputParameter(binding, value, bpmnFactory); + const inputOutput = createElement('camunda:InputOutput', { + inputParameters: [], + outputParameters: [outputParameter] + }, extensionElements, bpmnFactory); + outputParameter.$parent = inputOutput; + return inputOutput; +} + +const CAMUNDA_ERROR_EVENT_DEFINITION_TYPE = 'camunda:errorEventDefinition', + CAMUNDA_INPUT_PARAMETER_TYPE = 'camunda:inputParameter', + CAMUNDA_OUTPUT_PARAMETER_TYPE = 'camunda:outputParameter'; +const LOWER_PRIORITY = 300; +class ElementTemplatesPropertiesProvider { + constructor(elementTemplates, propertiesPanel, injector) { + propertiesPanel.registerProvider(LOWER_PRIORITY, this); + this._elementTemplates = elementTemplates; + this._injector = injector; + } + getGroups(element) { + return groups => { + const injector = this._injector; + if (!this._shouldShowTemplateProperties(element)) { + return groups; + } + + // (0) Copy provided groups + groups = groups.slice(); + const templatesGroup = { + element, + id: 'ElementTemplates__Template', + label: 'Template', + component: createElementTemplatesGroup(), + entries: TemplateProps({ + element, + elementTemplates: this._elementTemplates + }) + }; + + // (1) Add templates group + addGroupsAfter('documentation', groups, [templatesGroup]); + const elementTemplate = this._elementTemplates.get(element); + if (elementTemplate) { + const templateSpecificGroups = [].concat(createInputGroup(element, elementTemplate, injector, groups) || [], createOutputGroup(element, elementTemplate, injector) || [], createErrorGroup(element, elementTemplate, injector, groups) || [], CustomProperties({ + element, + elementTemplate + })); + + // (2) add template-specific properties groups + addGroupsAfter('ElementTemplates__Template', groups, templateSpecificGroups); + } + + // (3) apply entries visible + if (getTemplateId(element)) { + groups = filterWithEntriesVisible(elementTemplate || {}, groups); + } + return groups; + }; + } + _shouldShowTemplateProperties(element) { + return getTemplateId(element) || this._elementTemplates.getAll(element).length; + } +} +ElementTemplatesPropertiesProvider.$inject = ['elementTemplates', 'propertiesPanel', 'injector']; + +// helper ///////////////////// + +function createInputGroup(element, elementTemplate, injector, groups) { + const translate = injector.get('translate'); + const group = { + label: translate('Inputs'), + id: 'ElementTemplates__Input', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ListGroup, + items: [] + }; + const properties = elementTemplate.properties.filter(({ + binding, + type + }) => { + return !type && binding.type === CAMUNDA_INPUT_PARAMETER_TYPE; + }); + properties.forEach((property, index) => { + const item = InputProperties({ + element, + index, + property, + groups + }); + if (item) { + group.items.push(item); + } + }); + + // remove if empty + if (!group.items.length) { + return null; + } + return group; +} +function createOutputGroup(element, elementTemplate, injector, groups) { + const translate = injector.get('translate'); + const group = { + label: translate('Outputs'), + id: 'ElementTemplates__Output', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ListGroup, + items: [] + }; + const properties = elementTemplate.properties.filter(({ + binding, + type + }) => { + return !type && binding.type === CAMUNDA_OUTPUT_PARAMETER_TYPE; + }); + properties.forEach((property, index) => { + const item = OutputProperties({ + element, + index, + property, + injector + }); + if (item) { + group.items.push(item); + } + }); + + // remove if empty + if (!group.items.length) { + return null; + } + return group; +} +function createErrorGroup(element, elementTemplate, injector, groups) { + const translate = injector.get('translate'); + const group = { + label: translate('Errors'), + id: 'ElementTemplates__Error', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_3__.ListGroup, + items: [] + }; + const properties = elementTemplate.properties.filter(({ + binding, + type + }) => { + return !type && binding.type === CAMUNDA_ERROR_EVENT_DEFINITION_TYPE; + }); + properties.forEach((property, index) => { + const item = ErrorProperties({ + element, + index, + property, + groups + }); + if (item) { + group.items.push(item); + } + }); + + // remove if empty + if (!group.items.length) { + return null; + } + return group; +} + +/** + * + * @param {string} id + * @param {Array<{ id: string }} groups + * @param {Array<{ id: string }>} groupsToAdd + */ +function addGroupsAfter(id, groups, groupsToAdd) { + const index = groups.findIndex(group => group.id === id); + if (index !== -1) { + groups.splice(index + 1, 0, ...groupsToAdd); + } else { + // add in the beginning if group with provided id is missing + groups.unshift(...groupsToAdd); + } +} +function filterWithEntriesVisible(template, groups) { + if (!template.entriesVisible) { + return groups.filter(group => { + return group.id === 'general' || group.id.startsWith('ElementTemplates__'); + }); + } + return groups; +} + +var propertiesProviderModule = { + __depends__: [diagram_js_lib_i18n_translate__WEBPACK_IMPORTED_MODULE_19__["default"], bpmn_js_properties_panel__WEBPACK_IMPORTED_MODULE_5__.CamundaPlatformPropertiesProviderModule], + __init__: ['elementTemplatesPropertiesProvider'], + elementTemplatesPropertiesProvider: ['type', ElementTemplatesPropertiesProvider] +}; + +var index = { + __depends__: [coreModule, propertiesProviderModule] +}; + +/** + * Moddle base element. + */ +function Base() {} +Base.prototype.get = function (name) { + return this.$model.properties.get(this, name); +}; +Base.prototype.set = function (name, value) { + this.$model.properties.set(this, name, value); +}; + +/** + * A model element factory. + * + * @param {Moddle} model + * @param {Properties} properties + */ +function Factory(model, properties) { + this.model = model; + this.properties = properties; +} +Factory.prototype.createType = function (descriptor) { + var model = this.model; + var props = this.properties, + prototype = Object.create(Base.prototype); + + // initialize default values + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(descriptor.properties, function (p) { + if (!p.isMany && p.default !== undefined) { + prototype[p.name] = p.default; + } + }); + props.defineModel(prototype, model); + props.defineDescriptor(prototype, descriptor); + var name = descriptor.ns.name; + + /** + * The new type constructor + */ + function ModdleElement(attrs) { + props.define(this, '$type', { + value: name, + enumerable: true + }); + props.define(this, '$attrs', { + value: {} + }); + props.define(this, '$parent', { + writable: true + }); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(attrs, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(function (val, key) { + this.set(key, val); + }, this)); + } + ModdleElement.prototype = prototype; + ModdleElement.hasType = prototype.$instanceOf = this.model.hasType; + + // static links + props.defineModel(ModdleElement, model); + props.defineDescriptor(ModdleElement, descriptor); + return ModdleElement; +}; + +/** + * Built-in moddle types + */ +var BUILTINS = { + String: true, + Boolean: true, + Integer: true, + Real: true, + Element: true +}; + +/** + * Converters for built in types from string representations + */ +var TYPE_CONVERTERS = { + String: function (s) { + return s; + }, + Boolean: function (s) { + return s === 'true'; + }, + Integer: function (s) { + return parseInt(s, 10); + }, + Real: function (s) { + return parseFloat(s); + } +}; + +/** + * Convert a type to its real representation + */ +function coerceType(type, value) { + var converter = TYPE_CONVERTERS[type]; + if (converter) { + return converter(value); + } else { + return value; + } +} + +/** + * Return whether the given type is built-in + */ +function isBuiltIn(type) { + return !!BUILTINS[type]; +} - function setSelection(node, selection) { - - if (isContentEditable(node)) { - setContentEditableSelection(node, selection); - } else { - node.selectionStart = selection.start; - node.selectionEnd = selection.end; - } - } +/** + * Return whether the given type is simple + */ +function isSimple(type) { + return !!TYPE_CONVERTERS[type]; +} - function setContentEditableSelection(node, selection) { +/** + * Parses a namespaced attribute name of the form (ns:)localName to an object, + * given a default prefix to assume in case no explicit namespace is given. + * + * @param {String} name + * @param {String} [defaultPrefix] the default prefix to take, if none is present. + * + * @return {Object} the parsed name + */ +function parseName(name, defaultPrefix) { + var parts = name.split(/:/), + localName, + prefix; + + // no prefix (i.e. only local name) + if (parts.length === 1) { + localName = name; + prefix = defaultPrefix; + } else + // prefix + local name + if (parts.length === 2) { + localName = parts[1]; + prefix = parts[0]; + } else { + throw new Error('expected or , got ' + name); + } + name = (prefix ? prefix + ':' : '') + localName; + return { + name: name, + prefix: prefix, + localName: localName + }; +} + +/** + * A utility to build element descriptors. + */ +function DescriptorBuilder(nameNs) { + this.ns = nameNs; + this.name = nameNs.name; + this.allTypes = []; + this.allTypesByName = {}; + this.properties = []; + this.propertiesByName = {}; +} +DescriptorBuilder.prototype.build = function () { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.pick)(this, ['ns', 'name', 'allTypes', 'allTypesByName', 'properties', 'propertiesByName', 'bodyProperty', 'idProperty']); +}; + +/** + * Add property at given index. + * + * @param {Object} p + * @param {Number} [idx] + * @param {Boolean} [validate=true] + */ +DescriptorBuilder.prototype.addProperty = function (p, idx, validate) { + if (typeof idx === 'boolean') { + validate = idx; + idx = undefined; + } + this.addNamedProperty(p, validate !== false); + var properties = this.properties; + if (idx !== undefined) { + properties.splice(idx, 0, p); + } else { + properties.push(p); + } +}; +DescriptorBuilder.prototype.replaceProperty = function (oldProperty, newProperty, replace) { + var oldNameNs = oldProperty.ns; + var props = this.properties, + propertiesByName = this.propertiesByName, + rename = oldProperty.name !== newProperty.name; + if (oldProperty.isId) { + if (!newProperty.isId) { + throw new Error('property <' + newProperty.ns.name + '> must be id property ' + 'to refine <' + oldProperty.ns.name + '>'); + } + this.setIdProperty(newProperty, false); + } + if (oldProperty.isBody) { + if (!newProperty.isBody) { + throw new Error('property <' + newProperty.ns.name + '> must be body property ' + 'to refine <' + oldProperty.ns.name + '>'); + } + + // TODO: Check compatibility + this.setBodyProperty(newProperty, false); + } + + // validate existence and get location of old property + var idx = props.indexOf(oldProperty); + if (idx === -1) { + throw new Error('property <' + oldNameNs.name + '> not found in property list'); + } + + // remove old property + props.splice(idx, 1); + + // replacing the named property is intentional + // + // * validate only if this is a "rename" operation + // * add at specific index unless we "replace" + // + this.addProperty(newProperty, replace ? undefined : idx, rename); + + // make new property available under old name + propertiesByName[oldNameNs.name] = propertiesByName[oldNameNs.localName] = newProperty; +}; +DescriptorBuilder.prototype.redefineProperty = function (p, targetPropertyName, replace) { + var nsPrefix = p.ns.prefix; + var parts = targetPropertyName.split('#'); + var name = parseName(parts[0], nsPrefix); + var attrName = parseName(parts[1], name.prefix).name; + var redefinedProperty = this.propertiesByName[attrName]; + if (!redefinedProperty) { + throw new Error('refined property <' + attrName + '> not found'); + } else { + this.replaceProperty(redefinedProperty, p, replace); + } + delete p.redefines; +}; +DescriptorBuilder.prototype.addNamedProperty = function (p, validate) { + var ns = p.ns, + propsByName = this.propertiesByName; + if (validate) { + this.assertNotDefined(p, ns.name); + this.assertNotDefined(p, ns.localName); + } + propsByName[ns.name] = propsByName[ns.localName] = p; +}; +DescriptorBuilder.prototype.removeNamedProperty = function (p) { + var ns = p.ns, + propsByName = this.propertiesByName; + delete propsByName[ns.name]; + delete propsByName[ns.localName]; +}; +DescriptorBuilder.prototype.setBodyProperty = function (p, validate) { + if (validate && this.bodyProperty) { + throw new Error('body property defined multiple times ' + '(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)'); + } + this.bodyProperty = p; +}; +DescriptorBuilder.prototype.setIdProperty = function (p, validate) { + if (validate && this.idProperty) { + throw new Error('id property defined multiple times ' + '(<' + this.idProperty.ns.name + '>, <' + p.ns.name + '>)'); + } + this.idProperty = p; +}; +DescriptorBuilder.prototype.assertNotTrait = function (typeDescriptor) { + const _extends = typeDescriptor.extends || []; + if (_extends.length) { + throw new Error(`cannot create <${typeDescriptor.name}> extending <${typeDescriptor.extends}>`); + } +}; +DescriptorBuilder.prototype.assertNotDefined = function (p, name) { + var propertyName = p.name, + definedProperty = this.propertiesByName[propertyName]; + if (definedProperty) { + throw new Error('property <' + propertyName + '> already defined; ' + 'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' + '<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines'); + } +}; +DescriptorBuilder.prototype.hasProperty = function (name) { + return this.propertiesByName[name]; +}; +DescriptorBuilder.prototype.addTrait = function (t, inherited) { + if (inherited) { + this.assertNotTrait(t); + } + var typesByName = this.allTypesByName, + types = this.allTypes; + var typeName = t.name; + if (typeName in typesByName) { + return; + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(t.properties, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(function (p) { + // clone property to allow extensions + p = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, p, { + name: p.ns.localName, + inherited: inherited + }); + Object.defineProperty(p, 'definedBy', { + value: t + }); + var replaces = p.replaces, + redefines = p.redefines; + + // add replace/redefine support + if (replaces || redefines) { + this.redefineProperty(p, replaces || redefines, replaces); + } else { + if (p.isBody) { + this.setBodyProperty(p); + } + if (p.isId) { + this.setIdProperty(p); + } + this.addProperty(p); + } + }, this)); + types.push(t); + typesByName[typeName] = t; +}; + +/** + * A registry of Moddle packages. + * + * @param {Array} packages + * @param {Properties} properties + */ +function Registry(packages, properties) { + this.packageMap = {}; + this.typeMap = {}; + this.packages = []; + this.properties = properties; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(packages, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(this.registerPackage, this)); +} +Registry.prototype.getPackage = function (uriOrPrefix) { + return this.packageMap[uriOrPrefix]; +}; +Registry.prototype.getPackages = function () { + return this.packages; +}; +Registry.prototype.registerPackage = function (pkg) { + // copy package + pkg = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, pkg); + var pkgMap = this.packageMap; + ensureAvailable(pkgMap, pkg, 'prefix'); + ensureAvailable(pkgMap, pkg, 'uri'); + + // register types + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(pkg.types, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(function (descriptor) { + this.registerType(descriptor, pkg); + }, this)); + pkgMap[pkg.uri] = pkgMap[pkg.prefix] = pkg; + this.packages.push(pkg); +}; + +/** + * Register a type from a specific package with us + */ +Registry.prototype.registerType = function (type, pkg) { + type = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, type, { + superClass: (type.superClass || []).slice(), + extends: (type.extends || []).slice(), + properties: (type.properties || []).slice(), + meta: (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(type.meta || {}) + }); + var ns = parseName(type.name, pkg.prefix), + name = ns.name, + propertiesByName = {}; + + // parse properties + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(type.properties, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(function (p) { + // namespace property names + var propertyNs = parseName(p.name, ns.prefix), + propertyName = propertyNs.name; + + // namespace property types + if (!isBuiltIn(p.type)) { + p.type = parseName(p.type, propertyNs.prefix).name; + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(p, { + ns: propertyNs, + name: propertyName + }); + propertiesByName[propertyName] = p; + }, this)); + + // update ns + name + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(type, { + ns: ns, + name: name, + propertiesByName: propertiesByName + }); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(type.extends, (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.bind)(function (extendsName) { + var extendsNameNs = parseName(extendsName, ns.prefix); + var extended = this.typeMap[extendsNameNs.name]; + extended.traits = extended.traits || []; + extended.traits.push(name); + }, this)); + + // link to package + this.definePackage(type, pkg); + + // register + this.typeMap[name] = type; +}; + +/** + * Traverse the type hierarchy from bottom to top, + * calling iterator with (type, inherited) for all elements in + * the inheritance chain. + * + * @param {Object} nsName + * @param {Function} iterator + * @param {Boolean} [trait=false] + */ +Registry.prototype.mapTypes = function (nsName, iterator, trait) { + var type = isBuiltIn(nsName.name) ? { + name: nsName.name + } : this.typeMap[nsName.name]; + var self = this; + + /** + * Traverse the selected super type or trait + * + * @param {String} cls + * @param {Boolean} [trait=false] + */ + function traverse(cls, trait) { + var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix); + self.mapTypes(parentNs, iterator, trait); + } - var focusNode, - domRange, - domSelection; + /** + * Traverse the selected trait. + * + * @param {String} cls + */ + function traverseTrait(cls) { + return traverse(cls, true); + } - focusNode = node.firstChild || node, - domRange = document.createRange(); - domRange.setStart(focusNode, selection.start); - domRange.setEnd(focusNode, selection.end); + /** + * Traverse the selected super type + * + * @param {String} cls + */ + function traverseSuper(cls) { + return traverse(cls, false); + } + if (!type) { + throw new Error('unknown type <' + nsName.name + '>'); + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(type.superClass, trait ? traverseTrait : traverseSuper); + + // call iterator with (type, inherited=!trait) + iterator(type, !trait); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(type.traits, traverseTrait); +}; + +/** + * Returns the effective descriptor for a type. + * + * @param {String} type the namespaced name (ns:localName) of the type + * + * @return {Descriptor} the resulting effective descriptor + */ +Registry.prototype.getEffectiveDescriptor = function (name) { + var nsName = parseName(name); + var builder = new DescriptorBuilder(nsName); + this.mapTypes(nsName, function (type, inherited) { + builder.addTrait(type, inherited); + }); + var descriptor = builder.build(); + + // define package link + this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg); + return descriptor; +}; +Registry.prototype.definePackage = function (target, pkg) { + this.properties.define(target, '$pkg', { + value: pkg + }); +}; - domSelection = window.getSelection(); - domSelection.removeAllRanges(); - domSelection.addRange(domRange); - } +// helpers //////////////////////////// - function isImplicitRoot(element) { - return element.id === '__implicitroot'; - } +function ensureAvailable(packageMap, pkg, identifierKey) { + var value = pkg[identifierKey]; + if (value in packageMap) { + throw new Error('package with ' + identifierKey + ' <' + value + '> already defined'); + } +} - },{"./Utils":5,"bpmn-js/lib/util/ModelUtil":240,"lodash/debounce":607,"lodash/filter":609,"lodash/flattenDeep":612,"lodash/forEach":613,"lodash/get":614,"lodash/isArray":618,"lodash/isEmpty":622,"lodash/keyBy":629,"lodash/keys":630,"lodash/map":631,"lodash/xor":645,"min-dom":647,"scroll-tabs":656,"selection-update":657}],5:[function(require,module,exports){ - 'use strict'; +/** + * A utility that gets and sets properties of model elements. + * + * @param {Model} model + */ +function Properties(model) { + this.model = model; +} - var domQuery = require('min-dom').query, - domClear = require('min-dom').clear, - is = require('bpmn-js/lib/util/ModelUtil').is, - forEach = require('lodash/forEach'), - domify = require('min-dom').domify, - Ids = require('ids').default; +/** + * Sets a named property on the target element. + * If the value is undefined, the property gets deleted. + * + * @param {Object} target + * @param {String} name + * @param {Object} value + */ +Properties.prototype.set = function (target, name, value) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(name) || !name.length) { + throw new TypeError('property name must be a non-empty string'); + } + var property = this.getProperty(target, name); + var propertyName = property && property.name; + if (isUndefined(value)) { + // unset the property, if the specified value is undefined; + // delete from $attrs (for extensions) or the target itself + if (property) { + delete target[propertyName]; + } else { + delete target.$attrs[stripGlobal(name)]; + } + } else { + // set the property, defining well defined properties on the fly + // or simply updating them in target.$attrs (for extensions) + if (property) { + if (propertyName in target) { + target[propertyName] = value; + } else { + defineProperty(target, property, value); + } + } else { + target.$attrs[stripGlobal(name)] = value; + } + } +}; + +/** + * Returns the named property of the given element + * + * @param {Object} target + * @param {String} name + * + * @return {Object} + */ +Properties.prototype.get = function (target, name) { + var property = this.getProperty(target, name); + if (!property) { + return target.$attrs[stripGlobal(name)]; + } + var propertyName = property.name; + + // check if access to collection property and lazily initialize it + if (!target[propertyName] && property.isMany) { + defineProperty(target, property, []); + } + return target[propertyName]; +}; + +/** + * Define a property on the target element + * + * @param {Object} target + * @param {String} name + * @param {Object} options + */ +Properties.prototype.define = function (target, name, options) { + if (!options.writable) { + var value = options.value; + + // use getters for read-only variables to support ES6 proxies + // cf. https://github.com/bpmn-io/internal-docs/issues/386 + options = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, options, { + get: function () { + return value; + } + }); + delete options.value; + } + Object.defineProperty(target, name, options); +}; + +/** + * Define the descriptor for an element + */ +Properties.prototype.defineDescriptor = function (target, descriptor) { + this.define(target, '$descriptor', { + value: descriptor + }); +}; + +/** + * Define the model for an element + */ +Properties.prototype.defineModel = function (target, model) { + this.define(target, '$model', { + value: model + }); +}; + +/** + * Return property with the given name on the element. + * + * @param {any} target + * @param {string} name + * + * @return {object | null} property + */ +Properties.prototype.getProperty = function (target, name) { + var model = this.model; + var property = model.getPropertyDescriptor(target, name); + if (property) { + return property; + } + if (name.includes(':')) { + return null; + } + const strict = model.config.strict; + if (typeof strict !== 'undefined') { + const error = new TypeError(`unknown property <${name}> on <${target.$type}>`); + if (strict) { + throw error; + } else { + // eslint-disable-next-line no-undef + typeof console !== 'undefined' && console.warn(error); + } + } + return null; +}; +function isUndefined(val) { + return typeof val === 'undefined'; +} +function defineProperty(target, property, value) { + Object.defineProperty(target, property.name, { + enumerable: !property.isReference, + writable: true, + value: value, + configurable: true + }); +} +function stripGlobal(name) { + return name.replace(/^:/, ''); +} + +// Moddle implementation ///////////////////////////////////////////////// + +/** + * @class Moddle + * + * A model that can be used to create elements of a specific type. + * + * @example + * + * var Moddle = require('moddle'); + * + * var pkg = { + * name: 'mypackage', + * prefix: 'my', + * types: [ + * { name: 'Root' } + * ] + * }; + * + * var moddle = new Moddle([pkg]); + * + * @param {Array} packages the packages to contain + * + * @param { { strict?: boolean } } [config] moddle configuration + */ +function Moddle(packages, config = {}) { + this.properties = new Properties(this); + this.factory = new Factory(this, this.properties); + this.registry = new Registry(packages, this.properties); + this.typeCache = {}; + this.config = config; +} + +/** + * Create an instance of the specified type. + * + * @method Moddle#create + * + * @example + * + * var foo = moddle.create('my:Foo'); + * var bar = moddle.create('my:Bar', { id: 'BAR_1' }); + * + * @param {String|Object} descriptor the type descriptor or name know to the model + * @param {Object} attrs a number of attributes to initialize the model instance with + * @return {Object} model instance + */ +Moddle.prototype.create = function (descriptor, attrs) { + var Type = this.getType(descriptor); + if (!Type) { + throw new Error('unknown type <' + descriptor + '>'); + } + return new Type(attrs); +}; + +/** + * Returns the type representing a given descriptor + * + * @method Moddle#getType + * + * @example + * + * var Foo = moddle.getType('my:Foo'); + * var foo = new Foo({ 'id' : 'FOO_1' }); + * + * @param {String|Object} descriptor the type descriptor or name know to the model + * @return {Object} the type representing the descriptor + */ +Moddle.prototype.getType = function (descriptor) { + var cache = this.typeCache; + var name = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(descriptor) ? descriptor : descriptor.ns.name; + var type = cache[name]; + if (!type) { + descriptor = this.registry.getEffectiveDescriptor(name); + type = cache[name] = this.factory.createType(descriptor); + } + return type; +}; + +/** + * Creates an any-element type to be used within model instances. + * + * This can be used to create custom elements that lie outside the meta-model. + * The created element contains all the meta-data required to serialize it + * as part of meta-model elements. + * + * @method Moddle#createAny + * + * @example + * + * var foo = moddle.createAny('vendor:Foo', 'http://vendor', { + * value: 'bar' + * }); + * + * var container = moddle.create('my:Container', 'http://my', { + * any: [ foo ] + * }); + * + * // go ahead and serialize the stuff + * + * + * @param {String} name the name of the element + * @param {String} nsUri the namespace uri of the element + * @param {Object} [properties] a map of properties to initialize the instance with + * @return {Object} the any type instance + */ +Moddle.prototype.createAny = function (name, nsUri, properties) { + var nameNs = parseName(name); + var element = { + $type: name, + $instanceOf: function (type) { + return type === this.$type; + }, + get: function (key) { + return this[key]; + }, + set: function (key, value) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.set)(this, [key], value); + } + }; + var descriptor = { + name: name, + isGeneric: true, + ns: { + prefix: nameNs.prefix, + localName: nameNs.localName, + uri: nsUri + } + }; + this.properties.defineDescriptor(element, descriptor); + this.properties.defineModel(element, this); + this.properties.define(element, 'get', { + enumerable: false, + writable: true + }); + this.properties.define(element, 'set', { + enumerable: false, + writable: true + }); + this.properties.define(element, '$parent', { + enumerable: false, + writable: true + }); + this.properties.define(element, '$instanceOf', { + enumerable: false, + writable: true + }); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(properties, function (a, key) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isObject)(a) && a.value !== undefined) { + element[a.name] = a.value; + } else { + element[key] = a; + } + }); + return element; +}; + +/** + * Returns a registered package by uri or prefix + * + * @return {Object} the package + */ +Moddle.prototype.getPackage = function (uriOrPrefix) { + return this.registry.getPackage(uriOrPrefix); +}; - var SPACE_REGEX = /\s/; +/** + * Returns a snapshot of all known packages + * + * @return {Object} the package + */ +Moddle.prototype.getPackages = function () { + return this.registry.getPackages(); +}; -// for QName validation as per http://www.w3.org/TR/REC-xml/#NT-NameChar - var QNAME_REGEX = /^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i; +/** + * Returns the descriptor for an element + */ +Moddle.prototype.getElementDescriptor = function (element) { + return element.$descriptor; +}; -// for ID validation as per BPMN Schema (QName - Namespace) - var ID_REGEX = /^[a-z_][\w-.]*$/i; - - var HTML_ESCAPE_MAP = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''' - }; +/** + * Returns true if the given descriptor or instance + * represents the given type. + * + * May be applied to this, if element is omitted. + */ +Moddle.prototype.hasType = function (element, type) { + if (type === undefined) { + type = element; + element = this; + } + var descriptor = element.$model.getElementDescriptor(element); + return type in descriptor.allTypesByName; +}; + +/** + * Returns the descriptor of an elements named property + */ +Moddle.prototype.getPropertyDescriptor = function (element, property) { + return this.getElementDescriptor(element).propertiesByName[property]; +}; - function selectedOption(selectBox) { - if (selectBox.selectedIndex >= 0) { - return selectBox.options[selectBox.selectedIndex].value; - } - } +/** + * Returns a mapped type's descriptor + */ +Moddle.prototype.getTypeDescriptor = function (type) { + return this.registry.typeMap[type]; +}; + +var fromCharCode = String.fromCharCode; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var ENTITY_PATTERN = /&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig; +var ENTITY_MAPPING = { + 'amp': '&', + 'apos': '\'', + 'gt': '>', + 'lt': '<', + 'quot': '"' +}; + +// map UPPERCASE variants of supported special chars +Object.keys(ENTITY_MAPPING).forEach(function (k) { + ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k]; +}); +function replaceEntities(_, d, x, z) { + // reserved names, i.e.   + if (z) { + if (hasOwnProperty.call(ENTITY_MAPPING, z)) { + return ENTITY_MAPPING[z]; + } else { + // fall back to original value + return '&' + z + ';'; + } + } + + // decimal encoded char + if (d) { + return fromCharCode(d); + } + + // hex encoded char + return fromCharCode(parseInt(x, 16)); +} + +/** + * A basic entity decoder that can decode a minimal + * sub-set of reserved names (&) as well as + * hex (ય) and decimal (ӏ) encoded characters. + * + * @param {string} str + * + * @return {string} decoded string + */ +function decodeEntities(s) { + if (s.length > 3 && s.indexOf('&') !== -1) { + return s.replace(ENTITY_PATTERN, replaceEntities); + } + return s; +} +var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance'; +var XSI_PREFIX = 'xsi'; +var XSI_TYPE$1 = 'xsi:type'; +var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node'; +function error$1(msg) { + return new Error(msg); +} +function missingNamespaceForPrefix(prefix) { + return 'missing namespace for prefix <' + prefix + '>'; +} +function getter(getFn) { + return { + 'get': getFn, + 'enumerable': true + }; +} +function cloneNsMatrix(nsMatrix) { + var clone = {}, + key; + for (key in nsMatrix) { + clone[key] = nsMatrix[key]; + } + return clone; +} +function uriPrefix(prefix) { + return prefix + '$uri'; +} +function buildNsMatrix(nsUriToPrefix) { + var nsMatrix = {}, + uri, + prefix; + for (uri in nsUriToPrefix) { + prefix = nsUriToPrefix[uri]; + nsMatrix[prefix] = prefix; + nsMatrix[uriPrefix(prefix)] = uri; + } + return nsMatrix; +} +function noopGetContext() { + return { + 'line': 0, + 'column': 0 + }; +} +function throwFunc(err) { + throw err; +} + +/** + * Creates a new parser with the given options. + * + * @constructor + * + * @param {!Object=} options + */ +function Parser(options) { + if (!this) { + return new Parser(options); + } + var proxy = options && options['proxy']; + var onText, + onOpenTag, + onCloseTag, + onCDATA, + onError = throwFunc, + onWarning, + onComment, + onQuestion, + onAttention; + var getContext = noopGetContext; + + /** + * Do we need to parse the current elements attributes for namespaces? + * + * @type {boolean} + */ + var maybeNS = false; - module.exports.selectedOption = selectedOption; + /** + * Do we process namespaces at all? + * + * @type {boolean} + */ + var isNamespace = false; + /** + * The caught error returned on parse end + * + * @type {Error} + */ + var returnError = null; - function selectedType(elementSyntax, inputNode) { - var typeSelect = domQuery(elementSyntax, inputNode); - return selectedOption(typeSelect); - } + /** + * Should we stop parsing? + * + * @type {boolean} + */ + var parseStop = false; - module.exports.selectedType = selectedType; + /** + * A map of { uri: prefix } used by the parser. + * + * This map will ensure we can normalize prefixes during processing; + * for each uri, only one prefix will be exposed to the handlers. + * + * @type {!Object}} + */ + var nsUriToPrefix; + /** + * Handle parse error. + * + * @param {string|Error} err + */ + function handleError(err) { + if (!(err instanceof Error)) { + err = error$1(err); + } + returnError = err; + onError(err, getContext); + } + + /** + * Handle parse error. + * + * @param {string|Error} err + */ + function handleWarning(err) { + if (!onWarning) { + return; + } + if (!(err instanceof Error)) { + err = error$1(err); + } + onWarning(err, getContext); + } + + /** + * Register parse listener. + * + * @param {string} name + * @param {Function} cb + * + * @return {Parser} + */ + this['on'] = function (name, cb) { + if (typeof cb !== 'function') { + throw error$1('required args '); + } + switch (name) { + case 'openTag': + onOpenTag = cb; + break; + case 'text': + onText = cb; + break; + case 'closeTag': + onCloseTag = cb; + break; + case 'error': + onError = cb; + break; + case 'warn': + onWarning = cb; + break; + case 'cdata': + onCDATA = cb; + break; + case 'attention': + onAttention = cb; + break; + // + case 'question': + onQuestion = cb; + break; + // + case 'comment': + onComment = cb; + break; + default: + throw error$1('unsupported event: ' + name); + } + return this; + }; + + /** + * Set the namespace to prefix mapping. + * + * @example + * + * parser.ns({ + * 'http://foo': 'foo', + * 'http://bar': 'bar' + * }); + * + * @param {!Object} nsMap + * + * @return {Parser} + */ + this['ns'] = function (nsMap) { + if (typeof nsMap === 'undefined') { + nsMap = {}; + } + if (typeof nsMap !== 'object') { + throw error$1('required args '); + } + var _nsUriToPrefix = {}, + k; + for (k in nsMap) { + _nsUriToPrefix[k] = nsMap[k]; + } + + // FORCE default mapping for schema instance + _nsUriToPrefix[XSI_URI] = XSI_PREFIX; + isNamespace = true; + nsUriToPrefix = _nsUriToPrefix; + return this; + }; + + /** + * Parse xml string. + * + * @param {string} xml + * + * @return {Error} returnError, if not thrown + */ + this['parse'] = function (xml) { + if (typeof xml !== 'string') { + throw error$1('required args '); + } + returnError = null; + parse(xml); + getContext = noopGetContext; + parseStop = false; + return returnError; + }; + + /** + * Stop parsing. + */ + this['stop'] = function () { + parseStop = true; + }; - /** - * Retrieve the root element the document this - * business object is contained in. - * - * @return {ModdleElement} - */ - function getRoot(businessObject) { - var parent = businessObject; - while (parent.$parent) { - parent = parent.$parent; - } - return parent; - } + /** + * Parse string, invoking configured listeners on element. + * + * @param {string} xml + */ + function parse(xml) { + var nsMatrixStack = isNamespace ? [] : null, + nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null, + _nsMatrix, + nodeStack = [], + anonymousNsCount = 0, + tagStart = false, + tagEnd = false, + i = 0, + j = 0, + x, + y, + q, + w, + v, + xmlns, + elementName, + _elementName, + elementProxy; + var attrsString = '', + attrsStart = 0, + cachedAttrs // false = parsed with errors, null = needs parsing + ; + + /** + * Parse attributes on demand and returns the parsed attributes. + * + * Return semantics: (1) `false` on attribute parse error, + * (2) object hash on extracted attrs. + * + * @return {boolean|Object} + */ + function getAttrs() { + if (cachedAttrs !== null) { + return cachedAttrs; + } + var nsUri, + nsUriPrefix, + nsName, + defaultAlias = isNamespace && nsMatrix['xmlns'], + attrList = isNamespace && maybeNS ? [] : null, + i = attrsStart, + s = attrsString, + l = s.length, + hasNewMatrix, + newalias, + value, + alias, + name, + attrs = {}, + seenAttrs = {}, + skipAttr, + w, + j; + parseAttr: for (; i < l; i++) { + skipAttr = false; + w = s.charCodeAt(i); + if (w === 32 || w < 14 && w > 8) { + // WHITESPACE={ \f\n\r\t\v} + continue; + } + + // wait for non whitespace character + if (w < 65 || w > 122 || w > 90 && w < 97) { + if (w !== 95 && w !== 58) { + // char 95"_" 58":" + handleWarning('illegal first char attribute name'); + skipAttr = true; + } + } + + // parse attribute name + for (j = i + 1; j < l; j++) { + w = s.charCodeAt(j); + if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 46 || + // '.' + w === 45 || + // '-' + w === 95 // '_' + ) { + continue; + } + + // unexpected whitespace + if (w === 32 || w < 14 && w > 8) { + // WHITESPACE + handleWarning('missing attribute value'); + i = j; + continue parseAttr; + } + + // expected "=" + if (w === 61) { + // "=" == 61 + break; + } + handleWarning('illegal attribute name char'); + skipAttr = true; + } + name = s.substring(i, j); + if (name === 'xmlns:xmlns') { + handleWarning('illegal declaration of xmlns'); + skipAttr = true; + } + w = s.charCodeAt(j + 1); + if (w === 34) { + // '"' + j = s.indexOf('"', i = j + 2); + if (j === -1) { + j = s.indexOf('\'', i); + if (j !== -1) { + handleWarning('attribute value quote missmatch'); + skipAttr = true; + } + } + } else if (w === 39) { + // "'" + j = s.indexOf('\'', i = j + 2); + if (j === -1) { + j = s.indexOf('"', i); + if (j !== -1) { + handleWarning('attribute value quote missmatch'); + skipAttr = true; + } + } + } else { + handleWarning('missing attribute value quotes'); + skipAttr = true; + + // skip to next space + for (j = j + 1; j < l; j++) { + w = s.charCodeAt(j + 1); + if (w === 32 || w < 14 && w > 8) { + // WHITESPACE + break; + } + } + } + if (j === -1) { + handleWarning('missing closing quotes'); + j = l; + skipAttr = true; + } + if (!skipAttr) { + value = s.substring(i, j); + } + i = j; + + // ensure SPACE follows attribute + // skip illegal content otherwise + // example a="b"c + for (; j + 1 < l; j++) { + w = s.charCodeAt(j + 1); + if (w === 32 || w < 14 && w > 8) { + // WHITESPACE + break; + } + + // FIRST ILLEGAL CHAR + if (i === j) { + handleWarning('illegal character after attribute end'); + skipAttr = true; + } + } + + // advance cursor to next attribute + i = j + 1; + if (skipAttr) { + continue parseAttr; + } + + // check attribute re-declaration + if (name in seenAttrs) { + handleWarning('attribute <' + name + '> already defined'); + continue; + } + seenAttrs[name] = true; + if (!isNamespace) { + attrs[name] = value; + continue; + } + + // try to extract namespace information + if (maybeNS) { + newalias = name === 'xmlns' ? 'xmlns' : name.charCodeAt(0) === 120 && name.substr(0, 6) === 'xmlns:' ? name.substr(6) : null; + + // handle xmlns(:alias) assignment + if (newalias !== null) { + nsUri = decodeEntities(value); + nsUriPrefix = uriPrefix(newalias); + alias = nsUriToPrefix[nsUri]; + if (!alias) { + // no prefix defined or prefix collision + if (newalias === 'xmlns' || nsUriPrefix in nsMatrix && nsMatrix[nsUriPrefix] !== nsUri) { + // alocate free ns prefix + do { + alias = 'ns' + anonymousNsCount++; + } while (typeof nsMatrix[alias] !== 'undefined'); + } else { + alias = newalias; + } + nsUriToPrefix[nsUri] = alias; + } + if (nsMatrix[newalias] !== alias) { + if (!hasNewMatrix) { + nsMatrix = cloneNsMatrix(nsMatrix); + hasNewMatrix = true; + } + nsMatrix[newalias] = alias; + if (newalias === 'xmlns') { + nsMatrix[uriPrefix(alias)] = nsUri; + defaultAlias = alias; + } + nsMatrix[nsUriPrefix] = nsUri; + } + + // expose xmlns(:asd)="..." in attributes + attrs[name] = value; + continue; + } + + // collect attributes until all namespace + // declarations are processed + attrList.push(name, value); + continue; + } /** end if (maybeNs) */ + + // handle attributes on element without + // namespace declarations + w = name.indexOf(':'); + if (w === -1) { + attrs[name] = value; + continue; + } + + // normalize ns attribute name + if (!(nsName = nsMatrix[name.substring(0, w)])) { + handleWarning(missingNamespaceForPrefix(name.substring(0, w))); + continue; + } + name = defaultAlias === nsName ? name.substr(w + 1) : nsName + name.substr(w); + + // end: normalize ns attribute name + + // normalize xsi:type ns attribute value + if (name === XSI_TYPE$1) { + w = value.indexOf(':'); + if (w !== -1) { + nsName = value.substring(0, w); + + // handle default prefixes, i.e. xs:String gracefully + nsName = nsMatrix[nsName] || nsName; + value = nsName + value.substring(w); + } else { + value = defaultAlias + ':' + value; + } + } + + // end: normalize xsi:type ns attribute value + + attrs[name] = value; + } + + // handle deferred, possibly namespaced attributes + if (maybeNS) { + // normalize captured attributes + for (i = 0, l = attrList.length; i < l; i++) { + name = attrList[i++]; + value = attrList[i]; + w = name.indexOf(':'); + if (w !== -1) { + // normalize ns attribute name + if (!(nsName = nsMatrix[name.substring(0, w)])) { + handleWarning(missingNamespaceForPrefix(name.substring(0, w))); + continue; + } + name = defaultAlias === nsName ? name.substr(w + 1) : nsName + name.substr(w); + + // end: normalize ns attribute name + + // normalize xsi:type ns attribute value + if (name === XSI_TYPE$1) { + w = value.indexOf(':'); + if (w !== -1) { + nsName = value.substring(0, w); + + // handle default prefixes, i.e. xs:String gracefully + nsName = nsMatrix[nsName] || nsName; + value = nsName + value.substring(w); + } else { + value = defaultAlias + ':' + value; + } + } + + // end: normalize xsi:type ns attribute value + } + attrs[name] = value; + } + + // end: normalize captured attributes + } + return cachedAttrs = attrs; + } + + /** + * Extract the parse context { line, column, part } + * from the current parser position. + * + * @return {Object} parse context + */ + function getParseContext() { + var splitsRe = /(\r\n|\r|\n)/g; + var line = 0; + var column = 0; + var startOfLine = 0; + var endOfLine = j; + var match; + var data; + while (i >= startOfLine) { + match = splitsRe.exec(xml); + if (!match) { + break; + } + + // end of line = (break idx + break chars) + endOfLine = match[0].length + match.index; + if (endOfLine > i) { + break; + } + + // advance to next line + line += 1; + startOfLine = endOfLine; + } + + // EOF errors + if (i == -1) { + column = endOfLine; + data = xml.substring(j); + } else + // start errors + if (j === 0) { + data = xml.substring(j, i); + } + + // other errors + else { + column = i - startOfLine; + data = j == -1 ? xml.substring(i) : xml.substring(i, j + 1); + } + return { + 'data': data, + 'line': line, + 'column': column + }; + } + getContext = getParseContext; + if (proxy) { + elementProxy = Object.create({}, { + 'name': getter(function () { + return elementName; + }), + 'originalName': getter(function () { + return _elementName; + }), + 'attrs': getter(getAttrs), + 'ns': getter(function () { + return nsMatrix; + }) + }); + } + + // actual parse logic + while (j !== -1) { + if (xml.charCodeAt(j) === 60) { + // "<" + i = j; + } else { + i = xml.indexOf('<', j); + } + + // parse end + if (i === -1) { + if (nodeStack.length) { + return handleError('unexpected end of file'); + } + if (j === 0) { + return handleError('missing start tag'); + } + if (j < xml.length) { + if (xml.substring(j).trim()) { + handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE); + } + } + return; + } + + // parse text + if (j !== i) { + if (nodeStack.length) { + if (onText) { + onText(xml.substring(j, i), decodeEntities, getContext); + if (parseStop) { + return; + } + } + } else { + if (xml.substring(j, i).trim()) { + handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE); + if (parseStop) { + return; + } + } + } + } + w = xml.charCodeAt(i + 1); + + // parse comments + CDATA + if (w === 33) { + // "!" + q = xml.charCodeAt(i + 2); + + // CDATA section + if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') { + // 91 == "[" + j = xml.indexOf(']]>', i); + if (j === -1) { + return handleError('unclosed cdata'); + } + if (onCDATA) { + onCDATA(xml.substring(i + 9, j), getContext); + if (parseStop) { + return; + } + } + j += 3; + continue; + } + + // comment + if (q === 45 && xml.charCodeAt(i + 3) === 45) { + // 45 == "-" + j = xml.indexOf('-->', i); + if (j === -1) { + return handleError('unclosed comment'); + } + if (onComment) { + onComment(xml.substring(i + 4, j), decodeEntities, getContext); + if (parseStop) { + return; + } + } + j += 3; + continue; + } + } + + // parse question + if (w === 63) { + // "?" + j = xml.indexOf('?>', i); + if (j === -1) { + return handleError('unclosed question'); + } + if (onQuestion) { + onQuestion(xml.substring(i, j + 2), getContext); + if (parseStop) { + return; + } + } + j += 2; + continue; + } + + // find matching closing tag for attention or standard tags + // for that we must skip through attribute values + // (enclosed in single or double quotes) + for (x = i + 1;; x++) { + v = xml.charCodeAt(x); + if (isNaN(v)) { + j = -1; + return handleError('unclosed tag'); + } + + // [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" + // skips the quoted string + // (double quotes) does not appear in a literal enclosed by (double quotes) + // (single quote) does not appear in a literal enclosed by (single quote) + if (v === 34) { + // '"' + q = xml.indexOf('"', x + 1); + x = q !== -1 ? q : x; + } else if (v === 39) { + // "'" + q = xml.indexOf("'", x + 1); + x = q !== -1 ? q : x; + } else if (v === 62) { + // '>' + j = x; + break; + } + } + + // parse attention + // previously comment and CDATA have already been parsed + if (w === 33) { + // "!" + + if (onAttention) { + onAttention(xml.substring(i, j + 1), decodeEntities, getContext); + if (parseStop) { + return; + } + } + j += 1; + continue; + } + + // don't process attributes; + // there are none + cachedAttrs = {}; + + // if (xml.charCodeAt(i+1) === 47) { // close tag match + x = elementName = nodeStack.pop(); + q = i + 2 + x.length; + if (xml.substring(i + 2, q) !== x) { + return handleError('closing tag mismatch'); + } + + // verify chars in close tag + for (; q < j; q++) { + w = xml.charCodeAt(q); + if (w === 32 || w > 8 && w < 14) { + // \f\n\r\t\v space + continue; + } + return handleError('close tag'); + } + } else { + if (xml.charCodeAt(j - 1) === 47) { + // .../> + x = elementName = xml.substring(i + 1, j - 1); + tagStart = true; + tagEnd = true; + } else { + x = elementName = xml.substring(i + 1, j); + tagStart = true; + tagEnd = false; + } + if (!(w > 96 && w < 123 || w > 64 && w < 91 || w === 95 || w === 58)) { + // char 95"_" 58":" + return handleError('illegal first char nodeName'); + } + for (q = 1, y = x.length; q < y; q++) { + w = x.charCodeAt(q); + if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95 || w == 46) { + continue; + } + if (w === 32 || w < 14 && w > 8) { + // \f\n\r\t\v space + elementName = x.substring(0, q); + + // maybe there are attributes + cachedAttrs = null; + break; + } + return handleError('invalid nodeName'); + } + if (!tagEnd) { + nodeStack.push(elementName); + } + } + if (isNamespace) { + _nsMatrix = nsMatrix; + if (tagStart) { + // remember old namespace + // unless we're self-closing + if (!tagEnd) { + nsMatrixStack.push(_nsMatrix); + } + if (cachedAttrs === null) { + // quick check, whether there may be namespace + // declarations on the node; if that is the case + // we need to eagerly parse the node attributes + if (maybeNS = x.indexOf('xmlns', q) !== -1) { + attrsStart = q; + attrsString = x; + getAttrs(); + maybeNS = false; + } + } + } + _elementName = elementName; + w = elementName.indexOf(':'); + if (w !== -1) { + xmlns = nsMatrix[elementName.substring(0, w)]; + + // prefix given; namespace must exist + if (!xmlns) { + return handleError('missing namespace on <' + _elementName + '>'); + } + elementName = elementName.substr(w + 1); + } else { + xmlns = nsMatrix['xmlns']; + + // if no default namespace is defined, + // we'll import the element as anonymous. + // + // it is up to users to correct that to the document defined + // targetNamespace, or whatever their undersanding of the + // XML spec mandates. + } + + // adjust namespace prefixs as configured + if (xmlns) { + elementName = xmlns + ':' + elementName; + } + } + if (tagStart) { + attrsStart = q; + attrsString = x; + if (onOpenTag) { + if (proxy) { + onOpenTag(elementProxy, decodeEntities, tagEnd, getContext); + } else { + onOpenTag(elementName, getAttrs, decodeEntities, tagEnd, getContext); + } + if (parseStop) { + return; + } + } + } + if (tagEnd) { + if (onCloseTag) { + onCloseTag(proxy ? elementProxy : elementName, decodeEntities, tagStart, getContext); + if (parseStop) { + return; + } + } + + // restore old namespace + if (isNamespace) { + if (!tagStart) { + nsMatrix = nsMatrixStack.pop(); + } else { + nsMatrix = _nsMatrix; + } + } + } + j += 1; + } + } /** end parse */ +} + +function hasLowerCaseAlias(pkg) { + return pkg.xml && pkg.xml.tagAlias === 'lowerCase'; +} +var DEFAULT_NS_MAP = { + 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', + 'xml': 'http://www.w3.org/XML/1998/namespace' +}; +var XSI_TYPE = 'xsi:type'; +function serializeFormat(element) { + return element.xml && element.xml.serialize; +} +function serializeAsType(element) { + return serializeFormat(element) === XSI_TYPE; +} +function serializeAsProperty(element) { + return serializeFormat(element) === 'property'; +} +function capitalize(str) { + return str.charAt(0).toUpperCase() + str.slice(1); +} +function aliasToName(aliasNs, pkg) { + if (!hasLowerCaseAlias(pkg)) { + return aliasNs.name; + } + return aliasNs.prefix + ':' + capitalize(aliasNs.localName); +} +function prefixedToName(nameNs, pkg) { + var name = nameNs.name, + localName = nameNs.localName; + var typePrefix = pkg.xml && pkg.xml.typePrefix; + if (typePrefix && localName.indexOf(typePrefix) === 0) { + return nameNs.prefix + ':' + localName.slice(typePrefix.length); + } else { + return name; + } +} +function normalizeXsiTypeName(name, model) { + var nameNs = parseName(name); + var pkg = model.getPackage(nameNs.prefix); + return prefixedToName(nameNs, pkg); +} +function error(message) { + return new Error(message); +} + +/** + * Get the moddle descriptor for a given instance or type. + * + * @param {ModdleElement|Function} element + * + * @return {Object} the moddle descriptor + */ +function getModdleDescriptor(element) { + return element.$descriptor; +} - module.exports.getRoot = getRoot; +/** + * A parse context. + * + * @class + * + * @param {Object} options + * @param {ElementHandler} options.rootHandler the root handler for parsing a document + * @param {boolean} [options.lax=false] whether or not to ignore invalid elements + */ +function Context(options) { + /** + * @property {ElementHandler} rootHandler + */ + /** + * @property {Boolean} lax + */ - /** - * filters all elements in the list which have a given type. - * removes a new list - */ - function filterElementsByType(objectList, type) { - var list = objectList || []; - var result = []; - forEach(list, function(obj) { - if (is(obj, type)) { - result.push(obj); - } - }); - return result; - } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(this, options); + this.elementsById = {}; + this.references = []; + this.warnings = []; - module.exports.filterElementsByType = filterElementsByType; + /** + * Add an unresolved reference. + * + * @param {Object} reference + */ + this.addReference = function (reference) { + this.references.push(reference); + }; + /** + * Add a processed element. + * + * @param {ModdleElement} element + */ + this.addElement = function (element) { + if (!element) { + throw error('expected element'); + } + var elementsById = this.elementsById; + var descriptor = getModdleDescriptor(element); + var idProperty = descriptor.idProperty, + id; + if (idProperty) { + id = element.get(idProperty.name); + if (id) { + // for QName validation as per http://www.w3.org/TR/REC-xml/#NT-NameChar + if (!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(id)) { + throw new Error('illegal ID <' + id + '>'); + } + if (elementsById[id]) { + throw error('duplicate ID <' + id + '>'); + } + elementsById[id] = element; + } + } + }; + + /** + * Add an import warning. + * + * @param {Object} warning + * @param {String} warning.message + * @param {Error} [warning.error] + */ + this.addWarning = function (warning) { + this.warnings.push(warning); + }; +} +function BaseHandler() {} +BaseHandler.prototype.handleEnd = function () {}; +BaseHandler.prototype.handleText = function () {}; +BaseHandler.prototype.handleNode = function () {}; + +/** + * A simple pass through handler that does nothing except for + * ignoring all input it receives. + * + * This is used to ignore unknown elements and + * attributes. + */ +function NoopHandler() {} +NoopHandler.prototype = Object.create(BaseHandler.prototype); +NoopHandler.prototype.handleNode = function () { + return this; +}; +function BodyHandler() {} +BodyHandler.prototype = Object.create(BaseHandler.prototype); +BodyHandler.prototype.handleText = function (text) { + this.body = (this.body || '') + text; +}; +function ReferenceHandler(property, context) { + this.property = property; + this.context = context; +} +ReferenceHandler.prototype = Object.create(BodyHandler.prototype); +ReferenceHandler.prototype.handleNode = function (node) { + if (this.element) { + throw error('expected no sub nodes'); + } else { + this.element = this.createReference(node); + } + return this; +}; +ReferenceHandler.prototype.handleEnd = function () { + this.element.id = this.body; +}; +ReferenceHandler.prototype.createReference = function (node) { + return { + property: this.property.ns.name, + id: '' + }; +}; +function ValueHandler(propertyDesc, element) { + this.element = element; + this.propertyDesc = propertyDesc; +} +ValueHandler.prototype = Object.create(BodyHandler.prototype); +ValueHandler.prototype.handleEnd = function () { + var value = this.body || '', + element = this.element, + propertyDesc = this.propertyDesc; + value = coerceType(propertyDesc.type, value); + if (propertyDesc.isMany) { + element.get(propertyDesc.name).push(value); + } else { + element.set(propertyDesc.name, value); + } +}; +function BaseElementHandler() {} +BaseElementHandler.prototype = Object.create(BodyHandler.prototype); +BaseElementHandler.prototype.handleNode = function (node) { + var parser = this, + element = this.element; + if (!element) { + element = this.element = this.createElement(node); + this.context.addElement(element); + } else { + parser = this.handleChild(node); + } + return parser; +}; + +/** + * @class Reader.ElementHandler + * + */ +function ElementHandler(model, typeName, context) { + this.model = model; + this.type = model.getType(typeName); + this.context = context; +} +ElementHandler.prototype = Object.create(BaseElementHandler.prototype); +ElementHandler.prototype.addReference = function (reference) { + this.context.addReference(reference); +}; +ElementHandler.prototype.handleText = function (text) { + var element = this.element, + descriptor = getModdleDescriptor(element), + bodyProperty = descriptor.bodyProperty; + if (!bodyProperty) { + throw error('unexpected body text <' + text + '>'); + } + BodyHandler.prototype.handleText.call(this, text); +}; +ElementHandler.prototype.handleEnd = function () { + var value = this.body, + element = this.element, + descriptor = getModdleDescriptor(element), + bodyProperty = descriptor.bodyProperty; + if (bodyProperty && value !== undefined) { + value = coerceType(bodyProperty.type, value); + element.set(bodyProperty.name, value); + } +}; + +/** + * Create an instance of the model from the given node. + * + * @param {Element} node the xml node + */ +ElementHandler.prototype.createElement = function (node) { + var attributes = node.attributes, + Type = this.type, + descriptor = getModdleDescriptor(Type), + context = this.context, + instance = new Type({}), + model = this.model, + propNameNs; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(attributes, function (value, name) { + var prop = descriptor.propertiesByName[name], + values; + if (prop && prop.isReference) { + if (!prop.isMany) { + context.addReference({ + element: instance, + property: prop.ns.name, + id: value + }); + } else { + // IDREFS: parse references as whitespace-separated list + values = value.split(' '); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(values, function (v) { + context.addReference({ + element: instance, + property: prop.ns.name, + id: v + }); + }); + } + } else { + if (prop) { + value = coerceType(prop.type, value); + } else if (name !== 'xmlns') { + propNameNs = parseName(name, descriptor.ns.prefix); + + // check whether attribute is defined in a well-known namespace + // if that is the case we emit a warning to indicate potential misuse + if (model.getPackage(propNameNs.prefix)) { + context.addWarning({ + message: 'unknown attribute <' + name + '>', + element: instance, + property: name, + value: value + }); + } + } + instance.set(name, value); + } + }); + return instance; +}; +ElementHandler.prototype.getPropertyForNode = function (node) { + var name = node.name; + var nameNs = parseName(name); + var type = this.type, + model = this.model, + descriptor = getModdleDescriptor(type); + var propertyName = nameNs.name, + property = descriptor.propertiesByName[propertyName], + elementTypeName, + elementType; + + // search for properties by name first + + if (property && !property.isAttr) { + if (serializeAsType(property)) { + elementTypeName = node.attributes[XSI_TYPE]; + + // xsi type is optional, if it does not exists the + // default type is assumed + if (elementTypeName) { + // take possible type prefixes from XML + // into account, i.e.: xsi:type="t{ActualType}" + elementTypeName = normalizeXsiTypeName(elementTypeName, model); + elementType = model.getType(elementTypeName); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, property, { + effectiveType: getModdleDescriptor(elementType).name + }); + } + } + + // search for properties by name first + return property; + } + var pkg = model.getPackage(nameNs.prefix); + if (pkg) { + elementTypeName = aliasToName(nameNs, pkg); + elementType = model.getType(elementTypeName); + + // search for collection members later + property = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(descriptor.properties, function (p) { + return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type); + }); + if (property) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, property, { + effectiveType: getModdleDescriptor(elementType).name + }); + } + } else { + // parse unknown element (maybe extension) + property = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.find)(descriptor.properties, function (p) { + return !p.isReference && !p.isAttribute && p.type === 'Element'; + }); + if (property) { + return property; + } + } + throw error('unrecognized element <' + nameNs.name + '>'); +}; +ElementHandler.prototype.toString = function () { + return 'ElementDescriptor[' + getModdleDescriptor(this.type).name + ']'; +}; +ElementHandler.prototype.valueHandler = function (propertyDesc, element) { + return new ValueHandler(propertyDesc, element); +}; +ElementHandler.prototype.referenceHandler = function (propertyDesc) { + return new ReferenceHandler(propertyDesc, this.context); +}; +ElementHandler.prototype.handler = function (type) { + if (type === 'Element') { + return new GenericElementHandler(this.model, type, this.context); + } else { + return new ElementHandler(this.model, type, this.context); + } +}; + +/** + * Handle the child element parsing + * + * @param {Element} node the xml node + */ +ElementHandler.prototype.handleChild = function (node) { + var propertyDesc, type, element, childHandler; + propertyDesc = this.getPropertyForNode(node); + element = this.element; + type = propertyDesc.effectiveType || propertyDesc.type; + if (isSimple(type)) { + return this.valueHandler(propertyDesc, element); + } + if (propertyDesc.isReference) { + childHandler = this.referenceHandler(propertyDesc).handleNode(node); + } else { + childHandler = this.handler(type).handleNode(node); + } + var newElement = childHandler.element; + + // child handles may decide to skip elements + // by not returning anything + if (newElement !== undefined) { + if (propertyDesc.isMany) { + element.get(propertyDesc.name).push(newElement); + } else { + element.set(propertyDesc.name, newElement); + } + if (propertyDesc.isReference) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(newElement, { + element: element + }); + this.context.addReference(newElement); + } else { + // establish child -> parent relationship + newElement.$parent = element; + } + } + return childHandler; +}; + +/** + * An element handler that performs special validation + * to ensure the node it gets initialized with matches + * the handlers type (namespace wise). + * + * @param {Moddle} model + * @param {String} typeName + * @param {Context} context + */ +function RootElementHandler(model, typeName, context) { + ElementHandler.call(this, model, typeName, context); +} +RootElementHandler.prototype = Object.create(ElementHandler.prototype); +RootElementHandler.prototype.createElement = function (node) { + var name = node.name, + nameNs = parseName(name), + model = this.model, + type = this.type, + pkg = model.getPackage(nameNs.prefix), + typeName = pkg && aliasToName(nameNs, pkg) || name; + + // verify the correct namespace if we parse + // the first element in the handler tree + // + // this ensures we don't mistakenly import wrong namespace elements + if (!type.hasType(typeName)) { + throw error('unexpected element <' + node.originalName + '>'); + } + return ElementHandler.prototype.createElement.call(this, node); +}; +function GenericElementHandler(model, typeName, context) { + this.model = model; + this.context = context; +} +GenericElementHandler.prototype = Object.create(BaseElementHandler.prototype); +GenericElementHandler.prototype.createElement = function (node) { + var name = node.name, + ns = parseName(name), + prefix = ns.prefix, + uri = node.ns[prefix + '$uri'], + attributes = node.attributes; + return this.model.createAny(name, uri, attributes); +}; +GenericElementHandler.prototype.handleChild = function (node) { + var handler = new GenericElementHandler(this.model, 'Element', this.context).handleNode(node), + element = this.element; + var newElement = handler.element, + children; + if (newElement !== undefined) { + children = element.$children = element.$children || []; + children.push(newElement); + + // establish child -> parent relationship + newElement.$parent = element; + } + return handler; +}; +GenericElementHandler.prototype.handleEnd = function () { + if (this.body) { + this.element.$body = this.body; + } +}; + +/** + * A reader for a meta-model + * + * @param {Object} options + * @param {Model} options.model used to read xml files + * @param {Boolean} options.lax whether to make parse errors warnings + */ +function Reader(options) { + if (options instanceof Moddle) { + options = { + model: options + }; + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)(this, { + lax: false + }, options); +} + +/** + * The fromXML result. + * + * @typedef {Object} ParseResult + * + * @property {ModdleElement} rootElement + * @property {Array} references + * @property {Array} warnings + * @property {Object} elementsById - a mapping containing each ID -> ModdleElement + */ - function findRootElementsByType(businessObject, referencedType) { - var root = getRoot(businessObject); +/** + * The fromXML result. + * + * @typedef {Error} ParseError + * + * @property {Array} warnings + */ - return filterElementsByType(root.rootElements, referencedType); - } +/** + * Parse the given XML into a moddle document tree. + * + * @param {String} xml + * @param {ElementHandler|Object} options or rootHandler + * + * @returns {Promise} + */ +Reader.prototype.fromXML = function (xml, options, done) { + var rootHandler = options.rootHandler; + if (options instanceof ElementHandler) { + // root handler passed via (xml, { rootHandler: ElementHandler }, ...) + rootHandler = options; + options = {}; + } else { + if (typeof options === 'string') { + // rootHandler passed via (xml, 'someString', ...) + rootHandler = this.handler(options); + options = {}; + } else if (typeof rootHandler === 'string') { + // rootHandler passed via (xml, { rootHandler: 'someString' }, ...) + rootHandler = this.handler(rootHandler); + } + } + var model = this.model, + lax = this.lax; + var context = new Context((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, options, { + rootHandler: rootHandler + })), + parser = new Parser({ + proxy: true + }), + stack = createStack(); + rootHandler.context = context; + + // push root handler + stack.push(rootHandler); + + /** + * Handle error. + * + * @param {Error} err + * @param {Function} getContext + * @param {boolean} lax + * + * @return {boolean} true if handled + */ + function handleError(err, getContext, lax) { + var ctx = getContext(); + var line = ctx.line, + column = ctx.column, + data = ctx.data; + + // we receive the full context data here, + // for elements trim down the information + // to the tag name, only + if (data.charAt(0) === '<' && data.indexOf(' ') !== -1) { + data = data.slice(0, data.indexOf(' ')) + '>'; + } + var message = 'unparsable content ' + (data ? data + ' ' : '') + 'detected\n\t' + 'line: ' + line + '\n\t' + 'column: ' + column + '\n\t' + 'nested error: ' + err.message; + if (lax) { + context.addWarning({ + message: message, + error: err + }); + return true; + } else { + throw error(message); + } + } + function handleWarning(err, getContext) { + // just like handling errors in mode + return handleError(err, getContext, true); + } + + /** + * Resolve collected references on parse end. + */ + function resolveReferences() { + var elementsById = context.elementsById; + var references = context.references; + var i, r; + for (i = 0; r = references[i]; i++) { + var element = r.element; + var reference = elementsById[r.id]; + var property = getModdleDescriptor(element).propertiesByName[r.property]; + if (!reference) { + context.addWarning({ + message: 'unresolved reference <' + r.id + '>', + element: r.element, + property: r.property, + value: r.id + }); + } + if (property.isMany) { + var collection = element.get(property.name), + idx = collection.indexOf(r); + + // we replace an existing place holder (idx != -1) or + // append to the collection instead + if (idx === -1) { + idx = collection.length; + } + if (!reference) { + // remove unresolvable reference + collection.splice(idx, 1); + } else { + // add or update reference in collection + collection[idx] = reference; + } + } else { + element.set(property.name, reference); + } + } + } + function handleClose() { + stack.pop().handleEnd(); + } + var PREAMBLE_START_PATTERN = /^<\?xml /i; + var ENCODING_PATTERN = / encoding="([^"]+)"/i; + var UTF_8_PATTERN = /^utf-8$/i; + function handleQuestion(question) { + if (!PREAMBLE_START_PATTERN.test(question)) { + return; + } + var match = ENCODING_PATTERN.exec(question); + var encoding = match && match[1]; + if (!encoding || UTF_8_PATTERN.test(encoding)) { + return; + } + context.addWarning({ + message: 'unsupported document encoding <' + encoding + '>, ' + 'falling back to UTF-8' + }); + } + function handleOpen(node, getContext) { + var handler = stack.peek(); + try { + stack.push(handler.handleNode(node)); + } catch (err) { + if (handleError(err, getContext, lax)) { + stack.push(new NoopHandler()); + } + } + } + function handleCData(text, getContext) { + try { + stack.peek().handleText(text); + } catch (err) { + handleWarning(err, getContext); + } + } + function handleText(text, getContext) { + // strip whitespace only nodes, i.e. before + // sections and in between tags + + if (!text.trim()) { + return; + } + handleCData(text, getContext); + } + var uriMap = model.getPackages().reduce(function (uriMap, p) { + uriMap[p.uri] = p.prefix; + return uriMap; + }, { + 'http://www.w3.org/XML/1998/namespace': 'xml' // add default xml ns + }); + parser.ns(uriMap).on('openTag', function (obj, decodeStr, selfClosing, getContext) { + // gracefully handle unparsable attributes (attrs=false) + var attrs = obj.attrs || {}; + var decodedAttrs = Object.keys(attrs).reduce(function (d, key) { + var value = decodeStr(attrs[key]); + d[key] = value; + return d; + }, {}); + var node = { + name: obj.name, + originalName: obj.originalName, + attributes: decodedAttrs, + ns: obj.ns + }; + handleOpen(node, getContext); + }).on('question', handleQuestion).on('closeTag', handleClose).on('cdata', handleCData).on('text', function (text, decodeEntities, getContext) { + handleText(decodeEntities(text), getContext); + }).on('error', handleError).on('warn', handleWarning); + + // async XML parsing to make sure the execution environment + // (node or brower) is kept responsive and that certain optimization + // strategies can kick in. + return new Promise(function (resolve, reject) { + var err; + try { + parser.parse(xml); + resolveReferences(); + } catch (e) { + err = e; + } + var rootElement = rootHandler.element; + if (!err && !rootElement) { + err = error('failed to parse document as <' + rootHandler.type.$descriptor.name + '>'); + } + var warnings = context.warnings; + var references = context.references; + var elementsById = context.elementsById; + if (err) { + err.warnings = warnings; + return reject(err); + } else { + return resolve({ + rootElement: rootElement, + elementsById: elementsById, + references: references, + warnings: warnings + }); + } + }); +}; +Reader.prototype.handler = function (name) { + return new RootElementHandler(this.model, name); +}; + +// helpers ////////////////////////// + +function createStack() { + var stack = []; + Object.defineProperty(stack, 'peek', { + value: function () { + return this[this.length - 1]; + } + }); + return stack; +} +var XML_PREAMBLE = '\n'; +var ESCAPE_ATTR_CHARS = /<|>|'|"|&|\n\r|\n/g; +var ESCAPE_CHARS = /<|>|&/g; +function Namespaces(parent) { + var prefixMap = {}; + var uriMap = {}; + var used = {}; + var wellknown = []; + var custom = []; + + // API + + this.byUri = function (uri) { + return uriMap[uri] || parent && parent.byUri(uri); + }; + this.add = function (ns, isWellknown) { + uriMap[ns.uri] = ns; + if (isWellknown) { + wellknown.push(ns); + } else { + custom.push(ns); + } + this.mapPrefix(ns.prefix, ns.uri); + }; + this.uriByPrefix = function (prefix) { + return prefixMap[prefix || 'xmlns']; + }; + this.mapPrefix = function (prefix, uri) { + prefixMap[prefix || 'xmlns'] = uri; + }; + this.getNSKey = function (ns) { + return ns.prefix !== undefined ? ns.uri + '|' + ns.prefix : ns.uri; + }; + this.logUsed = function (ns) { + var uri = ns.uri; + var nsKey = this.getNSKey(ns); + used[nsKey] = this.byUri(uri); + + // Inform parent recursively about the usage of this NS + if (parent) { + parent.logUsed(ns); + } + }; + this.getUsed = function (ns) { + function isUsed(ns) { + var nsKey = self.getNSKey(ns); + return used[nsKey]; + } + var self = this; + var allNs = [].concat(wellknown, custom); + return allNs.filter(isUsed); + }; +} +function lower(string) { + return string.charAt(0).toLowerCase() + string.slice(1); +} +function nameToAlias(name, pkg) { + if (hasLowerCaseAlias(pkg)) { + return lower(name); + } else { + return name; + } +} +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +} +function nsName(ns) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(ns)) { + return ns; + } else { + return (ns.prefix ? ns.prefix + ':' : '') + ns.localName; + } +} +function getNsAttrs(namespaces) { + return namespaces.getUsed().filter(function (ns) { + // do not serialize built in namespace + return ns.prefix !== 'xml'; + }).map(function (ns) { + var name = 'xmlns' + (ns.prefix ? ':' + ns.prefix : ''); + return { + name: name, + value: ns.uri + }; + }); +} +function getElementNs(ns, descriptor) { + if (descriptor.isGeneric) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + localName: descriptor.ns.localName + }, ns); + } else { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) + }, ns); + } +} +function getPropertyNs(ns, descriptor) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + localName: descriptor.ns.localName + }, ns); +} +function getSerializableProperties(element) { + var descriptor = element.$descriptor; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.filter)(descriptor.properties, function (p) { + var name = p.name; + if (p.isVirtual) { + return false; + } + + // do not serialize defaults + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.has)(element, name)) { + return false; + } + var value = element[name]; + + // do not serialize default equals + if (value === p.default) { + return false; + } + + // do not serialize null properties + if (value === null) { + return false; + } + return p.isMany ? value.length : true; + }); +} +var ESCAPE_ATTR_MAP = { + '\n': '#10', + '\n\r': '#10', + '"': '#34', + '\'': '#39', + '<': '#60', + '>': '#62', + '&': '#38' +}; +var ESCAPE_MAP = { + '<': 'lt', + '>': 'gt', + '&': 'amp' +}; +function escape(str, charPattern, replaceMap) { + // ensure we are handling strings here + str = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(str) ? str : '' + str; + return str.replace(charPattern, function (s) { + return '&' + replaceMap[s] + ';'; + }); +} + +/** + * Escape a string attribute to not contain any bad values (line breaks, '"', ...) + * + * @param {String} str the string to escape + * @return {String} the escaped string + */ +function escapeAttr(str) { + return escape(str, ESCAPE_ATTR_CHARS, ESCAPE_ATTR_MAP); +} +function escapeBody(str) { + return escape(str, ESCAPE_CHARS, ESCAPE_MAP); +} +function filterAttributes(props) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.filter)(props, function (p) { + return p.isAttr; + }); +} +function filterContained(props) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.filter)(props, function (p) { + return !p.isAttr; + }); +} +function ReferenceSerializer(tagName) { + this.tagName = tagName; +} +ReferenceSerializer.prototype.build = function (element) { + this.element = element; + return this; +}; +ReferenceSerializer.prototype.serializeTo = function (writer) { + writer.appendIndent().append('<' + this.tagName + '>' + this.element.id + '').appendNewLine(); +}; +function BodySerializer() {} +BodySerializer.prototype.serializeValue = BodySerializer.prototype.serializeTo = function (writer) { + writer.append(this.escape ? escapeBody(this.value) : this.value); +}; +BodySerializer.prototype.build = function (prop, value) { + this.value = value; + if (prop.type === 'String' && value.search(ESCAPE_CHARS) !== -1) { + this.escape = true; + } + return this; +}; +function ValueSerializer(tagName) { + this.tagName = tagName; +} +inherits(ValueSerializer, BodySerializer); +ValueSerializer.prototype.serializeTo = function (writer) { + writer.appendIndent().append('<' + this.tagName + '>'); + this.serializeValue(writer); + writer.append('').appendNewLine(); +}; +function ElementSerializer(parent, propertyDescriptor) { + this.body = []; + this.attrs = []; + this.parent = parent; + this.propertyDescriptor = propertyDescriptor; +} +ElementSerializer.prototype.build = function (element) { + this.element = element; + var elementDescriptor = element.$descriptor, + propertyDescriptor = this.propertyDescriptor; + var otherAttrs, properties; + var isGeneric = elementDescriptor.isGeneric; + if (isGeneric) { + otherAttrs = this.parseGeneric(element); + } else { + otherAttrs = this.parseNsAttributes(element); + } + if (propertyDescriptor) { + this.ns = this.nsPropertyTagName(propertyDescriptor); + } else { + this.ns = this.nsTagName(elementDescriptor); + } + + // compute tag name + this.tagName = this.addTagName(this.ns); + if (!isGeneric) { + properties = getSerializableProperties(element); + this.parseAttributes(filterAttributes(properties)); + this.parseContainments(filterContained(properties)); + } + this.parseGenericAttributes(element, otherAttrs); + return this; +}; +ElementSerializer.prototype.nsTagName = function (descriptor) { + var effectiveNs = this.logNamespaceUsed(descriptor.ns); + return getElementNs(effectiveNs, descriptor); +}; +ElementSerializer.prototype.nsPropertyTagName = function (descriptor) { + var effectiveNs = this.logNamespaceUsed(descriptor.ns); + return getPropertyNs(effectiveNs, descriptor); +}; +ElementSerializer.prototype.isLocalNs = function (ns) { + return ns.uri === this.ns.uri; +}; + +/** + * Get the actual ns attribute name for the given element. + * + * @param {Object} element + * @param {Boolean} [element.inherited=false] + * + * @return {Object} nsName + */ +ElementSerializer.prototype.nsAttributeName = function (element) { + var ns; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(element)) { + ns = parseName(element); + } else { + ns = element.ns; + } + + // return just local name for inherited attributes + if (element.inherited) { + return { + localName: ns.localName + }; + } + + // parse + log effective ns + var effectiveNs = this.logNamespaceUsed(ns); + + // LOG ACTUAL namespace use + this.getNamespaces().logUsed(effectiveNs); + + // strip prefix if same namespace like parent + if (this.isLocalNs(effectiveNs)) { + return { + localName: ns.localName + }; + } else { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + localName: ns.localName + }, effectiveNs); + } +}; +ElementSerializer.prototype.parseGeneric = function (element) { + var self = this, + body = this.body; + var attributes = []; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(element, function (val, key) { + var nonNsAttr; + if (key === '$body') { + body.push(new BodySerializer().build({ + type: 'String' + }, val)); + } else if (key === '$children') { + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(val, function (child) { + body.push(new ElementSerializer(self).build(child)); + }); + } else if (key.indexOf('$') !== 0) { + nonNsAttr = self.parseNsAttribute(element, key, val); + if (nonNsAttr) { + attributes.push({ + name: key, + value: val + }); + } + } + }); + return attributes; +}; +ElementSerializer.prototype.parseNsAttribute = function (element, name, value) { + var model = element.$model; + var nameNs = parseName(name); + var ns; + + // parse xmlns:foo="http://foo.bar" + if (nameNs.prefix === 'xmlns') { + ns = { + prefix: nameNs.localName, + uri: value + }; + } + + // parse xmlns="http://foo.bar" + if (!nameNs.prefix && nameNs.localName === 'xmlns') { + ns = { + uri: value + }; + } + if (!ns) { + return { + name: name, + value: value + }; + } + if (model && model.getPackage(value)) { + // register well known namespace + this.logNamespace(ns, true, true); + } else { + // log custom namespace directly as used + var actualNs = this.logNamespaceUsed(ns, true); + this.getNamespaces().logUsed(actualNs); + } +}; + +/** + * Parse namespaces and return a list of left over generic attributes + * + * @param {Object} element + * @return {Array} + */ +ElementSerializer.prototype.parseNsAttributes = function (element, attrs) { + var self = this; + var genericAttrs = element.$attrs; + var attributes = []; + + // parse namespace attributes first + // and log them. push non namespace attributes to a list + // and process them later + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(genericAttrs, function (value, name) { + var nonNsAttr = self.parseNsAttribute(element, name, value); + if (nonNsAttr) { + attributes.push(nonNsAttr); + } + }); + return attributes; +}; +ElementSerializer.prototype.parseGenericAttributes = function (element, attributes) { + var self = this; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(attributes, function (attr) { + // do not serialize xsi:type attribute + // it is set manually based on the actual implementation type + if (attr.name === XSI_TYPE) { + return; + } + try { + self.addAttribute(self.nsAttributeName(attr.name), attr.value); + } catch (e) { + /* global console */ + + console.warn('missing namespace information for ', attr.name, '=', attr.value, 'on', element, e); + } + }); +}; +ElementSerializer.prototype.parseContainments = function (properties) { + var self = this, + body = this.body, + element = this.element; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(properties, function (p) { + var value = element.get(p.name), + isReference = p.isReference, + isMany = p.isMany; + if (!isMany) { + value = [value]; + } + if (p.isBody) { + body.push(new BodySerializer().build(p, value[0])); + } else if (isSimple(p.type)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(value, function (v) { + body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v)); + }); + } else if (isReference) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(value, function (v) { + body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v)); + }); + } else { + // allow serialization via type + // rather than element name + var asType = serializeAsType(p), + asProperty = serializeAsProperty(p); + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(value, function (v) { + var serializer; + if (asType) { + serializer = new TypeSerializer(self, p); + } else if (asProperty) { + serializer = new ElementSerializer(self, p); + } else { + serializer = new ElementSerializer(self); + } + body.push(serializer.build(v)); + }); + } + }); +}; +ElementSerializer.prototype.getNamespaces = function (local) { + var namespaces = this.namespaces, + parent = this.parent, + parentNamespaces; + if (!namespaces) { + parentNamespaces = parent && parent.getNamespaces(); + if (local || !parentNamespaces) { + this.namespaces = namespaces = new Namespaces(parentNamespaces); + } else { + namespaces = parentNamespaces; + } + } + return namespaces; +}; +ElementSerializer.prototype.logNamespace = function (ns, wellknown, local) { + var namespaces = this.getNamespaces(local); + var nsUri = ns.uri, + nsPrefix = ns.prefix; + var existing = namespaces.byUri(nsUri); + if (!existing || local) { + namespaces.add(ns, wellknown); + } + namespaces.mapPrefix(nsPrefix, nsUri); + return ns; +}; +ElementSerializer.prototype.logNamespaceUsed = function (ns, local) { + var element = this.element, + model = element.$model, + namespaces = this.getNamespaces(local); + + // ns may be + // + // * prefix only + // * prefix:uri + // * localName only + + var prefix = ns.prefix, + uri = ns.uri, + newPrefix, + idx, + wellknownUri; + + // handle anonymous namespaces (elementForm=unqualified), cf. #23 + if (!prefix && !uri) { + return { + localName: ns.localName + }; + } + wellknownUri = DEFAULT_NS_MAP[prefix] || model && (model.getPackage(prefix) || {}).uri; + uri = uri || wellknownUri || namespaces.uriByPrefix(prefix); + if (!uri) { + throw new Error('no namespace uri given for prefix <' + prefix + '>'); + } + ns = namespaces.byUri(uri); + if (!ns) { + newPrefix = prefix; + idx = 1; + + // find a prefix that is not mapped yet + while (namespaces.uriByPrefix(newPrefix)) { + newPrefix = prefix + '_' + idx++; + } + ns = this.logNamespace({ + prefix: newPrefix, + uri: uri + }, wellknownUri === uri); + } + if (prefix) { + namespaces.mapPrefix(prefix, uri); + } + return ns; +}; +ElementSerializer.prototype.parseAttributes = function (properties) { + var self = this, + element = this.element; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(properties, function (p) { + var value = element.get(p.name); + if (p.isReference) { + if (!p.isMany) { + value = value.id; + } else { + var values = []; + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(value, function (v) { + values.push(v.id); + }); - module.exports.findRootElementsByType = findRootElementsByType; + // IDREFS is a whitespace-separated list of references. + value = values.join(' '); + } + } + self.addAttribute(self.nsAttributeName(p), value); + }); +}; +ElementSerializer.prototype.addTagName = function (nsTagName) { + var actualNs = this.logNamespaceUsed(nsTagName); + this.getNamespaces().logUsed(actualNs); + return nsName(nsTagName); +}; +ElementSerializer.prototype.addAttribute = function (name, value) { + var attrs = this.attrs; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(value)) { + value = escapeAttr(value); + } + + // de-duplicate attributes + // https://github.com/bpmn-io/moddle-xml/issues/66 + var idx = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.findIndex)(attrs, function (element) { + return element.name.localName === name.localName && element.name.uri === name.uri && element.name.prefix === name.prefix; + }); + var attr = { + name: name, + value: value + }; + if (idx !== -1) { + attrs.splice(idx, 1, attr); + } else { + attrs.push(attr); + } +}; +ElementSerializer.prototype.serializeAttributes = function (writer) { + var attrs = this.attrs, + namespaces = this.namespaces; + if (namespaces) { + attrs = getNsAttrs(namespaces).concat(attrs); + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(attrs, function (a) { + writer.append(' ').append(nsName(a.name)).append('="').append(a.value).append('"'); + }); +}; +ElementSerializer.prototype.serializeTo = function (writer) { + var firstBody = this.body[0], + indent = firstBody && firstBody.constructor !== BodySerializer; + writer.appendIndent().append('<' + this.tagName); + this.serializeAttributes(writer); + writer.append(firstBody ? '>' : ' />'); + if (firstBody) { + if (indent) { + writer.appendNewLine().indent(); + } + (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.forEach)(this.body, function (b) { + b.serializeTo(writer); + }); + if (indent) { + writer.unindent().appendIndent(); + } + writer.append(''); + } + writer.appendNewLine(); +}; + +/** + * A serializer for types that handles serialization of data types + */ +function TypeSerializer(parent, propertyDescriptor) { + ElementSerializer.call(this, parent, propertyDescriptor); +} +inherits(TypeSerializer, ElementSerializer); +TypeSerializer.prototype.parseNsAttributes = function (element) { + // extracted attributes + var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element); + var descriptor = element.$descriptor; + + // only serialize xsi:type if necessary + if (descriptor.name === this.propertyDescriptor.type) { + return attributes; + } + var typeNs = this.typeNs = this.nsTagName(descriptor); + this.getNamespaces().logUsed(this.typeNs); + + // add xsi:type attribute to represent the elements + // actual type + + var pkg = element.$model.getPackage(typeNs.uri), + typePrefix = pkg.xml && pkg.xml.typePrefix || ''; + this.addAttribute(this.nsAttributeName(XSI_TYPE), (typeNs.prefix ? typeNs.prefix + ':' : '') + typePrefix + descriptor.ns.localName); + return attributes; +}; +TypeSerializer.prototype.isLocalNs = function (ns) { + return ns.uri === (this.typeNs || this.ns).uri; +}; +function SavingWriter() { + this.value = ''; + this.write = function (str) { + this.value += str; + }; +} +function FormatingWriter(out, format) { + var indent = ['']; + this.append = function (str) { + out.write(str); + return this; + }; + this.appendNewLine = function () { + if (format) { + out.write('\n'); + } + return this; + }; + this.appendIndent = function () { + if (format) { + out.write(indent.join(' ')); + } + return this; + }; + this.indent = function () { + indent.push(''); + return this; + }; + this.unindent = function () { + indent.pop(); + return this; + }; +} + +/** + * A writer for meta-model backed document trees + * + * @param {Object} options output options to pass into the writer + */ +function Writer(options) { + options = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + format: false, + preamble: true + }, options || {}); + function toXML(tree, writer) { + var internalWriter = writer || new SavingWriter(); + var formatingWriter = new FormatingWriter(internalWriter, options.format); + if (options.preamble) { + formatingWriter.append(XML_PREAMBLE); + } + new ElementSerializer().build(tree).serializeTo(formatingWriter); + if (!writer) { + return internalWriter.value; + } + } + return { + toXML: toXML + }; +} + +/** + * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files. + * + * @class BpmnModdle + * @extends Moddle + * + * @param {Object|Array} packages to use for instantiating the model + * @param {Object} [options] additional options to pass over + */ +function BpmnModdle(packages, options) { + Moddle.call(this, packages, options); +} +BpmnModdle.prototype = Object.create(Moddle.prototype); +/** + * The fromXML result. + * + * @typedef {Object} ParseResult + * + * @property {ModdleElement} rootElement + * @property {Array} references + * @property {Array} warnings + * @property {Object} elementsById - a mapping containing each ID -> ModdleElement + */ - function removeAllChildren(domElement) { - while (domElement.firstChild) { - domElement.removeChild(domElement.firstChild); - } - } +/** + * The fromXML error. + * + * @typedef {Error} ParseError + * + * @property {Array} warnings + */ - module.exports.removeAllChildren = removeAllChildren; +/** + * Instantiates a BPMN model tree from a given xml string. + * + * @param {String} xmlStr + * @param {String} [typeName='bpmn:Definitions'] name of the root element + * @param {Object} [options] options to pass to the underlying reader + * + * @returns {Promise} + */ +BpmnModdle.prototype.fromXML = function (xmlStr, typeName, options) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_13__.isString)(typeName)) { + options = typeName; + typeName = 'bpmn:Definitions'; + } + var reader = new Reader((0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({ + model: this, + lax: true + }, options)); + var rootHandler = reader.handler(typeName); + return reader.fromXML(xmlStr, rootHandler); +}; + +/** + * The toXML result. + * + * @typedef {Object} SerializationResult + * + * @property {String} xml + */ +/** + * Serializes a BPMN 2.0 object tree to XML. + * + * @param {String} element the root element, typically an instance of `bpmn:Definitions` + * @param {Object} [options] to pass to the underlying writer + * + * @returns {Promise} + */ +BpmnModdle.prototype.toXML = function (element, options) { + var writer = new Writer(options); + return new Promise(function (resolve, reject) { + try { + var result = writer.toXML(element); + return resolve({ + xml: result + }); + } catch (err) { + return reject(err); + } + }); +}; +var name$5 = "BPMN20"; +var uri$5 = "http://www.omg.org/spec/BPMN/20100524/MODEL"; +var prefix$5 = "bpmn"; +var associations$5 = []; +var types$5 = [{ + name: "Interface", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "operations", + type: "Operation", + isMany: true + }, { + name: "implementationRef", + isAttr: true, + type: "String" + }] +}, { + name: "Operation", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "inMessageRef", + type: "Message", + isReference: true + }, { + name: "outMessageRef", + type: "Message", + isReference: true + }, { + name: "errorRef", + type: "Error", + isMany: true, + isReference: true + }, { + name: "implementationRef", + isAttr: true, + type: "String" + }] +}, { + name: "EndPoint", + superClass: ["RootElement"] +}, { + name: "Auditing", + superClass: ["BaseElement"] +}, { + name: "GlobalTask", + superClass: ["CallableElement"], + properties: [{ + name: "resources", + type: "ResourceRole", + isMany: true + }] +}, { + name: "Monitoring", + superClass: ["BaseElement"] +}, { + name: "Performer", + superClass: ["ResourceRole"] +}, { + name: "Process", + superClass: ["FlowElementsContainer", "CallableElement"], + properties: [{ + name: "processType", + type: "ProcessType", + isAttr: true + }, { + name: "isClosed", + isAttr: true, + type: "Boolean" + }, { + name: "auditing", + type: "Auditing" + }, { + name: "monitoring", + type: "Monitoring" + }, { + name: "properties", + type: "Property", + isMany: true + }, { + name: "laneSets", + isMany: true, + replaces: "FlowElementsContainer#laneSets", + type: "LaneSet" + }, { + name: "flowElements", + isMany: true, + replaces: "FlowElementsContainer#flowElements", + type: "FlowElement" + }, { + name: "artifacts", + type: "Artifact", + isMany: true + }, { + name: "resources", + type: "ResourceRole", + isMany: true + }, { + name: "correlationSubscriptions", + type: "CorrelationSubscription", + isMany: true + }, { + name: "supports", + type: "Process", + isMany: true, + isReference: true + }, { + name: "definitionalCollaborationRef", + type: "Collaboration", + isAttr: true, + isReference: true + }, { + name: "isExecutable", + isAttr: true, + type: "Boolean" + }] +}, { + name: "LaneSet", + superClass: ["BaseElement"], + properties: [{ + name: "lanes", + type: "Lane", + isMany: true + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "Lane", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "partitionElementRef", + type: "BaseElement", + isAttr: true, + isReference: true + }, { + name: "partitionElement", + type: "BaseElement" + }, { + name: "flowNodeRef", + type: "FlowNode", + isMany: true, + isReference: true + }, { + name: "childLaneSet", + type: "LaneSet", + xml: { + serialize: "xsi:type" + } + }] +}, { + name: "GlobalManualTask", + superClass: ["GlobalTask"] +}, { + name: "ManualTask", + superClass: ["Task"] +}, { + name: "UserTask", + superClass: ["Task"], + properties: [{ + name: "renderings", + type: "Rendering", + isMany: true + }, { + name: "implementation", + isAttr: true, + type: "String" + }] +}, { + name: "Rendering", + superClass: ["BaseElement"] +}, { + name: "HumanPerformer", + superClass: ["Performer"] +}, { + name: "PotentialOwner", + superClass: ["HumanPerformer"] +}, { + name: "GlobalUserTask", + superClass: ["GlobalTask"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }, { + name: "renderings", + type: "Rendering", + isMany: true + }] +}, { + name: "Gateway", + isAbstract: true, + superClass: ["FlowNode"], + properties: [{ + name: "gatewayDirection", + type: "GatewayDirection", + "default": "Unspecified", + isAttr: true + }] +}, { + name: "EventBasedGateway", + superClass: ["Gateway"], + properties: [{ + name: "instantiate", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "eventGatewayType", + type: "EventBasedGatewayType", + isAttr: true, + "default": "Exclusive" + }] +}, { + name: "ComplexGateway", + superClass: ["Gateway"], + properties: [{ + name: "activationCondition", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "default", + type: "SequenceFlow", + isAttr: true, + isReference: true + }] +}, { + name: "ExclusiveGateway", + superClass: ["Gateway"], + properties: [{ + name: "default", + type: "SequenceFlow", + isAttr: true, + isReference: true + }] +}, { + name: "InclusiveGateway", + superClass: ["Gateway"], + properties: [{ + name: "default", + type: "SequenceFlow", + isAttr: true, + isReference: true + }] +}, { + name: "ParallelGateway", + superClass: ["Gateway"] +}, { + name: "RootElement", + isAbstract: true, + superClass: ["BaseElement"] +}, { + name: "Relationship", + superClass: ["BaseElement"], + properties: [{ + name: "type", + isAttr: true, + type: "String" + }, { + name: "direction", + type: "RelationshipDirection", + isAttr: true + }, { + name: "source", + isMany: true, + isReference: true, + type: "Element" + }, { + name: "target", + isMany: true, + isReference: true, + type: "Element" + }] +}, { + name: "BaseElement", + isAbstract: true, + properties: [{ + name: "id", + isAttr: true, + type: "String", + isId: true + }, { + name: "documentation", + type: "Documentation", + isMany: true + }, { + name: "extensionDefinitions", + type: "ExtensionDefinition", + isMany: true, + isReference: true + }, { + name: "extensionElements", + type: "ExtensionElements" + }] +}, { + name: "Extension", + properties: [{ + name: "mustUnderstand", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "definition", + type: "ExtensionDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "ExtensionDefinition", + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "extensionAttributeDefinitions", + type: "ExtensionAttributeDefinition", + isMany: true + }] +}, { + name: "ExtensionAttributeDefinition", + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "type", + isAttr: true, + type: "String" + }, { + name: "isReference", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "extensionDefinition", + type: "ExtensionDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "ExtensionElements", + properties: [{ + name: "valueRef", + isAttr: true, + isReference: true, + type: "Element" + }, { + name: "values", + type: "Element", + isMany: true + }, { + name: "extensionAttributeDefinition", + type: "ExtensionAttributeDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "Documentation", + superClass: ["BaseElement"], + properties: [{ + name: "text", + type: "String", + isBody: true + }, { + name: "textFormat", + "default": "text/plain", + isAttr: true, + type: "String" + }] +}, { + name: "Event", + isAbstract: true, + superClass: ["FlowNode", "InteractionNode"], + properties: [{ + name: "properties", + type: "Property", + isMany: true + }] +}, { + name: "IntermediateCatchEvent", + superClass: ["CatchEvent"] +}, { + name: "IntermediateThrowEvent", + superClass: ["ThrowEvent"] +}, { + name: "EndEvent", + superClass: ["ThrowEvent"] +}, { + name: "StartEvent", + superClass: ["CatchEvent"], + properties: [{ + name: "isInterrupting", + "default": true, + isAttr: true, + type: "Boolean" + }] +}, { + name: "ThrowEvent", + isAbstract: true, + superClass: ["Event"], + properties: [{ + name: "dataInputs", + type: "DataInput", + isMany: true + }, { + name: "dataInputAssociations", + type: "DataInputAssociation", + isMany: true + }, { + name: "inputSet", + type: "InputSet" + }, { + name: "eventDefinitions", + type: "EventDefinition", + isMany: true + }, { + name: "eventDefinitionRef", + type: "EventDefinition", + isMany: true, + isReference: true + }] +}, { + name: "CatchEvent", + isAbstract: true, + superClass: ["Event"], + properties: [{ + name: "parallelMultiple", + isAttr: true, + type: "Boolean", + "default": false + }, { + name: "dataOutputs", + type: "DataOutput", + isMany: true + }, { + name: "dataOutputAssociations", + type: "DataOutputAssociation", + isMany: true + }, { + name: "outputSet", + type: "OutputSet" + }, { + name: "eventDefinitions", + type: "EventDefinition", + isMany: true + }, { + name: "eventDefinitionRef", + type: "EventDefinition", + isMany: true, + isReference: true + }] +}, { + name: "BoundaryEvent", + superClass: ["CatchEvent"], + properties: [{ + name: "cancelActivity", + "default": true, + isAttr: true, + type: "Boolean" + }, { + name: "attachedToRef", + type: "Activity", + isAttr: true, + isReference: true + }] +}, { + name: "EventDefinition", + isAbstract: true, + superClass: ["RootElement"] +}, { + name: "CancelEventDefinition", + superClass: ["EventDefinition"] +}, { + name: "ErrorEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "errorRef", + type: "Error", + isAttr: true, + isReference: true + }] +}, { + name: "TerminateEventDefinition", + superClass: ["EventDefinition"] +}, { + name: "EscalationEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "escalationRef", + type: "Escalation", + isAttr: true, + isReference: true + }] +}, { + name: "Escalation", + properties: [{ + name: "structureRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }, { + name: "escalationCode", + isAttr: true, + type: "String" + }], + superClass: ["RootElement"] +}, { + name: "CompensateEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "waitForCompletion", + isAttr: true, + type: "Boolean", + "default": true + }, { + name: "activityRef", + type: "Activity", + isAttr: true, + isReference: true + }] +}, { + name: "TimerEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "timeDate", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "timeCycle", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "timeDuration", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }] +}, { + name: "LinkEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "target", + type: "LinkEventDefinition", + isReference: true + }, { + name: "source", + type: "LinkEventDefinition", + isMany: true, + isReference: true + }] +}, { + name: "MessageEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "messageRef", + type: "Message", + isAttr: true, + isReference: true + }, { + name: "operationRef", + type: "Operation", + isAttr: true, + isReference: true + }] +}, { + name: "ConditionalEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "condition", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }] +}, { + name: "SignalEventDefinition", + superClass: ["EventDefinition"], + properties: [{ + name: "signalRef", + type: "Signal", + isAttr: true, + isReference: true + }] +}, { + name: "Signal", + superClass: ["RootElement"], + properties: [{ + name: "structureRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "ImplicitThrowEvent", + superClass: ["ThrowEvent"] +}, { + name: "DataState", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "ItemAwareElement", + superClass: ["BaseElement"], + properties: [{ + name: "itemSubjectRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }, { + name: "dataState", + type: "DataState" + }] +}, { + name: "DataAssociation", + superClass: ["BaseElement"], + properties: [{ + name: "sourceRef", + type: "ItemAwareElement", + isMany: true, + isReference: true + }, { + name: "targetRef", + type: "ItemAwareElement", + isReference: true + }, { + name: "transformation", + type: "FormalExpression", + xml: { + serialize: "property" + } + }, { + name: "assignment", + type: "Assignment", + isMany: true + }] +}, { + name: "DataInput", + superClass: ["ItemAwareElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "isCollection", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "inputSetRef", + type: "InputSet", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "inputSetWithOptional", + type: "InputSet", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "inputSetWithWhileExecuting", + type: "InputSet", + isMany: true, + isVirtual: true, + isReference: true + }] +}, { + name: "DataOutput", + superClass: ["ItemAwareElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "isCollection", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "outputSetRef", + type: "OutputSet", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "outputSetWithOptional", + type: "OutputSet", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "outputSetWithWhileExecuting", + type: "OutputSet", + isMany: true, + isVirtual: true, + isReference: true + }] +}, { + name: "InputSet", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "dataInputRefs", + type: "DataInput", + isMany: true, + isReference: true + }, { + name: "optionalInputRefs", + type: "DataInput", + isMany: true, + isReference: true + }, { + name: "whileExecutingInputRefs", + type: "DataInput", + isMany: true, + isReference: true + }, { + name: "outputSetRefs", + type: "OutputSet", + isMany: true, + isReference: true + }] +}, { + name: "OutputSet", + superClass: ["BaseElement"], + properties: [{ + name: "dataOutputRefs", + type: "DataOutput", + isMany: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }, { + name: "inputSetRefs", + type: "InputSet", + isMany: true, + isReference: true + }, { + name: "optionalOutputRefs", + type: "DataOutput", + isMany: true, + isReference: true + }, { + name: "whileExecutingOutputRefs", + type: "DataOutput", + isMany: true, + isReference: true + }] +}, { + name: "Property", + superClass: ["ItemAwareElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "DataInputAssociation", + superClass: ["DataAssociation"] +}, { + name: "DataOutputAssociation", + superClass: ["DataAssociation"] +}, { + name: "InputOutputSpecification", + superClass: ["BaseElement"], + properties: [{ + name: "dataInputs", + type: "DataInput", + isMany: true + }, { + name: "dataOutputs", + type: "DataOutput", + isMany: true + }, { + name: "inputSets", + type: "InputSet", + isMany: true + }, { + name: "outputSets", + type: "OutputSet", + isMany: true + }] +}, { + name: "DataObject", + superClass: ["FlowElement", "ItemAwareElement"], + properties: [{ + name: "isCollection", + "default": false, + isAttr: true, + type: "Boolean" + }] +}, { + name: "InputOutputBinding", + properties: [{ + name: "inputDataRef", + type: "InputSet", + isAttr: true, + isReference: true + }, { + name: "outputDataRef", + type: "OutputSet", + isAttr: true, + isReference: true + }, { + name: "operationRef", + type: "Operation", + isAttr: true, + isReference: true + }] +}, { + name: "Assignment", + superClass: ["BaseElement"], + properties: [{ + name: "from", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "to", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }] +}, { + name: "DataStore", + superClass: ["RootElement", "ItemAwareElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "capacity", + isAttr: true, + type: "Integer" + }, { + name: "isUnlimited", + "default": true, + isAttr: true, + type: "Boolean" + }] +}, { + name: "DataStoreReference", + superClass: ["ItemAwareElement", "FlowElement"], + properties: [{ + name: "dataStoreRef", + type: "DataStore", + isAttr: true, + isReference: true + }] +}, { + name: "DataObjectReference", + superClass: ["ItemAwareElement", "FlowElement"], + properties: [{ + name: "dataObjectRef", + type: "DataObject", + isAttr: true, + isReference: true + }] +}, { + name: "ConversationLink", + superClass: ["BaseElement"], + properties: [{ + name: "sourceRef", + type: "InteractionNode", + isAttr: true, + isReference: true + }, { + name: "targetRef", + type: "InteractionNode", + isAttr: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "ConversationAssociation", + superClass: ["BaseElement"], + properties: [{ + name: "innerConversationNodeRef", + type: "ConversationNode", + isAttr: true, + isReference: true + }, { + name: "outerConversationNodeRef", + type: "ConversationNode", + isAttr: true, + isReference: true + }] +}, { + name: "CallConversation", + superClass: ["ConversationNode"], + properties: [{ + name: "calledCollaborationRef", + type: "Collaboration", + isAttr: true, + isReference: true + }, { + name: "participantAssociations", + type: "ParticipantAssociation", + isMany: true + }] +}, { + name: "Conversation", + superClass: ["ConversationNode"] +}, { + name: "SubConversation", + superClass: ["ConversationNode"], + properties: [{ + name: "conversationNodes", + type: "ConversationNode", + isMany: true + }] +}, { + name: "ConversationNode", + isAbstract: true, + superClass: ["InteractionNode", "BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "participantRef", + type: "Participant", + isMany: true, + isReference: true + }, { + name: "messageFlowRefs", + type: "MessageFlow", + isMany: true, + isReference: true + }, { + name: "correlationKeys", + type: "CorrelationKey", + isMany: true + }] +}, { + name: "GlobalConversation", + superClass: ["Collaboration"] +}, { + name: "PartnerEntity", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "participantRef", + type: "Participant", + isMany: true, + isReference: true + }] +}, { + name: "PartnerRole", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "participantRef", + type: "Participant", + isMany: true, + isReference: true + }] +}, { + name: "CorrelationProperty", + superClass: ["RootElement"], + properties: [{ + name: "correlationPropertyRetrievalExpression", + type: "CorrelationPropertyRetrievalExpression", + isMany: true + }, { + name: "name", + isAttr: true, + type: "String" + }, { + name: "type", + type: "ItemDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "Error", + superClass: ["RootElement"], + properties: [{ + name: "structureRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }, { + name: "errorCode", + isAttr: true, + type: "String" + }] +}, { + name: "CorrelationKey", + superClass: ["BaseElement"], + properties: [{ + name: "correlationPropertyRef", + type: "CorrelationProperty", + isMany: true, + isReference: true + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "Expression", + superClass: ["BaseElement"], + isAbstract: false, + properties: [{ + name: "body", + isBody: true, + type: "String" + }] +}, { + name: "FormalExpression", + superClass: ["Expression"], + properties: [{ + name: "language", + isAttr: true, + type: "String" + }, { + name: "evaluatesToTypeRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "Message", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "itemRef", + type: "ItemDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "ItemDefinition", + superClass: ["RootElement"], + properties: [{ + name: "itemKind", + type: "ItemKind", + isAttr: true + }, { + name: "structureRef", + isAttr: true, + type: "String" + }, { + name: "isCollection", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "import", + type: "Import", + isAttr: true, + isReference: true + }] +}, { + name: "FlowElement", + isAbstract: true, + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "auditing", + type: "Auditing" + }, { + name: "monitoring", + type: "Monitoring" + }, { + name: "categoryValueRef", + type: "CategoryValue", + isMany: true, + isReference: true + }] +}, { + name: "SequenceFlow", + superClass: ["FlowElement"], + properties: [{ + name: "isImmediate", + isAttr: true, + type: "Boolean" + }, { + name: "conditionExpression", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "sourceRef", + type: "FlowNode", + isAttr: true, + isReference: true + }, { + name: "targetRef", + type: "FlowNode", + isAttr: true, + isReference: true + }] +}, { + name: "FlowElementsContainer", + isAbstract: true, + superClass: ["BaseElement"], + properties: [{ + name: "laneSets", + type: "LaneSet", + isMany: true + }, { + name: "flowElements", + type: "FlowElement", + isMany: true + }] +}, { + name: "CallableElement", + isAbstract: true, + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "ioSpecification", + type: "InputOutputSpecification", + xml: { + serialize: "property" + } + }, { + name: "supportedInterfaceRef", + type: "Interface", + isMany: true, + isReference: true + }, { + name: "ioBinding", + type: "InputOutputBinding", + isMany: true, + xml: { + serialize: "property" + } + }] +}, { + name: "FlowNode", + isAbstract: true, + superClass: ["FlowElement"], + properties: [{ + name: "incoming", + type: "SequenceFlow", + isMany: true, + isReference: true + }, { + name: "outgoing", + type: "SequenceFlow", + isMany: true, + isReference: true + }, { + name: "lanes", + type: "Lane", + isMany: true, + isVirtual: true, + isReference: true + }] +}, { + name: "CorrelationPropertyRetrievalExpression", + superClass: ["BaseElement"], + properties: [{ + name: "messagePath", + type: "FormalExpression" + }, { + name: "messageRef", + type: "Message", + isAttr: true, + isReference: true + }] +}, { + name: "CorrelationPropertyBinding", + superClass: ["BaseElement"], + properties: [{ + name: "dataPath", + type: "FormalExpression" + }, { + name: "correlationPropertyRef", + type: "CorrelationProperty", + isAttr: true, + isReference: true + }] +}, { + name: "Resource", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "resourceParameters", + type: "ResourceParameter", + isMany: true + }] +}, { + name: "ResourceParameter", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "isRequired", + isAttr: true, + type: "Boolean" + }, { + name: "type", + type: "ItemDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "CorrelationSubscription", + superClass: ["BaseElement"], + properties: [{ + name: "correlationKeyRef", + type: "CorrelationKey", + isAttr: true, + isReference: true + }, { + name: "correlationPropertyBinding", + type: "CorrelationPropertyBinding", + isMany: true + }] +}, { + name: "MessageFlow", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "sourceRef", + type: "InteractionNode", + isAttr: true, + isReference: true + }, { + name: "targetRef", + type: "InteractionNode", + isAttr: true, + isReference: true + }, { + name: "messageRef", + type: "Message", + isAttr: true, + isReference: true + }] +}, { + name: "MessageFlowAssociation", + superClass: ["BaseElement"], + properties: [{ + name: "innerMessageFlowRef", + type: "MessageFlow", + isAttr: true, + isReference: true + }, { + name: "outerMessageFlowRef", + type: "MessageFlow", + isAttr: true, + isReference: true + }] +}, { + name: "InteractionNode", + isAbstract: true, + properties: [{ + name: "incomingConversationLinks", + type: "ConversationLink", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "outgoingConversationLinks", + type: "ConversationLink", + isMany: true, + isVirtual: true, + isReference: true + }] +}, { + name: "Participant", + superClass: ["InteractionNode", "BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "interfaceRef", + type: "Interface", + isMany: true, + isReference: true + }, { + name: "participantMultiplicity", + type: "ParticipantMultiplicity" + }, { + name: "endPointRefs", + type: "EndPoint", + isMany: true, + isReference: true + }, { + name: "processRef", + type: "Process", + isAttr: true, + isReference: true + }] +}, { + name: "ParticipantAssociation", + superClass: ["BaseElement"], + properties: [{ + name: "innerParticipantRef", + type: "Participant", + isAttr: true, + isReference: true + }, { + name: "outerParticipantRef", + type: "Participant", + isAttr: true, + isReference: true + }] +}, { + name: "ParticipantMultiplicity", + properties: [{ + name: "minimum", + "default": 0, + isAttr: true, + type: "Integer" + }, { + name: "maximum", + "default": 1, + isAttr: true, + type: "Integer" + }], + superClass: ["BaseElement"] +}, { + name: "Collaboration", + superClass: ["RootElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "isClosed", + isAttr: true, + type: "Boolean" + }, { + name: "participants", + type: "Participant", + isMany: true + }, { + name: "messageFlows", + type: "MessageFlow", + isMany: true + }, { + name: "artifacts", + type: "Artifact", + isMany: true + }, { + name: "conversations", + type: "ConversationNode", + isMany: true + }, { + name: "conversationAssociations", + type: "ConversationAssociation" + }, { + name: "participantAssociations", + type: "ParticipantAssociation", + isMany: true + }, { + name: "messageFlowAssociations", + type: "MessageFlowAssociation", + isMany: true + }, { + name: "correlationKeys", + type: "CorrelationKey", + isMany: true + }, { + name: "choreographyRef", + type: "Choreography", + isMany: true, + isReference: true + }, { + name: "conversationLinks", + type: "ConversationLink", + isMany: true + }] +}, { + name: "ChoreographyActivity", + isAbstract: true, + superClass: ["FlowNode"], + properties: [{ + name: "participantRef", + type: "Participant", + isMany: true, + isReference: true + }, { + name: "initiatingParticipantRef", + type: "Participant", + isAttr: true, + isReference: true + }, { + name: "correlationKeys", + type: "CorrelationKey", + isMany: true + }, { + name: "loopType", + type: "ChoreographyLoopType", + "default": "None", + isAttr: true + }] +}, { + name: "CallChoreography", + superClass: ["ChoreographyActivity"], + properties: [{ + name: "calledChoreographyRef", + type: "Choreography", + isAttr: true, + isReference: true + }, { + name: "participantAssociations", + type: "ParticipantAssociation", + isMany: true + }] +}, { + name: "SubChoreography", + superClass: ["ChoreographyActivity", "FlowElementsContainer"], + properties: [{ + name: "artifacts", + type: "Artifact", + isMany: true + }] +}, { + name: "ChoreographyTask", + superClass: ["ChoreographyActivity"], + properties: [{ + name: "messageFlowRef", + type: "MessageFlow", + isMany: true, + isReference: true + }] +}, { + name: "Choreography", + superClass: ["Collaboration", "FlowElementsContainer"] +}, { + name: "GlobalChoreographyTask", + superClass: ["Choreography"], + properties: [{ + name: "initiatingParticipantRef", + type: "Participant", + isAttr: true, + isReference: true + }] +}, { + name: "TextAnnotation", + superClass: ["Artifact"], + properties: [{ + name: "text", + type: "String" + }, { + name: "textFormat", + "default": "text/plain", + isAttr: true, + type: "String" + }] +}, { + name: "Group", + superClass: ["Artifact"], + properties: [{ + name: "categoryValueRef", + type: "CategoryValue", + isAttr: true, + isReference: true + }] +}, { + name: "Association", + superClass: ["Artifact"], + properties: [{ + name: "associationDirection", + type: "AssociationDirection", + isAttr: true + }, { + name: "sourceRef", + type: "BaseElement", + isAttr: true, + isReference: true + }, { + name: "targetRef", + type: "BaseElement", + isAttr: true, + isReference: true + }] +}, { + name: "Category", + superClass: ["RootElement"], + properties: [{ + name: "categoryValue", + type: "CategoryValue", + isMany: true + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "Artifact", + isAbstract: true, + superClass: ["BaseElement"] +}, { + name: "CategoryValue", + superClass: ["BaseElement"], + properties: [{ + name: "categorizedFlowElements", + type: "FlowElement", + isMany: true, + isVirtual: true, + isReference: true + }, { + name: "value", + isAttr: true, + type: "String" + }] +}, { + name: "Activity", + isAbstract: true, + superClass: ["FlowNode"], + properties: [{ + name: "isForCompensation", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "default", + type: "SequenceFlow", + isAttr: true, + isReference: true + }, { + name: "ioSpecification", + type: "InputOutputSpecification", + xml: { + serialize: "property" + } + }, { + name: "boundaryEventRefs", + type: "BoundaryEvent", + isMany: true, + isReference: true + }, { + name: "properties", + type: "Property", + isMany: true + }, { + name: "dataInputAssociations", + type: "DataInputAssociation", + isMany: true + }, { + name: "dataOutputAssociations", + type: "DataOutputAssociation", + isMany: true + }, { + name: "startQuantity", + "default": 1, + isAttr: true, + type: "Integer" + }, { + name: "resources", + type: "ResourceRole", + isMany: true + }, { + name: "completionQuantity", + "default": 1, + isAttr: true, + type: "Integer" + }, { + name: "loopCharacteristics", + type: "LoopCharacteristics" + }] +}, { + name: "ServiceTask", + superClass: ["Task"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }, { + name: "operationRef", + type: "Operation", + isAttr: true, + isReference: true + }] +}, { + name: "SubProcess", + superClass: ["Activity", "FlowElementsContainer", "InteractionNode"], + properties: [{ + name: "triggeredByEvent", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "artifacts", + type: "Artifact", + isMany: true + }] +}, { + name: "LoopCharacteristics", + isAbstract: true, + superClass: ["BaseElement"] +}, { + name: "MultiInstanceLoopCharacteristics", + superClass: ["LoopCharacteristics"], + properties: [{ + name: "isSequential", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "behavior", + type: "MultiInstanceBehavior", + "default": "All", + isAttr: true + }, { + name: "loopCardinality", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "loopDataInputRef", + type: "ItemAwareElement", + isReference: true + }, { + name: "loopDataOutputRef", + type: "ItemAwareElement", + isReference: true + }, { + name: "inputDataItem", + type: "DataInput", + xml: { + serialize: "property" + } + }, { + name: "outputDataItem", + type: "DataOutput", + xml: { + serialize: "property" + } + }, { + name: "complexBehaviorDefinition", + type: "ComplexBehaviorDefinition", + isMany: true + }, { + name: "completionCondition", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "oneBehaviorEventRef", + type: "EventDefinition", + isAttr: true, + isReference: true + }, { + name: "noneBehaviorEventRef", + type: "EventDefinition", + isAttr: true, + isReference: true + }] +}, { + name: "StandardLoopCharacteristics", + superClass: ["LoopCharacteristics"], + properties: [{ + name: "testBefore", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "loopCondition", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "loopMaximum", + type: "Integer", + isAttr: true + }] +}, { + name: "CallActivity", + superClass: ["Activity", "InteractionNode"], + properties: [{ + name: "calledElement", + type: "String", + isAttr: true + }] +}, { + name: "Task", + superClass: ["Activity", "InteractionNode"] +}, { + name: "SendTask", + superClass: ["Task"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }, { + name: "operationRef", + type: "Operation", + isAttr: true, + isReference: true + }, { + name: "messageRef", + type: "Message", + isAttr: true, + isReference: true + }] +}, { + name: "ReceiveTask", + superClass: ["Task"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }, { + name: "instantiate", + "default": false, + isAttr: true, + type: "Boolean" + }, { + name: "operationRef", + type: "Operation", + isAttr: true, + isReference: true + }, { + name: "messageRef", + type: "Message", + isAttr: true, + isReference: true + }] +}, { + name: "ScriptTask", + superClass: ["Task"], + properties: [{ + name: "scriptFormat", + isAttr: true, + type: "String" + }, { + name: "script", + type: "String" + }] +}, { + name: "BusinessRuleTask", + superClass: ["Task"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }] +}, { + name: "AdHocSubProcess", + superClass: ["SubProcess"], + properties: [{ + name: "completionCondition", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "ordering", + type: "AdHocOrdering", + isAttr: true + }, { + name: "cancelRemainingInstances", + "default": true, + isAttr: true, + type: "Boolean" + }] +}, { + name: "Transaction", + superClass: ["SubProcess"], + properties: [{ + name: "protocol", + isAttr: true, + type: "String" + }, { + name: "method", + isAttr: true, + type: "String" + }] +}, { + name: "GlobalScriptTask", + superClass: ["GlobalTask"], + properties: [{ + name: "scriptLanguage", + isAttr: true, + type: "String" + }, { + name: "script", + isAttr: true, + type: "String" + }] +}, { + name: "GlobalBusinessRuleTask", + superClass: ["GlobalTask"], + properties: [{ + name: "implementation", + isAttr: true, + type: "String" + }] +}, { + name: "ComplexBehaviorDefinition", + superClass: ["BaseElement"], + properties: [{ + name: "condition", + type: "FormalExpression" + }, { + name: "event", + type: "ImplicitThrowEvent" + }] +}, { + name: "ResourceRole", + superClass: ["BaseElement"], + properties: [{ + name: "resourceRef", + type: "Resource", + isReference: true + }, { + name: "resourceParameterBindings", + type: "ResourceParameterBinding", + isMany: true + }, { + name: "resourceAssignmentExpression", + type: "ResourceAssignmentExpression" + }, { + name: "name", + isAttr: true, + type: "String" + }] +}, { + name: "ResourceParameterBinding", + properties: [{ + name: "expression", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }, { + name: "parameterRef", + type: "ResourceParameter", + isAttr: true, + isReference: true + }], + superClass: ["BaseElement"] +}, { + name: "ResourceAssignmentExpression", + properties: [{ + name: "expression", + type: "Expression", + xml: { + serialize: "xsi:type" + } + }], + superClass: ["BaseElement"] +}, { + name: "Import", + properties: [{ + name: "importType", + isAttr: true, + type: "String" + }, { + name: "location", + isAttr: true, + type: "String" + }, { + name: "namespace", + isAttr: true, + type: "String" + }] +}, { + name: "Definitions", + superClass: ["BaseElement"], + properties: [{ + name: "name", + isAttr: true, + type: "String" + }, { + name: "targetNamespace", + isAttr: true, + type: "String" + }, { + name: "expressionLanguage", + "default": "http://www.w3.org/1999/XPath", + isAttr: true, + type: "String" + }, { + name: "typeLanguage", + "default": "http://www.w3.org/2001/XMLSchema", + isAttr: true, + type: "String" + }, { + name: "imports", + type: "Import", + isMany: true + }, { + name: "extensions", + type: "Extension", + isMany: true + }, { + name: "rootElements", + type: "RootElement", + isMany: true + }, { + name: "diagrams", + isMany: true, + type: "bpmndi:BPMNDiagram" + }, { + name: "exporter", + isAttr: true, + type: "String" + }, { + name: "relationships", + type: "Relationship", + isMany: true + }, { + name: "exporterVersion", + isAttr: true, + type: "String" + }] +}]; +var enumerations$3 = [{ + name: "ProcessType", + literalValues: [{ + name: "None" + }, { + name: "Public" + }, { + name: "Private" + }] +}, { + name: "GatewayDirection", + literalValues: [{ + name: "Unspecified" + }, { + name: "Converging" + }, { + name: "Diverging" + }, { + name: "Mixed" + }] +}, { + name: "EventBasedGatewayType", + literalValues: [{ + name: "Parallel" + }, { + name: "Exclusive" + }] +}, { + name: "RelationshipDirection", + literalValues: [{ + name: "None" + }, { + name: "Forward" + }, { + name: "Backward" + }, { + name: "Both" + }] +}, { + name: "ItemKind", + literalValues: [{ + name: "Physical" + }, { + name: "Information" + }] +}, { + name: "ChoreographyLoopType", + literalValues: [{ + name: "None" + }, { + name: "Standard" + }, { + name: "MultiInstanceSequential" + }, { + name: "MultiInstanceParallel" + }] +}, { + name: "AssociationDirection", + literalValues: [{ + name: "None" + }, { + name: "One" + }, { + name: "Both" + }] +}, { + name: "MultiInstanceBehavior", + literalValues: [{ + name: "None" + }, { + name: "One" + }, { + name: "All" + }, { + name: "Complex" + }] +}, { + name: "AdHocOrdering", + literalValues: [{ + name: "Parallel" + }, { + name: "Sequential" + }] +}]; +var xml$1 = { + tagAlias: "lowerCase", + typePrefix: "t" +}; +var BpmnPackage = { + name: name$5, + uri: uri$5, + prefix: prefix$5, + associations: associations$5, + types: types$5, + enumerations: enumerations$3, + xml: xml$1 +}; +var name$4 = "BPMNDI"; +var uri$4 = "http://www.omg.org/spec/BPMN/20100524/DI"; +var prefix$4 = "bpmndi"; +var types$4 = [{ + name: "BPMNDiagram", + properties: [{ + name: "plane", + type: "BPMNPlane", + redefines: "di:Diagram#rootElement" + }, { + name: "labelStyle", + type: "BPMNLabelStyle", + isMany: true + }], + superClass: ["di:Diagram"] +}, { + name: "BPMNPlane", + properties: [{ + name: "bpmnElement", + isAttr: true, + isReference: true, + type: "bpmn:BaseElement", + redefines: "di:DiagramElement#modelElement" + }], + superClass: ["di:Plane"] +}, { + name: "BPMNShape", + properties: [{ + name: "bpmnElement", + isAttr: true, + isReference: true, + type: "bpmn:BaseElement", + redefines: "di:DiagramElement#modelElement" + }, { + name: "isHorizontal", + isAttr: true, + type: "Boolean" + }, { + name: "isExpanded", + isAttr: true, + type: "Boolean" + }, { + name: "isMarkerVisible", + isAttr: true, + type: "Boolean" + }, { + name: "label", + type: "BPMNLabel" + }, { + name: "isMessageVisible", + isAttr: true, + type: "Boolean" + }, { + name: "participantBandKind", + type: "ParticipantBandKind", + isAttr: true + }, { + name: "choreographyActivityShape", + type: "BPMNShape", + isAttr: true, + isReference: true + }], + superClass: ["di:LabeledShape"] +}, { + name: "BPMNEdge", + properties: [{ + name: "label", + type: "BPMNLabel" + }, { + name: "bpmnElement", + isAttr: true, + isReference: true, + type: "bpmn:BaseElement", + redefines: "di:DiagramElement#modelElement" + }, { + name: "sourceElement", + isAttr: true, + isReference: true, + type: "di:DiagramElement", + redefines: "di:Edge#source" + }, { + name: "targetElement", + isAttr: true, + isReference: true, + type: "di:DiagramElement", + redefines: "di:Edge#target" + }, { + name: "messageVisibleKind", + type: "MessageVisibleKind", + isAttr: true, + "default": "initiating" + }], + superClass: ["di:LabeledEdge"] +}, { + name: "BPMNLabel", + properties: [{ + name: "labelStyle", + type: "BPMNLabelStyle", + isAttr: true, + isReference: true, + redefines: "di:DiagramElement#style" + }], + superClass: ["di:Label"] +}, { + name: "BPMNLabelStyle", + properties: [{ + name: "font", + type: "dc:Font" + }], + superClass: ["di:Style"] +}]; +var enumerations$2 = [{ + name: "ParticipantBandKind", + literalValues: [{ + name: "top_initiating" + }, { + name: "middle_initiating" + }, { + name: "bottom_initiating" + }, { + name: "top_non_initiating" + }, { + name: "middle_non_initiating" + }, { + name: "bottom_non_initiating" + }] +}, { + name: "MessageVisibleKind", + literalValues: [{ + name: "initiating" + }, { + name: "non_initiating" + }] +}]; +var associations$4 = []; +var BpmnDiPackage = { + name: name$4, + uri: uri$4, + prefix: prefix$4, + types: types$4, + enumerations: enumerations$2, + associations: associations$4 +}; +var name$3 = "DC"; +var uri$3 = "http://www.omg.org/spec/DD/20100524/DC"; +var prefix$3 = "dc"; +var types$3 = [{ + name: "Boolean" +}, { + name: "Integer" +}, { + name: "Real" +}, { + name: "String" +}, { + name: "Font", + properties: [{ + name: "name", + type: "String", + isAttr: true + }, { + name: "size", + type: "Real", + isAttr: true + }, { + name: "isBold", + type: "Boolean", + isAttr: true + }, { + name: "isItalic", + type: "Boolean", + isAttr: true + }, { + name: "isUnderline", + type: "Boolean", + isAttr: true + }, { + name: "isStrikeThrough", + type: "Boolean", + isAttr: true + }] +}, { + name: "Point", + properties: [{ + name: "x", + type: "Real", + "default": "0", + isAttr: true + }, { + name: "y", + type: "Real", + "default": "0", + isAttr: true + }] +}, { + name: "Bounds", + properties: [{ + name: "x", + type: "Real", + "default": "0", + isAttr: true + }, { + name: "y", + type: "Real", + "default": "0", + isAttr: true + }, { + name: "width", + type: "Real", + isAttr: true + }, { + name: "height", + type: "Real", + isAttr: true + }] +}]; +var associations$3 = []; +var DcPackage = { + name: name$3, + uri: uri$3, + prefix: prefix$3, + types: types$3, + associations: associations$3 +}; +var name$2 = "DI"; +var uri$2 = "http://www.omg.org/spec/DD/20100524/DI"; +var prefix$2 = "di"; +var types$2 = [{ + name: "DiagramElement", + isAbstract: true, + properties: [{ + name: "id", + isAttr: true, + isId: true, + type: "String" + }, { + name: "extension", + type: "Extension" + }, { + name: "owningDiagram", + type: "Diagram", + isReadOnly: true, + isVirtual: true, + isReference: true + }, { + name: "owningElement", + type: "DiagramElement", + isReadOnly: true, + isVirtual: true, + isReference: true + }, { + name: "modelElement", + isReadOnly: true, + isVirtual: true, + isReference: true, + type: "Element" + }, { + name: "style", + type: "Style", + isReadOnly: true, + isVirtual: true, + isReference: true + }, { + name: "ownedElement", + type: "DiagramElement", + isReadOnly: true, + isMany: true, + isVirtual: true + }] +}, { + name: "Node", + isAbstract: true, + superClass: ["DiagramElement"] +}, { + name: "Edge", + isAbstract: true, + superClass: ["DiagramElement"], + properties: [{ + name: "source", + type: "DiagramElement", + isReadOnly: true, + isVirtual: true, + isReference: true + }, { + name: "target", + type: "DiagramElement", + isReadOnly: true, + isVirtual: true, + isReference: true + }, { + name: "waypoint", + isUnique: false, + isMany: true, + type: "dc:Point", + xml: { + serialize: "xsi:type" + } + }] +}, { + name: "Diagram", + isAbstract: true, + properties: [{ + name: "id", + isAttr: true, + isId: true, + type: "String" + }, { + name: "rootElement", + type: "DiagramElement", + isReadOnly: true, + isVirtual: true + }, { + name: "name", + isAttr: true, + type: "String" + }, { + name: "documentation", + isAttr: true, + type: "String" + }, { + name: "resolution", + isAttr: true, + type: "Real" + }, { + name: "ownedStyle", + type: "Style", + isReadOnly: true, + isMany: true, + isVirtual: true + }] +}, { + name: "Shape", + isAbstract: true, + superClass: ["Node"], + properties: [{ + name: "bounds", + type: "dc:Bounds" + }] +}, { + name: "Plane", + isAbstract: true, + superClass: ["Node"], + properties: [{ + name: "planeElement", + type: "DiagramElement", + subsettedProperty: "DiagramElement-ownedElement", + isMany: true + }] +}, { + name: "LabeledEdge", + isAbstract: true, + superClass: ["Edge"], + properties: [{ + name: "ownedLabel", + type: "Label", + isReadOnly: true, + subsettedProperty: "DiagramElement-ownedElement", + isMany: true, + isVirtual: true + }] +}, { + name: "LabeledShape", + isAbstract: true, + superClass: ["Shape"], + properties: [{ + name: "ownedLabel", + type: "Label", + isReadOnly: true, + subsettedProperty: "DiagramElement-ownedElement", + isMany: true, + isVirtual: true + }] +}, { + name: "Label", + isAbstract: true, + superClass: ["Node"], + properties: [{ + name: "bounds", + type: "dc:Bounds" + }] +}, { + name: "Style", + isAbstract: true, + properties: [{ + name: "id", + isAttr: true, + isId: true, + type: "String" + }] +}, { + name: "Extension", + properties: [{ + name: "values", + isMany: true, + type: "Element" + }] +}]; +var associations$2 = []; +var xml$2 = { + tagAlias: "lowerCase" +}; +var DiPackage = { + name: name$2, + uri: uri$2, + prefix: prefix$2, + types: types$2, + associations: associations$2, + xml: xml$2 +}; +var name$1 = "bpmn.io colors for BPMN"; +var uri$1 = "http://bpmn.io/schema/bpmn/biocolor/1.0"; +var prefix$1 = "bioc"; +var types$1 = [{ + name: "ColoredShape", + "extends": ["bpmndi:BPMNShape"], + properties: [{ + name: "stroke", + isAttr: true, + type: "String" + }, { + name: "fill", + isAttr: true, + type: "String" + }] +}, { + name: "ColoredEdge", + "extends": ["bpmndi:BPMNEdge"], + properties: [{ + name: "stroke", + isAttr: true, + type: "String" + }, { + name: "fill", + isAttr: true, + type: "String" + }] +}]; +var enumerations$1 = []; +var associations$1 = []; +var BiocPackage = { + name: name$1, + uri: uri$1, + prefix: prefix$1, + types: types$1, + enumerations: enumerations$1, + associations: associations$1 +}; +var name$6 = "BPMN in Color"; +var uri$6 = "http://www.omg.org/spec/BPMN/non-normative/color/1.0"; +var prefix$6 = "color"; +var types$6 = [{ + name: "ColoredLabel", + "extends": ["bpmndi:BPMNLabel"], + properties: [{ + name: "color", + isAttr: true, + type: "String" + }] +}, { + name: "ColoredShape", + "extends": ["bpmndi:BPMNShape"], + properties: [{ + name: "background-color", + isAttr: true, + type: "String" + }, { + name: "border-color", + isAttr: true, + type: "String" + }] +}, { + name: "ColoredEdge", + "extends": ["bpmndi:BPMNEdge"], + properties: [{ + name: "border-color", + isAttr: true, + type: "String" + }] +}]; +var enumerations = []; +var associations$6 = []; +var BpmnInColorPackage = { + name: name$6, + uri: uri$6, + prefix: prefix$6, + types: types$6, + enumerations: enumerations, + associations: associations$6 +}; +var packages = { + bpmn: BpmnPackage, + bpmndi: BpmnDiPackage, + dc: DcPackage, + di: DiPackage, + bioc: BiocPackage, + color: BpmnInColorPackage +}; +function simple(additionalPackages, options) { + var pks = (0,min_dash__WEBPACK_IMPORTED_MODULE_13__.assign)({}, packages, additionalPackages); + return new BpmnModdle(pks, options); +} + +var name = "zeebe"; +var prefix = "zeebe"; +var uri = "http://camunda.org/schema/zeebe/1.0"; +var xml = { + tagAlias: "lowerCase" +}; +var associations = [ +]; +var types = [ + { + name: "ZeebeServiceTask", + "extends": [ + "bpmn:ServiceTask", + "bpmn:BusinessRuleTask", + "bpmn:ScriptTask", + "bpmn:SendTask", + "bpmn:EndEvent", + "bpmn:IntermediateThrowEvent" + ], + properties: [ + { + name: "retryCounter", + type: "String", + isAttr: true + } + ] + }, + { + name: "IoMapping", + superClass: [ + "Element" + ], + properties: [ + { + name: "ioMapping", + type: "IoMapping" + }, + { + name: "inputParameters", + isMany: true, + type: "Input" + }, + { + name: "outputParameters", + isMany: true, + type: "Output" + } + ], + meta: { + allowedIn: [ + "bpmn:CallActivity", + "bpmn:Event", + "bpmn:ReceiveTask", + "zeebe:ZeebeServiceTask", + "bpmn:SubProcess", + "bpmn:UserTask" + ] + } + }, + { + name: "InputOutputParameter", + properties: [ + { + name: "source", + isAttr: true, + type: "String" + }, + { + name: "target", + isAttr: true, + type: "String" + } + ] + }, + { + name: "Subscription", + superClass: [ + "Element" + ], + properties: [ + { + name: "correlationKey", + isAttr: true, + type: "String" + } + ] + }, + { + name: "Input", + superClass: [ + "InputOutputParameter" + ], + meta: { + allowedIn: [ + "bpmn:CallActivity", + "zeebe:ZeebeServiceTask", + "bpmn:SubProcess", + "bpmn:UserTask" + ] + } + }, + { + name: "Output", + superClass: [ + "InputOutputParameter" + ], + meta: { + allowedIn: [ + "bpmn:CallActivity", + "bpmn:Event", + "bpmn:ReceiveTask", + "zeebe:ZeebeServiceTask", + "bpmn:SubProcess", + "bpmn:UserTask" + ] + } + }, + { + name: "TaskHeaders", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "zeebe:ZeebeServiceTask", + "bpmn:UserTask" + ] + }, + properties: [ + { + name: "values", + type: "Header", + isMany: true + } + ] + }, + { + name: "Header", + superClass: [ + "Element" + ], + properties: [ + { + name: "id", + type: "String", + isAttr: true + }, + { + name: "key", + type: "String", + isAttr: true + }, + { + name: "value", + type: "String", + isAttr: true + } + ] + }, + { + name: "TaskDefinition", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "zeebe:ZeebeServiceTask" + ] + }, + properties: [ + { + name: "type", + type: "String", + isAttr: true + }, + { + name: "retries", + type: "String", + isAttr: true + } + ] + }, + { + name: "LoopCharacteristics", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "zeebe:ZeebeServiceTask", + "bpmn:ReceiveTask", + "bpmn:SubProcess" + ] + }, + properties: [ + { + name: "inputCollection", + type: "String", + isAttr: true + }, + { + name: "inputElement", + type: "String", + isAttr: true + }, + { + name: "outputCollection", + type: "String", + isAttr: true + }, + { + name: "outputElement", + type: "String", + isAttr: true + } + ] + }, + { + name: "CalledElement", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:CallActivity" + ] + }, + properties: [ + { + name: "processId", + type: "String", + isAttr: true + }, + { + name: "processIdExpression", + type: "String", + isAttr: true + }, + { + name: "propagateAllChildVariables", + isAttr: true, + type: "Boolean" + }, + { + name: "propagateAllParentVariables", + isAttr: true, + type: "Boolean", + "default": true + } + ] + }, + { + name: "UserTaskForm", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:Process" + ] + }, + properties: [ + { + name: "id", + type: "String", + isAttr: true + }, + { + name: "body", + type: "String", + isBody: true + } + ] + }, + { + name: "FormDefinition", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:UserTask" + ] + }, + properties: [ + { + name: "formKey", + type: "String", + isAttr: true + }, + { + name: "formId", + type: "String", + isAttr: true + } + ] + }, + { + name: "CalledDecision", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:BusinessRuleTask" + ] + }, + properties: [ + { + name: "decisionId", + type: "String", + isAttr: true + }, + { + name: "resultVariable", + type: "String", + isAttr: true + } + ] + }, + { + name: "AssignmentDefinition", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:UserTask" + ] + }, + properties: [ + { + name: "assignee", + type: "String", + isAttr: true + }, + { + name: "candidateGroups", + type: "String", + isAttr: true + }, + { + name: "candidateUsers", + type: "String", + isAttr: true + } + ] + }, + { + name: "TaskSchedule", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:UserTask" + ] + }, + properties: [ + { + name: "dueDate", + type: "String", + isAttr: true + }, + { + name: "followUpDate", + type: "String", + isAttr: true + } + ] + }, + { + name: "Properties", + superClass: [ + "Element" + ], + properties: [ + { + name: "properties", + type: "Property", + isMany: true + } + ] + }, + { + name: "Property", + properties: [ + { + name: "name", + type: "String", + isAttr: true + }, + { + name: "value", + type: "String", + isAttr: true + } + ] + }, + { + name: "TemplateSupported", + isAbstract: true, + "extends": [ + "bpmn:Collaboration", + "bpmn:Process", + "bpmn:FlowElement" + ], + properties: [ + { + name: "modelerTemplate", + isAttr: true, + type: "String" + }, + { + name: "modelerTemplateVersion", + isAttr: true, + type: "Integer" + }, + { + name: "modelerTemplateIcon", + isAttr: true, + type: "String" + } + ] + }, + { + name: "TemplatedRootElement", + isAbstract: true, + "extends": [ + "bpmn:Error", + "bpmn:Escalation", + "bpmn:Message", + "bpmn:Signal" + ], + properties: [ + { + name: "modelerTemplate", + isAttr: true, + type: "String" + } + ] + }, + { + name: "Script", + superClass: [ + "Element" + ], + meta: { + allowedIn: [ + "bpmn:ScriptTask" + ] + }, + properties: [ + { + name: "expression", + type: "String", + isAttr: true + }, + { + name: "resultVariable", + type: "String", + isAttr: true + } + ] + } +]; +var zeebeModdle = { + name: name, + prefix: prefix, + uri: uri, + xml: xml, + associations: associations, + types: types +}; + +/** + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. + * + * Camunda licenses this file to you under the MIT; you may not use this file + * except in compliance with the MIT License. + */ - /** - * adds an empty option to the list - */ - function addEmptyParameter(list) { - return list.push({ 'label': '', 'value': '', 'name': '' }); - } +const elementTemplateLintRule = ({ + templates = [] +}) => { + const moddle = new simple({ + zeebe: zeebeModdle + }); + const validator = new Validator(moddle).addAll(templates); + const validTemplates = validator.getValidTemplates(); + + // We use the ElementTemplates Module without the required bpmn-js modules + // As we only use it to facilitate template ID and version lookup, + // access to commandstack etc. is not required + const elementTemplates = new ElementTemplates(); + elementTemplates.set(validTemplates); + function check(node, reporter) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_11__.is)(node, 'bpmn:FlowElement')) { + return; + } + let template = elementTemplates.get(node); + const templateId = elementTemplates._getTemplateId(node); + + // Handle missing template + if (templateId && !template) { + reporter.report(node.id, 'Linked element template not found', { + name: node.name + }); + return; + } + if (!template) { + return; + } + template = applyConditions(node, template); + + // Check attributes + template.properties.forEach(property => { + const value = getPropertyValue(node, property); + const error = validateProperty(value, property); + if (!error) { + return; + } + reporter.report(node.id, error, { + propertiesPanel: { + entryIds: [getEntryId(property, template)] + }, + name: node.name + }); + }); + } + return { + check + }; +}; +const ElementTemplateLinterPlugin = function (templates) { + return { + config: { + rules: { + 'element-templates/validate': ['error', { + templates + }] + } + }, + resolver: new (bpmnlint_lib_resolver_static_resolver__WEBPACK_IMPORTED_MODULE_10___default())({ + 'rule:bpmnlint-plugin-element-templates/validate': elementTemplateLintRule + }) + }; +}; + +// helpers ////////////////////// + +function getEntryId(property, template) { + const index = template.properties.filter(p => p.group === property.group).indexOf(property); + const path = ['custom-entry', template.id]; + if (property.group) { + path.push(property.group); + } + path.push(index); + return path.join('-'); +} + + +//# sourceMappingURL=index.esm.js.map + + +/***/ }), + +/***/ "../node_modules/bpmn-js-properties-panel/dist/index.esm.js": +/*!******************************************************************!*\ + !*** ../node_modules/bpmn-js-properties-panel/dist/index.esm.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BpmnPropertiesPanelModule: () => (/* binding */ index$3), +/* harmony export */ BpmnPropertiesProviderModule: () => (/* binding */ index$2), +/* harmony export */ CamundaPlatformPropertiesProviderModule: () => (/* binding */ index), +/* harmony export */ ZeebePropertiesProviderModule: () => (/* binding */ index$1), +/* harmony export */ ZeebeTooltipProvider: () => (/* binding */ TooltipProvider), +/* harmony export */ useService: () => (/* binding */ useService) +/* harmony export */ }); +/* harmony import */ var _bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact/hooks */ "../node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @bpmn-io/properties-panel */ "../node_modules/@bpmn-io/properties-panel/dist/index.esm.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact */ "../node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); +/* harmony import */ var bpmn_js_lib_features_label_editing_LabelUtil__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! bpmn-js/lib/features/label-editing/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! bpmn-js/lib/features/modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! bpmn-js/lib/util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact/compat */ "../node_modules/@bpmn-io/properties-panel/preact/compat/dist/compat.module.js"); +/* harmony import */ var _bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @bpmn-io/properties-panel/preact/jsx-runtime */ "../node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js"); +/* harmony import */ var diagram_js_lib_features_keyboard_KeyboardUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! diagram-js/lib/features/keyboard/KeyboardUtil */ "../node_modules/diagram-js/lib/features/keyboard/KeyboardUtil.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var ids__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ids */ "../node_modules/ids/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! diagram-js/lib/util/Collections */ "../node_modules/diagram-js/lib/util/Collections.js"); +/* harmony import */ var _bpmn_io_extract_process_variables_zeebe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @bpmn-io/extract-process-variables/zeebe */ "../node_modules/@bpmn-io/extract-process-variables/zeebe/index.js"); +/* harmony import */ var array_move__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! array-move */ "../node_modules/array-move/index.js"); +/* harmony import */ var _bpmn_io_extract_process_variables__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @bpmn-io/extract-process-variables */ "../node_modules/@bpmn-io/extract-process-variables/dist/index.js"); + + + + + + + + + + + + + + + + + + +const BpmnPropertiesPanelContext = (0,_bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_2__.createContext)({ + selectedElement: null, + injector: null, + getService() { + return null; + } +}); + +function useService(type, strict) { + const { + getService + } = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(BpmnPropertiesPanelContext); + return getService(type, strict); +} + +function _extends$1o() { _extends$1o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1o.apply(this, arguments); } +var AssociationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1o({ + width: "32", + height: "32", + xmlns: "http://www.w3.org/2000/svg" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + stroke: "#000", + strokeWidth: "2", + fill: "none", + strokeDasharray: "3.3,6", + strokeLinecap: "square", + d: "M1.5 30.5l29-29" +}))); + +function _extends$1n() { _extends$1n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1n.apply(this, arguments); } +var BusinessRuleTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1n({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zM5.296 7.398v12.665h16.87V7.398H5.296zm.718 4.386h15.433v3.44H9.985v-3.432h-.719v3.431H6.014v-3.44zm0 4.158h3.252v3.403H6.014v-3.403zm3.97 0h11.463v3.403H9.985v-3.403z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.079 8.209v3.587H21.44V8.209z" +}))); + +function _extends$1m() { _extends$1m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1m.apply(this, arguments); } +var CallActivityIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1m({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M24.978 3c3.761 0 6.89 2.979 7.018 6.695l.004.238V22.4c0 3.747-3.05 6.804-6.783 6.93l-.24.003H7.023c-3.761 0-6.89-2.978-7.018-6.695L0 22.4V9.933C0 6.187 3.05 3.13 6.783 3.004L7.023 3h17.955zm0 3.667H7.022c-1.842 0-3.255 1.344-3.35 3.079l-.005.187V22.4c0 1.761 1.35 3.167 3.16 3.262l.195.005L10 25.666V15h12v10.666h2.978c1.842 0 3.255-1.344 3.35-3.079l.005-.187V9.933c0-1.761-1.35-3.166-3.16-3.261l-.195-.005zm-3.732 9.087H10.754v9.912h10.491v-9.912zm-4.475 1.817v2.658h2.658v1.542H16.77v2.658H15.23V21.77H12.57V20.23h2.658V17.57h1.542z" +}))); + +function _extends$1l() { _extends$1l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1l.apply(this, arguments); } +var CollaborationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1l({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("g", { + fillRule: "evenodd" +}, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fillRule: "nonzero", + d: "M0 0v8.62h32V0H0zm1.655 7.054v-5.37h28.62v5.37H1.656zM0 23.38V32h32v-8.62H0zm1.655 7.054v-5.37h28.62v5.37H1.656z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M24 8l4 7h-8l4-7zm0 2l-2.28 4h4.56L24 10zM23.5 21h1v3h-1zM23.5 15h1v3h-1zM8 24l-4-7h8l-4 7zm0-2l2.28-4H5.72L8 22zM7.5 8h1v3h-1zM7.5 14h1v3h-1z" +})))); + +function _extends$1k() { _extends$1k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1k.apply(this, arguments); } +var ConditionalFlowIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1k({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M32 .041S20.42 5.95 14.537 8.713c1.26 1.15 2.432 2.392 3.648 3.588-5.703 5.78-3.15 3.303-8.087 8.316l-8.472 1.377L0 32l10.006-1.626.098-.598 1.279-7.873c4.975-5.052 2.403-2.555 8.118-8.346 1.218 1.214 2.43 2.435 3.648 3.648C26.29 11.018 32 .041 32 .041zM9.603 22.397L8.54 28.91 2.03 29.97l1.061-6.515 6.512-1.058z" +}))); + +function _extends$1j() { _extends$1j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1j.apply(this, arguments); } +var ConnectionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1j({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M32 .06S20.33 6.014 14.403 8.798c1.27 1.16 2.451 2.41 3.676 3.616L0 30.734 1.325 32l18.08-18.32c1.227 1.223 2.448 2.453 3.676 3.676C26.247 11.12 32 .06 32 .06z" +}))); + +function _extends$1i() { _extends$1i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1i.apply(this, arguments); } +var DataInputOutputAssociationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1i({ + width: "32", + height: "32", + xmlns: "http://www.w3.org/2000/svg" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + stroke: "#000", + strokeWidth: "2", + strokeLinecap: "round", + strokeDasharray: "1.1,4.3", + d: "M1.5 30.5L27 5" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M31.803.197L26.5 16.107l-1.52-1.52 3.783-11.35-11.35 3.783-1.52-1.52z" +}))); + +function _extends$1h() { _extends$1h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1h.apply(this, arguments); } +var DataInputIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1h({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M20.833 0H3.488v32H28V7.36L20.833 0zm-2.105 1.818v7.507h7.454v20.857H5.306V1.818h13.422zm1.818.493l5.06 5.196h-5.06V2.311zm-9.182.86v3.744H7.081v3.222h4.283v3.743l5.7-5.354-5.7-5.354zm.808 1.868l3.711 3.487-3.71 3.487V9.329H7.888V7.723h4.283V5.039z" +}))); + +function _extends$1g() { _extends$1g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1g.apply(this, arguments); } +var DataObjectIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1g({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M21.345 0H4v32h24.512V7.36L21.345 0zM19.24 1.818v7.507h7.454v20.857H5.818V1.818H19.24zm1.818.493l5.06 5.196h-5.06V2.311z" +}))); + +function _extends$1f() { _extends$1f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1f.apply(this, arguments); } +var DataOutputIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1f({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M20.833 0H3.488v32H28V7.36L20.833 0zm-2.105 1.818v7.507h7.454v20.857H5.306V1.818h13.422zm1.818.493l5.06 5.196h-5.06V2.311zm-9.182.86v3.744H7.081v3.222h4.283v3.743l5.7-5.354-5.7-5.354z" +}))); + +function _extends$1e() { _extends$1e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1e.apply(this, arguments); } +var DataStoreIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1e({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.008 1c-3.712 0-7.417.306-10.319.939-1.45.316-2.7.71-3.68 1.226C1.065 3.662.297 4.304.061 5.23a.823.823 0 00-.035.15L0 5.502l.017.084c-.012 7.41 0 14.46 0 22.08l.017.082c.203.985.995 1.656 1.975 2.172.98.517 2.23.91 3.68 1.226 2.902.633 6.607.94 10.319.94 3.711 0 7.416-.307 10.318-.94 1.451-.316 2.701-.71 3.68-1.226.98-.516 1.772-1.187 1.975-2.172l.017-.082V5.541a.825.825 0 000-.106v-.016l-.002-.013a.823.823 0 00-.046-.197c-.244-.916-1.007-1.55-1.943-2.044-.98-.516-2.23-.91-3.68-1.226C23.423 1.306 19.718 1 16.006 1zm0 1.646c3.62 0 7.245.308 9.968.901 1.36.297 2.497.67 3.263 1.074.612.323.932.643 1.063.882-.131.24-.451.56-1.063.882-.766.404-1.902.777-3.263 1.074-2.723.594-6.349.901-9.968.901-3.62 0-7.245-.307-9.968-.901-1.361-.297-2.497-.67-3.264-1.074-.611-.322-.931-.642-1.062-.882.13-.24.451-.56 1.062-.882.767-.403 1.903-.777 3.264-1.074 2.723-.593 6.348-.9 9.968-.9zM1.664 7.647c.112.067.227.132.345.194.98.517 2.23.91 3.68 1.226 2.902.633 6.607.94 10.319.94 3.711 0 7.416-.307 10.318-.94 1.451-.316 2.701-.71 3.68-1.226.119-.062.234-.127.346-.194v1.93c-.08.245-.398.619-1.113.995-.766.404-1.902.777-3.263 1.074-2.723.594-6.349.901-9.968.901-3.62 0-7.245-.307-9.968-.9-1.361-.298-2.497-.671-3.264-1.075-.714-.376-1.032-.75-1.112-.995v-1.93zm0 4.187c.112.067.227.132.345.195.98.516 2.23.91 3.68 1.226 2.902.632 6.607.938 10.319.938 3.711 0 7.416-.306 10.318-.938 1.451-.317 2.701-.71 3.68-1.226.119-.063.234-.128.346-.195v1.93c-.08.245-.398.619-1.113.995-.766.404-1.902.777-3.263 1.074-2.723.594-6.349.901-9.968.901-3.62 0-7.245-.307-9.968-.9-1.361-.298-2.497-.67-3.264-1.075-.714-.376-1.032-.75-1.112-.995v-1.93zm0 4.188c.112.067.227.131.345.194.98.516 2.23.91 3.68 1.226 2.902.633 6.607.939 10.319.939 3.711 0 7.416-.306 10.318-.94 1.451-.316 2.701-.709 3.68-1.225.119-.063.234-.127.346-.194V27.47c-.08.245-.398.618-1.113.995-.766.404-1.902.777-3.263 1.074-2.723.594-6.349.9-9.968.9-3.62 0-7.245-.306-9.968-.9-1.361-.297-2.497-.67-3.264-1.074-.714-.377-1.032-.75-1.112-.995V16.022z" +}))); + +function _extends$1d() { _extends$1d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1d.apply(this, arguments); } +var DefaultFlowIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1d({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M32 .06S20.33 6.014 14.403 8.798c1.27 1.16 2.451 2.41 3.676 3.616L6.84 23.804H.046v1.755h5.063L0 30.735 1.325 32l6.357-6.441h7.145v-1.756H9.414l9.99-10.123c1.228 1.223 2.45 2.453 3.677 3.676C26.247 11.12 32 .06 32 .06z" +}))); + +function _extends$1c() { _extends$1c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1c.apply(this, arguments); } +var EndEventCancelIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1c({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm-3.955 3.918L8.94 12.072l3.985 3.985-3.913 3.913 3.048 3.047 3.913-3.913 3.987 3.987 3.096-3.096-3.987-3.987 3.913-3.913-3.047-3.048-3.913 3.913-3.985-3.985z" +}))); + +function _extends$1b() { _extends$1b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1b.apply(this, arguments); } +var EndEventCompensationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1b({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm-.56 5.744l-7.407 5.23 7.408 5.234v-5.057c2.384 1.687 4.771 3.371 7.157 5.057V10.801l-7.157 5.054v-5.054z" +}))); + +function _extends$1a() { _extends$1a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1a.apply(this, arguments); } +var EndEventErrorIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1a({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm6.132 4.166l-3.633 7.363-4.516-5.874-4.102 12.131 4.599-5.91 4.743 5.427 2.909-13.137z" +}))); + +function _extends$19() { _extends$19 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$19.apply(this, arguments); } +var EndEventEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$19({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm.006 3.9c-1.672 4.653-2.733 9.5-4.406 14.153 1.535-1.525 2.872-3.234 4.406-4.759l4.406 4.76c-1.497-4.71-2.91-9.445-4.406-14.155z" +}))); + +function _extends$18() { _extends$18 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$18.apply(this, arguments); } +var EndEventLinkIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$18({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676 0C7.943.007.834 6.45.104 14.16c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 4.958 23.394.313 16.978.032A18.532 18.532 0 0015.676 0zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm1.78 4.065v3.555H9.779v6.713h7.994v3.554l5.828-6.91-5.828-6.912z" +}))); + +function _extends$17() { _extends$17 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$17.apply(this, arguments); } +var EndEventMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$17({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676 0C7.943.007.834 6.45.104 14.16c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 4.958 23.394.313 16.978.032A18.532 18.532 0 0015.676 0zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm-5.91 5.448l6.041 4.9 6.04-4.9H10.084zm-1.34 1.137v9.92h14.513v-9.718l-7.132 5.786-7.381-5.988z" +}))); + +function _extends$16() { _extends$16 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$16.apply(this, arguments); } +var EndEventMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$16({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676 0C7.943.007.834 6.45.104 14.16c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 4.958 23.394.313 16.978.032A18.529 18.529 0 0015.676 0zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm.011 3.039l-7.619 5.53 2.91 8.95h9.418l2.91-8.95-7.619-5.53z" +}))); + +function _extends$15() { _extends$15 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$15.apply(this, arguments); } +var EndEventNoneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$15({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.84.042C8.654-.01 1.913 5.437.4 12.454-1.057 18.62 1.554 25.495 6.784 29.09c5.076 3.636 12.31 3.92 17.59.544 5.309-3.251 8.435-9.744 7.445-15.921C30.91 7.307 25.795 1.738 19.442.422a16.064 16.064 0 00-3.602-.38zm.382 5.01c5.28-.017 10.13 4.353 10.669 9.61.687 5.025-2.552 10.281-7.423 11.792-4.754 1.617-10.486-.447-12.962-4.856-2.74-4.575-1.574-11.094 2.768-14.27a11.05 11.05 0 016.948-2.276z" +}))); + +function _extends$14() { _extends$14 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$14.apply(this, arguments); } +var EndEventSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$14({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm.006 3.492c-2.261 4.07-4.532 8.136-6.797 12.204h13.595L15.999 8.55z" +}))); + +function _extends$13() { _extends$13 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$13.apply(this, arguments); } +var EndEventTerminateIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$13({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.676.051C7.943.058.834 6.501.104 14.21c-.783 6.565 2.912 13.427 8.942 16.216 5.6 2.737 12.789 1.87 17.434-2.344 4.725-4.09 6.79-11.06 4.714-17.006C29.22 5.009 23.394.364 16.978.083A18.532 18.532 0 0015.676.05zm.317 5.006c5.695-.165 10.916 4.858 10.983 10.555.246 5.212-3.67 10.33-8.864 11.204-5.026 1.007-10.6-1.898-12.36-6.777-1.894-4.826.039-10.928 4.649-13.46a11.082 11.082 0 015.592-1.522zm.006 2.859c-5.264-.2-9.495 5.551-7.755 10.516 1.366 5.085 8.108 7.436 12.339 4.301 4.455-2.807 4.708-9.943.462-13.058A8.128 8.128 0 0016 7.915z" +}))); + +function _extends$12() { _extends$12 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$12.apply(this, arguments); } +var EventSubProcessExpandedIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$12({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M7.295 4.78h1.779V3.003h-1.78V4.78zm3.558 0h1.779V3.003h-1.78V4.78zm3.557 0h1.78V3.003h-1.78V4.78zm3.558 0h1.78V3.003h-1.78V4.78zm3.558 0h1.779V3.003h-1.779V4.78zm3.558 0c.55.014 1.106-.034 1.654.045l.245-1.762c-.629-.096-1.266-.05-1.9-.061V4.78zM5.732 3.004a5.933 5.933 0 00-.915.093c.111.582.226 1.164.315 1.75.358-.101.947.098.746-.483-.096-.382.164-1.208-.146-1.36zm22.372 2.281c.427.234.812.547 1.13.915.42-.4 1.002-.777 1.33-1.18a5.863 5.863 0 00-1.593-1.289l-.867 1.554zm-25.27-1.44c-.587.354-1.11.811-1.539 1.345.47.333.96.86 1.417 1.077.299-.362.66-.673 1.065-.913-.328-.493-.55-1.055-.944-1.509zM30.515 7.26c-.563.046-.557.342-.378.784.154.25-.097.862.25.85.525-.023 1.14.043 1.612-.032a5.891 5.891 0 00-.362-2.027l-1.122.425zM.268 7.114A6.042 6.042 0 000 9.052h1.78c-.013-.5.047-1.003.208-1.478L.296 7.027l-.026.079-.002.008zM30.22 12.45H32v-1.779h-1.779v1.779zm-30.22.16h1.78v-1.779H0v1.78zm30.22 3.398H32v-1.78h-1.779v1.78zm-30.22.16h1.78v-1.779H0v1.779zm30.22 3.398H32v-1.78h-1.779v1.78zm-30.22.16h1.78v-1.78H0v1.78zm30.22 3.397H32v-1.779h-1.779v1.78zm-30.22.16h1.78v-1.778H0v1.778zm30.137 1.47a4.059 4.059 0 01-.522 1.32c.506.283 1.046.715 1.53.908a5.836 5.836 0 00.744-1.918c-.576-.094-1.209-.264-1.752-.31zm-29.984.51c.157.676.435 1.325.82 1.904l1.486-.977a4.065 4.065 0 01-.577-1.347l-1.73.42zm28.427 1.943c-.371.277-.79.49-1.234.627l.548 1.693a5.84 5.84 0 001.835-.96l-1.082-1.412-.066.05-.001.002zm-26.164 1.47c.567.413 1.21.722 1.886.907.14-.569.343-1.175.444-1.722a4.062 4.062 0 01-1.283-.624l-1.047 1.438zm3.88 1.119h1.779v-1.78h-1.78v1.78zm3.55 0h1.787v-1.78H9.846v1.78zm3.565 0h1.78v-1.78h-1.78v1.78zm3.558 0h1.78v-1.78h-1.78v1.78zm3.451 0h1.743v-1.78h-1.743v1.78zm3.665 0h1.779v-1.78h-1.78v1.78zm-1.922-.545V16.776H9.846V29.25h12.318zM10.967 17.905h10.068V27.97H10.967V17.905zm1.336 3.998v1.711h7.396v-1.711h-7.396z", + opacity: ".97" +}))); + +function _extends$11() { _extends$11 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$11.apply(this, arguments); } +var GatewayComplexIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$11({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.001 0a1.29 1.29 0 00-.917.373L.373 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.917.372A1.294 1.294 0 0016.002 0zM16 2.181l13.821 13.821L16 29.823 2.179 16.003 16 2.18zm-.327 6.79v.007l-.145.027-.118.08-.083.123-.028.145v4.954L11.793 10.8l-.125-.08-.14-.029-.144.027-.122.082-.46.46-.085.125-.026.142.028.14.08.125 3.505 3.505H9.347l-.001-.002-.145.032-.118.08-.083.122-.028.146v.652l.029.147.082.119.12.08.144.032h4.956L10.8 20.207v-.001l-.084.124-.026.142.028.14.08.124.46.461.126.082.14.029.143-.027.124-.084L15.3 17.69v4.964-.001l.028.147.082.12.12.08.144.031h.652l.148-.03.118-.08.083-.12.028-.146v-4.962l3.505 3.505.126.082.14.027.142-.027.124-.084.461-.46.083-.123s.028-.144.027-.146l-.028-.14-.082-.126-3.496-3.496h4.948l.148-.03.119-.08.082-.12.028-.147v-.652l-.028-.145-.083-.122-.119-.08s-.147-.033-.147-.031h-4.964l3.512-3.512.082-.122.029-.144-.028-.14-.084-.124-.46-.461-.123-.082-.14-.027-.145.027-.122.082-3.507 3.507V9.348l-.028-.146-.082-.122-.12-.08-.147-.029h-.652z" +}))); + +function _extends$10() { _extends$10 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$10.apply(this, arguments); } +var GatewayEventBasedIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$10({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16 0a1.29 1.29 0 00-.918.373L.371 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.915.372A1.294 1.294 0 0016 0zm-.002 2.181l13.821 13.821-13.821 13.821-13.821-13.82L15.998 2.18zm0 5.876l-.254.185-7.377 5.355 2.915 8.964h9.433l2.915-8.964-7.631-5.54zm0 1.07l6.614 4.8-2.526 7.769h-8.175l-2.526-7.768 6.614-4.802z" +}))); + +function _extends$$() { _extends$$ = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$$.apply(this, arguments); } +var GatewayNoneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$$({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M.373 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.917.373a1.313 1.313 0 00-1.833 0L.373 15.084zm1.806.918L16 2.182l13.821 13.82L16 29.823 2.179 16.003z" +}))); + +function _extends$_() { _extends$_ = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$_.apply(this, arguments); } +var GatewayOrIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$_({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.001 0a1.29 1.29 0 00-.917.373L.373 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.917.372A1.294 1.294 0 0016.002 0zM16 2.181l13.821 13.821L16 29.823 2.179 16.003 16 2.18zm0 6.379a7.447 7.447 0 00-7.44 7.441A7.447 7.447 0 0016 23.443 7.447 7.447 0 0023.443 16a7.447 7.447 0 00-7.441-7.441zm0 .825a6.61 6.61 0 016.617 6.616A6.61 6.61 0 0116 22.618 6.61 6.61 0 019.385 16 6.61 6.61 0 0116 9.385z" +}))); + +function _extends$Z() { _extends$Z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Z.apply(this, arguments); } +var GatewayParallelIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$Z({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.001 0a1.29 1.29 0 00-.917.373L.373 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.917.372A1.294 1.294 0 0016.002 0zM16 2.181l13.821 13.821L16 29.823 2.179 16.003 16 2.18zm-.377 5.708l-.168.032-.136.092-.096.14-.032.168v6.868h-6.87l-.002-.002-.166.037-.137.092v-.002l-.095.141-.033.167v.753s.032.169.034.17l.094.138.138.092.167.036h6.87v6.867l-.001-.001.033.17.095.138.138.092s.166.035.167.037h.752l.17-.036.137-.092.095-.137.033-.17v-6.867h6.868l.17-.035.137-.092.095-.137.033-.17v-.753s-.033-.165-.032-.167l-.096-.14-.138-.093s-.17-.037-.17-.035H16.81V8.323l-.033-.168-.094-.14-.138-.092-.17-.034h-.752z" +}))); + +function _extends$Y() { _extends$Y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Y.apply(this, arguments); } +var GatewayXorIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$Y({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16 0a1.29 1.29 0 00-.918.373L.371 15.084a1.316 1.316 0 00.002 1.834l14.71 14.709a1.313 1.313 0 001.833 0l14.711-14.711a1.316 1.316 0 00-.002-1.834L16.915.372A1.294 1.294 0 0016 0zm-.002 2.181l13.821 13.821-13.821 13.821-13.821-13.82L15.998 2.18zm-5.162 7.69l-.166.032-.141.096-.532.532s-.097.142-.097.144l-.03.164.032.162.093.144 4.857 4.858-4.855 4.855v-.001L9.9 21l-.03.164.032.162s.093.142.093.144l.531.532.146.095.162.032.164-.03.144-.097 4.855-4.856 4.857 4.857.145.095.162.032.164-.03.144-.097.531-.532.095-.14.033-.168-.033-.162-.095-.146L17.144 16 22 11.144l.095-.14.033-.166-.033-.163-.097-.144-.532-.532-.14-.095-.163-.032-.166.032-.141.095L16 14.855l-4.858-4.858v-.002l-.144-.092-.162-.032z" +}))); + +function _extends$X() { _extends$X = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$X.apply(this, arguments); } +var GroupIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$X({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.34.016c-2.333.025-4.684 1.77-5.29 4.17C.608 5.848.88 7.608.804 9.314v2.922h2.041c.038-2.332-.076-4.673.062-7C3.14 3.355 4.869 1.938 6.643 2.04h8.956V.009c-3.086 0-6.173-.02-9.258 0v.007zm13.094 2.023h1.92V.009h-1.92v2.03zm5.756 0c1.265-.069 2.66.045 3.602 1.055 1.036.983 1.201 2.523 1.122 3.91v6.313h2.078c-.03-2.677.062-5.36-.047-8.032-.17-2.743-2.62-5.111-5.215-5.236-.511-.064-1.027-.02-1.54-.033v2.023zM.803 18.319h2.041v-2.026H.804v2.026zm29.11 1.084h2.08v-2.03h-2.08v2.03zM.804 26.148c.004 2.218 1.393 4.366 3.313 5.28 1.728.853 3.681.448 5.521.544.43-.112 1.29.231 1.435-.183v-1.847c-1.788-.043-3.584.094-5.365-.082-1.67-.354-2.919-2.048-2.863-3.844v-3.644H.804v3.777zm29.11-.068c.04 1.961-1.508 3.787-3.381 3.842-1.954.06-3.914.02-5.87.026v2.03c2.118-.042 4.242.08 6.355-.063 2.524-.264 4.818-2.644 4.94-5.323.08-1.039.014-2.085.035-3.126h-2.078v2.613zm-15.006 5.898h1.92v-2.03h-1.92v2.03z" +}))); + +function _extends$W() { _extends$W = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$W.apply(this, arguments); } +var IntermediateEventCatchCancelIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$W({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.111.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.454 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.215-2.282-2.022-5.3-3.217-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.082 11.082 0 0116 5.021zm-3.956 3.946l-3.096 3.097 3.985 3.985-3.913 3.913 3.047 3.048 3.913-3.913 3.988 3.987 3.097-3.096L19.076 16l3.914-3.913-3.048-3.048-3.913 3.913-3.986-3.985zm-.002 1.222l3.988 3.987 3.913-3.913 1.826 1.826-3.913 3.913 3.985 3.986-1.873 1.873-3.985-3.985-3.913 3.913-1.827-1.827 3.914-3.913-3.988-3.987 1.873-1.873z" +}))); + +function _extends$V() { _extends$V = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$V.apply(this, arguments); } +var IntermediateEventCatchCompensationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$V({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm-.56 5.772l-7.408 5.231 7.409 5.234v-5.057c2.385 1.687 4.771 3.371 7.157 5.057V10.793l-7.157 5.055v-5.055zm-.865 1.665v7.125l-5.048-3.562 5.048-3.563zm7.161 0v7.132l-5.048-3.566 5.048-3.566z" +}))); + +function _extends$U() { _extends$U = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$U.apply(this, arguments); } +var IntermediateEventCatchConditionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$U({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.97.04h-.127C8.713-.018 2.003 5.334.437 12.286c-1.51 6.123.98 13.005 6.136 16.665 5.125 3.788 12.546 4.105 17.912.623 5.272-3.276 8.33-9.766 7.325-15.916-.904-6.241-5.79-11.7-11.95-13.143A16.082 16.082 0 0015.97.04zm-.181 1.724c.115 0 .23 0 .347.003 6.625-.066 12.823 5.149 13.89 11.69 1.13 5.91-1.908 12.349-7.262 15.138-5.473 3.013-12.866 1.884-17.116-2.726C1.291 21.372.444 13.914 3.802 8.602c2.493-4.112 7.169-6.819 11.987-6.838zm.283 1.554c-.117 0-.234.002-.351.005-6.1 0-11.691 5.049-12.346 11.114-.78 5.684 2.795 11.612 8.218 13.52 5.139 1.943 11.416.101 14.624-4.38 3.461-4.583 3.262-11.538-.596-15.831-2.36-2.747-5.924-4.423-9.549-4.428zm-.078 1.695c.078 0 .156 0 .234.003 5.4 0 10.321 4.556 10.734 9.942.563 5.13-2.958 10.364-7.971 11.678-4.832 1.41-10.457-.935-12.746-5.446-2.463-4.559-1.2-10.795 3.014-13.883a11.072 11.072 0 016.735-2.294zm-5.352 4.266V22.761h10.716V9.279H10.642zm.863.866h8.987v11.75h-8.987v-11.75zm.927 1.323v.862h7.133v-.862h-7.133zm0 2.602v.866h7.133v-.866h-7.133zm0 3.008v.862h7.133v-.862h-7.133zm0 2.717v.863h7.133v-.863h-7.133z" +}))); + +function _extends$T() { _extends$T = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$T.apply(this, arguments); } +var IntermediateEventCatchErrorIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$T({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm6.132 4.194c-1.21 2.455-2.422 4.91-3.633 7.364l-4.516-5.875-4.103 12.133 4.6-5.912c1.58 1.81 3.162 3.619 4.744 5.429L22.13 9.215zM14.383 13.1l4.295 5.445 1.073-2.387-1.027 4.131-4.384-5.157-1.778 2.75 1.821-4.782z" +}))); + +function _extends$S() { _extends$S = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$S.apply(this, arguments); } +var IntermediateEventCatchEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$S({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm.006 3.927c-1.672 4.654-2.734 9.502-4.406 14.155 1.534-1.525 2.872-3.234 4.406-4.759l4.406 4.76c-1.496-4.71-2.91-9.446-4.406-14.156zm.032 2.929c.822 2.586 1.598 5.186 2.42 7.771l-2.42-2.612c-.682.597-2.452 2.884-2.338 2.388.87-2.487 1.447-5.067 2.338-7.547z" +}))); + +function _extends$R() { _extends$R = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$R.apply(this, arguments); } +var IntermediateEventCatchLinkIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$R({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm1.78 4.093v3.555H9.785v6.714h7.994v3.554l5.829-6.911-5.83-6.912zm.974 2.584l3.61 4.295-3.61 4.294v-1.933h-7.88v-4.688h7.88v-1.968z" +}))); + +function _extends$Q() { _extends$Q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Q.apply(this, arguments); } +var IntermediateEventCatchMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$Q({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm-7.245 5.475v11.06h14.502v-11.06H8.754zm3.222 1.728h8.057c-1.427.878-2.854 2.806-4.281 3.016l-3.776-3.016zm9.554 1.017v6.587H10.48V13.24l5.524 4.414 5.526-4.414z" +}))); + +function _extends$P() { _extends$P = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$P.apply(this, arguments); } +var IntermediateEventCatchMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$P({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.156.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.407 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 4.975zm.006 3.073l-7.62 5.531 2.91 8.95h9.42l2.91-8.95-7.62-5.53zm0 1.067l6.604 4.794-2.523 7.757h-8.162l-2.522-7.757 6.603-4.794z" +}))); + +function _extends$O() { _extends$O = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$O.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingConditionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$O({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M10.638 9.563V23.056h10.724V9.563H10.638zm.863.866h8.995v11.76H11.5V10.43zm.928 1.324v.862h7.139v-.862h-7.14zm0 2.605v.866h7.139v-.866h-7.14zm0 3.01v.863h7.139v-.863h-7.14zm0 2.72v.863h7.139v-.864h-7.14zM15.999.308h-.004l-.188.001h-.011l-.188.004h-.011L15.41.32h-.011l-.187.008h-.005L15.2.33l-.187.01h-.005l-.005.001-.187.013h-.011L14.62.37h-.01l-.186.018h-.011l-.185.02-.005.001h-.006l-.185.022-.005.001h-.005l-.185.025h-.005l-.005.001-.185.027h-.005l-.005.001-.184.029h-.005l-.005.001-.183.031-.006.001-.005.001-.182.033-.006.001-.005.001-.182.035-.005.001-.005.001-.182.038h-.005l-.005.002-.181.04h-.005l-.005.002-.18.042-.006.001-.005.001-.18.044-.005.002h-.005l-.17.045-.152.054-.139.082-.121.106-.1.127-.074.143-.046.155-.017.16.013.16.043.156.07.145.097.13.119.108.137.085.15.058.159.03.16-.001.133-.023.165-.043.168-.041.171-.04.171-.037.172-.036.17-.033.173-.03.17-.03.177-.027.171-.025.175-.022.175-.02.175-.02.176-.016.175-.014.177-.012.176-.01.177-.007.174-.006.177-.003.178-.001h.177l.178.004.174.006.177.007.176.01.177.012.175.014.176.017.175.018.175.02.175.023.171.025.176.027.17.03.174.03.17.033.171.036.154.033.16.02.161-.01.156-.04.146-.069.131-.094.111-.117.087-.135.061-.15.032-.158.002-.16-.027-.16-.057-.15L20 1.023l-.108-.12-.128-.097-.145-.073-.128-.038-.158-.035-.005-.001-.005-.001L19.14.62h-.005l-.005-.002-.182-.035h-.006L18.938.58l-.182-.033h-.006l-.005-.002-.183-.03-.005-.001-.006-.001-.183-.029h-.005l-.006-.001-.184-.027h-.005l-.005-.001-.185-.024h-.005L17.968.43 17.783.41l-.006-.001h-.005l-.185-.02h-.006l-.005-.001L17.39.37h-.005L17.38.368l-.187-.015h-.005l-.005-.001-.187-.013h-.011L16.8.328h-.011L16.6.32h-.011l-.187-.006h-.011L16.204.31h-.011L16.005.31H16zm9.016 2.935l-.16.004-.158.033-.15.062-.134.09-.116.111-.093.132-.067.147-.038.156-.01.161.022.16.05.153.078.141.103.124.102.087.045.034.142.106.137.105.14.11.136.11.135.112.134.115.134.117.13.115.132.122.128.12.127.122.126.125.124.126.124.128.121.13.118.128.118.132.117.133.113.134.113.136.11.136.109.137.109.142.104.14.103.14.101.142.1.144.099.146.095.145.094.147.093.15.092.15.087.149.087.15.084.152.084.155.08.152.08.155.04.081.084.138.11.119.128.096.145.072.155.043.16.013.16-.016.155-.046.144-.074.127-.099.106-.12.083-.14.055-.151.026-.16-.004-.16-.034-.158-.05-.124-.042-.085-.002-.004-.003-.005-.084-.165-.002-.004-.003-.005-.086-.164-.002-.004-.003-.005-.088-.162-.002-.005-.003-.005-.09-.161-.002-.005-.003-.004-.092-.16-.003-.005-.002-.005-.094-.16-.003-.004-.003-.004-.096-.159-.002-.004-.003-.005-.098-.157-.003-.004-.003-.005-.1-.156-.003-.004-.003-.005-.101-.154-.003-.005-.003-.004-.104-.154-.003-.004-.003-.005-.106-.152-.003-.005-.003-.004-.108-.151-.003-.004-.003-.005-.11-.15-.003-.004-.003-.004-.111-.15-.004-.003-.003-.005-.113-.147-.004-.004-.003-.005-.115-.146-.004-.004-.003-.004-.117-.145-.004-.004-.003-.004-.12-.144-.003-.004-.003-.004-.121-.142-.004-.004-.003-.004-.123-.141-.003-.004-.004-.004-.125-.14-.003-.004-.004-.004-.127-.138-.003-.004-.004-.004-.128-.136-.004-.004-.004-.004-.13-.135-.004-.004-.004-.004-.132-.134-.003-.004-.004-.003-.134-.133-.004-.003-.004-.004-.135-.13-.004-.004-.004-.004-.136-.128-.004-.004-.004-.004-.138-.126-.004-.004-.004-.003-.14-.125-.004-.004-.004-.003-.14-.123-.005-.004-.004-.003-.142-.121-.004-.004-.004-.003-.144-.12-.004-.003-.004-.003-.145-.117-.004-.004-.004-.003-.147-.115-.004-.004-.004-.003-.148-.113-.004-.003-.004-.004-.149-.111-.004-.003-.004-.004-.05-.036-.14-.083-.15-.055-.16-.027zm-18.381.344l-.161.008-.157.037-.147.066-.111.074-.04.032-.005.003-.004.004-.145.117-.004.003-.004.004-.144.119-.004.003-.004.004-.142.12-.004.004-.004.004-.141.123-.004.003-.004.004-.14.125-.004.003-.004.004-.138.126-.004.004-.004.004-.136.128-.004.004-.004.004-.135.13-.004.004-.004.003-.134.133-.004.003L4.682 5l-.132.134-.003.004-.004.004-.13.135-.004.004-.004.004-.128.136-.004.004-.004.004-.126.138-.004.004-.003.004-.125.14-.004.004-.003.004-.123.14-.004.005-.003.004-.121.142-.004.004-.003.004-.12.144-.003.004-.003.004-.117.145-.004.004-.003.004-.115.146-.004.005-.003.004-.113.147-.003.005-.004.004-.111.149-.003.004-.004.004-.11.15-.002.005-.003.004-.108.151-.003.004-.003.005-.106.152-.003.005-.003.004-.104.154-.003.004-.003.005-.102.154-.003.005-.002.004-.1.156-.003.005-.003.004-.098.157-.003.005-.003.004-.096.159-.002.004-.003.005-.094.16-.003.004-.002.004-.092.16-.003.005-.003.005-.09.161-.002.005-.003.005-.088.162-.002.005-.003.004-.086.164-.002.005-.002.004-.084.165-.003.005-.002.004-.082.166-.002.004-.003.005-.08.167-.002.004-.002.005-.078.168-.002.004-.002.005-.045.1-.053.153-.023.16.007.16.037.157.065.148.092.132.114.114.134.09.148.064.157.035.161.006.16-.025.152-.054.14-.08.121-.106.1-.126.065-.118.043-.095.074-.16.075-.155.077-.157.08-.155.08-.152.083-.155.085-.152.086-.15.088-.149.091-.15.094-.15.094-.147.095-.145.099-.146.1-.144.1-.142.104-.14.104-.14.11-.142.107-.137.11-.136.114-.136.113-.134.117-.133.118-.132.117-.129.122-.13.124-.127.123-.126.127-.125.127-.122.128-.12.132-.122.13-.115.133-.117.135-.115.135-.111.136-.11.037-.03.117-.11.094-.132.068-.146.04-.156.01-.161-.02-.16-.05-.154-.076-.141-.102-.125-.123-.104-.14-.08-.153-.051-.16-.023zM16 3.595h-.005l-.148.001h-.01l-.147.003h-.011l-.147.005h-.011l-.146.007h-.011l-.146.009h-.011l-.146.01h-.005l-.005.001-.146.012h-.011l-.145.014h-.006l-.005.001-.05.006-.158.031-.15.06-.135.088-.117.111-.094.13-.069.147-.04.156-.01.16.019.16.049.154.076.142.102.125.123.105.14.08.152.051.16.023.134-.003.045-.005.135-.013.133-.01.136-.01.135-.007.137-.006.136-.004.136-.003h.274l.136.003.136.004.136.006.136.007.136.01.133.01.135.013.135.014.135.016.134.018.132.018.134.021.133.023.133.024.133.025.13.027.132.03.132.03.129.031.13.034.129.035.129.036.13.04.126.038.128.042.126.042.128.045.127.047.126.047.12.048.127.051.123.052.006.002.147.048.16.021.16-.009.157-.038.147-.067.131-.093.112-.116.089-.135.062-.149.033-.158.004-.16-.027-.16-.055-.151-.083-.139-.107-.12-.127-.099-.118-.063-.004-.001-.005-.003-.005-.002-.133-.056-.005-.002-.005-.002-.134-.054-.004-.002-.005-.002-.135-.053-.005-.002-.005-.002-.135-.051-.005-.002-.005-.002-.135-.05-.005-.001-.005-.002-.137-.048-.005-.001-.005-.002-.137-.046-.005-.002-.005-.002-.137-.044-.005-.002-.005-.001-.138-.043-.006-.002-.005-.001-.138-.042-.005-.001-.005-.002-.14-.04H19.4l-.005-.002-.14-.038-.005-.001-.005-.002-.14-.036-.005-.001-.005-.001-.141-.035-.005-.001-.005-.001-.142-.033-.005-.001-.005-.001-.142-.031-.005-.002h-.005l-.142-.03-.005-.001-.005-.001-.143-.028h-.005l-.005-.002-.143-.025-.006-.001-.005-.001-.143-.024-.005-.001-.006-.001-.143-.022-.006-.001h-.005l-.144-.022h-.005l-.006-.001-.144-.019h-.005l-.006-.001-.144-.017h-.006l-.005-.001-.145-.016h-.011l-.145-.014H17.1l-.005-.001-.146-.012h-.01l-.146-.01-.006-.001h-.005l-.146-.009h-.011l-.147-.006h-.01L16.32 3.6h-.011l-.147-.003h-.011l-.147-.001H16zm-5.482 1.366l-.16.008-.157.037-.123.053-.06.032-.005.002-.004.003-.128.069-.004.002-.005.003-.126.07-.005.003-.004.002-.126.072-.005.003-.004.003-.125.073-.004.003-.005.003-.124.075-.004.003-.005.002-.123.077-.004.003-.005.003-.122.078-.004.003-.005.003-.121.08-.004.002-.005.003-.12.082-.005.003-.004.003-.12.083-.004.003-.004.003-.118.084-.005.003-.004.003-.118.086-.004.003-.004.003-.117.088-.004.003-.004.003-.116.089-.004.003-.004.004-.114.09-.005.003-.004.003-.113.092-.004.004-.004.003-.113.093-.004.004-.004.003-.111.095-.005.003-.004.004-.11.096-.004.004-.004.003-.11.098-.003.003-.004.004-.108.1-.004.003-.004.003-.107.101-.004.004-.004.003-.106.102-.004.004-.003.004-.105.103-.004.004-.004.004-.103.105-.004.004-.004.003-.102.106-.003.004-.004.004-.1.107-.004.004-.004.004-.099.108-.004.004-.003.004-.098.11-.003.003-.004.004-.096.11-.004.005-.003.004-.095.111-.003.004-.004.004-.093.113-.003.004-.004.004-.092.113-.003.004-.003.005-.09.114-.004.004-.003.004-.089.116-.003.004-.003.004-.088.117-.003.004-.003.004-.086.118-.003.004-.003.005-.084.118-.003.004-.003.005-.083.12-.003.003-.003.005-.082.12-.003.005-.002.004-.068.103-.076.142-.048.154-.018.16.011.161.041.156.07.146.095.13.117.11.136.086.15.06.158.03.162.002.158-.03.15-.057.138-.085.119-.109.082-.105.065-.099.075-.11.077-.113.077-.107.08-.11.08-.108.084-.108.083-.105.086-.106.086-.104.088-.104.089-.101.09-.102.093-.101.093-.099.094-.097.095-.096.098-.097.098-.095.099-.093.1-.092.103-.091.101-.089.104-.088.104-.086.106-.086.106-.083.106-.082.109-.082.108-.079.11-.078.11-.076.112-.076.112-.074.113-.072.113-.071.115-.07.115-.068.118-.067.117-.065.12-.065.054-.029.135-.088.116-.111.094-.132.068-.146.04-.156.009-.161-.02-.16-.05-.153-.078-.142-.102-.125-.123-.103-.141-.079-.153-.051-.16-.022zm13.91 2.116l-.162.008-.157.037-.147.066-.132.092-.113.116-.09.134-.063.148-.034.157-.005.162.025.159.055.152.082.138.086.103.09.09.094.098.092.099.093.1.091.103.089.101.088.104.086.104.086.106.083.105.083.108.08.108.081.11.077.107.077.112.075.111.075.114.072.113.071.113.07.114.068.118.067.115.065.118.064.117.062.117.061.121.059.119.059.122.056.121.054.12.055.125.051.123.051.125.048.123.048.127.047.126.044.125.043.128.042.129.039.126.038.13.022.076.058.15.085.137.11.119.129.096.145.07.155.043.16.013.161-.017.154-.046.144-.075.126-.1.106-.12.082-.14.055-.151.025-.16-.005-.16-.026-.132-.023-.082-.002-.005-.001-.005-.042-.139-.001-.005-.002-.005-.043-.138-.001-.005-.002-.005-.044-.137-.002-.005-.002-.005-.046-.137-.002-.005-.001-.005-.048-.137-.002-.005-.002-.005-.05-.135-.001-.005-.002-.005-.051-.135-.002-.005-.002-.005-.053-.135-.002-.005-.002-.005-.054-.133-.002-.005-.002-.005-.057-.133-.002-.005-.002-.005-.057-.132-.003-.005-.002-.005-.06-.132-.001-.005-.002-.004-.061-.132-.003-.004-.002-.005-.063-.13-.002-.005-.002-.005-.064-.13-.003-.004-.002-.005-.066-.129-.002-.004-.003-.005-.067-.128-.002-.005-.003-.004-.069-.128-.002-.004-.003-.005-.07-.126-.003-.005-.003-.004-.072-.126-.002-.005-.003-.004-.074-.125-.002-.004-.003-.005-.075-.124-.003-.004-.003-.005-.076-.123-.003-.004-.003-.005-.078-.122-.003-.004-.003-.005-.08-.121-.003-.004-.003-.005-.081-.12-.003-.005-.003-.004-.083-.12-.003-.004-.003-.004-.084-.118-.003-.005-.003-.004-.086-.118-.003-.004-.004-.004-.087-.117-.003-.004-.003-.004-.09-.116-.002-.004-.004-.004-.09-.114-.003-.005-.004-.004-.091-.113-.004-.004-.003-.004-.094-.113-.003-.004-.003-.004-.095-.111-.004-.004-.003-.004-.096-.11-.004-.005-.003-.004-.098-.11-.004-.003-.003-.004-.1-.108-.003-.004-.004-.004-.1-.107-.004-.004-.004-.004-.102-.106-.003-.003-.004-.004-.093-.095-.124-.103-.14-.08-.153-.05-.16-.023zM4.45 13.135l-.161.002-.158.032-.15.06-.135.088-.118.11-.094.131-.069.146-.035.129-.026.132v.005l-.002.005-.025.143-.001.005-.001.006-.024.143-.001.005-.001.006-.022.143-.001.006-.001.005-.02.144-.001.005-.001.005-.019.145v.005l-.001.006-.017.144v.006l-.001.005-.016.145v.011l-.014.145v.005l-.001.006-.012.146v.01l-.01.146-.001.006v.005l-.009.146v.011l-.007.146v.011l-.004.147v.011l-.003.147v.01l-.002.148v.01l.001.148v.01l.003.147v.011l.005.147v.01l.007.147v.011l.009.146v.011l.01.146v.01l.013.146v.011l.014.145v.005l.001.006.016.145v.011l.018.144v.006l.001.005.019.144v.006l.001.005.021.144v.005l.002.006.022.143v.006l.002.005.024.143v.005l.002.006.025.143.001.005.001.005.028.143.001.005.001.005.03.142v.005l.002.006.03.141.002.005.001.005.033.142v.005l.002.005.035.14v.006l.002.005.036.14.002.005.001.005.038.14.001.005.002.005.04.14v.005l.002.005.042.138.001.006.002.005.042.138.002.005.002.005.017.054.064.148.09.134.114.114.132.092.148.065.157.037.16.007.16-.023.153-.052.14-.08.123-.104.102-.125.076-.142.049-.153.02-.16-.011-.161-.031-.13-.017-.051-.039-.126-.038-.13-.037-.128-.035-.13-.033-.128-.033-.134-.03-.13-.029-.131-.026-.13-.026-.133-.024-.133-.023-.133-.02-.132-.02-.136-.017-.132-.016-.135-.014-.135-.012-.133-.012-.138-.009-.133-.007-.136-.006-.138-.004-.134-.003-.136v-.274l.003-.136.004-.134.006-.139.007-.136.01-.133.01-.138.013-.132.014-.135.016-.135.017-.132.02-.137.02-.13.023-.134.024-.133.024-.126.016-.16-.014-.161-.044-.155-.072-.145-.098-.128-.12-.108-.137-.084-.15-.057-.16-.029zm26.698 1.601l-.161.01-.157.04-.146.067-.131.093-.112.117-.088.135-.061.149-.033.157-.005.134.006.14.006.176.003.177.001.178-.001.177-.003.178-.006.177-.007.176-.01.177-.012.176-.015.176-.016.173-.018.175-.02.175-.024.174-.025.175-.026.17-.03.174-.03.173-.033.17-.036.172-.037.17-.04.17-.042.172-.043.168-.045.166-.048.169-.05.167-.052.168-.053.164-.056.166-.058.166-.06.16-.062.165-.062.158-.066.165-.068.16-.07.16-.07.158-.075.159-.074.155-.079.158-.08.158-.06.15-.03.158-.001.161.029.159.058.15.085.137.108.119.13.097.144.07.156.044.16.013.16-.017.155-.046.143-.074.127-.1.107-.12.07-.115.083-.164.003-.005.002-.004.082-.166.002-.005.003-.004.08-.167.002-.005.002-.004.078-.168.002-.005.002-.004.076-.169.002-.004.002-.005.074-.17.002-.004.002-.005.072-.17.002-.005.002-.005.07-.171.001-.005.002-.005.068-.172.002-.004.002-.005.065-.173.002-.005.002-.005.063-.173.002-.005.002-.005.06-.174.003-.005.001-.005.06-.175.001-.005.002-.005.057-.176.001-.005.002-.005.055-.177.001-.005.002-.005.052-.177.002-.005.001-.005.051-.178.001-.005.002-.005.048-.179.002-.005v-.005l.047-.179.001-.005.002-.005.044-.18v-.005l.002-.005.042-.18.001-.006.001-.005.04-.181.001-.005.001-.005.037-.182.002-.005v-.005l.036-.182v-.006l.002-.005.033-.182v-.006l.002-.005.03-.183.001-.005.001-.005.029-.184v-.005l.001-.006.027-.184v-.005l.001-.005.024-.185v-.005l.001-.005.022-.185v-.006l.001-.005.02-.185v-.006l.001-.005.017-.186v-.005l.001-.005.015-.187v-.005l.001-.005.013-.187v-.01l.01-.187.001-.006v-.005l.009-.187v-.011l.006-.187V16.7l.004-.188v-.011l.001-.188v-.01l-.001-.188v-.011l-.004-.188v-.011l-.006-.187v-.011l-.007-.145-.022-.16-.05-.152-.08-.141-.103-.124-.125-.102-.141-.077-.153-.05-.16-.02zm-30.21.572l-.161.001-.158.032-.15.06-.136.087-.117.11-.095.131-.068.146-.04.156-.012.133-.001.14v.01l.001.188v.011l.004.188v.011l.006.187v.011l.008.187v.011l.011.187v.005l.001.005.013.187v.01l.016.187v.01l.018.186v.011l.02.185.001.005v.006l.022.185.001.005v.005l.025.185v.005l.001.005.027.184v.006l.001.005.029.184v.005l.001.005.031.183.001.005.001.006.033.182.001.005.001.006.035.182.001.005.001.005.038.182v.005l.002.005.04.181v.005l.002.005.042.18.001.006.001.005.044.18.002.005v.005l.047.18.001.004.002.005.048.179.002.005.001.005.05.178.002.005.001.005.053.177.002.005.001.005.055.177.002.005.001.005.057.176.002.005.001.005.06.175.001.005.002.005.061.174.002.005.002.005.063.173.002.005.002.005.065.173.002.005.002.004.067.172.002.005.002.005.07.171.002.005.002.005.072.17.002.005.002.004.074.17.002.005.002.004.076.169.002.004.002.005.078.168.002.004.002.005.08.167.003.004.002.005.082.166.002.004.003.005.02.04.086.136.11.118.13.095.146.07.156.041.16.012.16-.019.155-.048.142-.075.126-.1.105-.123.08-.14.054-.152.024-.16-.006-.16-.036-.158-.051-.123-.018-.034-.078-.158-.074-.155-.074-.16-.071-.157-.07-.16-.068-.16-.067-.165-.062-.158-.062-.164-.059-.161-.058-.166-.056-.166-.053-.164-.052-.168-.05-.167-.048-.17-.045-.165-.043-.168-.043-.172-.039-.17-.037-.17-.036-.172-.033-.17-.03-.173-.03-.174-.027-.17-.025-.175-.022-.174-.021-.175-.018-.175-.017-.173-.014-.176-.012-.176-.01-.177-.007-.176-.006-.177-.003-.178-.001-.177v-.134l-.013-.16-.044-.156-.072-.144-.097-.129-.12-.108-.137-.085-.15-.057-.159-.028zm26.798 2.024l-.16.007-.157.038-.148.066-.132.092-.113.115-.09.134-.062.148-.03.127-.001.004-.023.134-.024.133-.026.133-.026.13-.03.132-.03.129-.032.134-.033.128-.035.13-.037.128-.038.13-.04.126-.04.128-.044.128-.044.126-.046.126-.048.126-.05.125-.05.125-.051.122-.054.123-.055.122-.056.12-.058.122-.06.12-.061.12-.063.119-.062.116-.067.119-.066.116-.069.115-.069.115-.07.113-.073.113-.074.112-.076.113-.077.112-.077.107-.08.11-.08.107-.085.11-.044.056-.088.135-.06.15-.033.158-.002.16.027.16.057.15.083.138.108.12.128.098.144.072.155.045.16.015.161-.016.155-.044.144-.073.128-.098.09-.099.05-.061.003-.004.003-.005.089-.115.003-.004.003-.005.088-.116.003-.004.003-.005.086-.117.003-.004.003-.005.084-.118.003-.004.003-.005.083-.12.003-.004.003-.004.081-.12.003-.005.003-.004.08-.121.003-.005.003-.004.078-.122.003-.005.003-.004.077-.123.002-.005.003-.004.075-.124.003-.005.003-.004.073-.125.003-.005.003-.004.072-.126.002-.004.003-.005.07-.126.003-.005.002-.005.07-.127.002-.004.002-.005.068-.128.002-.005.002-.004.066-.13.003-.004.002-.005.064-.13.002-.004.003-.005.062-.13.002-.005.003-.005.06-.13.003-.005.002-.005.06-.132.002-.005.002-.005.057-.132.003-.005.002-.005.056-.133.002-.005.002-.005.054-.134.002-.004.002-.005.053-.135.002-.005.002-.005.051-.135.002-.005.002-.005.05-.135.001-.005.002-.005.048-.137.001-.005.002-.005.046-.137.002-.005.002-.005.044-.137.002-.005.002-.005.042-.138.002-.005.001-.006.042-.138.001-.005.002-.005.04-.14v-.005l.002-.005.038-.14.001-.005.002-.005.036-.14.001-.005.001-.005.035-.141.001-.005.001-.005.033-.142.001-.005.001-.005.031-.141.001-.006.002-.005.029-.142v-.005l.002-.005.028-.143v-.005l.002-.005.025-.143.001-.006.001-.005.024-.143.001-.005.001-.006.001-.006.01-.161-.02-.16-.05-.154-.077-.141-.102-.125-.123-.104-.141-.079-.153-.051-.16-.022zM6.841 23.019l-.16.024-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.018.16.011.161.041.156.07.146.077.109.04.048.003.004.003.004.095.111.003.004.004.004.096.11.004.005.003.004.098.109.003.004.004.004.1.108.003.004.003.004.101.107.004.004.003.004.102.105.004.004.004.004.103.105.004.004.004.003.105.104.003.004.004.003.106.102.004.004.004.004.107.1.004.004.004.004.108.099.004.003.004.004.11.098.003.003.004.004.11.096.004.003.005.004.11.095.005.003.004.004.113.093.004.003.004.004.113.091.004.004.005.003.114.09.004.004.004.003.116.089.004.003.004.003.117.088.004.003.004.003.118.086.004.003.005.003.118.084.004.003.005.003.119.083.004.003.005.003.12.081.005.003.004.003.121.08.005.003.004.003.122.078.005.003.004.003.123.076.005.003.004.003.124.075.005.003.004.003.125.073.004.003.005.002.126.073.004.002.005.003.126.07.005.003.004.002.128.07.004.002.005.002.128.067.005.003.004.002.13.066.004.002.005.003.13.064.004.002.005.003.13.062.005.002.004.003.132.06.004.003.005.002.132.06.005.002.005.002.132.057.005.002.005.002.133.057.005.002.005.002.133.054.005.002.005.002.13.05.154.045.16.016.16-.015.156-.045.144-.072.128-.098.108-.12.083-.138.057-.15.028-.16-.003-.16-.032-.159-.061-.149-.088-.135-.11-.117-.132-.094-.12-.058-.124-.049-.126-.051-.122-.051-.122-.054-.12-.054-.126-.058-.119-.057-.12-.06-.12-.06-.118-.063-.117-.064-.119-.066-.116-.066-.115-.068-.115-.07-.113-.07-.115-.074-.112-.074-.11-.075-.11-.076-.112-.08-.11-.08-.109-.081-.106-.082-.104-.082-.106-.086-.105-.087-.101-.086-.105-.091-.1-.09-.1-.091-.1-.094-.097-.094-.1-.098-.093-.095-.096-.1-.093-.098-.092-.101-.089-.1-.09-.102-.088-.104-.036-.043-.114-.114-.133-.091-.148-.065-.157-.036-.161-.006zm15.063 2.701l-.16.014-.156.044-.12.057-.06.034-.12.066-.117.064-.118.062-.12.061-.12.06-.118.057-.126.058-.12.054-.122.054-.122.05-.126.052-.125.05-.124.046-.127.047-.125.044-.129.043-.126.04-.13.042-.128.038-.127.035-.13.036-.131.034-.129.031-.132.03-.13.03-.135.027-.133.026-.13.023-.13.022-.137.021-.132.02-.134.017-.132.015-.138.015-.135.013-.133.01-.138.01-.136.007-.134.006-.136.004-.14.003-.16.018-.155.047-.142.076-.127.1-.105.122-.08.14-.054.151-.025.16.006.16.035.158.064.148.09.134.114.114.133.092.147.065.157.036.134.008.145-.002h.011l.147-.005h.01l.147-.007h.011l.146-.009h.011l.146-.01h.005l.005-.001.146-.012h.011l.145-.014h.005l.006-.001.145-.016h.011l.144-.018h.006l.005-.001.144-.02h.011l.144-.021.005-.001h.006l.143-.023.006-.001h.005l.143-.025h.005l.006-.002.143-.026h.005l.005-.002.143-.027.005-.001.005-.001.142-.03h.005l.005-.002.142-.03.005-.002.005-.001.142-.033.005-.001.005-.001.14-.035.006-.001.005-.001.14-.037h.005l.005-.002.14-.038.005-.002h.005l.14-.04.005-.002.005-.001.138-.042.005-.001.006-.002.138-.043.005-.001.005-.002.137-.044.005-.002.005-.002.137-.046.005-.002.005-.001.137-.048.005-.002.005-.002.135-.05.005-.001.005-.002.135-.051.005-.002.005-.002.135-.053.005-.002.004-.002.134-.054.005-.002.005-.002.133-.057.005-.002.005-.002.132-.057.005-.003.005-.002.132-.06.005-.001.004-.002.131-.061.005-.003.005-.002.13-.062.005-.003.005-.002.13-.064.004-.003.005-.002.128-.066.005-.002.005-.003.128-.067.005-.002.004-.003.127-.069.005-.002.005-.003.126-.07.005-.003.004-.003.065-.037.132-.093.112-.115.089-.135.062-.149.034-.157.003-.161-.026-.16-.055-.15-.082-.14-.107-.12-.127-.1-.144-.073-.154-.046-.16-.016zM6.33 27.127l-.16.023-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.02.16.012.161.041.156.07.146.094.13.096.093.032.026.004.003.004.004.145.117.004.003.004.004.146.115.005.003.004.004.147.113.005.003.004.004.149.111.004.003.004.003.15.11.005.003.004.003.151.108.004.003.005.003.152.106.005.003.004.003.154.104.004.003.005.003.154.102.005.002.004.003.156.1.005.003.004.003.157.098.005.003.004.002.159.096.004.003.005.003.16.094.004.003.004.002.16.092.005.003.005.002.161.09.005.003.005.002.162.088.005.003.004.002.164.086.005.003.004.002.165.084.005.003.004.002.166.082.004.002.005.003.167.08.004.002.005.002.168.078.004.002.005.002.168.076.005.002.005.002.17.074.004.002.005.002.17.072.005.002.005.002.17.07.006.002.005.001.171.068.005.002.005.002.173.065.005.002.005.002.173.063.005.002.005.002.174.06.005.003.005.001.175.06.005.001.005.002.176.057.005.001.005.002.176.055.006.001.005.002.177.052.005.002.005.001.178.05.005.002.005.002.178.048.006.001.005.002.179.046.005.001.005.002.18.044h.005l.005.002.18.042.006.001.005.001.159.035.16.02.16-.01.157-.04.146-.069.13-.094.112-.117.087-.136.06-.149.033-.158.002-.161-.028-.159-.057-.15-.084-.138-.108-.12-.128-.098-.144-.072-.128-.039-.154-.033-.168-.04-.171-.041-.17-.044-.168-.046-.167-.047-.168-.05-.165-.051-.166-.054-.166-.056-.163-.057-.165-.06-.161-.062-.164-.064-.16-.065-.16-.068-.162-.07-.157-.07-.157-.074-.157-.075-.156-.077-.153-.079-.156-.082-.153-.082-.154-.086-.15-.086-.152-.09-.148-.09-.147-.092-.149-.095-.145-.095-.144-.098-.145-.1-.143-.102-.14-.103-.14-.104-.14-.108-.139-.11-.136-.11-.027-.022-.133-.091-.148-.065-.157-.036-.161-.006zm19.215.087l-.16.01-.157.039-.146.067-.11.076-.064.051-.139.11-.14.108-.14.104-.14.103-.143.101-.145.101-.144.098-.145.095-.149.095-.148.093-.147.089-.152.09-.15.086-.154.086-.153.082-.156.082-.153.079-.156.077-.157.075-.158.073-.157.071-.16.07-.16.068-.161.065-.164.064-.161.061-.165.06-.163.058-.166.056-.166.054-.166.051-.167.05-.167.047-.17.046-.168.044-.171.042-.168.039-.17.037-.11.023-.154.047-.143.075-.126.1-.106.122-.081.139-.054.152-.025.16.006.16.035.158.063.148.09.133.114.115.132.092.148.065.157.037.16.007.133-.016.115-.024.005-.001.005-.001.181-.04h.005l.005-.002.18-.042.006-.001.005-.001.18-.044.005-.002.005-.001.18-.046.004-.002h.005l.179-.05h.005l.005-.002.178-.05.005-.002.005-.002.177-.052.005-.002.005-.001.177-.055.005-.002.005-.001.176-.057.005-.002.005-.002.175-.059.005-.001.005-.002.174-.061.005-.002.005-.002.173-.063.005-.002.005-.002.173-.065.004-.002.005-.002.172-.068.005-.002.005-.002.171-.07.005-.001.005-.002.17-.072.005-.002.004-.002.17-.074.005-.002.004-.002.169-.076.004-.002.005-.002.168-.078.004-.002.005-.003.167-.08.004-.002.005-.002.166-.082.004-.002.005-.003.165-.084.004-.002.005-.003.163-.086.005-.002.005-.003.162-.088.005-.002.005-.003.161-.09.005-.002.004-.003.16-.092.005-.003.005-.002.16-.094.004-.003.004-.003.158-.096.005-.002.004-.003.158-.098.004-.003.005-.003.156-.1.004-.003.004-.003.155-.101.005-.003.004-.003.154-.104.004-.003.004-.003.153-.106.004-.003.005-.003.151-.108.004-.003.005-.003.15-.11.004-.003.004-.003.149-.112.004-.003.004-.003.148-.113.004-.004.004-.003.147-.115.004-.004.004-.003.068-.055.116-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.05-.153-.08-.14-.103-.125-.124-.102-.142-.077-.153-.05-.16-.02z" +}))); + +function _extends$N() { _extends$N = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$N.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$N({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.012 9.222c-1.673 4.657-2.735 9.508-4.409 14.164 1.536-1.526 2.874-3.236 4.41-4.762l4.408 4.762c-1.497-4.712-2.911-9.451-4.409-14.164zm.032 2.93c.823 2.588 1.599 5.19 2.421 7.777l-2.42-2.614c-.683.598-2.454 2.886-2.34 2.39.871-2.489 1.448-5.07 2.34-7.552zM16.012.312c-1.448.02-2.93.157-4.302.628-.852.447-.255 1.863.66 1.574 2.255-.608 4.648-.607 6.922-.108.934.075 1.228-1.376.338-1.67C18.451.44 17.227.317 16.012.311zm9.012 2.934c-.913-.104-1.272 1.258-.454 1.648 1.834 1.36 3.293 3.185 4.31 5.22.526.776 1.842.098 1.515-.78a15.522 15.522 0 00-5.06-6.006c-.1-.044-.203-.07-.31-.082zM6.65 3.59c-.762.089-1.24.809-1.805 1.267C3.38 6.295 2.163 8.007 1.37 9.905c-.266.898 1.094 1.484 1.564.675a14.825 14.825 0 014.327-5.56c.476-.515.09-1.419-.612-1.431zm9.362.007c-.698.066-1.689-.16-2.033.635-.282.733.535 1.358 1.217 1.125 1.806-.147 3.63.203 5.293.907.902.255 1.472-1.112.656-1.573-1.6-.735-3.374-1.089-5.133-1.094zm-5.479 1.365c-.835.15-1.517.76-2.21 1.226-1.203.94-2.318 2.061-3.057 3.402-.33.904 1.063 1.552 1.547.723 1.045-1.656 2.596-2.925 4.285-3.873.545-.499.171-1.463-.565-1.478zm13.903 2.115c-.875-.07-1.22 1.173-.501 1.627 1.325 1.34 2.188 3.062 2.748 4.84.468.84 1.869.21 1.557-.699-.604-2.118-1.751-4.097-3.351-5.615a.93.93 0 00-.453-.153zM4.467 13.132c-.822-.07-.996.826-1.046 1.455-.256 1.93-.094 3.933.562 5.769.406.844 1.807.365 1.612-.551a11.498 11.498 0 01-.334-5.808.874.874 0 00-.794-.865zm26.687 1.6c-.746-.037-1.014.785-.879 1.395.043 2.393-.57 4.771-1.66 6.894-.31.884 1.02 1.536 1.53.75a15.632 15.632 0 001.821-8.372.876.876 0 00-.812-.667zm-30.197.571c-.782-.073-1.044.775-.933 1.404.068 2.414.661 4.833 1.809 6.962.534.77 1.842.076 1.505-.798a14.833 14.833 0 01-1.603-6.861.876.876 0 00-.778-.707zm26.787 2.024c-.777-.048-.952.797-1.021 1.392-.354 1.692-1.202 3.231-2.216 4.608-.407.872.925 1.638 1.48.852 1.361-1.733 2.296-3.827 2.582-6.017a.874.874 0 00-.825-.835zM6.857 23.012c-.808.018-1.082 1.122-.47 1.59 1.393 1.607 3.187 2.886 5.194 3.599.91.222 1.43-1.165.598-1.596a11.495 11.495 0 01-4.723-3.396.899.899 0 00-.599-.197zm15.057 2.7c-.81.194-1.504.76-2.325.972-1.203.458-2.5.536-3.758.664-.869.307-.573 1.728.346 1.663 2.201-.034 4.412-.626 6.293-1.778.604-.495.227-1.532-.556-1.521zM6.346 27.118c-.833.008-1.11 1.218-.395 1.617 1.986 1.602 4.358 2.749 6.868 3.226.933.076 1.227-1.376.338-1.67a14.838 14.838 0 01-6.345-3.066.929.929 0 00-.466-.107zm19.208.087c-.766.09-1.241.841-1.922 1.158-1.516.991-3.251 1.58-4.996 2.005-.872.405-.346 1.849.584 1.604 2.543-.526 4.98-1.66 6.963-3.344.47-.52.072-1.42-.63-1.423z" +}))); + +function _extends$M() { _extends$M = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$M.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$M({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M8.742 10.464v11.072h14.516V10.464H8.742zm3.224 1.73h8.066a69569 69569 0 00-4.034 3.22l-4.032-3.22zm9.565 1.018v6.594H10.469v-6.593L16 17.63l5.532-4.419zM16 0h-.005l-.188.001h-.011l-.188.004h-.011l-.187.006h-.011l-.187.008h-.005L15.2.02l-.187.01h-.005l-.005.001-.187.013h-.011L14.62.06h-.01l-.186.018h-.011l-.185.02-.005.001h-.006l-.185.022-.005.001h-.005l-.185.025h-.005l-.005.001-.185.027h-.005l-.005.001-.184.029h-.005l-.005.001-.183.031-.006.001-.005.001-.182.033-.006.001-.005.001-.182.035-.005.001-.005.001-.182.038h-.005l-.005.002-.181.04h-.005l-.005.002-.18.042-.006.001-.005.001-.18.044-.005.002h-.005l-.17.045-.152.054-.139.082-.121.106-.1.127-.074.143-.046.155-.017.16.013.16.043.156.07.145.097.13.119.108.137.085.15.058.159.03.16-.001.133-.023.165-.043.168-.041.171-.04.171-.037.172-.036.17-.033.173-.03.17-.03.177-.027.171-.025.175-.022.175-.02.175-.02.176-.016.175-.014.177-.012.176-.01.177-.007.174-.006.177-.003L16 1.73h.177l.178.004.174.006.177.007.176.01.177.012.175.014.176.017.175.018.175.02.175.023.171.025.176.027.17.03.174.03.17.033.171.036.154.033.16.02.161-.01.156-.04.146-.069.131-.094.111-.117.087-.135.061-.15.032-.158.002-.16-.027-.16-.057-.15L20 .714l-.108-.12-.128-.097-.145-.073-.128-.038-.158-.035-.005-.001-.005-.001L19.14.31h-.005l-.005-.002-.182-.035h-.006l-.005-.002-.182-.033h-.006l-.005-.002-.183-.03-.005-.001-.006-.001-.183-.029h-.005l-.006-.001-.184-.027h-.005l-.005-.001-.185-.024h-.005L17.968.12 17.783.1l-.006-.001h-.005l-.185-.02h-.006l-.005-.001L17.39.06h-.005L17.38.06l-.187-.015h-.005l-.005-.001-.187-.013h-.011L16.8.02h-.011L16.6.01h-.011l-.187-.006h-.011L16.204 0h-.011L16.005 0H16zm9.015 2.935l-.16.004-.158.033-.15.062-.134.09-.116.111-.093.132-.067.147-.038.156-.01.161.022.16.05.153.078.141.103.124.102.087.045.034.142.106.137.105.14.11.136.11.135.112.134.115.134.117.13.115.132.122.128.12.127.122.126.125.124.126.124.128.121.13.118.128.118.132.117.133.113.134.113.136.11.136.109.137.109.142.104.14.103.14.101.142.1.144.099.146.095.145.094.147.093.15.092.15.087.149.087.15.084.152.084.155.08.152.08.155.04.081.084.138.11.119.128.096.145.072.155.043.16.013.16-.016.155-.046.144-.074.127-.099.106-.12.083-.14.055-.151.026-.16-.004-.16-.034-.158-.05-.124-.042-.085-.002-.004-.003-.005-.084-.165-.002-.004-.003-.005-.086-.164-.002-.004-.003-.005-.088-.162-.002-.005-.003-.005-.09-.161-.002-.005-.003-.004-.092-.16-.003-.005-.002-.005-.094-.16-.003-.004-.003-.004-.096-.159-.002-.004-.003-.005-.098-.157-.003-.004-.003-.005-.1-.156-.003-.004-.003-.005-.101-.154-.003-.005-.003-.004-.104-.154-.003-.004-.003-.005-.106-.152-.003-.005-.003-.004-.108-.151-.003-.004-.003-.005-.11-.15-.003-.004-.003-.004-.111-.15-.004-.003-.003-.005-.113-.147-.004-.004-.003-.005-.115-.146-.004-.004-.003-.004-.117-.145-.004-.004-.003-.004-.12-.144-.003-.004-.003-.004-.121-.142-.004-.004-.003-.004-.123-.141-.003-.004-.004-.004-.125-.14-.003-.004-.004-.004-.127-.138-.003-.004-.004-.004-.128-.136-.004-.004-.004-.004-.13-.135-.004-.004-.004-.004-.132-.134-.003-.004-.004-.003-.134-.133-.004-.003-.004-.004-.135-.13-.004-.004-.004-.004-.136-.128-.004-.004-.004-.004-.138-.126-.004-.004-.004-.003-.14-.125-.004-.004-.004-.003-.14-.123-.005-.004-.004-.003-.142-.121-.004-.004-.004-.003-.144-.12-.004-.003-.004-.003-.145-.117-.004-.004-.004-.003-.147-.115-.004-.004-.004-.003-.148-.113-.004-.003-.004-.004-.149-.111-.004-.003-.004-.004-.05-.036-.14-.083-.15-.055-.16-.027zM6.634 3.28l-.161.008-.157.037-.147.066-.111.074-.04.032-.005.003-.004.004-.145.117-.004.003-.004.004-.144.119-.004.003-.004.004-.142.12-.004.004-.004.004-.141.123-.004.003-.004.004-.14.125-.004.003-.004.004-.138.126-.004.004-.004.004-.136.128-.004.004-.004.004-.135.13-.004.004-.004.003-.134.133-.004.003-.004.004-.132.134-.003.004-.004.004-.13.135-.004.004-.004.004-.128.136-.004.004-.004.004-.126.138-.004.004-.003.004-.125.14-.004.004-.003.004-.123.14-.004.005-.003.004-.121.142-.004.004-.003.004-.12.144-.003.004-.003.004-.117.145-.004.004-.003.004-.115.146-.004.005-.003.004-.113.147-.003.005-.004.004-.111.149-.003.004-.004.004-.11.15-.002.005-.003.004-.108.151-.003.004-.003.005-.106.152-.003.005-.003.004-.104.154-.003.004-.003.005-.102.154-.003.005-.002.004-.1.156-.003.005-.003.004-.098.157-.003.005-.003.004-.096.159-.002.004-.003.005-.094.16-.003.004-.002.004-.092.16-.003.005-.003.005-.09.161-.002.005-.003.005-.088.162-.002.005-.003.004-.086.164-.002.005-.002.004-.084.165-.003.005-.002.004-.082.166-.002.004-.003.005-.08.167-.002.004-.002.005-.078.168-.002.004-.002.005-.045.1-.053.153-.023.16.007.16.037.157.065.148.092.132.114.114.134.09.148.064.157.035.161.006.16-.025.152-.054.14-.08.121-.106.1-.126.065-.118.043-.095.074-.16.075-.155.077-.157.08-.155.08-.152.083-.155.085-.152.086-.15.088-.149.091-.15.094-.15.094-.147.095-.145.099-.146.1-.144.1-.142.104-.14.104-.14.11-.142.107-.137.11-.136.114-.136.113-.134.117-.133.118-.132.117-.129.122-.13.124-.127.123-.126.127-.125.127-.122.128-.12.132-.122.13-.115.133-.117.135-.115.135-.111.136-.11.037-.03.117-.11.094-.132.068-.146.04-.156.01-.161-.02-.16-.05-.154-.076-.141-.102-.125-.123-.104-.14-.08-.153-.051-.16-.023zM16 3.286h-.005l-.148.001h-.01l-.147.003h-.011l-.147.005h-.011l-.146.007h-.011l-.146.009h-.011l-.146.01h-.005l-.005.001-.146.012h-.011l-.145.014h-.006l-.005.001-.05.006-.158.031-.15.06-.135.088-.117.111-.094.13-.069.147-.04.156-.01.16.019.16.049.154.076.142.102.125.123.105.14.08.152.051.16.023.134-.003.045-.005.135-.013.133-.01.136-.01.135-.007.137-.006.136-.004.136-.003h.274l.136.003.136.004.136.006.136.007.136.01.133.01.135.013.135.014.135.016.134.018.132.018.134.021.133.023.133.024.133.025.13.027.132.03.132.03.129.031.13.034.129.035.129.036.13.04.126.038.128.042.126.042.128.045.127.047.126.047.12.048.127.051.123.052.006.002.147.048.16.021.16-.009.157-.038.147-.067.131-.093.112-.116.089-.135.062-.149.033-.158.004-.16-.027-.16-.055-.151-.083-.139-.107-.12-.127-.099-.118-.063-.004-.001-.005-.003-.005-.002-.133-.056-.005-.002-.005-.002-.134-.054-.004-.002-.005-.002-.135-.053-.005-.002-.005-.002-.135-.051-.005-.002-.005-.002-.135-.05-.005-.001-.005-.002-.137-.048-.005-.001-.005-.002-.137-.046-.005-.002-.005-.002-.137-.044-.005-.002-.005-.001-.138-.043-.006-.002-.005-.001-.138-.042-.005-.001-.005-.002-.14-.04H19.4l-.005-.002-.14-.038-.005-.001-.005-.002-.14-.036-.005-.001-.005-.001-.141-.035-.005-.001-.005-.001-.142-.033-.005-.001-.005-.001-.142-.031-.005-.002h-.005l-.142-.03-.005-.001-.005-.001-.143-.028h-.005l-.005-.002-.143-.025-.006-.001-.005-.001-.143-.024-.005-.001-.006-.001-.143-.022-.006-.001h-.005l-.144-.022h-.005l-.006-.001-.144-.019h-.005l-.006-.001-.144-.017h-.006l-.005-.001-.145-.016h-.011l-.145-.014H17.1l-.005-.001-.146-.012h-.01l-.146-.01-.006-.001h-.005l-.146-.009h-.011l-.147-.006h-.01l-.147-.005h-.011l-.147-.003h-.011l-.147-.001H16zm-5.482 1.366l-.16.008-.157.037-.123.053-.06.032-.005.002-.004.003-.128.069-.004.002-.005.003-.126.07-.005.003-.004.002-.126.072-.005.003-.004.003-.125.073-.004.003-.005.003-.124.075-.004.003-.005.002-.123.077-.004.003-.005.003-.122.078-.004.003-.005.003-.121.08-.004.002-.005.003-.12.082-.005.003-.004.003-.12.083-.004.003-.004.003-.118.084-.005.003-.004.003-.118.086-.004.003-.004.003-.117.088-.004.003-.004.003-.116.089-.004.003-.004.004-.114.09-.005.003-.004.003-.113.092-.004.004-.004.003-.113.093-.004.004-.004.003-.111.095-.005.003-.004.004-.11.096-.004.004-.004.003-.11.098-.003.003-.004.004-.108.1-.004.003-.004.003-.107.101-.004.004-.004.003-.106.102-.004.004-.003.004-.105.103-.004.004-.004.004-.103.105-.004.004-.004.003-.102.106-.003.004-.004.004-.1.107-.004.004-.004.004-.099.108-.004.004-.003.004-.098.11-.003.003-.004.004-.096.11-.004.005-.003.004-.095.111-.003.004-.004.004-.093.113-.003.004-.004.004-.092.113-.003.004-.003.005-.09.114-.004.004-.003.004-.089.116-.003.004-.003.004-.088.117-.003.004-.003.004-.086.118-.003.004-.003.005-.084.118-.003.004-.003.005-.083.12-.003.003-.003.005-.082.12-.003.005-.002.004-.068.103-.076.142-.048.154-.018.16.011.161.041.156.07.146.095.13.117.11.136.086.15.06.158.03.162.002.158-.03.15-.057.138-.085.119-.109.082-.105.065-.099.075-.11.077-.113.077-.107.08-.11.08-.108.084-.108.083-.105.086-.106.086-.104.088-.104.089-.101.09-.102.093-.101.093-.099.094-.097.095-.096.098-.097.098-.095.099-.093.1-.092.103-.091.101-.089.104-.088.104-.086.106-.086.106-.083.106-.082.109-.082.108-.079.11-.078.11-.076.112-.076.112-.074.113-.072.113-.071.115-.07.115-.068.118-.067.117-.065.12-.065.054-.029.135-.088.116-.111.094-.132.068-.146.04-.156.009-.161-.02-.16-.05-.153-.078-.142-.102-.125-.123-.103-.141-.079-.153-.051-.16-.022zm13.91 2.116l-.162.008-.157.037-.147.066-.132.092-.113.116-.09.134-.063.148-.034.157-.005.162.025.159.055.152.082.138.086.103.09.09.094.098.092.099.093.1.091.103.089.101.088.104.086.104.086.106.083.105.083.108.08.108.081.11.077.107.077.112.075.111.075.114.072.113.071.113.07.114.068.118.067.115.065.118.064.117.062.117.061.121.059.119.059.122.056.121.054.12.055.125.051.123.051.125.048.123.048.127.047.126.044.125.043.128.042.129.039.126.038.13.022.076.058.15.085.137.11.119.129.096.145.07.155.043.16.013.161-.017.154-.046.144-.075.126-.1.106-.12.082-.14.055-.151.025-.16-.005-.16-.026-.132-.023-.082-.002-.005-.001-.005-.042-.139-.001-.005-.002-.005-.043-.138-.001-.005-.002-.005-.044-.137-.002-.005-.002-.005-.046-.137-.002-.005-.001-.005-.048-.137-.002-.005-.002-.005-.05-.135-.001-.005-.002-.005-.051-.135-.002-.005-.002-.005-.053-.135-.002-.005-.002-.005-.054-.133-.002-.005-.002-.005-.057-.133-.002-.005-.002-.005-.057-.132-.003-.005-.002-.005-.06-.132-.001-.005-.002-.004-.061-.132-.003-.004-.002-.005-.063-.13-.002-.005-.002-.005-.064-.13-.003-.004-.002-.005-.066-.129-.002-.004-.003-.005-.067-.128-.002-.005-.003-.004-.069-.128-.002-.004-.003-.005-.07-.126-.003-.005-.003-.004-.072-.126-.002-.005-.003-.004-.074-.125-.002-.004-.003-.005-.075-.124-.003-.004-.003-.005-.076-.123-.003-.004-.003-.005-.078-.122-.003-.004-.003-.005-.08-.121-.003-.004-.003-.005-.081-.12-.003-.005-.003-.004-.083-.12-.003-.004-.003-.004-.084-.118-.003-.005-.003-.004-.086-.118-.003-.004-.004-.004-.087-.117-.003-.004-.003-.004-.09-.116-.002-.004-.004-.004-.09-.114-.003-.005-.004-.004-.091-.113-.004-.004-.003-.004-.094-.113-.003-.004-.003-.004-.095-.111-.004-.004-.003-.004-.096-.11-.004-.005-.003-.004-.098-.11-.004-.003-.003-.004-.1-.108-.003-.004-.004-.004-.1-.107-.004-.004-.004-.004-.102-.106-.003-.003-.004-.004-.093-.095-.124-.103-.14-.08-.153-.05-.16-.023zM4.45 12.826l-.161.002-.158.032-.15.06-.135.088-.118.11-.094.131-.069.146-.035.129-.026.132v.005l-.002.005-.025.143-.001.005-.001.006-.024.143-.001.005-.001.006-.022.143-.001.006-.001.005-.02.144-.001.005-.001.005-.019.145v.005l-.001.006-.017.144v.006l-.001.005-.016.145v.011l-.014.145v.005l-.001.006-.012.146v.01l-.01.146-.001.006v.005l-.009.146v.011l-.007.146v.011l-.004.147v.011l-.003.147v.01l-.002.148v.01l.001.148v.01l.003.147v.011l.005.147v.01l.007.147v.011l.009.146v.011l.01.146v.01l.013.146v.011l.014.145v.005l.001.006.016.145v.011l.018.144v.006l.001.005.019.144v.006l.001.005.021.144v.005l.002.006.022.143v.006l.002.005.024.143v.005l.002.006.025.143.001.005.001.005.028.143.001.005.001.005.03.142v.005l.002.006.03.141.002.005.001.005.033.142v.005l.002.005.035.14v.006l.002.005.036.14.002.005.001.005.038.14.001.005.002.005.04.14v.005l.002.005.042.138.001.006.002.005.042.138.002.005.002.005.017.054.064.148.09.134.114.114.132.092.148.065.157.037.16.007.16-.023.153-.052.14-.08.123-.104.102-.125.076-.142.049-.153.02-.16-.011-.161-.031-.13-.017-.051-.039-.126-.038-.13-.037-.128-.035-.13-.033-.128-.033-.134-.03-.13-.029-.131-.026-.13-.026-.133-.024-.133-.023-.133-.02-.132-.02-.136-.017-.132-.016-.135-.014-.135-.012-.133-.012-.138-.009-.133-.007-.136-.006-.138-.004-.134-.003-.136v-.274l.003-.136.004-.134.006-.139.007-.136.01-.133.01-.138.013-.132.014-.135.016-.135.017-.132.02-.137.02-.13.023-.134.024-.133.024-.126.016-.16-.014-.161-.044-.155-.072-.145-.098-.128-.12-.108-.137-.084-.15-.057-.16-.029zm26.698 1.601l-.161.01-.157.04-.146.067-.131.093-.112.117-.088.135-.061.149-.033.157-.005.134.006.14.006.176.003.177.001.178-.001.177-.003.178-.006.177-.007.176-.01.177-.012.176-.015.176-.016.173-.018.175-.02.175-.024.174-.025.175-.026.17-.03.174-.03.173-.033.17-.036.172-.037.17-.04.17-.042.172-.043.168-.045.166-.048.169-.05.167-.052.168-.053.164-.056.166-.058.166-.06.16-.062.165-.062.158-.066.165-.068.16-.07.16-.07.158-.075.159-.074.155-.079.158-.08.158-.06.15-.03.158-.001.161.029.159.058.15.085.137.108.119.13.097.144.07.156.044.16.013.16-.017.155-.046.143-.074.127-.1.107-.12.07-.115.083-.164.003-.005.002-.004.082-.166.002-.005.003-.004.08-.167.002-.005.002-.004.078-.168.002-.005.002-.004.076-.169.002-.004.002-.005.074-.17.002-.004.002-.005.072-.17.002-.005.002-.005.07-.171.001-.005.002-.005.068-.172.002-.004.002-.005.065-.173.002-.005.002-.005.063-.173.002-.005.002-.005.06-.174.003-.005.001-.005.06-.175.001-.005.002-.005.057-.176.001-.005.002-.005.055-.177.001-.005.002-.005.052-.177.002-.005.001-.005.051-.178.001-.005.002-.005.048-.179.002-.005v-.005l.047-.179.001-.005.002-.005.044-.18v-.005l.002-.005.042-.18.001-.006.001-.005.04-.181.001-.005.001-.005.037-.182.002-.005v-.005l.036-.182v-.006l.002-.005.033-.182v-.006l.002-.005.03-.183.001-.005.001-.005.029-.184v-.005l.001-.006.027-.184v-.005l.001-.005.024-.185v-.005l.001-.005.022-.185v-.006l.001-.005.02-.185v-.006l.001-.005.017-.186v-.005l.001-.005.015-.187v-.005l.001-.005.013-.187v-.01l.01-.187.001-.006v-.005l.009-.187v-.011l.006-.187v-.011l.004-.188v-.011l.001-.188v-.01l-.001-.188v-.011l-.004-.188v-.011l-.006-.187v-.011l-.007-.145-.022-.16-.05-.152-.08-.141-.103-.124-.125-.102-.141-.077-.153-.05-.16-.02zM.938 15L.777 15l-.158.032-.15.06-.136.087-.117.11-.095.131-.068.146-.04.156-.012.133-.001.14v.01l.001.188v.011l.004.188v.011l.006.187v.011l.008.187v.011l.011.187v.005l.001.005.013.187v.01l.016.187v.01l.018.186v.011l.02.185.001.005v.006l.022.185.001.005v.005l.025.185v.005l.001.005.027.184v.006l.001.005.029.184v.005l.001.005.031.183.001.005.001.006.033.182.001.005.001.006.035.182.001.005.001.005.038.182v.005l.002.005.04.181v.005l.002.005.042.18.001.006.001.005.044.18.002.005v.005l.047.18.001.004.002.005.048.179.002.005.001.005.05.178.002.005.001.005.053.177.002.005.001.005.055.177.002.005.001.005.057.176.002.005.001.005.06.175.001.005.002.005.061.174.002.005.002.005.063.173.002.005.002.005.065.173.002.005.002.004.067.172.002.005.002.005.07.171.002.005.002.005.072.17.002.005.002.004.074.17.002.005.002.004.076.169.002.004.002.005.078.168.002.004.002.005.08.167.003.004.002.005.082.166.002.004.003.005.02.04.086.136.11.118.13.095.146.07.156.041.16.012.16-.019.155-.048.142-.075.126-.1.105-.123.08-.14.054-.152.024-.16-.006-.16-.036-.158-.051-.123-.018-.034-.078-.158L3.1 22.1l-.074-.16-.071-.157-.07-.16-.068-.16-.067-.165-.062-.158-.062-.164-.059-.161-.058-.166-.056-.166-.053-.164-.052-.168-.05-.167-.048-.17-.045-.165-.043-.168-.043-.172-.039-.17-.037-.17-.036-.172-.033-.17-.03-.173-.03-.174-.027-.17-.025-.175-.022-.174-.021-.175-.018-.175-.017-.173-.014-.176-.012-.176-.01-.177-.007-.176-.006-.177-.003-.178L1.73 16v-.134l-.013-.16-.044-.156-.072-.144-.097-.129-.12-.108-.137-.085-.15-.057L.938 15zm26.798 2.024l-.16.007-.157.038-.148.066-.132.092-.113.115-.09.134-.062.148-.03.127-.001.004-.023.134-.024.133-.026.133-.026.13-.03.132-.03.129-.032.134-.033.128-.035.13-.037.128-.038.13-.04.126-.04.128-.044.128-.044.126-.046.126-.048.126-.05.125-.05.125-.051.122-.054.123-.055.122-.056.12-.058.122-.06.12-.061.12-.063.119-.062.116-.067.119-.066.116-.069.115-.069.115-.07.113-.073.113-.074.112-.076.113-.077.112-.077.107-.08.11-.08.107-.085.11-.044.056-.088.135-.06.15-.033.158-.002.16.027.16.057.15.083.138.108.12.128.098.144.072.155.045.16.015.161-.016.155-.044.144-.073.128-.098.09-.099.05-.061.003-.004.003-.005.089-.115.003-.004.003-.005.088-.116.003-.004.003-.005.086-.117.003-.004.003-.005.084-.118.003-.004.003-.005.083-.12.003-.004.003-.004.081-.12.003-.005.003-.004.08-.121.003-.005.003-.004.078-.122.003-.005.003-.004.077-.123.002-.005.003-.004.075-.124.003-.005.003-.004.073-.125.003-.005.003-.004.072-.126.002-.004.003-.005.07-.126.003-.005.002-.005.07-.127.002-.004.002-.005.068-.128.002-.005.002-.004.066-.13.003-.004.002-.005.064-.13.002-.004.003-.005.062-.13.002-.005.003-.005.06-.13.003-.005.002-.005.06-.132.002-.005.002-.005.057-.132.003-.005.002-.005.056-.133.002-.005.002-.005.054-.134.002-.004.002-.005.053-.135.002-.005.002-.005.051-.135.002-.005.002-.005.05-.135.001-.005.002-.005.048-.137.001-.005.002-.005.046-.137.002-.005.002-.005.044-.137.002-.005.002-.005.042-.138.002-.005.001-.006.042-.138.001-.005.002-.005.04-.14V19.4l.002-.005.038-.14.001-.005.002-.005.036-.14.001-.005.001-.005.035-.141.001-.005.001-.005.033-.142.001-.005.001-.005.031-.141.001-.006.002-.005.029-.142v-.005l.002-.005.028-.143v-.005l.002-.005.025-.143.001-.006.001-.005.024-.143.001-.005.001-.006.001-.006.01-.161-.02-.16-.05-.154-.077-.141-.102-.125-.123-.104-.141-.079-.153-.051-.16-.022zM6.841 22.71l-.16.024-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.018.16.011.161.041.156.07.146.077.109.04.048.003.004.003.004.095.111.003.004.004.004.096.11.004.005.003.004.098.109.003.004.004.004.1.108.003.004.003.004.101.107.004.004.003.004.102.105.004.004.004.004.103.105.004.004.004.003.105.104.003.004.004.003.106.102.004.004.004.004.107.1.004.004.004.004.108.099.004.003.004.004.11.098.003.003.004.004.11.096.004.003.005.004.11.095.005.003.004.004.113.093.004.003.004.004.113.091.004.004.005.003.114.09.004.004.004.003.116.089.004.003.004.003.117.088.004.003.004.003.118.086.004.003.005.003.118.084.004.003.005.003.119.083.004.003.005.003.12.081.005.003.004.003.121.08.005.003.004.003.122.078.005.003.004.003.123.076.005.003.004.003.124.075.005.003.004.003.125.073.004.003.005.002.126.073.004.002.005.003.126.07.005.003.004.002.128.07.004.002.005.002.128.067.005.003.004.002.13.066.004.002.005.003.13.064.004.002.005.003.13.062.005.002.004.003.132.06.004.003.005.002.132.06.005.002.005.002.132.057.005.002.005.002.133.057.005.002.005.002.133.054.005.002.005.002.13.05.154.045.16.016.16-.015.156-.045.144-.072.128-.098.108-.12.083-.138.057-.15.028-.16-.003-.16-.032-.159-.061-.149-.088-.135-.11-.117-.132-.094-.12-.058-.124-.049-.126-.051-.122-.051-.122-.054-.12-.054-.126-.058-.119-.057-.12-.06-.12-.06-.118-.063-.117-.064-.119-.066-.116-.066-.115-.068-.115-.07-.113-.07-.115-.074-.112-.074-.11-.075-.11-.076-.112-.08-.11-.08-.109-.081-.106-.082-.104-.082-.106-.086-.105-.087-.101-.086-.105-.091-.1-.09-.1-.091-.1-.094-.097-.094-.1-.098-.093-.095-.096-.1-.093-.098-.092-.101-.089-.1-.09-.102-.088-.104-.036-.043-.114-.114-.133-.091-.148-.065-.157-.036-.161-.006zm15.063 2.701l-.16.014-.156.044-.12.057-.06.034-.12.066-.117.064-.118.062-.12.061-.12.06-.118.057-.126.058-.12.054-.122.054-.122.05-.126.052-.125.05-.124.046-.127.047-.125.044-.129.043-.126.04-.13.042-.128.038-.127.035-.13.036-.131.034-.129.031-.132.03-.13.03-.135.027-.133.026-.13.023-.13.022-.137.021-.132.02-.134.017-.132.015-.138.015-.135.013-.133.01-.138.01-.136.007-.134.006-.136.004-.14.003-.16.018-.155.047-.142.076-.127.1-.105.122-.08.14-.054.151-.025.16.006.16.035.158.064.148.09.134.114.114.133.092.147.065.157.036.134.008.145-.002h.011l.147-.005h.01l.147-.007h.011l.146-.009h.011l.146-.01h.005l.005-.001.146-.012h.011l.145-.014h.005l.006-.001.145-.016h.011l.144-.018h.006l.005-.001.144-.02h.011l.144-.021.005-.001h.006l.143-.023.006-.001h.005l.143-.025h.005l.006-.002.143-.026h.005l.005-.002.143-.027.005-.001.005-.001.142-.03h.005l.005-.002.142-.03.005-.002.005-.001.142-.033.005-.001.005-.001.14-.035.006-.001.005-.001.14-.037h.005l.005-.002.14-.038.005-.002h.005l.14-.04.005-.002.005-.001.138-.042.005-.001.006-.002.138-.043.005-.001.005-.002.137-.044.005-.002.005-.002.137-.046.005-.002.005-.001.137-.048.005-.002.005-.002.135-.05.005-.001.005-.002.135-.051.005-.002.005-.002.135-.053.005-.002.004-.002.134-.054.005-.002.005-.002.133-.057.005-.002.005-.002.132-.057.005-.003.005-.002.132-.06.005-.001.004-.002.131-.061.005-.003.005-.002.13-.062.005-.003.005-.002.13-.064.004-.003.005-.002.128-.066.005-.002.005-.003.128-.067.005-.002.004-.003.127-.069.005-.002.005-.003.126-.07.005-.003.004-.003.065-.037.132-.093.112-.115.089-.135.062-.149.034-.157.003-.161-.026-.16-.055-.15-.082-.14-.107-.12-.127-.1-.144-.073-.154-.046-.16-.016zM6.33 26.818l-.16.023-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.02.16.012.161.041.156.07.146.094.13.096.093.032.026.004.003.004.004.145.117.004.003.004.004.146.115.005.003.004.004.147.113.005.003.004.004.149.111.004.003.004.003.15.11.005.003.004.003.151.108.004.003.005.003.152.106.005.003.004.003.154.104.004.003.005.003.154.102.005.002.004.003.156.1.005.003.004.003.157.098.005.003.004.002.159.096.004.003.005.003.16.094.004.003.004.002.16.092.005.003.005.002.161.09.005.003.005.002.162.088.005.003.004.002.164.086.005.003.004.002.165.084.005.003.004.002.166.082.004.002.005.003.167.08.004.002.005.002.168.078.004.002.005.002.168.076.005.002.005.002.17.074.004.002.005.002.17.072.005.002.005.002.17.07.006.002.005.001.171.068.005.002.005.002.173.065.005.002.005.002.173.063.005.002.005.002.174.06.005.003.005.001.175.06.005.001.005.002.176.057.005.001.005.002.176.055.006.001.005.002.177.052.005.002.005.001.178.05.005.002.005.002.178.048.006.001.005.002.179.046.005.001.005.002.18.044h.005l.005.002.18.042.006.001.005.001.159.035.16.02.16-.01.157-.04.146-.069.13-.094.112-.117.087-.136.06-.149.033-.158.002-.161-.028-.159-.057-.15-.084-.138-.108-.12-.128-.098-.144-.072-.128-.039-.154-.033-.168-.04-.171-.041-.17-.044-.168-.046-.167-.047-.168-.05-.165-.051-.166-.054-.166-.056-.163-.057-.165-.06-.161-.062-.164-.064-.16-.065-.16-.068-.162-.07-.157-.07-.157-.074-.157-.075-.156-.077-.153-.079-.156-.082-.153-.082-.154-.086-.15-.086-.152-.09-.148-.09-.147-.092-.149-.095-.145-.095-.144-.098-.145-.1-.143-.102-.14-.103-.14-.104-.14-.108-.139-.11-.136-.11-.027-.022-.133-.091-.148-.065-.157-.036-.161-.006zm19.215.087l-.16.01-.157.039-.146.067-.11.076-.064.051-.139.11-.14.108-.14.104-.14.103-.143.101-.145.101-.144.098-.145.095-.149.095-.148.093-.147.089-.152.09-.15.086-.154.086-.153.082-.156.082-.153.079-.156.077-.157.075-.158.073-.157.071-.16.07-.16.068-.161.065-.164.064-.161.061-.165.06-.163.058-.166.056-.166.054-.166.051-.167.05-.167.047-.17.046-.168.044-.171.042-.168.039-.17.037-.11.023-.154.047-.143.075-.126.1-.106.122-.081.139-.054.152-.025.16.006.16.035.158.063.148.09.133.114.115.132.092.148.065.157.037.16.007.133-.016.115-.024.005-.001.005-.001.181-.04h.005l.005-.002.18-.042.006-.001.005-.001.18-.044.005-.002.005-.001.18-.046.004-.002h.005l.179-.05h.005l.005-.002.178-.05.005-.002.005-.002.177-.052.005-.002.005-.001.177-.055.005-.002.005-.001.176-.057.005-.002.005-.002.175-.059.005-.001.005-.002.174-.061.005-.002.005-.002.173-.063.005-.002.005-.002.173-.065.004-.002.005-.002.172-.068.005-.002.005-.002.171-.07.005-.001.005-.002.17-.072.005-.002.004-.002.17-.074.005-.002.004-.002.169-.076.004-.002.005-.002.168-.078.004-.002.005-.003.167-.08.004-.002.005-.002.166-.082.004-.002.005-.003.165-.084.004-.002.005-.003.163-.086.005-.002.005-.003.162-.088.005-.002.005-.003.161-.09.005-.002.004-.003.16-.092.005-.003.005-.002.16-.094.004-.003.004-.003.158-.096.005-.002.004-.003.158-.098.004-.003.005-.003.156-.1.004-.003.004-.003.155-.101.005-.003.004-.003.154-.104.004-.003.004-.003.153-.106.004-.003.005-.003.151-.108.004-.003.005-.003.15-.11.004-.003.004-.003.149-.112.004-.003.004-.003.148-.113.004-.004.004-.003.147-.115.004-.004.004-.003.068-.055.116-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.05-.153-.08-.14-.103-.125-.124-.102-.142-.077-.153-.05-.16-.02z" +}))); + +function _extends$L() { _extends$L = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$L.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$L({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M23.637 13.902l-7.625-5.535-7.624 5.535 2.912 8.956h9.425l2.912-8.956zm-1.017.33l-2.524 7.762H11.93l-2.524-7.762 6.607-4.796 6.608 4.796zM16.012.311c-1.448.02-2.93.157-4.302.628-.852.447-.255 1.863.66 1.574 2.255-.608 4.648-.607 6.922-.108.934.075 1.228-1.376.338-1.67C18.451.44 17.227.317 16.012.311zm9.012 2.934c-.913-.104-1.272 1.258-.454 1.648 1.834 1.36 3.293 3.185 4.31 5.22.526.776 1.842.098 1.515-.78a15.522 15.522 0 00-5.06-6.006c-.1-.044-.203-.07-.31-.082zM6.65 3.59c-.762.089-1.24.809-1.805 1.267C3.38 6.295 2.163 8.007 1.37 9.905c-.266.898 1.094 1.484 1.564.675a14.825 14.825 0 014.327-5.56c.476-.515.09-1.419-.612-1.431zm9.362.007c-.698.066-1.689-.16-2.033.635-.282.733.535 1.358 1.217 1.125 1.806-.147 3.63.203 5.293.907.902.255 1.472-1.112.656-1.573-1.6-.735-3.374-1.089-5.133-1.094zm-5.479 1.365c-.835.15-1.517.76-2.21 1.226-1.203.94-2.318 2.061-3.057 3.402-.33.904 1.063 1.552 1.547.723 1.045-1.656 2.596-2.925 4.285-3.873.545-.499.171-1.463-.565-1.478zm13.903 2.115c-.875-.07-1.22 1.173-.501 1.627 1.325 1.34 2.188 3.062 2.748 4.84.468.84 1.869.21 1.557-.699-.604-2.118-1.751-4.097-3.351-5.615a.93.93 0 00-.453-.153zM4.467 13.132c-.822-.07-.996.826-1.046 1.455-.256 1.93-.094 3.933.562 5.769.406.844 1.807.365 1.612-.551a11.498 11.498 0 01-.334-5.808.874.874 0 00-.794-.865zm26.687 1.6c-.746-.037-1.014.785-.879 1.395.043 2.393-.57 4.771-1.66 6.894-.31.884 1.02 1.536 1.53.75a15.632 15.632 0 001.821-8.372.876.876 0 00-.812-.667zm-30.197.571c-.782-.073-1.044.775-.933 1.404.068 2.414.661 4.833 1.809 6.962.534.77 1.842.076 1.505-.798a14.833 14.833 0 01-1.603-6.861.876.876 0 00-.778-.707zm26.787 2.024c-.777-.048-.952.797-1.021 1.392-.354 1.692-1.202 3.231-2.216 4.608-.407.872.925 1.638 1.48.852 1.361-1.733 2.296-3.827 2.582-6.017a.874.874 0 00-.825-.835zM6.857 23.012c-.808.018-1.082 1.122-.47 1.59 1.393 1.607 3.187 2.886 5.194 3.599.91.222 1.43-1.165.598-1.596a11.495 11.495 0 01-4.723-3.396.899.899 0 00-.599-.197zm15.057 2.7c-.81.194-1.504.76-2.325.972-1.203.458-2.5.536-3.758.664-.869.307-.573 1.728.346 1.663 2.201-.034 4.412-.626 6.293-1.778.604-.495.227-1.532-.556-1.521zM6.346 27.118c-.833.008-1.11 1.218-.395 1.617 1.986 1.602 4.358 2.749 6.868 3.226.933.076 1.227-1.376.338-1.67a14.838 14.838 0 01-6.345-3.066.929.929 0 00-.466-.107zm19.208.087c-.766.09-1.241.841-1.922 1.158-1.516.991-3.251 1.58-4.996 2.005-.872.405-.346 1.849.584 1.604 2.543-.526 4.98-1.66 6.963-3.344.47-.52.072-1.42-.63-1.423z" +}))); + +function _extends$K() { _extends$K = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$K.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingParallelIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$K({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M13.51 9.081v4.428H9.08v4.982h4.428v4.428h4.982V18.49h4.428v-4.982H18.49V9.081h-4.982zm.83.83h3.32v4.428h4.429v3.322H17.66v4.428h-3.32v-4.454H9.91v-3.296h4.428V9.911zM16 0h-.005l-.188.001h-.011l-.188.004h-.011l-.187.006h-.011l-.187.008h-.005L15.2.02l-.187.01h-.005l-.005.001-.187.013h-.011L14.62.06h-.01l-.186.018h-.011l-.185.02-.005.001h-.006l-.185.022-.005.001h-.005l-.185.025h-.005l-.005.001-.185.027h-.005l-.005.001-.184.029h-.005l-.005.001-.183.031-.006.001-.005.001-.182.033-.006.001-.005.001-.182.035-.005.001-.005.001-.182.038h-.005l-.005.002-.181.04h-.005l-.005.002-.18.042-.006.001-.005.001-.18.044-.005.002h-.005l-.17.045-.152.054-.139.082-.121.106-.1.127-.074.143-.046.155-.017.16.013.16.043.156.07.145.097.13.119.108.137.085.15.058.159.03.16-.001.133-.023.165-.043.168-.041.171-.04.171-.037.172-.036.17-.033.173-.03.17-.03.177-.027.171-.025.175-.022.175-.02.175-.02.176-.016.175-.014.177-.012.176-.01.177-.007.174-.006.177-.003L16 1.73h.177l.178.004.174.006.177.007.176.01.177.012.175.014.176.017.175.018.175.02.175.023.171.025.176.027.17.03.174.03.17.033.171.036.154.033.16.02.161-.01.156-.04.146-.069.131-.094.111-.117.087-.135.061-.15.032-.158.002-.16-.027-.16-.057-.15L20 .714l-.108-.12-.128-.097-.145-.073-.128-.038-.158-.035-.005-.001-.005-.001L19.14.31h-.005l-.005-.002-.182-.035h-.006l-.005-.002-.182-.033h-.006l-.005-.002-.183-.03-.005-.001-.006-.001-.183-.029h-.005l-.006-.001-.184-.027h-.005l-.005-.001-.185-.024h-.005L17.968.12 17.783.1l-.006-.001h-.005l-.185-.02h-.006l-.005-.001L17.39.06h-.005L17.38.06l-.187-.015h-.005l-.005-.001-.187-.013h-.011L16.8.02h-.011L16.6.01h-.011l-.187-.006h-.011L16.204 0h-.011L16.005 0H16zm9.015 2.935l-.16.004-.158.033-.15.062-.134.09-.116.111-.093.132-.067.147-.038.156-.01.161.022.16.05.153.078.141.103.124.102.087.045.034.142.106.137.105.14.11.136.11.135.112.134.115.134.117.13.115.132.122.128.12.127.122.126.125.124.126.124.128.121.13.118.128.118.132.117.133.113.134.113.136.11.136.109.137.109.142.104.14.103.14.101.142.1.144.099.146.095.145.094.147.093.15.092.15.087.149.087.15.084.152.084.155.08.152.08.155.04.081.084.138.11.119.128.096.145.072.155.043.16.013.16-.016.155-.046.144-.074.127-.099.106-.12.083-.14.055-.151.026-.16-.004-.16-.034-.158-.05-.124-.042-.085-.002-.004-.003-.005-.084-.165-.002-.004-.003-.005-.086-.164-.002-.004-.003-.005-.088-.162-.002-.005-.003-.005-.09-.161-.002-.005-.003-.004-.092-.16-.003-.005-.002-.005-.094-.16-.003-.004-.003-.004-.096-.159-.002-.004-.003-.005-.098-.157-.003-.004-.003-.005-.1-.156-.003-.004-.003-.005-.101-.154-.003-.005-.003-.004-.104-.154-.003-.004-.003-.005-.106-.152-.003-.005-.003-.004-.108-.151-.003-.004-.003-.005-.11-.15-.003-.004-.003-.004-.111-.15-.004-.003-.003-.005-.113-.147-.004-.004-.003-.005-.115-.146-.004-.004-.003-.004-.117-.145-.004-.004-.003-.004-.12-.144-.003-.004-.003-.004-.121-.142-.004-.004-.003-.004-.123-.141-.003-.004-.004-.004-.125-.14-.003-.004-.004-.004-.127-.138-.003-.004-.004-.004-.128-.136-.004-.004-.004-.004-.13-.135-.004-.004-.004-.004-.132-.134-.003-.004-.004-.003-.134-.133-.004-.003-.004-.004-.135-.13-.004-.004-.004-.004-.136-.128-.004-.004-.004-.004-.138-.126-.004-.004-.004-.003-.14-.125-.004-.004-.004-.003-.14-.123-.005-.004-.004-.003-.142-.121-.004-.004-.004-.003-.144-.12-.004-.003-.004-.003-.145-.117-.004-.004-.004-.003-.147-.115-.004-.004-.004-.003-.148-.113-.004-.003-.004-.004-.149-.111-.004-.003-.004-.004-.05-.036-.14-.083-.15-.055-.16-.027zM6.634 3.28l-.161.008-.157.037-.147.066-.111.074-.04.032-.005.003-.004.004-.145.117-.004.003-.004.004-.144.119-.004.003-.004.004-.142.12-.004.004-.004.004-.141.123-.004.003-.004.004-.14.125-.004.003-.004.004-.138.126-.004.004-.004.004-.136.128-.004.004-.004.004-.135.13-.004.004-.004.003-.134.133-.004.003-.004.004-.132.134-.003.004-.004.004-.13.135-.004.004-.004.004-.128.136-.004.004-.004.004-.126.138-.004.004-.003.004-.125.14-.004.004-.003.004-.123.14-.004.005-.003.004-.121.142-.004.004-.003.004-.12.144-.003.004-.003.004-.117.145-.004.004-.003.004-.115.146-.004.005-.003.004-.113.147-.003.005-.004.004-.111.149-.003.004-.004.004-.11.15-.002.005-.003.004-.108.151-.003.004-.003.005-.106.152-.003.005-.003.004-.104.154-.003.004-.003.005-.102.154-.003.005-.002.004-.1.156-.003.005-.003.004-.098.157-.003.005-.003.004-.096.159-.002.004-.003.005-.094.16-.003.004-.002.004-.092.16-.003.005-.003.005-.09.161-.002.005-.003.005-.088.162-.002.005-.003.004-.086.164-.002.005-.002.004-.084.165-.003.005-.002.004-.082.166-.002.004-.003.005-.08.167-.002.004-.002.005-.078.168-.002.004-.002.005-.045.1-.053.153-.023.16.007.16.037.157.065.148.092.132.114.114.134.09.148.064.157.035.161.006.16-.025.152-.054.14-.08.121-.106.1-.126.065-.118.043-.095.074-.16.075-.155.077-.157.08-.155.08-.152.083-.155.085-.152.086-.15.088-.149.091-.15.094-.15.094-.147.095-.145.099-.146.1-.144.1-.142.104-.14.104-.14.11-.142.107-.137.11-.136.114-.136.113-.134.117-.133.118-.132.117-.129.122-.13.124-.127.123-.126.127-.125.127-.122.128-.12.132-.122.13-.115.133-.117.135-.115.135-.111.136-.11.037-.03.117-.11.094-.132.068-.146.04-.156.01-.161-.02-.16-.05-.154-.076-.141-.102-.125-.123-.104-.14-.08-.153-.051-.16-.023zM16 3.286h-.005l-.148.001h-.01l-.147.003h-.011l-.147.005h-.011l-.146.007h-.011l-.146.009h-.011l-.146.01h-.005l-.005.001-.146.012h-.011l-.145.014h-.006l-.005.001-.05.006-.158.031-.15.06-.135.088-.117.111-.094.13-.069.147-.04.156-.01.16.019.16.049.154.076.142.102.125.123.105.14.08.152.051.16.023.134-.003.045-.005.135-.013.133-.01.136-.01.135-.007.137-.006.136-.004.136-.003h.274l.136.003.136.004.136.006.136.007.136.01.133.01.135.013.135.014.135.016.134.018.132.018.134.021.133.023.133.024.133.025.13.027.132.03.132.03.129.031.13.034.129.035.129.036.13.04.126.038.128.042.126.042.128.045.127.047.126.047.12.048.127.051.123.052.006.002.147.048.16.021.16-.009.157-.038.147-.067.131-.093.112-.116.089-.135.062-.149.033-.158.004-.16-.027-.16-.055-.151-.083-.139-.107-.12-.127-.099-.118-.063-.004-.001-.005-.003-.005-.002-.133-.056-.005-.002-.005-.002-.134-.054-.004-.002-.005-.002-.135-.053-.005-.002-.005-.002-.135-.051-.005-.002-.005-.002-.135-.05-.005-.001-.005-.002-.137-.048-.005-.001-.005-.002-.137-.046-.005-.002-.005-.002-.137-.044-.005-.002-.005-.001-.138-.043-.006-.002-.005-.001-.138-.042-.005-.001-.005-.002-.14-.04H19.4l-.005-.002-.14-.038-.005-.001-.005-.002-.14-.036-.005-.001-.005-.001-.141-.035-.005-.001-.005-.001-.142-.033-.005-.001-.005-.001-.142-.031-.005-.002h-.005l-.142-.03-.005-.001-.005-.001-.143-.028h-.005l-.005-.002-.143-.025-.006-.001-.005-.001-.143-.024-.005-.001-.006-.001-.143-.022-.006-.001h-.005l-.144-.022h-.005l-.006-.001-.144-.019h-.005l-.006-.001-.144-.017h-.006l-.005-.001-.145-.016h-.011l-.145-.014H17.1l-.005-.001-.146-.012h-.01l-.146-.01-.006-.001h-.005l-.146-.009h-.011l-.147-.006h-.01l-.147-.005h-.011l-.147-.003h-.011l-.147-.001H16zm-5.482 1.366l-.16.008-.157.037-.123.053-.06.032-.005.002-.004.003-.128.069-.004.002-.005.003-.126.07-.005.003-.004.002-.126.072-.005.003-.004.003-.125.073-.004.003-.005.003-.124.075-.004.003-.005.002-.123.077-.004.003-.005.003-.122.078-.004.003-.005.003-.121.08-.004.002-.005.003-.12.082-.005.003-.004.003-.12.083-.004.003-.004.003-.118.084-.005.003-.004.003-.118.086-.004.003-.004.003-.117.088-.004.003-.004.003-.116.089-.004.003-.004.004-.114.09-.005.003-.004.003-.113.092-.004.004-.004.003-.113.093-.004.004-.004.003-.111.095-.005.003-.004.004-.11.096-.004.004-.004.003-.11.098-.003.003-.004.004-.108.1-.004.003-.004.003-.107.101-.004.004-.004.003-.106.102-.004.004-.003.004-.105.103-.004.004-.004.004-.103.105-.004.004-.004.003-.102.106-.003.004-.004.004-.1.107-.004.004-.004.004-.099.108-.004.004-.003.004-.098.11-.003.003-.004.004-.096.11-.004.005-.003.004-.095.111-.003.004-.004.004-.093.113-.003.004-.004.004-.092.113-.003.004-.003.005-.09.114-.004.004-.003.004-.089.116-.003.004-.003.004-.088.117-.003.004-.003.004-.086.118-.003.004-.003.005-.084.118-.003.004-.003.005-.083.12-.003.003-.003.005-.082.12-.003.005-.002.004-.068.103-.076.142-.048.154-.018.16.011.161.041.156.07.146.095.13.117.11.136.086.15.06.158.03.162.002.158-.03.15-.057.138-.085.119-.109.082-.105.065-.099.075-.11.077-.113.077-.107.08-.11.08-.108.084-.108.083-.105.086-.106.086-.104.088-.104.089-.101.09-.102.093-.101.093-.099.094-.097.095-.096.098-.097.098-.095.099-.093.1-.092.103-.091.101-.089.104-.088.104-.086.106-.086.106-.083.106-.082.109-.082.108-.079.11-.078.11-.076.112-.076.112-.074.113-.072.113-.071.115-.07.115-.068.118-.067.117-.065.12-.065.054-.029.135-.088.116-.111.094-.132.068-.146.04-.156.009-.161-.02-.16-.05-.153-.078-.142-.102-.125-.123-.103-.141-.079-.153-.051-.16-.022zm13.91 2.116l-.162.008-.157.037-.147.066-.132.092-.113.116-.09.134-.063.148-.034.157-.005.162.025.159.055.152.082.138.086.103.09.09.094.098.092.099.093.1.091.103.089.101.088.104.086.104.086.106.083.105.083.108.08.108.081.11.077.107.077.112.075.111.075.114.072.113.071.113.07.114.068.118.067.115.065.118.064.117.062.117.061.121.059.119.059.122.056.121.054.12.055.125.051.123.051.125.048.123.048.127.047.126.044.125.043.128.042.129.039.126.038.13.022.076.058.15.085.137.11.119.129.096.145.07.155.043.16.013.161-.017.154-.046.144-.075.126-.1.106-.12.082-.14.055-.151.025-.16-.005-.16-.026-.132-.023-.082-.002-.005-.001-.005-.042-.139-.001-.005-.002-.005-.043-.138-.001-.005-.002-.005-.044-.137-.002-.005-.002-.005-.046-.137-.002-.005-.001-.005-.048-.137-.002-.005-.002-.005-.05-.135-.001-.005-.002-.005-.051-.135-.002-.005-.002-.005-.053-.135-.002-.005-.002-.005-.054-.133-.002-.005-.002-.005-.057-.133-.002-.005-.002-.005-.057-.132-.003-.005-.002-.005-.06-.132-.001-.005-.002-.004-.061-.132-.003-.004-.002-.005-.063-.13-.002-.005-.002-.005-.064-.13-.003-.004-.002-.005-.066-.129-.002-.004-.003-.005-.067-.128-.002-.005-.003-.004-.069-.128-.002-.004-.003-.005-.07-.126-.003-.005-.003-.004-.072-.126-.002-.005-.003-.004-.074-.125-.002-.004-.003-.005-.075-.124-.003-.004-.003-.005-.076-.123-.003-.004-.003-.005-.078-.122-.003-.004-.003-.005-.08-.121-.003-.004-.003-.005-.081-.12-.003-.005-.003-.004-.083-.12-.003-.004-.003-.004-.084-.118-.003-.005-.003-.004-.086-.118-.003-.004-.004-.004-.087-.117-.003-.004-.003-.004-.09-.116-.002-.004-.004-.004-.09-.114-.003-.005-.004-.004-.091-.113-.004-.004-.003-.004-.094-.113-.003-.004-.003-.004-.095-.111-.004-.004-.003-.004-.096-.11-.004-.005-.003-.004-.098-.11-.004-.003-.003-.004-.1-.108-.003-.004-.004-.004-.1-.107-.004-.004-.004-.004-.102-.106-.003-.003-.004-.004-.093-.095-.124-.103-.14-.08-.153-.05-.16-.023zM4.45 12.826l-.161.002-.158.032-.15.06-.135.088-.118.11-.094.131-.069.146-.035.129-.026.132v.005l-.002.005-.025.143-.001.005-.001.006-.024.143-.001.005-.001.006-.022.143-.001.006-.001.005-.02.144-.001.005-.001.005-.019.145v.005l-.001.006-.017.144v.006l-.001.005-.016.145v.011l-.014.145v.005l-.001.006-.012.146v.01l-.01.146-.001.006v.005l-.009.146v.011l-.007.146v.011l-.004.147v.011l-.003.147v.01l-.002.148v.01l.001.148v.01l.003.147v.011l.005.147v.01l.007.147v.011l.009.146v.011l.01.146v.01l.013.146v.011l.014.145v.005l.001.006.016.145v.011l.018.144v.006l.001.005.019.144v.006l.001.005.021.144v.005l.002.006.022.143v.006l.002.005.024.143v.005l.002.006.025.143.001.005.001.005.028.143.001.005.001.005.03.142v.005l.002.006.03.141.002.005.001.005.033.142v.005l.002.005.035.14v.006l.002.005.036.14.002.005.001.005.038.14.001.005.002.005.04.14v.005l.002.005.042.138.001.006.002.005.042.138.002.005.002.005.017.054.064.148.09.134.114.114.132.092.148.065.157.037.16.007.16-.023.153-.052.14-.08.123-.104.102-.125.076-.142.049-.153.02-.16-.011-.161-.031-.13-.017-.051-.039-.126-.038-.13-.037-.128-.035-.13-.033-.128-.033-.134-.03-.13-.029-.131-.026-.13-.026-.133-.024-.133-.023-.133-.02-.132-.02-.136-.017-.132-.016-.135-.014-.135-.012-.133-.012-.138-.009-.133-.007-.136-.006-.138-.004-.134-.003-.136v-.274l.003-.136.004-.134.006-.139.007-.136.01-.133.01-.138.013-.132.014-.135.016-.135.017-.132.02-.137.02-.13.023-.134.024-.133.024-.126.016-.16-.014-.161-.044-.155-.072-.145-.098-.128-.12-.108-.137-.084-.15-.057-.16-.029zm26.698 1.601l-.161.01-.157.04-.146.067-.131.093-.112.117-.088.135-.061.149-.033.157-.005.134.006.14.006.176.003.177.001.178-.001.177-.003.178-.006.177-.007.176-.01.177-.012.176-.015.176-.016.173-.018.175-.02.175-.024.174-.025.175-.026.17-.03.174-.03.173-.033.17-.036.172-.037.17-.04.17-.042.172-.043.168-.045.166-.048.169-.05.167-.052.168-.053.164-.056.166-.058.166-.06.16-.062.165-.062.158-.066.165-.068.16-.07.16-.07.158-.075.159-.074.155-.079.158-.08.158-.06.15-.03.158-.001.161.029.159.058.15.085.137.108.119.13.097.144.07.156.044.16.013.16-.017.155-.046.143-.074.127-.1.107-.12.07-.115.083-.164.003-.005.002-.004.082-.166.002-.005.003-.004.08-.167.002-.005.002-.004.078-.168.002-.005.002-.004.076-.169.002-.004.002-.005.074-.17.002-.004.002-.005.072-.17.002-.005.002-.005.07-.171.001-.005.002-.005.068-.172.002-.004.002-.005.065-.173.002-.005.002-.005.063-.173.002-.005.002-.005.06-.174.003-.005.001-.005.06-.175.001-.005.002-.005.057-.176.001-.005.002-.005.055-.177.001-.005.002-.005.052-.177.002-.005.001-.005.051-.178.001-.005.002-.005.048-.179.002-.005v-.005l.047-.179.001-.005.002-.005.044-.18v-.005l.002-.005.042-.18.001-.006.001-.005.04-.181.001-.005.001-.005.037-.182.002-.005v-.005l.036-.182v-.006l.002-.005.033-.182v-.006l.002-.005.03-.183.001-.005.001-.005.029-.184v-.005l.001-.006.027-.184v-.005l.001-.005.024-.185v-.005l.001-.005.022-.185v-.006l.001-.005.02-.185v-.006l.001-.005.017-.186v-.005l.001-.005.015-.187v-.005l.001-.005.013-.187v-.01l.01-.187.001-.006v-.005l.009-.187v-.011l.006-.187v-.011l.004-.188v-.011l.001-.188v-.01l-.001-.188v-.011l-.004-.188v-.011l-.006-.187v-.011l-.007-.145-.022-.16-.05-.152-.08-.141-.103-.124-.125-.102-.141-.077-.153-.05-.16-.02zM.938 15L.777 15l-.158.032-.15.06-.136.087-.117.11-.095.131-.068.146-.04.156-.012.133-.001.14v.01l.001.188v.011l.004.188v.011l.006.187v.011l.008.187v.011l.011.187v.005l.001.005.013.187v.01l.016.187v.01l.018.186v.011l.02.185.001.005v.006l.022.185.001.005v.005l.025.185v.005l.001.005.027.184v.006l.001.005.029.184v.005l.001.005.031.183.001.005.001.006.033.182.001.005.001.006.035.182.001.005.001.005.038.182v.005l.002.005.04.181v.005l.002.005.042.18.001.006.001.005.044.18.002.005v.005l.047.18.001.004.002.005.048.179.002.005.001.005.05.178.002.005.001.005.053.177.002.005.001.005.055.177.002.005.001.005.057.176.002.005.001.005.06.175.001.005.002.005.061.174.002.005.002.005.063.173.002.005.002.005.065.173.002.005.002.004.067.172.002.005.002.005.07.171.002.005.002.005.072.17.002.005.002.004.074.17.002.005.002.004.076.169.002.004.002.005.078.168.002.004.002.005.08.167.003.004.002.005.082.166.002.004.003.005.02.04.086.136.11.118.13.095.146.07.156.041.16.012.16-.019.155-.048.142-.075.126-.1.105-.123.08-.14.054-.152.024-.16-.006-.16-.036-.158-.051-.123-.018-.034-.078-.158L3.1 22.1l-.074-.16-.071-.157-.07-.16-.068-.16-.067-.165-.062-.158-.062-.164-.059-.161-.058-.166-.056-.166-.053-.164-.052-.168-.05-.167-.048-.17-.045-.165-.043-.168-.043-.172-.039-.17-.037-.17-.036-.172-.033-.17-.03-.173-.03-.174-.027-.17-.025-.175-.022-.174-.021-.175-.018-.175-.017-.173-.014-.176-.012-.176-.01-.177-.007-.176-.006-.177-.003-.178L1.73 16v-.134l-.013-.16-.044-.156-.072-.144-.097-.129-.12-.108-.137-.085-.15-.057L.938 15zm26.798 2.024l-.16.007-.157.038-.148.066-.132.092-.113.115-.09.134-.062.148-.03.127-.001.004-.023.134-.024.133-.026.133-.026.13-.03.132-.03.129-.032.134-.033.128-.035.13-.037.128-.038.13-.04.126-.04.128-.044.128-.044.126-.046.126-.048.126-.05.125-.05.125-.051.122-.054.123-.055.122-.056.12-.058.122-.06.12-.061.12-.063.119-.062.116-.067.119-.066.116-.069.115-.069.115-.07.113-.073.113-.074.112-.076.113-.077.112-.077.107-.08.11-.08.107-.085.11-.044.056-.088.135-.06.15-.033.158-.002.16.027.16.057.15.083.138.108.12.128.098.144.072.155.045.16.015.161-.016.155-.044.144-.073.128-.098.09-.099.05-.061.003-.004.003-.005.089-.115.003-.004.003-.005.088-.116.003-.004.003-.005.086-.117.003-.004.003-.005.084-.118.003-.004.003-.005.083-.12.003-.004.003-.004.081-.12.003-.005.003-.004.08-.121.003-.005.003-.004.078-.122.003-.005.003-.004.077-.123.002-.005.003-.004.075-.124.003-.005.003-.004.073-.125.003-.005.003-.004.072-.126.002-.004.003-.005.07-.126.003-.005.002-.005.07-.127.002-.004.002-.005.068-.128.002-.005.002-.004.066-.13.003-.004.002-.005.064-.13.002-.004.003-.005.062-.13.002-.005.003-.005.06-.13.003-.005.002-.005.06-.132.002-.005.002-.005.057-.132.003-.005.002-.005.056-.133.002-.005.002-.005.054-.134.002-.004.002-.005.053-.135.002-.005.002-.005.051-.135.002-.005.002-.005.05-.135.001-.005.002-.005.048-.137.001-.005.002-.005.046-.137.002-.005.002-.005.044-.137.002-.005.002-.005.042-.138.002-.005.001-.006.042-.138.001-.005.002-.005.04-.14V19.4l.002-.005.038-.14.001-.005.002-.005.036-.14.001-.005.001-.005.035-.141.001-.005.001-.005.033-.142.001-.005.001-.005.031-.141.001-.006.002-.005.029-.142v-.005l.002-.005.028-.143v-.005l.002-.005.025-.143.001-.006.001-.005.024-.143.001-.005.001-.006.001-.006.01-.161-.02-.16-.05-.154-.077-.141-.102-.125-.123-.104-.141-.079-.153-.051-.16-.022zM6.841 22.71l-.16.024-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.018.16.011.161.041.156.07.146.077.109.04.048.003.004.003.004.095.111.003.004.004.004.096.11.004.005.003.004.098.109.003.004.004.004.1.108.003.004.003.004.101.107.004.004.003.004.102.105.004.004.004.004.103.105.004.004.004.003.105.104.003.004.004.003.106.102.004.004.004.004.107.1.004.004.004.004.108.099.004.003.004.004.11.098.003.003.004.004.11.096.004.003.005.004.11.095.005.003.004.004.113.093.004.003.004.004.113.091.004.004.005.003.114.09.004.004.004.003.116.089.004.003.004.003.117.088.004.003.004.003.118.086.004.003.005.003.118.084.004.003.005.003.119.083.004.003.005.003.12.081.005.003.004.003.121.08.005.003.004.003.122.078.005.003.004.003.123.076.005.003.004.003.124.075.005.003.004.003.125.073.004.003.005.002.126.073.004.002.005.003.126.07.005.003.004.002.128.07.004.002.005.002.128.067.005.003.004.002.13.066.004.002.005.003.13.064.004.002.005.003.13.062.005.002.004.003.132.06.004.003.005.002.132.06.005.002.005.002.132.057.005.002.005.002.133.057.005.002.005.002.133.054.005.002.005.002.13.05.154.045.16.016.16-.015.156-.045.144-.072.128-.098.108-.12.083-.138.057-.15.028-.16-.003-.16-.032-.159-.061-.149-.088-.135-.11-.117-.132-.094-.12-.058-.124-.049-.126-.051-.122-.051-.122-.054-.12-.054-.126-.058-.119-.057-.12-.06-.12-.06-.118-.063-.117-.064-.119-.066-.116-.066-.115-.068-.115-.07-.113-.07-.115-.074-.112-.074-.11-.075-.11-.076-.112-.08-.11-.08-.109-.081-.106-.082-.104-.082-.106-.086-.105-.087-.101-.086-.105-.091-.1-.09-.1-.091-.1-.094-.097-.094-.1-.098-.093-.095-.096-.1-.093-.098-.092-.101-.089-.1-.09-.102-.088-.104-.036-.043-.114-.114-.133-.091-.148-.065-.157-.036-.161-.006zm15.063 2.701l-.16.014-.156.044-.12.057-.06.034-.12.066-.117.064-.118.062-.12.061-.12.06-.118.057-.126.058-.12.054-.122.054-.122.05-.126.052-.125.05-.124.046-.127.047-.125.044-.129.043-.126.04-.13.042-.128.038-.127.035-.13.036-.131.034-.129.031-.132.03-.13.03-.135.027-.133.026-.13.023-.13.022-.137.021-.132.02-.134.017-.132.015-.138.015-.135.013-.133.01-.138.01-.136.007-.134.006-.136.004-.14.003-.16.018-.155.047-.142.076-.127.1-.105.122-.08.14-.054.151-.025.16.006.16.035.158.064.148.09.134.114.114.133.092.147.065.157.036.134.008.145-.002h.011l.147-.005h.01l.147-.007h.011l.146-.009h.011l.146-.01h.005l.005-.001.146-.012h.011l.145-.014h.005l.006-.001.145-.016h.011l.144-.018h.006l.005-.001.144-.02h.011l.144-.021.005-.001h.006l.143-.023.006-.001h.005l.143-.025h.005l.006-.002.143-.026h.005l.005-.002.143-.027.005-.001.005-.001.142-.03h.005l.005-.002.142-.03.005-.002.005-.001.142-.033.005-.001.005-.001.14-.035.006-.001.005-.001.14-.037h.005l.005-.002.14-.038.005-.002h.005l.14-.04.005-.002.005-.001.138-.042.005-.001.006-.002.138-.043.005-.001.005-.002.137-.044.005-.002.005-.002.137-.046.005-.002.005-.001.137-.048.005-.002.005-.002.135-.05.005-.001.005-.002.135-.051.005-.002.005-.002.135-.053.005-.002.004-.002.134-.054.005-.002.005-.002.133-.057.005-.002.005-.002.132-.057.005-.003.005-.002.132-.06.005-.001.004-.002.131-.061.005-.003.005-.002.13-.062.005-.003.005-.002.13-.064.004-.003.005-.002.128-.066.005-.002.005-.003.128-.067.005-.002.004-.003.127-.069.005-.002.005-.003.126-.07.005-.003.004-.003.065-.037.132-.093.112-.115.089-.135.062-.149.034-.157.003-.161-.026-.16-.055-.15-.082-.14-.107-.12-.127-.1-.144-.073-.154-.046-.16-.016zM6.33 26.818l-.16.023-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.02.16.012.161.041.156.07.146.094.13.096.093.032.026.004.003.004.004.145.117.004.003.004.004.146.115.005.003.004.004.147.113.005.003.004.004.149.111.004.003.004.003.15.11.005.003.004.003.151.108.004.003.005.003.152.106.005.003.004.003.154.104.004.003.005.003.154.102.005.002.004.003.156.1.005.003.004.003.157.098.005.003.004.002.159.096.004.003.005.003.16.094.004.003.004.002.16.092.005.003.005.002.161.09.005.003.005.002.162.088.005.003.004.002.164.086.005.003.004.002.165.084.005.003.004.002.166.082.004.002.005.003.167.08.004.002.005.002.168.078.004.002.005.002.168.076.005.002.005.002.17.074.004.002.005.002.17.072.005.002.005.002.17.07.006.002.005.001.171.068.005.002.005.002.173.065.005.002.005.002.173.063.005.002.005.002.174.06.005.003.005.001.175.06.005.001.005.002.176.057.005.001.005.002.176.055.006.001.005.002.177.052.005.002.005.001.178.05.005.002.005.002.178.048.006.001.005.002.179.046.005.001.005.002.18.044h.005l.005.002.18.042.006.001.005.001.159.035.16.02.16-.01.157-.04.146-.069.13-.094.112-.117.087-.136.06-.149.033-.158.002-.161-.028-.159-.057-.15-.084-.138-.108-.12-.128-.098-.144-.072-.128-.039-.154-.033-.168-.04-.171-.041-.17-.044-.168-.046-.167-.047-.168-.05-.165-.051-.166-.054-.166-.056-.163-.057-.165-.06-.161-.062-.164-.064-.16-.065-.16-.068-.162-.07-.157-.07-.157-.074-.157-.075-.156-.077-.153-.079-.156-.082-.153-.082-.154-.086-.15-.086-.152-.09-.148-.09-.147-.092-.149-.095-.145-.095-.144-.098-.145-.1-.143-.102-.14-.103-.14-.104-.14-.108-.139-.11-.136-.11-.027-.022-.133-.091-.148-.065-.157-.036-.161-.006zm19.215.087l-.16.01-.157.039-.146.067-.11.076-.064.051-.139.11-.14.108-.14.104-.14.103-.143.101-.145.101-.144.098-.145.095-.149.095-.148.093-.147.089-.152.09-.15.086-.154.086-.153.082-.156.082-.153.079-.156.077-.157.075-.158.073-.157.071-.16.07-.16.068-.161.065-.164.064-.161.061-.165.06-.163.058-.166.056-.166.054-.166.051-.167.05-.167.047-.17.046-.168.044-.171.042-.168.039-.17.037-.11.023-.154.047-.143.075-.126.1-.106.122-.081.139-.054.152-.025.16.006.16.035.158.063.148.09.133.114.115.132.092.148.065.157.037.16.007.133-.016.115-.024.005-.001.005-.001.181-.04h.005l.005-.002.18-.042.006-.001.005-.001.18-.044.005-.002.005-.001.18-.046.004-.002h.005l.179-.05h.005l.005-.002.178-.05.005-.002.005-.002.177-.052.005-.002.005-.001.177-.055.005-.002.005-.001.176-.057.005-.002.005-.002.175-.059.005-.001.005-.002.174-.061.005-.002.005-.002.173-.063.005-.002.005-.002.173-.065.004-.002.005-.002.172-.068.005-.002.005-.002.171-.07.005-.001.005-.002.17-.072.005-.002.004-.002.17-.074.005-.002.004-.002.169-.076.004-.002.005-.002.168-.078.004-.002.005-.003.167-.08.004-.002.005-.002.166-.082.004-.002.005-.003.165-.084.004-.002.005-.003.163-.086.005-.002.005-.003.162-.088.005-.002.005-.003.161-.09.005-.002.004-.003.16-.092.005-.003.005-.002.16-.094.004-.003.004-.003.158-.096.005-.002.004-.003.158-.098.004-.003.005-.003.156-.1.004-.003.004-.003.155-.101.005-.003.004-.003.154-.104.004-.003.004-.003.153-.106.004-.003.005-.003.151-.108.004-.003.005-.003.15-.11.004-.003.004-.003.149-.112.004-.003.004-.003.148-.113.004-.004.004-.003.147-.115.004-.004.004-.003.068-.055.116-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.05-.153-.08-.14-.103-.125-.124-.102-.142-.077-.153-.05-.16-.02z", + opacity: ".98" +}))); + +function _extends$J() { _extends$J = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$J.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$J({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.012 8.816L9.21 21.026h13.606l-6.803-12.21zm0 1.776l5.332 9.57H10.681l5.331-9.57zm0-10.281c-1.448.02-2.93.157-4.302.628-.852.447-.255 1.863.66 1.574 2.255-.608 4.648-.607 6.922-.108.934.075 1.228-1.376.338-1.67C18.451.44 17.227.317 16.012.311zm9.012 2.934c-.913-.104-1.272 1.258-.454 1.648 1.834 1.36 3.293 3.185 4.31 5.22.526.776 1.842.098 1.515-.78a15.522 15.522 0 00-5.06-6.006c-.1-.044-.203-.07-.31-.082zM6.65 3.59c-.762.089-1.24.809-1.805 1.267C3.38 6.295 2.163 8.007 1.37 9.905c-.266.898 1.094 1.484 1.564.675a14.825 14.825 0 014.327-5.56c.476-.515.09-1.419-.612-1.431zm9.362.007c-.698.066-1.689-.16-2.033.635-.282.733.535 1.358 1.217 1.125 1.806-.147 3.63.203 5.293.907.902.255 1.472-1.112.656-1.573-1.6-.735-3.374-1.089-5.133-1.094zm-5.479 1.365c-.835.15-1.517.76-2.21 1.226-1.203.94-2.318 2.061-3.057 3.402-.33.904 1.063 1.552 1.547.723 1.045-1.656 2.596-2.925 4.285-3.873.545-.499.171-1.463-.565-1.478zm13.903 2.115c-.875-.07-1.22 1.173-.501 1.627 1.325 1.34 2.188 3.062 2.748 4.84.468.84 1.869.21 1.557-.699-.604-2.118-1.751-4.097-3.351-5.615a.93.93 0 00-.453-.153zM4.467 13.132c-.822-.07-.996.826-1.046 1.455-.256 1.93-.094 3.933.562 5.769.406.844 1.807.365 1.612-.551a11.498 11.498 0 01-.334-5.808.874.874 0 00-.794-.865zm26.687 1.6c-.746-.037-1.014.785-.879 1.395.043 2.393-.57 4.771-1.66 6.894-.31.884 1.02 1.536 1.53.75a15.632 15.632 0 001.821-8.372.876.876 0 00-.812-.667zm-30.197.571c-.782-.073-1.044.775-.933 1.404.068 2.414.661 4.833 1.809 6.962.534.77 1.842.076 1.505-.798a14.833 14.833 0 01-1.603-6.861.876.876 0 00-.778-.707zm26.787 2.024c-.777-.048-.952.797-1.021 1.392-.354 1.692-1.202 3.231-2.216 4.608-.407.872.925 1.638 1.48.852 1.361-1.733 2.296-3.827 2.582-6.017a.874.874 0 00-.825-.835zM6.857 23.012c-.808.018-1.082 1.122-.47 1.59 1.393 1.607 3.187 2.886 5.194 3.599.91.222 1.43-1.165.598-1.596a11.495 11.495 0 01-4.723-3.396.899.899 0 00-.599-.197zm15.057 2.7c-.81.194-1.504.76-2.325.972-1.203.458-2.5.536-3.758.664-.869.307-.573 1.728.346 1.663 2.201-.034 4.412-.626 6.293-1.778.604-.495.227-1.532-.556-1.521zM6.346 27.118c-.833.008-1.11 1.218-.395 1.617 1.986 1.602 4.358 2.749 6.868 3.226.933.076 1.227-1.376.338-1.67a14.838 14.838 0 01-6.345-3.066.929.929 0 00-.466-.107zm19.208.087c-.766.09-1.241.841-1.922 1.158-1.516.991-3.251 1.58-4.996 2.005-.872.405-.346 1.849.584 1.604 2.543-.526 4.98-1.66 6.963-3.344.47-.52.072-1.42-.63-1.423z" +}))); + +function _extends$I() { _extends$I = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$I.apply(this, arguments); } +var IntermediateEventCatchNonInterruptingTimerIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$I({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.998 8.406c-3.018-.041-5.92 1.926-7.031 4.727-1.138 2.695-.51 6.012 1.537 8.103 1.99 2.141 5.268 2.93 8.014 1.927 2.878-.98 4.992-3.827 5.068-6.87.153-2.957-1.624-5.88-4.3-7.137a7.552 7.552 0 00-3.288-.75zm0 1.384c2.759-.052 5.373 1.973 6.015 4.655.704 2.578-.482 5.517-2.791 6.867-2.358 1.48-5.682 1.086-7.618-.918-2.043-1.971-2.407-5.381-.84-7.745 1.11-1.763 3.15-2.88 5.234-2.86zm1.962 1.765l-2.074 3.762c-.64.068-.793 1.04-.202 1.3.39.27.696-.18 1.052-.165h3.17v-.865h-3.182l1.993-3.615c-.252-.14-.505-.278-.757-.417zm-1.965-8.268h-.158l-.147.003h-.011l-.147.005h-.011l-.146.007h-.011l-.146.009h-.011l-.146.01h-.005l-.005.001-.146.012h-.011l-.145.014h-.006l-.005.001-.05.006-.158.031-.15.06-.135.088-.117.111-.094.13-.069.147-.04.156-.01.16.019.16.049.154.076.142.102.125.123.105.14.08.152.051.16.023.134-.003.045-.005.135-.013.133-.01.136-.01.135-.007.137-.006.136-.004.136-.003h.274l.136.003.136.004.136.006.136.007.136.01.133.01.135.013.135.014.135.016.134.018.132.018.134.021.133.023.133.024.133.025.13.027.132.03.132.03.129.031.13.034.129.035.129.036.13.04.126.038.128.042.126.042.128.045.127.047.126.048.12.047.127.051.123.052.006.002.147.048.16.021.16-.009.157-.038.147-.067.131-.093.112-.116.089-.135.062-.149.033-.158.004-.16-.027-.16-.055-.151-.083-.138-.107-.121-.127-.099-.118-.063-.004-.001-.005-.003-.005-.002-.133-.056-.005-.002-.005-.002-.134-.054-.004-.002-.005-.002-.135-.053-.005-.002-.005-.002-.135-.051-.005-.002-.005-.002-.135-.05-.005-.001-.005-.002-.137-.048-.005-.001-.005-.002-.137-.046-.005-.002-.005-.002-.137-.044-.005-.002-.005-.001-.138-.043-.005-.002-.006-.001-.138-.042-.005-.001-.005-.002-.14-.04H19.4l-.005-.002-.14-.038-.005-.001-.005-.002-.14-.036-.005-.001-.005-.001-.141-.035-.005-.001-.005-.001-.142-.033-.005-.001-.005-.001-.141-.031-.006-.002h-.005l-.142-.03-.005-.001-.005-.001-.143-.028h-.005l-.005-.001-.143-.026-.006-.001-.005-.001-.143-.024-.005-.001-.006-.001-.143-.022-.006-.001h-.005l-.144-.022h-.005l-.006-.001-.144-.019h-.005l-.006-.001-.144-.017h-.006l-.005-.001-.145-.016h-.011l-.145-.014H17.1l-.005-.001-.146-.012h-.01l-.146-.01-.006-.001h-.005l-.146-.009h-.011l-.147-.006h-.01l-.147-.005h-.011l-.147-.003h-.01l-.148-.001h-.01zM10.357 4.66l-.156.037-.123.053-.06.032-.005.002-.004.003-.128.069-.004.002-.005.003-.126.07-.005.003-.004.002-.126.072-.005.003-.004.003-.125.073-.004.003-.005.003-.124.075-.004.003-.005.002-.123.077-.004.003-.005.003-.122.078-.004.003-.005.003-.121.08-.004.002-.005.003-.12.082-.005.003-.004.003-.12.083-.004.003-.004.003-.118.084-.005.003-.004.003-.118.086-.004.003-.004.003-.117.088-.004.003-.004.003-.116.089-.004.003-.004.004-.114.09-.005.003-.004.003-.113.092-.004.004-.004.003-.113.093-.004.004-.004.003-.111.095-.004.003-.005.004-.11.096-.004.004-.004.003-.109.098-.004.003-.004.004-.108.1-.004.003-.004.003-.107.101-.004.004-.004.003-.106.102-.003.004-.004.004-.105.103-.004.004-.004.004-.103.105-.004.004-.004.003-.102.106-.003.004-.004.004-.1.107-.004.004-.004.004-.099.108-.004.004-.003.004-.098.11-.003.003-.004.004-.096.11-.004.005-.003.004-.095.111-.003.004-.004.004-.093.113-.003.004-.004.004-.092.113-.003.004-.003.005-.09.114-.004.004-.003.004-.089.116-.003.004-.003.004-.088.117-.003.004-.003.005-.086.117-.003.004-.003.005-.084.118-.003.004-.003.005-.083.12-.003.003-.003.005-.082.12-.003.005-.002.004-.068.103-.076.142-.048.154-.018.16.011.161.041.156.07.146.095.13.117.11.136.086.15.06.158.03.162.002.158-.029.15-.058.138-.085.119-.108.082-.106.065-.099.075-.11.077-.113.077-.107.08-.11.08-.108.084-.108.083-.105.086-.106.086-.104.088-.104.089-.101.09-.102.093-.101.093-.099.094-.097.095-.096.098-.097.098-.095.099-.093.1-.092.103-.091.101-.089.104-.088.104-.086.106-.086.106-.083.106-.082.109-.082.108-.079.11-.078.11-.076.112-.076.112-.074.113-.072.113-.071.115-.07.115-.068.118-.067.117-.065.12-.065.054-.029.135-.088.116-.111.094-.132.068-.146.04-.156.009-.161-.02-.16-.05-.153-.078-.142-.102-.125-.123-.103-.141-.079-.153-.051-.16-.022-.16.008zm13.91 2.116l-.158.037-.147.066-.132.092-.113.116-.09.134-.063.148-.034.157-.005.162.026.159.054.152.082.139.086.102.09.09.094.098.093.099.092.1.091.103.089.101.088.104.086.104.086.106.083.105.083.108.08.108.081.11.077.107.077.112.075.111.075.114.072.113.071.113.07.115.068.117.067.115.065.118.064.117.062.118.061.12.059.119.059.122.056.121.054.12.055.125.051.123.051.125.048.123.049.127.046.126.044.125.043.128.042.129.039.126.038.13.022.076.058.15.086.137.109.119.129.096.145.07.155.043.16.013.161-.017.155-.046.143-.074.126-.1.106-.122.082-.138.055-.152.025-.16-.005-.16-.026-.132-.023-.082-.002-.005-.001-.005-.042-.139-.001-.005-.002-.005-.043-.138-.001-.005-.002-.005-.044-.137-.002-.005-.002-.005-.046-.137-.002-.005-.001-.005-.048-.137-.002-.005-.002-.005-.05-.135-.001-.005-.002-.005-.051-.135-.002-.005-.002-.005-.053-.135-.002-.005-.002-.005-.054-.133-.002-.005-.002-.005-.057-.133-.002-.005-.002-.005-.057-.132-.003-.005-.002-.005-.059-.132-.002-.005-.002-.004-.061-.132-.003-.004-.002-.005-.062-.13-.003-.005-.002-.005-.064-.13-.003-.004-.002-.005-.066-.129-.002-.004-.003-.005-.067-.128-.002-.005-.003-.004-.069-.128-.002-.004-.003-.005-.07-.126-.003-.005-.003-.004-.072-.126-.002-.005-.003-.004-.073-.125-.003-.004-.003-.005-.075-.124-.003-.004-.003-.005-.076-.123-.003-.004-.003-.005-.078-.122-.003-.004-.003-.005-.08-.121-.003-.004-.003-.005-.08-.12-.004-.005-.003-.004-.083-.12-.003-.004-.003-.004-.084-.118-.003-.005-.003-.004-.086-.117-.003-.005-.003-.004-.088-.117-.003-.004-.003-.004-.09-.116-.002-.004-.004-.004-.09-.114-.003-.005-.004-.004-.091-.113-.004-.004-.003-.004-.093-.113-.004-.004-.003-.004-.095-.111-.004-.004-.003-.004-.096-.11-.004-.005-.003-.004-.098-.109-.004-.004-.003-.004-.1-.108-.003-.004-.004-.004-.1-.107-.004-.004-.004-.004-.102-.106-.003-.003-.004-.004-.093-.095-.124-.103-.14-.08-.153-.05-.16-.023-.16.008zM4.288 12.828l-.158.032-.15.06-.135.088-.117.11-.095.131-.069.146-.035.129-.026.132v.005l-.002.005-.025.143-.001.005-.001.006-.024.143-.001.005-.001.006-.022.143-.001.006-.001.005-.02.144-.001.005-.001.006-.019.144v.005l-.001.006-.017.144v.006l-.001.005-.016.145v.011l-.014.145v.006l-.001.005-.012.146v.01l-.01.146-.001.006v.005l-.009.146v.011l-.007.146v.011l-.004.147v.011l-.003.147v.01l-.002.148v.01l.001.148v.01l.003.147v.011l.005.147v.01l.007.147v.011l.009.146v.011l.01.146v.01l.013.146v.011l.014.145v.005l.001.006.016.145v.011l.018.144v.006l.001.005.019.144v.006l.001.005.021.144v.005l.002.006.022.143v.006l.002.005.024.143v.005l.002.006.025.143.001.005.001.005.028.143.001.005.001.005.03.142v.005l.002.006.03.141.002.005.001.006.033.14v.006l.002.005.035.14v.006l.002.005.036.14.002.005.001.005.038.14.001.005.002.005.04.14v.005l.002.005.042.138.001.006.002.005.042.138.002.005.002.005.017.054.064.148.09.134.114.114.132.092.148.065.157.037.16.007.16-.023.153-.052.14-.08.123-.103.102-.126.076-.142.049-.153.02-.16-.01-.161-.032-.13-.017-.051-.039-.126-.038-.13-.037-.128-.035-.13-.033-.128-.033-.134-.03-.13-.029-.131-.026-.13-.026-.132-.024-.134-.023-.133-.02-.132-.02-.136-.017-.132-.016-.135-.014-.135-.012-.133-.012-.138-.009-.133-.007-.136-.006-.138-.004-.134-.003-.136v-.274l.003-.136.004-.134.006-.139.007-.136.01-.132.01-.139.013-.132.014-.135.016-.135.017-.132.02-.137.02-.13.023-.134.024-.133.024-.126.016-.16-.014-.161-.044-.155-.072-.145-.098-.128-.12-.108-.137-.084-.15-.057-.16-.029-.16.002zm23.286 4.202l-.156.038-.148.066-.132.092-.113.115-.09.134-.062.148-.03.127-.001.004-.023.134-.024.134-.026.132-.026.13-.03.132-.03.129-.032.134-.033.128-.035.13-.037.128-.038.13-.04.126-.04.128-.044.128-.044.126-.046.126-.048.126-.05.125-.05.125-.051.122-.054.123-.055.122-.056.12-.058.122-.06.12-.061.12-.062.119-.063.116-.067.119-.066.116-.068.115-.07.115-.07.113-.073.113-.074.112-.076.113-.077.112-.077.107-.08.11-.08.108-.085.109-.044.056-.088.135-.06.15-.033.158-.002.16.027.16.057.15.083.138.108.12.128.098.144.072.155.045.16.015.161-.016.155-.044.144-.073.128-.098.09-.099.05-.061.003-.004.003-.005.089-.115.003-.004.003-.005.088-.116.003-.004.003-.005.086-.117.003-.004.003-.005.084-.118.003-.004.003-.005.083-.12.003-.004.003-.004.082-.12.003-.005.002-.004.08-.121.003-.005.003-.004.078-.122.003-.005.003-.004.077-.123.002-.005.003-.004.075-.124.003-.005.003-.004.073-.125.003-.004.003-.005.072-.126.002-.004.003-.005.07-.126.003-.005.002-.005.07-.127.002-.004.002-.005.068-.128.002-.005.002-.004.066-.13.003-.004.002-.005.064-.13.002-.004.003-.005.062-.13.003-.005.002-.005.06-.13.003-.005.002-.005.06-.132.002-.005.002-.005.057-.132.003-.005.002-.005.056-.133.002-.005.002-.005.054-.134.002-.004.002-.005.053-.135.002-.005.002-.005.051-.135.002-.005.002-.005.05-.135.001-.005.002-.005.048-.137.001-.005.002-.005.046-.137.002-.005.002-.005.044-.137.002-.005.002-.005.042-.138.002-.005.002-.006.04-.138.002-.005.002-.005.04-.14V19.4l.002-.005.038-.14.001-.005.002-.005.036-.14.001-.005.001-.005.035-.141.001-.005.001-.005.033-.141.001-.006.001-.005.031-.141.002-.006v-.005l.03-.142.001-.005.001-.005.028-.143v-.005l.002-.005.025-.143.001-.006.001-.005.024-.143.001-.005.001-.006.001-.006.01-.161-.02-.16-.05-.154-.077-.141-.102-.125-.123-.104-.141-.079-.153-.051-.16-.022-.16.007zM6.681 22.734l-.152.053-.14.08-.122.105-.101.126-.076.142-.048.154-.018.16.011.161.041.156.07.146.077.11.04.047.003.004.003.004.095.111.003.004.004.004.096.11.004.005.003.004.098.109.003.004.004.004.1.108.003.004.003.004.101.107.004.004.003.004.102.106.004.003.004.004.103.105.004.004.004.004.105.103.004.004.003.003.106.102.004.004.004.004.107.1.004.004.004.004.108.099.004.003.004.004.11.098.003.003.004.004.11.096.005.004.004.003.11.095.005.003.004.004.113.093.004.003.004.004.113.091.004.004.005.003.114.09.004.004.004.003.116.089.004.003.004.003.117.088.004.003.004.003.118.086.004.003.005.003.118.084.004.003.005.003.119.083.004.003.005.003.12.081.005.003.004.003.121.08.005.003.004.003.122.078.005.003.004.003.123.076.005.003.004.003.124.075.005.003.004.003.125.073.004.003.005.003.126.072.004.002.005.003.126.07.005.003.004.002.128.07.004.002.005.002.128.068.005.002.004.002.13.066.004.003.005.002.13.064.004.002.005.003.13.062.005.002.004.003.132.06.004.003.005.002.132.06.005.002.005.002.132.057.005.002.005.003.133.056.005.002.005.002.133.054.005.002.005.002.13.05.154.045.16.016.161-.015.155-.045.144-.072.128-.098.108-.12.083-.138.057-.15.028-.16-.003-.16-.032-.158-.061-.15-.088-.135-.11-.117-.132-.094-.12-.058-.124-.049-.126-.051-.122-.051-.122-.054-.12-.054-.126-.058-.119-.057-.12-.06-.12-.06-.118-.063-.117-.064-.119-.066-.116-.066-.115-.068-.115-.07-.113-.07-.115-.074-.112-.074-.11-.075-.11-.076-.112-.079-.11-.08-.109-.082-.106-.082-.104-.082-.106-.086-.105-.087-.101-.086-.105-.091-.1-.09-.1-.091-.1-.094-.097-.094-.1-.098-.093-.095-.096-.1-.093-.098-.092-.101-.089-.1-.09-.102-.088-.104-.036-.043-.114-.114-.133-.091-.148-.065-.157-.036-.161-.006-.16.024zm15.063 2.691l-.156.044-.12.057-.06.034-.12.066-.116.064-.119.062-.12.061-.12.06-.118.057-.126.058-.12.054-.122.054-.122.05-.126.052-.125.05-.124.046-.127.047-.125.044-.129.043-.126.04-.13.042-.128.038-.127.036-.13.035-.131.034-.129.031-.132.03-.13.03-.135.027-.133.026-.13.023-.13.022-.137.021-.132.02-.134.017-.132.015-.138.015-.135.013-.133.01-.138.01-.136.007-.134.006-.136.004-.14.003-.16.018-.155.047-.142.076-.127.1-.105.122-.08.14-.054.151-.025.16.006.16.035.158.064.148.09.134.114.114.133.092.147.065.157.036.134.008.145-.002h.011l.147-.005h.01l.147-.007h.011l.146-.009h.011l.146-.01h.005l.005-.001.146-.012h.011l.145-.014h.005l.006-.001.145-.016h.011l.144-.018h.006l.005-.001.144-.02h.011l.144-.021h.005l.006-.002.143-.022h.006l.005-.002.143-.024h.005l.006-.002.143-.026h.005l.005-.002.143-.027.005-.001.005-.001.142-.03h.005l.005-.002.142-.03.005-.002.005-.001.142-.033.005-.001.005-.001.14-.035.006-.001.005-.001.14-.036.005-.002.005-.001.14-.038.005-.001.005-.002.14-.04h.005l.005-.002.138-.042.005-.001.006-.002.138-.043.005-.001.005-.002.137-.044.005-.002.005-.002.137-.046.005-.002.005-.001.137-.048.005-.002.005-.002.135-.05.005-.001.005-.002.135-.051.005-.002.005-.002.135-.053.005-.002.004-.002.134-.054.005-.002.005-.002.133-.056.005-.003.005-.002.132-.057.005-.002.005-.003.132-.059.005-.002.004-.002.131-.061.005-.003.005-.002.13-.062.005-.003.005-.002.13-.064.004-.002.005-.003.129-.066.004-.002.005-.003.128-.067.005-.002.004-.003.127-.069.005-.002.005-.003.126-.07.005-.003.004-.002.065-.038.132-.093.112-.115.089-.135.062-.149.034-.157.004-.161-.027-.16-.055-.15-.082-.14-.107-.12-.127-.1-.144-.073-.154-.045-.16-.017-.161.014zM15.994 0l-.187.001h-.011l-.188.004h-.011l-.187.006h-.011l-.187.008h-.005L15.2.02l-.187.01h-.005l-.005.001-.187.013h-.01L14.62.06h-.01l-.186.018h-.011l-.185.02-.005.001h-.006l-.185.022-.005.001h-.005l-.185.025h-.005l-.005.001-.184.027h-.006l-.005.001-.184.029h-.005l-.005.001-.183.031-.005.001-.006.001-.182.033-.006.001-.005.001-.182.035-.005.001-.005.001-.182.038h-.005l-.005.002-.181.04h-.005l-.005.002-.18.042-.006.001-.005.001-.18.044-.005.002h-.005l-.17.045-.152.054-.139.082-.121.106-.1.127-.074.143-.046.155-.017.16.013.16.043.156.07.145.097.13.119.108.137.085.15.058.159.03.16-.001.133-.023.165-.043.168-.041.171-.04.171-.037.172-.036.17-.033.173-.03.17-.03.177-.027.171-.025.175-.022.175-.02.175-.02.176-.016.175-.014.177-.012.176-.01.177-.007.174-.006.177-.003L16 1.73h.177l.178.004.174.006.177.007.176.01.177.012.175.014.176.017.175.018.175.02.175.023.171.025.177.027.17.03.173.03.17.033.171.036.154.033.16.02.161-.01.156-.04.146-.069.131-.094.111-.117.088-.135.06-.15.032-.158.002-.16-.027-.16-.057-.15L20 .714l-.108-.12-.128-.097-.144-.073-.129-.038-.158-.035-.005-.001-.005-.001L19.14.31h-.005l-.005-.002-.182-.035h-.006l-.005-.002-.182-.033h-.006l-.005-.002-.183-.03-.005-.001-.005-.001-.184-.029h-.005l-.006-.001-.184-.027h-.005l-.005-.001-.185-.024h-.005L17.968.12 17.783.1l-.006-.001h-.005l-.185-.02h-.006l-.005-.001L17.39.06 17.385.06h-.005l-.187-.015h-.005l-.005-.001-.187-.013h-.01L16.799.02h-.011L16.6.01h-.011l-.187-.006h-.011L16.204 0h-.011L16.005 0h-.01zm8.86 2.939l-.157.033-.15.062-.134.09-.116.111-.093.132-.067.147-.038.156-.01.161.022.16.05.153.078.141.103.124.102.087.045.034.142.106.137.105.14.11.136.11.135.112.134.115.134.117.13.115.132.122.128.12.127.122.127.125.123.126.124.128.121.13.118.128.118.132.117.133.113.134.113.136.11.136.109.137.109.142.104.14.103.14.101.142.1.144.099.146.095.145.094.147.093.15.092.15.087.149.087.15.085.152.083.155.08.152.08.155.04.081.084.138.11.119.128.096.145.072.155.043.16.013.161-.016.155-.046.143-.074.127-.099.106-.12.083-.14.055-.151.026-.16-.004-.16-.034-.158-.05-.124-.042-.085-.002-.004-.003-.005-.084-.165-.002-.004-.003-.005-.086-.164-.002-.004-.003-.005-.088-.162-.002-.005-.003-.005-.09-.161-.002-.005-.003-.004-.092-.16-.002-.005-.003-.005-.094-.16-.003-.004-.003-.004-.096-.159-.002-.004-.003-.005-.098-.157-.003-.004-.003-.005-.1-.156-.003-.004-.002-.005-.102-.154-.003-.005-.003-.004-.104-.154-.003-.004-.003-.005-.106-.152-.003-.004-.003-.005-.108-.151-.003-.004-.003-.005-.11-.15-.003-.004-.003-.004-.111-.15-.004-.003-.003-.005-.113-.147-.004-.004-.003-.005-.115-.146-.004-.004-.003-.004-.117-.145-.004-.004-.003-.004-.12-.144-.003-.004-.003-.004-.121-.142-.003-.004-.004-.004-.123-.141-.003-.004-.004-.004-.125-.14-.003-.004-.004-.004-.127-.138-.003-.004-.004-.004-.128-.136-.004-.004-.004-.004-.13-.135-.004-.004-.003-.004-.133-.134-.003-.004-.004-.003-.134-.133-.004-.003-.004-.004-.135-.13-.004-.004-.004-.004-.136-.128-.004-.004-.004-.004-.138-.126-.004-.004-.004-.003-.14-.125-.004-.004-.004-.003-.14-.123-.005-.004-.004-.003-.142-.121-.004-.004-.004-.003-.144-.12-.004-.003-.004-.003-.145-.117-.004-.004-.004-.003-.147-.115-.004-.004-.004-.003-.148-.113-.004-.003-.004-.004-.149-.111-.004-.003-.004-.004-.05-.036-.14-.083-.15-.055-.16-.027-.16.004zm-18.381.348l-.157.037-.147.066-.111.074-.04.032-.005.003-.004.004-.145.117-.004.003-.004.004-.144.119-.004.003-.004.004-.142.12-.004.004-.004.004-.141.123-.004.003-.004.004-.14.125-.004.003-.004.004-.138.126-.004.004-.004.004-.136.128-.004.004-.004.004-.135.13-.004.004-.004.003-.134.133-.004.003-.004.004-.132.134-.003.004-.004.004-.13.135-.004.004-.004.004-.128.136-.004.004-.004.004-.126.138-.004.004-.003.004-.125.14-.004.004-.003.004-.123.14-.004.005-.003.004-.121.142-.004.004-.003.004-.12.144-.003.004-.003.004-.117.145-.004.004-.003.004-.115.146-.004.005-.003.004-.113.147-.003.005-.004.004-.111.149-.003.004-.004.004-.11.15-.002.005-.003.004-.108.151-.003.005-.003.004-.106.152-.003.005-.003.004-.104.154-.003.004-.003.005-.102.154-.003.005-.002.004-.1.156-.003.005-.003.004-.098.157-.003.005-.003.004-.096.159-.002.004-.003.005-.094.16-.003.004-.002.004-.092.16-.003.005-.003.005-.09.161-.002.005-.003.005-.088.162-.002.005-.003.004-.086.164-.002.005-.002.004-.084.165-.003.005-.002.004-.082.166-.002.005-.003.004-.08.167-.002.004-.002.005-.078.168-.002.004-.002.005-.045.1-.053.153-.023.16.007.16.037.157.065.148.092.132.114.114.134.09.148.064.157.035.161.006.16-.025.152-.054.14-.08.121-.106.1-.126.065-.118.043-.095.074-.16.075-.155.077-.157.08-.155.08-.152.083-.155.085-.152.086-.15.088-.149.091-.15.094-.15.094-.147.095-.145.099-.146.1-.144.1-.142.104-.14.104-.14.11-.142.107-.137.11-.136.114-.136.113-.134.117-.133.118-.132.117-.129.122-.13.124-.127.123-.126.127-.125.127-.122.128-.12.132-.122.13-.115.133-.117.135-.115.135-.111.136-.11.037-.03.117-.11.094-.132.068-.146.04-.156.01-.161-.02-.16-.05-.154-.076-.141-.102-.125-.123-.104-.14-.08-.153-.051-.16-.023-.161.008zm24.514 11.15l-.157.04-.146.067-.131.093-.112.117-.088.135-.061.149-.033.157-.005.134.006.14.006.176.003.177.001.178-.001.177-.003.178-.006.177-.007.176-.01.177-.012.176-.015.176-.016.173-.018.175-.02.175-.024.174-.024.175-.027.17-.03.174-.03.173-.033.17-.036.172-.037.17-.04.17-.042.172-.043.168-.045.166-.048.169-.05.167-.052.168-.053.164-.056.166-.058.166-.06.161-.061.164-.063.158-.066.165-.068.16-.07.16-.07.158-.075.159-.074.155-.078.158-.081.158-.06.15-.03.158-.001.161.029.159.058.15.085.137.108.12.13.096.144.07.156.044.16.013.16-.017.155-.046.143-.074.127-.1.107-.12.07-.115.083-.164.003-.005.002-.004.082-.166.002-.005.003-.004.08-.167.002-.005.002-.004.078-.168.002-.004.002-.005.076-.169.002-.004.002-.005.074-.17.002-.004.002-.005.072-.17.002-.005.002-.005.07-.17.002-.006.001-.005.068-.172.002-.004.002-.005.065-.173.002-.005.002-.005.063-.173.002-.005.002-.005.06-.174.003-.005.001-.005.06-.175.001-.005.002-.005.057-.176.001-.005.002-.005.055-.177.001-.005.002-.005.052-.177.002-.005.001-.005.051-.178.001-.005.002-.005.048-.179.002-.005v-.005l.047-.179.001-.005.002-.005.044-.18v-.005l.002-.005.042-.18.001-.006.001-.005.04-.18.001-.006.001-.005.038-.182v-.005l.002-.005.035-.182v-.006l.002-.005.033-.182v-.006l.002-.005.03-.183.001-.005.001-.005.029-.184v-.005l.001-.006.027-.184v-.005l.001-.005.024-.185v-.005l.001-.005.022-.185v-.006l.001-.005.02-.185v-.006l.001-.005.017-.186v-.005l.001-.005.015-.187v-.005l.001-.005.013-.187v-.01l.01-.187.001-.006v-.005l.009-.187v-.011l.006-.187v-.011l.004-.188v-.011l.001-.188v-.01l-.001-.188v-.011l-.004-.188v-.011l-.006-.187v-.011l-.007-.145-.022-.16-.05-.152-.08-.141-.103-.124-.125-.102-.141-.077-.153-.05-.16-.02-.161.009zM.777 15l-.158.032-.15.06-.136.087-.117.11-.095.131-.068.146-.04.156-.012.133-.001.14v.01l.001.188v.011l.004.188v.011l.006.187v.011l.008.187v.011l.011.187v.005l.001.005.013.187v.01l.016.187v.01l.018.186v.011l.02.185.001.005v.006l.022.185.001.005v.005l.025.185v.005l.001.005.027.184v.006l.001.005.029.184v.005l.001.005.031.183.001.005.001.006.033.182.001.005.001.006.035.182.001.005.001.005.038.182v.005l.002.005.04.181v.005l.002.005.042.18.001.006.001.005.044.18.002.005v.005l.047.18.001.004.002.005.048.179.002.005.001.005.05.178.002.005.001.005.053.177.002.005.001.005.055.177.002.005.001.005.057.176.002.005.001.005.06.175.001.005.002.005.061.174.002.005.002.005.063.173.002.005.002.005.065.173.002.005.002.004.067.172.002.005.002.005.07.171.002.005.002.005.072.17.002.005.002.005.074.169.002.005.002.004.076.169.002.005.002.004.078.168.002.004.002.005.08.167.003.004.002.005.082.166.002.004.003.005.02.04.086.136.11.118.13.095.146.07.156.041.16.012.16-.019.155-.048.142-.075.126-.1.105-.123.08-.14.054-.152.024-.16-.006-.16-.036-.158-.051-.123-.018-.034-.078-.158L3.1 22.1l-.074-.16-.071-.156-.07-.162-.068-.16-.067-.164-.062-.158-.062-.164-.059-.161-.058-.166-.056-.166-.053-.164-.052-.168-.05-.167-.048-.17-.045-.165-.043-.168-.043-.172-.039-.17-.037-.17-.036-.172-.033-.17-.03-.173-.03-.174-.027-.17-.025-.175-.022-.174-.021-.175-.018-.175-.017-.173-.014-.176-.012-.176-.01-.177-.007-.176-.006-.177-.003-.178L1.73 16v-.134l-.013-.16-.044-.156-.072-.144-.097-.129-.12-.108-.137-.085-.15-.057L.938 15 .777 15zM6.17 26.842l-.152.052-.14.08-.122.105-.101.126-.076.142-.048.154-.02.16.012.161.041.156.07.146.094.13.096.093.032.026.004.003.004.004.145.117.004.003.004.004.146.115.005.003.004.004.147.113.005.003.004.004.149.111.004.003.004.003.15.11.005.003.004.003.151.108.005.003.004.003.152.106.005.003.004.003.154.104.004.003.005.003.154.102.005.002.004.003.156.1.005.003.004.003.157.098.005.003.004.002.159.096.004.003.005.003.16.094.004.003.004.002.16.092.005.003.005.002.161.09.005.003.005.003.162.088.005.002.004.002.164.087.005.002.004.002.165.084.005.003.004.002.166.082.004.002.005.003.167.08.004.002.005.002.168.078.004.002.005.002.169.076.004.002.005.002.17.074.004.002.005.002.17.072.005.002.005.002.17.07.006.002.005.001.171.068.005.002.005.002.173.065.005.002.005.002.173.063.005.002.005.002.174.061.005.002.005.001.175.06.005.001.005.002.176.057.005.001.005.002.177.055.005.001.005.002.177.052.005.002.005.001.178.051.005.001.005.002.178.048.006.002h.005l.179.047.005.001.005.002.18.044h.005l.005.002.18.042.006.001.005.001.159.035.16.02.16-.01.157-.04.146-.069.13-.094.112-.117.087-.136.06-.149.033-.158.002-.161-.028-.159-.057-.15-.084-.138-.108-.12-.128-.098-.144-.072-.128-.039-.154-.033-.168-.04-.171-.041-.169-.044-.17-.045-.166-.048-.168-.05-.165-.051-.166-.054-.166-.056-.163-.057-.165-.06-.161-.062-.164-.064-.16-.065-.16-.068-.162-.07-.157-.07-.157-.074-.157-.075-.156-.077-.153-.079-.156-.082-.153-.082-.154-.086-.15-.086-.152-.09-.148-.09-.147-.092-.149-.095-.145-.095-.144-.098-.145-.1-.143-.102-.14-.103-.14-.104-.14-.108-.139-.11-.136-.11-.027-.022-.133-.091-.148-.065-.157-.036-.161-.006-.16.024zm19.214.073l-.156.039-.146.067-.11.076-.064.051-.139.11-.14.108-.14.104-.14.103-.143.101-.145.101-.144.098-.145.095-.149.095-.148.093-.147.089-.152.09-.15.086-.154.086-.153.082-.156.082-.153.079-.156.077-.157.075-.157.073-.158.071-.16.07-.16.068-.161.065-.164.064-.161.061-.165.06-.163.058-.166.056-.166.054-.166.051-.167.05-.167.048-.17.045-.168.044-.171.042-.168.039-.17.037-.11.023-.154.047-.143.075-.126.1-.106.122-.081.139-.054.152-.025.16.006.16.035.158.063.148.09.133.114.115.132.092.148.065.157.037.16.008.133-.017.115-.024h.005l.005-.002.181-.04h.005l.005-.002.18-.042.006-.001.005-.001.18-.044.005-.002h.005l.18-.047.004-.001.005-.002.179-.048.005-.002.005-.001.178-.05.005-.002.005-.002.177-.052.005-.002.005-.001.177-.055.005-.002.005-.001.176-.057.005-.002.005-.002.175-.059.005-.001.005-.002.174-.061.005-.002.005-.002.173-.063.005-.002.005-.002.173-.065.005-.002.004-.002.172-.068.005-.001.005-.002.171-.07.005-.002.005-.002.17-.072.005-.002.005-.002.169-.074.005-.002.004-.002.169-.076.004-.002.005-.002.168-.078.004-.002.005-.002.167-.08.004-.003.005-.002.166-.082.004-.002.005-.003.165-.084.004-.002.005-.002.163-.087.005-.002.005-.002.162-.088.005-.003.005-.003.161-.09.005-.002.004-.003.16-.092.005-.002.005-.003.16-.094.004-.003.004-.003.158-.096.005-.002.004-.003.158-.098.004-.003.005-.003.156-.1.004-.003.004-.002.155-.102.005-.003.004-.003.154-.104.004-.003.005-.003.152-.106.004-.003.005-.003.151-.108.004-.003.005-.003.15-.11.004-.003.004-.003.149-.111.004-.004.004-.003.148-.113.004-.004.004-.003.147-.115.004-.004.004-.003.068-.055.116-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.05-.153-.08-.14-.103-.125-.124-.102-.142-.077-.153-.05-.16-.02-.16.009z" +}))); + +function _extends$H() { _extends$H = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$H.apply(this, arguments); } +var IntermediateEventCatchParallelMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$H({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.157.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.408 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.215-2.282-2.022-5.3-3.217-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.082 11.082 0 0116 4.975zm-2.15 3.281v5.534H8.213v4.38h5.636v5.534h4.31V18.17h5.639v-4.38h-5.64V8.256h-4.31zm.865.865h2.583v5.534h5.635v2.65h-5.635v5.533h-2.583v-5.534h-5.64v-2.649h5.64V9.121z" +}))); + +function _extends$G() { _extends$G = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$G.apply(this, arguments); } +var IntermediateEventCatchSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$G({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm.006 3.521L9.206 20.745h13.598L16.005 8.542zm0 1.775l5.329 9.564H10.677l5.328-9.564z" +}))); + +function _extends$F() { _extends$F = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$F.apply(this, arguments); } +var IntermediateEventCatchTimerIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$F({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.97.04h-.127C8.713-.018 2.003 5.334.437 12.286c-1.51 6.123.98 13.005 6.136 16.665 5.125 3.788 12.546 4.105 17.912.623 5.272-3.276 8.33-9.766 7.325-15.916-.904-6.241-5.79-11.7-11.95-13.143A16.082 16.082 0 0015.97.04zm-.181 1.724c.115 0 .23 0 .347.003 6.625-.066 12.823 5.149 13.89 11.69 1.13 5.91-1.908 12.349-7.262 15.138-5.473 3.013-12.866 1.884-17.116-2.726C1.291 21.372.444 13.914 3.802 8.602c2.493-4.112 7.169-6.819 11.987-6.838zm.283 1.554c-.117 0-.234.002-.351.005-6.1 0-11.691 5.049-12.346 11.114-.78 5.684 2.795 11.612 8.218 13.52 5.139 1.943 11.416.101 14.624-4.38 3.461-4.583 3.262-11.538-.596-15.831-2.36-2.747-5.924-4.423-9.549-4.428zm-.078 1.695c.078 0 .156 0 .234.003 5.4 0 10.321 4.556 10.734 9.942.563 5.13-2.958 10.364-7.971 11.678-4.832 1.41-10.457-.935-12.746-5.446-2.463-4.559-1.2-10.795 3.014-13.883a11.072 11.072 0 016.735-2.294zm-.137 3.42c-2.965.02-5.792 1.968-6.884 4.722-1.137 2.693-.509 6.007 1.536 8.096 1.988 2.14 5.263 2.929 8.007 1.926 2.875-.98 4.987-3.824 5.063-6.865.154-2.954-1.622-5.875-4.295-7.13a7.545 7.545 0 00-3.427-.75zm.27 1.381c2.708.013 5.249 2.014 5.88 4.652.704 2.576-.481 5.512-2.788 6.862-2.356 1.478-5.677 1.084-7.611-.918-2.042-1.97-2.405-5.376-.839-7.738 1.11-1.762 3.146-2.877 5.229-2.857h.13zm1.831 1.764l-2.072 3.76c-.64.068-.792 1.039-.202 1.298.39.27.696-.18 1.051-.164h3.168v-.864h-3.18l1.992-3.612-.757-.418z" +}))); + +function _extends$E() { _extends$E = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$E.apply(this, arguments); } +var IntermediateEventNoneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$E({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.848.001C8.113-.093.931 6.281.125 13.983c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.207C29.105 4.938 23.55.48 17.367.06A16.448 16.448 0 0015.848 0v.001zm.293 1.727c7.113-.099 13.662 5.97 14.077 13.08.56 6.299-3.516 12.735-9.582 14.679-5.798 2.004-12.806-.12-16.283-5.237C.717 19.159.874 11.638 5.016 6.876 7.722 3.638 11.902 1.63 16.14 1.728zm-.415 1.555C9.157 3.258 3.256 9.156 3.278 15.729c-.16 5.965 4.365 11.725 10.293 12.737 5.409 1.065 11.37-1.744 13.775-6.753 2.534-4.986 1.386-11.627-2.953-15.251-2.364-2.077-5.512-3.27-8.667-3.18zm.507 1.692c5.82-.026 11.013 5.318 10.79 11.143-.024 5.3-4.313 10.267-9.636 10.803-5.075.667-10.426-2.588-11.885-7.553-1.535-4.744.494-10.46 4.925-12.885a11.072 11.072 0 015.806-1.508z" +}))); + +function _extends$D() { _extends$D = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$D.apply(this, arguments); } +var IntermediateEventThrowCompensationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$D({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.156.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.407 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 4.975zm-.56 5.772l-7.408 5.231 7.409 5.234v-5.057c2.385 1.687 4.771 3.371 7.157 5.057V10.747l-7.157 5.055v-5.055z" +}))); + +function _extends$C() { _extends$C = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$C.apply(this, arguments); } +var IntermediateEventThrowEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$C({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm.006 3.927c-1.672 4.654-2.734 9.502-4.406 14.155 1.534-1.525 2.872-3.234 4.406-4.759l4.406 4.76c-1.496-4.71-2.91-9.446-4.406-14.156z" +}))); + +function _extends$B() { _extends$B = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$B.apply(this, arguments); } +var IntermediateEventThrowLinkIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$B({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.049C8.195-.11.935 6.286.125 14.03c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.93 23.445.453 17.201.095c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.22.872 11.725 4.985 6.962c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 5.021c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 5.021zm1.78 4.093v3.555H9.785v6.714h7.994v3.554l5.829-6.911-5.83-6.912z" +}))); + +function _extends$A() { _extends$A = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$A.apply(this, arguments); } +var IntermediateEventThrowMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$A({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.156.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.407 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 4.975zm-5.91 5.475l6.04 4.901 6.042-4.9H10.088zm-1.341 1.138v9.921h14.514V11.79l-7.132 5.787-7.382-5.99z" +}))); + +function _extends$z() { _extends$z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$z.apply(this, arguments); } +var IntermediateEventThrowMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$z({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.156.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.407 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 4.975zm.006 3.073l-7.62 5.532 2.91 8.95h9.42l2.91-8.95-7.62-5.532z" +}))); + +function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); } +var IntermediateEventThrowSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$y({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.975.003C8.195-.156.935 6.24.125 13.985c-.855 6.55 2.741 13.46 8.74 16.314 5.666 2.847 13.012 1.99 17.71-2.33 4.745-4.162 6.727-11.243 4.532-17.206C29.09 4.884 23.445.407 17.201.049c-.408-.03-.817-.046-1.226-.046zm-.181 1.724c7.134-.269 13.84 5.68 14.399 12.804.686 6.283-3.267 12.792-9.283 14.862-5.847 2.162-13.025.06-16.557-5.141C.728 19.174.872 11.679 4.985 6.916c2.632-3.171 6.671-5.174 10.809-5.19zm.283 1.553c-6.6-.21-12.671 5.585-12.79 12.185-.292 5.964 4.129 11.817 10.034 12.953 5.47 1.198 11.584-1.613 14.025-6.702 2.525-4.97 1.396-11.585-2.912-15.216-2.282-2.021-5.3-3.216-8.357-3.22zM16 4.975c5.818-.154 11.117 5.082 11.024 10.905.103 5.384-4.23 10.5-9.636 11.043-5.075.667-10.426-2.587-11.885-7.552-1.53-4.73.48-10.428 4.888-12.864A11.083 11.083 0 0116 4.975zm.006 3.52c-2.261 4.07-4.533 8.136-6.798 12.205h13.596L16.005 8.495z" +}))); + +function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); } +var LaneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$x({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M0 7v18.62h32V7H0zm1.655 17.056V8.684h28.62v15.372H1.656z" +}))); + +function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); } +var ManualTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$w({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zm4.43 1.328c-.222.005-.43.09-.606.203-.985.638-4.356 2.977-5.096 3.486-.67.46-1.12 1.153-1.38 1.974-.27.858-.235 1.793-.232 2.576.002.59.016 1.104.17 1.727.22.908.634 1.63 1.23 2.118.597.49 1.363.732 2.23.734 3.038.012 6.078.016 9.119 0 .327-.002.645-.127.848-.37.204-.241.287-.56.291-.914a1.732 1.732 0 00-.097-.625h.327c.335 0 .641-.11.852-.316.21-.206.317-.475.374-.754a1.783 1.783 0 00-.126-1.143 1.18 1.18 0 00.877-.521c.196-.306.257-.666.258-1.025.001-.375-.088-.738-.293-1.033a1.179 1.179 0 00-.958-.512h-.478c.108-.237.156-.505.155-.782-.003-.373-.098-.721-.316-.99a1.21 1.21 0 00-.943-.43c-2.273-.004-4.236.018-6.412.012l-.19-.001c.102-.104.202-.205.312-.314.337-.336.662-.652.83-.869.4-.516.46-1.215.123-1.729-.178-.272-.439-.456-.72-.494a.93.93 0 00-.148-.008zm.029.728l.022.001c.055.008.115.027.209.172.132.201.126.606-.09.884-.079.102-.431.465-.767.8-.337.334-.657.643-.815.836-.153.186-.096.338-.056.435.04.096.085.212.298.263.063.014.066.01.086.012l.066.003c2.429.027 4.986-.004 7.223-.003.194 0 .293.056.379.162.086.105.151.286.153.533 0 .257-.065.467-.155.59-.09.124-.183.182-.37.183-1.706-.001-3.411-.005-5.117-.009v.731c2.23.004 4.461.01 6.692.012.17 0 .265.06.361.2.096.138.164.364.163.615 0 .268-.058.501-.143.634-.085.132-.162.193-.385.195-2.32-.001-4.554-.006-6.688-.003v.73c1.905 0 3.809.003 5.713.001.194.005.316.09.416.26.102.173.151.442.093.728-.04.193-.102.313-.17.38-.067.065-.148.108-.343.108h-5.71l.002.734c1.445 0 2.89-.01 4.334-.001.162 0 .232.041.297.123.064.081.123.238.12.488-.003.244-.061.385-.12.455-.06.07-.127.11-.296.11-3.037.016-6.076.012-9.113 0-.735-.002-1.316-.196-1.77-.568-.454-.372-.793-.935-.986-1.728-.134-.546-.146-.978-.148-1.558-.003-.796-.018-1.664.199-2.354.222-.705.582-1.24 1.096-1.593.75-.515 4.14-2.866 5.079-3.474a.504.504 0 01.241-.087z" +}))); + +function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); } +var MessageFlowIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$v({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M4.073 26.607l1.295 1.296L1.325 32l-.662-.633L0 30.735l4.073-4.128zm6.953-7.046l1.296 1.296L1.325 32l7.555-7.656-1.295-1.296 1.455-1.474 1.986-2.013zM32 .06s-2.699 5.189-5.417 10.462l-.326.633c-1.14 2.214-2.265 4.407-3.176 6.2-1.228-1.222-2.449-2.452-3.676-3.675l-3.57 3.618-1.297-1.296 3.541-3.588c-.98-.964-1.932-1.958-2.923-2.91l-.753-.706c2.68-1.258 6.533-3.165 9.95-4.876l.617-.309C28.838 1.673 32 .06 32 .06zm-4.126 4.06l-.015.007-.115.057-.048.024-.115.057L17.7 9.172l5.017 4.948 5.157-10z" +}))); + +function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); } +var ParticipantIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$u({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M0 5v22.069h32V5H0zm30.276 1.684v18.82H6.62V6.684h23.655zm-28.62 0h3.31v18.82h-3.31V6.684z" +}))); + +function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); } +var ProcessIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$t({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fillRule: "evenodd", + d: "M16.177 0l.137.002c.452.009.9.037 1.342.082.346.036.62.303.68.646l.437 2.536c.055.319.296.57.608.655.986.269 1.923.653 2.796 1.14.28.155.624.145.885-.039l2.083-1.47a.775.775 0 01.937.022c.86.699 1.645 1.484 2.343 2.343.22.27.223.653.023.937l-1.439 2.038a.833.833 0 00-.031.896c.512.889.92 1.846 1.204 2.855a.833.833 0 00.653.601l2.435.42c.342.059.61.333.645.679a15.928 15.928 0 01.08 2.064l-.003.114c-.012.382-.038.76-.077 1.134a.775.775 0 01-.645.68l-2.396.412a.835.835 0 00-.656.61 12.511 12.511 0 01-1.2 2.917.832.832 0 00.034.892l1.396 1.978c.2.284.196.667-.023.936a16.104 16.104 0 01-2.343 2.343.775.775 0 01-.937.023l-1.99-1.404a.833.833 0 00-.88-.026c-.907.516-1.886.922-2.916 1.2a.833.833 0 00-.61.656l-.414 2.396a.775.775 0 01-.679.646 16.096 16.096 0 01-3.312 0 .775.775 0 01-.679-.646l-.423-2.452a.834.834 0 00-.598-.636 12.474 12.474 0 01-1.468-.514 12.49 12.49 0 01-1.417-.68.833.833 0 00-.878.03l-2.026 1.43a.775.775 0 01-.937-.023 16.069 16.069 0 01-2.342-2.342.774.774 0 01-.024-.936l1.402-1.986a.833.833 0 00.032-.896 12.507 12.507 0 01-1.214-2.911.833.833 0 00-.655-.606l-2.386-.412a.775.775 0 01-.646-.678 16.097 16.097 0 010-3.314.775.775 0 01.646-.678l2.386-.412a.833.833 0 00.655-.606 12.507 12.507 0 011.214-2.911.833.833 0 00-.032-.896L3.552 6.853a.774.774 0 01.023-.936 16.091 16.091 0 012.343-2.343.775.775 0 01.937-.023l2.03 1.433c.26.177.6.182.874.028.915-.512 1.88-.9 2.87-1.167a.833.833 0 00.612-.656l.424-2.46a.775.775 0 01.679-.645C14.845.032 15.348.004 15.85 0h.326zM16 6.4c-5.302 0-9.6 4.297-9.6 9.599 0 5.302 4.298 9.6 9.6 9.6s9.6-4.298 9.6-9.6-4.298-9.6-9.6-9.6zm-3 4.283c0-1.425 1.637-2.203 2.715-1.29l5.69 4.815c.794.672.794 1.91 0 2.583l-5.69 4.815c-1.078.913-2.715.134-2.715-1.29z" +}))); + +function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); } +var ReceiveTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$s({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zM5.23 7.764v11.577h17.55V7.764H5.23zm1.816.758h13.917l-6.959 4.577-6.958-4.577zm-1.06.21l8.018 5.274 8.018-5.275v9.853H5.987V8.73z" +}))); + +function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); } +var ScriptTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$r({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zm2.99 3.077l-.077.045-.026.015c-1.09.646-1.84 1.239-2.336 1.818-.496.579-.735 1.162-.742 1.725-.014 1.119.812 1.958 1.544 2.708.732.75 1.385 1.456 1.446 2.041.032.298-.039.598-.364 1.008-.324.408-.911.897-1.85 1.445l-1.388.808h8.56l.101-.059c.996-.58 1.667-1.116 2.094-1.655.429-.54.603-1.107.547-1.638-.11-1.052-.967-1.818-1.688-2.556-.721-.739-1.306-1.436-1.298-2.092.004-.331.132-.7.535-1.171.402-.47 1.08-1.02 2.119-1.636l1.362-.806h-8.54zm.241.867h5.271a6.83 6.83 0 00-1.113 1.01c-.496.58-.736 1.163-.743 1.726-.014 1.119.812 1.958 1.544 2.708.732.75 1.385 1.456 1.446 2.041.032.298-.039.598-.364 1.008-.312.393-.872.862-1.753 1.386H8.728c.367-.286.658-.566.88-.847.43-.54.604-1.107.548-1.638-.11-1.052-.968-1.818-1.688-2.556-.721-.739-1.306-1.435-1.298-2.092.004-.331.132-.7.534-1.171.389-.454 1.04-.984 2.021-1.575zm-1.233 1.48v.4h4.12v-.4h-4.12zm-.154 2.158v.4H12.6v-.4H8.34zm1.931 2.158v.4h4.126v-.4H10.27zm.59 2.158v.4h4.276v-.4h-4.276z" +}))); + +function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); } +var SendTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$q({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zm-1.38 3.16l8.332 4.717L21.78 8.16H5.114zm.021 1.745v9.309H21.8V9.905l-8.353 4.655-8.31-4.655z" +}))); + +function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); } +var ServiceTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$p({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 3C2.916 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.012C28.015 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5zm1.22 1.681V7.84c-.329.093-.63.223-.914.382l-.83-.82-1.554 1.561.83.82c-.16.288-.285.594-.372.911l-1.177.002v2.2l1.189-.004c.109.431.345.819.58 1.165v-1.898l-1.038.004v-.737l1.034-.002.058-.294c.084-.429.252-.838.493-1.203l.165-.25-.727-.718.523-.526.728.719.247-.165c.379-.25.793-.417 1.206-.505l.291-.06-.002-1.01h.75L9.19 8.417H11.16c-.185-.221-.951-.508-1.237-.588L9.93 6.68H7.713zm2.078 2.105l.003 1.158a4.19 4.19 0 00-.915.383l-.83-.821-1.553 1.562.83.82c-.16.288-.286.593-.373.91l-1.176.003v2.2l1.188-.004c.094.326.224.624.383.905l-.85.847 1.57 1.543.847-.843c.29.161.599.286.919.373v1.198c.756.006 1.56.003 2.206.003V17.81a4.19 4.19 0 00.915-.383l.847.835 1.554-1.56-.848-.836c.16-.288.286-.594.373-.912l1.152-.007V12.75l-1.165.007a4.09 4.09 0 00-.382-.905l.805-.807-1.57-1.546-.804.806a4.16 4.16 0 00-.915-.372l.007-1.147H9.792zm.732.73h.751l-.006 1.005.297.058c.43.085.844.252 1.21.492l.25.162.701-.704.528.52-.702.704.169.25c.248.374.412.779.505 1.196l.061.292 1.016-.006v.737l-1.01.006-.058.292c-.085.43-.252.838-.494 1.205l-.165.25.744.733-.523.525-.743-.734-.248.165c-.378.247-.789.418-1.203.503l-.294.058v1.067h-.745v-1.059l-.295-.057a3.395 3.395 0 01-1.21-.492l-.248-.162-.747.743-.528-.52.747-.744-.17-.25a3.546 3.546 0 01-.506-1.196l-.06-.291-1.04.004v-.738l1.034-.002.058-.294c.085-.428.252-.837.493-1.203l.165-.25-.726-.718.522-.526.728.72.248-.166a3.546 3.546 0 011.205-.504l.292-.06-.003-1.01zm.388 2.685a1.65 1.65 0 00-1.645 1.645c0 .904.74 1.645 1.645 1.645a1.65 1.65 0 001.645-1.645 1.65 1.65 0 00-1.645-1.645zm0 .73a.91.91 0 01.915.915.91.91 0 01-.915.914.91.91 0 01-.915-.914.91.91 0 01.915-.915z" +}))); + +function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); } +var StartEventCompensationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$o({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.001C9.705-.084 3.643 3.964 1.257 9.775-1.235 15.485.06 22.577 4.42 27.03c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994 0zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626C2.101 23.171.377 16.07 2.848 10.44c2.14-5.205 7.515-8.774 13.147-8.708zm-.566 9.03l-7.415 5.235 7.415 5.238v-5.062c2.386 1.689 4.775 3.375 7.163 5.062V10.761l-7.163 5.058v-5.058zm-.866 1.666v7.13L9.51 15.993l5.052-3.565zm7.166 0v7.137l-5.052-3.568 5.052-3.569z" +}))); + +function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); } +var StartEventConditionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$n({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16 0C7.174 0 0 7.174 0 16s7.174 16 16 16 16-7.174 16-16S24.826 0 16 0zm0 1.73c7.892 0 14.27 6.378 14.27 14.27 0 7.891-6.379 14.27-14.27 14.27S1.73 23.891 1.73 16C1.73 8.108 8.108 1.73 16 1.73zm-5.362 7.523v13.493h10.724V9.253H10.638zm.863.866h8.995V21.88H11.501V10.12zm.928 1.324v.863h7.139v-.863h-7.139zm0 2.605v.867h7.139v-.867h-7.139zm0 3.01v.864h7.139v-.863h-7.139zm0 2.72v.863h7.139v-.863h-7.139z" +}))); + +function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); } +var StartEventErrorIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$m({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.005C9.705-.08 3.643 3.968 1.257 9.78-1.235 15.49.06 22.581 4.42 27.034c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994.005zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626-4.814-3.838-6.538-10.939-4.067-16.57 2.14-5.205 7.515-8.774 13.147-8.708zm6.13 7.45l-3.635 7.37-4.52-5.88c-1.37 4.048-2.738 8.095-4.106 12.143l4.603-5.917 4.748 5.433 2.91-13.149zm-7.754 3.889l4.299 5.449 1.073-2.39-1.028 4.135-4.387-5.16-1.78 2.75 1.823-4.784z" +}))); + +function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); } +var StartEventEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$l({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.001C9.705-.084 3.643 3.964 1.257 9.775-1.235 15.485.06 22.577 4.42 27.03c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994 0zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626C2.101 23.171.377 16.07 2.848 10.44c2.14-5.205 7.515-8.774 13.147-8.708zm0 7.183c-1.674 4.658-2.736 9.509-4.41 14.166 1.535-1.526 2.874-3.236 4.41-4.763l4.41 4.763c-1.499-4.713-2.913-9.453-4.41-14.166zm.032 2.931c.822 2.588 1.598 5.19 2.42 7.778l-2.42-2.615c-.683.598-2.455 2.887-2.34 2.39.871-2.489 1.448-5.07 2.34-7.553z" +}))); + +function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); } +var StartEventMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$k({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.001C9.705-.084 3.643 3.964 1.257 9.775-1.235 15.485.06 22.577 4.42 27.03c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994 0zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626C2.101 23.171.377 16.07 2.848 10.44c2.14-5.205 7.515-8.774 13.147-8.708zm-7.257 8.732v11.069h14.513v-11.07H8.738zm3.224 1.73h8.064c-1.428.878-2.857 2.807-4.285 3.018l-3.779-3.019zm9.562 1.017v6.593H10.465V13.21l5.528 4.417 5.53-4.418z" +}))); + +function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); } +var StartEventMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$j({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.001C9.705-.084 3.643 3.964 1.257 9.775-1.235 15.485.06 22.577 4.42 27.03c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994 0zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626C2.101 23.171.377 16.07 2.848 10.44c2.14-5.205 7.515-8.774 13.147-8.708zm0 6.328l-7.626 5.536c.97 2.986 1.942 5.971 2.913 8.957h9.426l2.912-8.957-7.625-5.536zm0 1.068l6.609 4.798-2.525 7.763H11.91l-2.524-7.763 6.609-4.798z" +}))); + +function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); } +var StartEventNonInterruptingConditionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$i({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M10.632 9.189V22.68h10.723V9.189H10.632zm.862.865h8.994v11.76H11.494v-11.76zm.928 1.324v.863h7.138v-.863h-7.138zm0 2.605v.866h7.138v-.866h-7.138zm0 3.01v.863h7.138v-.863h-7.138zm0 2.72v.862h7.138v-.863h-7.138zM16.12 0h-.232l-.22.004h-.012l-.221.006h-.012l-.22.01h-.012l-.22.013h-.012l-.22.016h-.012l-.22.019h-.005l-.006.001-.22.021h-.006l-.005.001-.22.025h-.011l-.22.028h-.005l-.006.002-.219.03h-.005l-.006.001-.218.033-.006.001-.006.001-.217.036-.006.001-.006.001-.217.039-.006.001-.006.001-.216.042-.006.001-.006.001-.215.045-.006.001-.006.002-.215.047-.006.002-.006.001-.214.05-.006.002-.006.002-.115.029-.152.053-.14.081-.122.106-.1.126-.075.143-.047.154-.018.16.012.16.042.156.07.145.095.13.118.11.137.086.15.059.158.03h.161l.132-.022.11-.028.202-.047.203-.046.208-.043.202-.039.206-.037.206-.034.205-.03.208-.03.205-.025.209-.023.208-.02.21-.017.209-.015.207-.011.21-.009.21-.006.207-.003h.21l.21.002.207.005.207.008.212.011.207.014.208.017.209.019.208.022.205.025.206.028.207.03.208.035.205.036.202.039.052.01.16.018.16-.012.156-.042.146-.07.13-.096.109-.119.085-.136.06-.15.03-.159v-.16l-.03-.16-.059-.15-.086-.136-.109-.118-.13-.096-.145-.07-.128-.038-.057-.011-.006-.002h-.006l-.216-.042-.006-.001-.006-.001-.217-.039H18.9l-.006-.002-.217-.035-.006-.001-.006-.001-.218-.032-.006-.001-.006-.001-.218-.03h-.006l-.006-.001-.219-.027h-.011l-.22-.024-.005-.001h-.006l-.22-.021h-.006l-.006-.001-.22-.017-.005-.001h-.006L17.06.03h-.012l-.22-.012h-.012l-.22-.01h-.012l-.22-.005h-.012L16.132 0h-.012zm8.715 2.783l-.157.034-.149.063-.134.089-.116.112-.092.132-.067.147-.038.157-.008.16.021.16.051.153.079.141.103.124.102.087.052.038h.001l.087.064v.001l.082.061.002.001.076.059h.001l.084.065.082.066.002.001.079.063.002.002.077.063.081.067.002.002.077.065.076.065.001.002.08.07.078.07h.002l.075.068.077.072.002.001.073.069.077.073.072.07.002.001.077.076.07.07v.001l.075.076.07.073.002.001.074.079.002.002.069.074.069.075.074.082.07.08.002.001.068.079h.001l.067.079.068.082.065.078.001.002.068.083.067.084.063.081.001.002.067.087.002.002.063.084.001.001.064.087.008.01.008.01.095.12.093.121.09.119.087.119.088.122.086.123.084.12.081.122.001.002.084.126.08.126.08.127.077.126.079.131.074.127.075.131.073.131.07.13.07.133.069.133.045.09.086.137.109.119.13.096.144.07.156.042.16.013.16-.017.155-.047.143-.075.126-.1.106-.121.082-.14.054-.151.025-.16-.005-.16-.035-.158-.05-.124-.048-.095-.002-.004-.002-.004-.073-.14-.002-.005-.002-.004-.074-.14-.002-.004-.002-.004-.076-.14-.002-.003-.002-.004-.077-.139-.003-.004-.002-.004-.078-.138-.003-.004-.002-.003-.08-.137-.002-.004-.003-.004-.081-.136-.002-.004-.003-.004-.083-.136-.002-.003-.002-.004-.085-.135-.002-.004-.003-.003-.085-.134-.003-.004-.002-.004-.087-.132-.003-.004-.003-.004-.088-.132-.003-.003-.002-.004-.09-.13-.003-.005-.003-.003-.091-.13-.003-.004-.002-.004-.093-.129-.003-.003-.003-.004-.094-.128-.003-.004-.003-.003-.095-.127-.003-.004-.003-.004-.097-.125-.003-.004-.003-.004-.09-.114-.06-.082-.003-.003-.002-.003-.069-.091-.002-.004-.002-.003-.07-.09-.003-.003-.002-.003-.07-.09-.003-.003-.002-.003-.071-.09-.002-.003-.003-.002-.072-.089-.002-.003-.002-.003-.073-.088-.002-.003-.002-.002-.074-.087-.002-.003-.002-.003-.074-.086-.003-.003-.002-.003-.074-.086-.003-.002-.002-.003-.075-.085-.003-.003-.002-.002-.076-.084-.002-.003-.003-.003-.076-.083-.002-.003-.003-.003-.077-.082-.002-.003-.003-.002-.077-.082-.003-.003-.003-.002-.078-.081-.002-.003-.003-.003-.078-.08-.003-.002-.003-.003-.079-.08-.002-.002-.003-.002-.08-.08-.002-.002-.003-.002-.08-.078-.003-.003-.003-.002-.08-.077-.003-.003-.003-.002-.082-.077-.002-.002-.003-.002-.082-.076-.003-.002-.002-.003-.083-.075-.003-.002-.002-.003-.084-.074-.002-.002-.003-.002-.084-.074-.003-.002-.002-.002-.085-.073-.002-.002-.003-.003-.085-.071-.003-.003-.002-.002-.086-.07-.003-.003-.002-.002-.086-.07-.003-.003-.003-.002-.086-.07-.003-.002-.003-.002-.087-.069-.002-.002-.003-.002-.088-.068-.002-.002-.003-.002-.088-.067-.003-.003-.003-.002-.088-.066-.003-.002-.003-.002-.089-.066-.003-.002-.003-.002-.057-.042-.14-.082-.15-.055-.16-.026-.16.004zM6.377 3.21l-.157.037-.148.066-.111.074-.007.006-.003.002-.003.002-.086.069-.003.002-.002.002-.086.07-.003.002-.002.002-.086.07-.002.003-.003.002-.085.071-.002.002-.003.003-.084.071-.003.003-.002.002-.084.072-.003.003-.002.002-.083.073-.003.003-.002.002-.083.074-.002.002-.003.003-.082.074-.003.003-.002.002-.081.076-.003.002-.003.002-.08.077-.003.002-.003.003-.08.076-.002.003-.003.002-.08.078-.002.002-.003.003-.079.078-.002.003-.003.002-.078.08-.003.002-.002.002-.078.08-.002.003-.003.002-.077.08-.003.004-.002.002-.077.081-.002.003-.003.003-.076.082-.002.002-.003.003-.075.082-.002.003-.003.003-.074.083-.003.003-.002.003-.074.084-.003.003-.002.002-.074.085-.002.003-.002.003-.073.085-.003.003-.002.003-.072.086-.002.003-.003.003-.071.087-.003.003-.002.002-.07.088-.003.003-.002.003-.07.088-.003.003-.002.003-.07.09-.002.002-.002.003-.069.09-.002.003-.003.003-.068.09-.002.003-.002.003-.067.092-.003.003-.002.003-.067.092-.002.003-.002.003-.066.092-.002.003-.002.004-.066.093-.002.003-.002.003-.065.094-.002.003-.002.004-.064.094-.002.003-.002.004-.063.095-.002.003-.002.003-.063.097-.002.003-.002.003-.046.073-.05.07-.003.002-.002.003-.067.093-.003.003-.002.003-.066.094-.002.003-.002.003-.066.094-.002.003-.002.003-.064.094-.002.004-.002.003-.064.094-.002.004-.002.003-.062.095-.002.003-.002.003-.062.096-.002.003-.002.003-.06.096-.003.003-.002.003-.06.096-.001.004-.002.003-.059.096-.002.004-.002.003-.058.097-.002.003-.001.003-.057.098-.002.003-.002.003-.056.098-.002.003-.002.003-.055.098-.002.004-.001.003-.055.098-.001.004-.002.003-.054.099-.001.003-.002.003-.052.1-.002.002-.002.004-.051.1-.002.002-.002.004-.05.1-.002.003-.002.003-.05.1v.003l-.002.004-.05.1v.003l-.002.004-.048.1-.002.004-.001.003-.047.101-.002.003-.001.004-.013.027-.052.152-.024.16.006.16.037.157.064.148.091.133.114.114.134.09.147.065.157.036.162.006.159-.024.152-.053.14-.08.122-.105.1-.126.066-.117.01-.023.044-.095.045-.095.002-.003.042-.087.048-.097.048-.095v-.001l.048-.092.001-.001.047-.09.05-.093.002-.002.049-.09.052-.092.001-.002.051-.089.001-.002.051-.087.053-.088.001-.002.055-.091.057-.091.057-.09.001-.002.057-.089.055-.083.001-.002.06-.09.06-.088.062-.089.001-.001.06-.084.063-.088.065-.089.017-.023.016-.025.06-.094.059-.09v-.002l.058-.086.057-.086.001-.001.062-.09.062-.088.001-.002.06-.085.002-.002.06-.082.063-.087.064-.084.002-.002.061-.08.065-.084.064-.08v-.001l.067-.083.067-.082.07-.083.069-.08.063-.074.074-.083.068-.077.002-.002.07-.076.07-.075.072-.077.001-.001.067-.07.076-.078.002-.002.07-.07.075-.075.002-.002.072-.07.075-.072.002-.002.073-.069.074-.068.001-.001.08-.073.076-.068.002-.002.072-.063v-.001l.078-.067.079-.068.002-.001.08-.068.002-.002.077-.063.082-.066.001-.001.075-.06.002-.002.006-.004.117-.111.094-.131.068-.146.04-.156.01-.161-.019-.16-.049-.154-.076-.141-.102-.125-.123-.105-.14-.079-.153-.052-.16-.023-.16.007zm24.596 11.088l-.156.04-.146.067-.131.094-.112.117-.087.135-.061.15-.033.157-.004.134.007.142.005.152.004.15.002.149v.153l.001.011v.015l.004.11.002.11v.002l.002.106v.321l-.003.102-.002.106-.004.107-.005.105-.006.106-.006.106-.008.106v.002l-.008.103v.002l-.01.1-.01.105-.01.105-.013.105-.012.099v.002l-.014.108-.014.1-.016.105-.016.103v.002l-.017.099-.018.104-.019.103v.002l-.019.097-.02.104-.022.103v.001l-.022.098-.023.103v.002l-.024.096-.025.103v.002l-.024.096-.027.102v.003l-.026.093v.001l-.029.103v.002l-.03.099-.028.097v.002l-.03.095-.03.096v.001l-.033.1-.031.095v.002l-.035.1v.003l-.034.094v.003l-.035.096v.001l-.034.09v.002l-.038.098-.036.093v.002l-.038.095-.079.194-.08.188-.085.189-.087.19-.09.184-.092.183-.095.184-.05.093-.064.148-.034.158-.005.16.026.16.054.151.082.14.106.12.127.1.143.075.154.046.16.017.161-.013.156-.042.144-.071.13-.096.109-.119.072-.112.053-.099.003-.005.003-.006.102-.195.003-.006.003-.006.098-.196.003-.006.003-.006.096-.197.002-.006.003-.006.093-.2.002-.006.003-.006.09-.2.002-.006.003-.007.086-.202.003-.006.002-.006.084-.203.002-.005.001-.005.04-.102.002-.003.001-.003.04-.103.001-.003.001-.003.04-.103v-.004l.001-.003.039-.103v-.003l.002-.003.037-.104.001-.003.001-.003.037-.104v-.004l.002-.003.035-.104.002-.003v-.004l.035-.104.002-.004v-.003l.034-.105.002-.003v-.003l.034-.105v-.004l.002-.003.032-.106.001-.003.001-.003.031-.106.001-.003.001-.004.031-.106.001-.003.001-.004.03-.106v-.003l.002-.004.028-.107.001-.003.001-.003.028-.107.001-.004.001-.003.027-.107.001-.004v-.003l.027-.108.001-.003v-.004l.026-.108.001-.003v-.004l.025-.108.001-.003v-.004l.025-.108v-.004l.001-.003.023-.109v-.003l.001-.004.022-.109v-.003l.002-.004.02-.109.001-.004v-.003l.02-.11.002-.003v-.004l.02-.11v-.007l.019-.11v-.003l.001-.004.017-.11v-.004l.001-.003.017-.11v-.008l.016-.11v-.004l.001-.004.015-.11v-.008l.015-.111v-.008l.013-.111v-.007l.013-.112v-.007l.011-.112v-.004l.001-.004.01-.112v-.007l.01-.112v-.008l.008-.112v-.008l.007-.113v-.007l.007-.113v-.008l.005-.113v-.007l.005-.114v-.007l.003-.114v-.007l.003-.114v-.129l.001-.114v-.13l-.003-.114v-.008l-.003-.115v-.007l-.003-.102v-.155l-.003-.158v-.01l-.004-.158v-.01l-.006-.158v-.01l-.007-.148-.023-.16-.051-.152-.08-.14-.103-.124-.125-.102-.142-.077-.153-.05-.16-.02-.161.01zm-30.213.66l-.157.034-.149.063-.134.09-.115.113-.092.132-.067.147-.037.156-.009.134.001.11V15.95l.006.22v.012l.01.22v.012l.012.22v.006l.001.006.015.22v.005l.001.006.018.22.001.006v.006l.022.219v.006l.001.006.024.219.001.006v.006l.028.218.001.006v.006l.031.218.001.006.001.006.033.218.001.006.001.005.037.218v.006l.002.005.04.217v.006l.001.006.043.216.001.006.001.006.046.216v.005l.002.006.048.215.002.006.001.006.051.214.002.006v.006l.055.214.002.005.001.006.057.213.002.006.001.005.06.213.002.005.001.006.063.212.002.005.001.006.066.21.002.006.002.006.068.21.002.005.002.005.07.21.003.005.002.005.074.208.002.006.002.005.077.207.002.006.002.005.08.206.002.005.002.006.082.204.002.006.002.005.086.204.002.005.002.006.088.202.002.005.003.006.09.2.003.006.002.005.094.2.002.006.003.005.096.199.002.005.003.005.03.062.086.137.11.118.128.097.145.07.156.043.16.013.16-.017.155-.047.143-.074.127-.1.106-.121.081-.14.055-.15.025-.16-.005-.161-.034-.158-.05-.124-.028-.055-.092-.19-.087-.188-.087-.192-.083-.19-.08-.193-.078-.194-.076-.196-.073-.195-.07-.197-.067-.198-.065-.199-.063-.2-.059-.2-.056-.2-.055-.204-.05-.201-.049-.202-.046-.205-.043-.206-.04-.203-.038-.207-.034-.204-.032-.207-.028-.205-.026-.207-.023-.208-.02-.207-.018-.207-.014-.208-.011-.207-.009-.208-.005-.207-.002-.104-.017-.16-.046-.155-.074-.143-.1-.126-.121-.107-.139-.081-.152-.055-.159-.025-.161.004zm24.585 11.83l-.156.039-.146.068-.11.076-.015.012-.163.129-.166.127-.168.125-.17.124-.17.12-.172.118-.173.115-.176.114-.177.111-.18.11-.178.105-.182.104-.182.101-.184.1-.184.095-.189.095-.186.09-.188.089-.19.086-.19.082-.193.081-.195.078-.191.074-.197.073-.195.07-.196.065-.198.064-.198.061-.2.058-.2.055-.2.052-.2.049-.151.035-.153.05-.141.078-.125.103-.103.124-.078.14-.05.154-.022.16.009.16.038.157.067.147.093.132.116.112.134.089.149.062.158.034.16.003.133-.02.158-.035.006-.002.006-.001.213-.052.006-.002.007-.001.212-.056.006-.001.006-.002.212-.058.006-.002.006-.002.211-.061.006-.002.006-.002.21-.064.006-.002.006-.002.21-.067.005-.002.006-.002.208-.07.006-.002.006-.003.207-.073.006-.002.006-.002.206-.077.006-.002.005-.002.206-.08.005-.001.006-.003.204-.082.006-.002.005-.002.203-.085.006-.003.005-.002.202-.088.006-.002.005-.003.2-.09.006-.003.006-.003.2-.093.005-.003.005-.002.198-.096.006-.003.005-.003.197-.099.005-.002.005-.003.196-.102.005-.002.005-.003.195-.105.005-.002.005-.003.193-.107.005-.003.005-.003.191-.11.005-.003.005-.003.19-.112.005-.003.005-.003.189-.115.005-.003.005-.003.187-.117.005-.003.004-.004.186-.12.005-.003.004-.003.184-.122.005-.003.005-.004.182-.125.004-.003.005-.003.18-.128.005-.003.005-.003.179-.13.004-.003.005-.004.177-.132.004-.004.005-.003.175-.135.005-.003.004-.004.173-.137.005-.003.004-.004.019-.015.115-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.052-.153-.079-.14-.103-.124-.125-.102-.142-.078-.153-.05-.16-.02-.16.01zm-19.17.054l-.153.051-.14.079-.124.103-.103.125-.077.141-.05.153-.02.16.009.161.04.156.067.147.093.131.095.094.047.04.005.004.005.004.17.14.005.004.005.004.172.137.004.004.005.003.086.067.003.002.003.002.087.067.003.002.003.002.088.066.002.003.003.002.089.065.002.002.003.002.09.065.002.002.003.002.09.064.002.002.003.002.09.063.003.002.003.002.09.063.003.002.003.002.092.062.002.002.003.002.092.061.003.002.003.002.092.06.003.003.003.001.093.06.003.002.003.002.093.06.003.001.003.002.094.058.003.002.003.002.095.058.003.001.003.002.095.057.003.002.003.002.095.056.003.002.003.002.096.055.004.002.003.001.096.055.003.002.003.002.098.053.003.002.003.002.097.053.004.002.003.001.098.053.003.001.003.002.099.052.003.001.003.002.1.05.003.002.003.002.1.05.003.002.003.001.1.05h.003l.004.003.1.048.004.001.003.002.101.048.003.001.004.002.101.046.004.002.003.001.102.046.004.002.003.001.103.045.003.002.003.001.103.045.004.001.003.002.104.043.003.001.004.002.104.042.003.002.004.001.104.042.004.001.003.002.105.04.004.002.003.001.106.04.003.002h.004l.106.04.004.001.003.002.107.038.003.001.004.001.107.038.003.001.004.001.107.037.004.001.004.001.108.036.003.001.004.001.108.035.004.001.003.001.11.034.003.001.004.001.109.033.004.002h.003l.11.033h.004l.003.002.11.031.004.001.004.001.084.023.081.028.004.001.003.001.109.037.003.001.004.001.109.036.003.001.004.001.109.035h.003l.004.002.11.033.003.001.003.001.11.033.003.001.004.001.109.031.004.002h.003l.11.031.003.001.004.001.11.03h.003l.003.001.11.029h.004l.003.002.11.027.003.001.004.001.11.027h.003l.004.001.004.001.16.022.16-.008.157-.038.147-.067.132-.092.112-.116.09-.134.062-.149.034-.157.004-.161-.025-.16-.055-.151-.082-.139-.107-.12-.127-.1-.143-.074-.124-.04h-.003l-.104-.025-.103-.026h-.002l-.095-.026h-.001l-.101-.027h-.002l-.1-.028h-.002l-.103-.03-.104-.032-.097-.03h-.002l-.103-.033-.102-.033-.101-.034-.106-.036-.027-.01-.027-.007-.107-.03-.104-.029-.104-.03h-.002l-.097-.03-.102-.032-.102-.032-.102-.034-.103-.035-.096-.034-.1-.036-.101-.037h-.002l-.094-.036-.096-.037-.097-.04h-.002l-.099-.04-.098-.042h-.002l-.092-.04-.097-.043-.095-.043-.097-.044h-.002l-.09-.043-.094-.045-.094-.046-.093-.047-.09-.046-.096-.05-.088-.047-.002-.001-.09-.049-.094-.052-.002-.002-.087-.049-.087-.05h-.002l-.088-.053h-.001l-.09-.055-.086-.052-.002-.001-.089-.055-.084-.054h-.002l-.09-.059h-.001l-.085-.056-.001-.001-.084-.056-.082-.056h-.001l-.086-.06-.082-.058H7.79l-.086-.062-.002-.002-.08-.058-.081-.06h-.001l-.085-.064-.002-.002-.076-.058-.002-.002-.082-.064-.161-.128-.162-.133-.04-.034-.132-.092-.147-.066-.157-.038-.16-.008-.16.022z" +}))); + +function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); } +var StartEventNonInterruptingEscalationIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$h({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16 9.209c-1.674 4.655-2.735 9.504-4.408 14.16 1.534-1.526 2.873-3.235 4.407-4.761l4.408 4.76c-1.497-4.71-2.91-9.448-4.408-14.16zm.031 2.93c.822 2.586 1.598 5.187 2.42 7.774l-2.42-2.614c-.682.598-2.453 2.886-2.34 2.389.873-2.488 1.45-5.068 2.34-7.55zM16.132.364c-1.51.016-3.055.139-4.492.614-.854.442-.266 1.861.651 1.578 2.266-.58 4.656-.596 6.944-.144.935.063 1.21-1.391.318-1.674-1.118-.26-2.274-.361-3.42-.374zm8.865 2.777c-.931-.1-1.262 1.29-.425 1.666 1.863 1.364 3.222 3.298 4.322 5.296.617.737 1.875-.145 1.398-.979-1.184-2.275-2.808-4.384-4.923-5.866a.863.863 0 00-.372-.117zM6.55 3.564c-.734.078-1.196.762-1.735 1.206C3.552 6.02 2.55 7.511 1.681 9.053c-.31.533-.71 1.33-.03 1.767.615.432 1.282-.132 1.446-.742.796-1.475 1.746-2.89 2.934-4.08.43-.548 1.292-.822 1.34-1.595a.874.874 0 00-.822-.839zm24.582 11.078c-.771-.033-1.004.82-.873 1.437.13 2.395-.471 4.797-1.615 6.897-.33.876.984 1.559 1.512.785a14.276 14.276 0 001.761-8.54.865.865 0 00-.785-.579zm-30.195.666c-.774-.06-1.032.785-.905 1.407.117 2.41.732 4.81 1.858 6.945.528.774 1.84.09 1.51-.786A15.932 15.932 0 011.728 16a.876.876 0 00-.79-.692zm24.57 11.817c-.762.099-1.243.835-1.919 1.16-1.514 1.002-3.237 1.632-4.978 2.092-.864.423-.307 1.855.616 1.591 2.528-.578 4.93-1.75 6.913-3.421.469-.522.07-1.42-.631-1.422zm-19.16.042c-.845.001-1.12 1.228-.395 1.628 1.665 1.401 3.667 2.348 5.76 2.912.618.178 1.482.565 1.893-.177.355-.628-.226-1.297-.87-1.326-1.972-.515-3.912-1.285-5.5-2.594-.26-.213-.522-.472-.888-.443z" +}))); + +function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); } +var StartEventNonInterruptingMessageIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$g({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M8.746 10.393v11.064h14.506V10.393H8.746zm3.223 1.728h8.06c-1.428.879-2.856 2.807-4.283 3.018l-3.777-3.018zm9.557 1.018v6.59H10.473v-6.59l5.525 4.416 5.528-4.416zM16.132 0c-1.51.016-3.055.139-4.492.614-.854.442-.266 1.861.651 1.578 2.266-.58 4.656-.596 6.944-.144.935.063 1.21-1.391.318-1.674-1.118-.26-2.274-.361-3.42-.374zm8.865 2.777c-.931-.1-1.262 1.29-.425 1.666 1.863 1.364 3.222 3.298 4.322 5.296.617.737 1.875-.145 1.398-.979-1.184-2.275-2.808-4.384-4.923-5.866a.863.863 0 00-.372-.117zM6.55 3.2c-.734.078-1.196.762-1.735 1.206C3.552 5.656 2.55 7.147 1.681 8.69c-.31.533-.71 1.33-.03 1.767.615.432 1.282-.132 1.446-.742.796-1.475 1.746-2.89 2.934-4.08.43-.548 1.292-.822 1.34-1.595a.874.874 0 00-.822-.839zm24.582 11.078c-.771-.033-1.004.82-.873 1.437.13 2.395-.471 4.797-1.615 6.897-.33.876.984 1.559 1.512.785a14.276 14.276 0 001.761-8.54.865.865 0 00-.785-.579zm-30.195.666c-.774-.06-1.032.785-.905 1.407.117 2.41.732 4.81 1.858 6.945.528.774 1.84.09 1.51-.786a15.932 15.932 0 01-1.672-6.874.876.876 0 00-.79-.692zm24.57 11.817c-.762.099-1.243.835-1.919 1.16-1.514 1.002-3.237 1.632-4.978 2.092-.864.423-.307 1.855.616 1.591 2.528-.578 4.93-1.75 6.913-3.421.469-.522.07-1.42-.631-1.422zm-19.16.042c-.845.001-1.12 1.228-.395 1.628 1.665 1.401 3.667 2.348 5.76 2.912.618.178 1.482.565 1.893-.177.355-.628-.226-1.297-.87-1.326-1.972-.515-3.912-1.285-5.5-2.594-.26-.213-.522-.472-.888-.443z" +}))); + +function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); } +var StartEventNonInterruptingMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$f({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M23.621 13.524L16 7.99l-7.622 5.534 2.911 8.952h9.422l2.911-8.952zm-1.016.33l-2.523 7.759h-8.165l-2.524-7.76L16 9.059l6.606 4.796zM16.132 0c-1.51.016-3.055.139-4.492.614-.854.442-.266 1.861.651 1.578 2.266-.58 4.656-.596 6.944-.144.935.063 1.21-1.391.318-1.674-1.118-.26-2.274-.361-3.42-.374zm8.865 2.777c-.931-.1-1.262 1.29-.425 1.666 1.863 1.364 3.222 3.298 4.322 5.296.617.737 1.875-.145 1.398-.979-1.184-2.275-2.808-4.384-4.923-5.866a.863.863 0 00-.372-.117zM6.55 3.2c-.734.078-1.196.762-1.735 1.206C3.552 5.656 2.55 7.147 1.681 8.69c-.31.533-.71 1.33-.03 1.767.615.432 1.282-.132 1.446-.742.796-1.475 1.746-2.89 2.934-4.08.43-.548 1.292-.822 1.34-1.595a.874.874 0 00-.822-.839zm24.582 11.078c-.771-.033-1.004.82-.873 1.437.13 2.395-.471 4.797-1.615 6.897-.33.876.984 1.559 1.512.785a14.276 14.276 0 001.761-8.54.865.865 0 00-.785-.579zm-30.195.666c-.774-.06-1.032.785-.905 1.407.117 2.41.732 4.81 1.858 6.945.528.774 1.84.09 1.51-.786a15.932 15.932 0 01-1.672-6.874.876.876 0 00-.79-.692zm24.57 11.817c-.762.099-1.243.835-1.919 1.16-1.514 1.002-3.237 1.632-4.978 2.092-.864.423-.307 1.855.616 1.591 2.528-.578 4.93-1.75 6.913-3.421.469-.522.07-1.42-.631-1.422zm-19.16.042c-.845.001-1.12 1.228-.395 1.628 1.665 1.401 3.667 2.348 5.76 2.912.618.178 1.482.565 1.893-.177.355-.628-.226-1.297-.87-1.326-1.972-.515-3.912-1.285-5.5-2.594-.26-.213-.522-.472-.888-.443z" +}))); + +function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); } +var StartEventNonInterruptingParallelMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$e({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M13.503 9.016v4.428H9.075v4.98h4.428v4.428h4.98v-4.427h4.428v-4.981h-4.427V9.016h-4.981zm.83.83h3.32v4.428h4.428v3.32h-4.428v4.428h-3.32v-4.454H9.905v-3.294h4.428V9.846zM16.12 0h-.232l-.22.004h-.012l-.221.006h-.012l-.22.01h-.012l-.22.013h-.012l-.22.016h-.012l-.22.019h-.005l-.006.001-.22.021h-.006l-.005.001-.22.025h-.011l-.22.028h-.005l-.006.002-.219.03h-.005l-.006.001-.218.033-.006.001-.006.001-.217.036-.006.001-.006.001-.217.039-.006.001-.006.001-.216.042-.006.001-.006.001-.215.045-.006.001-.006.002-.215.047-.006.002-.006.001-.214.05-.006.002-.006.002-.115.029-.152.053-.14.081-.122.106-.1.126-.075.143-.047.154-.018.16.012.16.042.156.07.145.095.13.118.11.137.086.15.059.158.03h.161l.132-.022.11-.028.202-.047.203-.046.208-.043.202-.039.206-.037.206-.034.205-.03.208-.03.205-.025.209-.023.208-.02.21-.017.209-.015.207-.011.21-.009.21-.006.207-.003h.21l.21.002.207.005.207.008.212.011.207.014.208.017.209.019.208.022.205.025.206.028.207.03.208.035.205.036.202.039.052.01.16.018.16-.012.156-.042.146-.07.13-.096.109-.119.085-.136.06-.15.03-.159v-.16l-.03-.16-.059-.15-.086-.136-.109-.118-.13-.096-.145-.07-.128-.038-.057-.011-.006-.002h-.006l-.216-.042-.006-.001-.006-.001-.217-.039H18.9l-.006-.002-.217-.035-.006-.001-.006-.001-.218-.032-.006-.001-.006-.001-.218-.03h-.006l-.006-.001-.219-.027h-.011l-.22-.024-.005-.001h-.006l-.22-.021h-.006l-.006-.001-.22-.017-.005-.001h-.006L17.06.03h-.012l-.22-.012h-.012l-.22-.01h-.012l-.22-.005h-.012L16.132 0h-.012zm8.715 2.783l-.157.034-.149.063-.134.089-.116.112-.092.132-.067.147-.038.157-.008.16.021.16.051.153.079.141.103.124.102.087.052.038h.001l.087.064v.001l.082.061.002.001.076.059h.001l.084.065.082.066.002.001.079.063.002.002.077.063.081.067.002.002.077.065.076.065.001.002.08.07.078.07h.002l.075.068.077.072.002.001.073.069.077.073.072.07.002.001.077.076.07.07v.001l.075.076.07.073.002.001.074.079.002.002.069.074.069.075.074.082.07.08.002.001.068.079h.001l.067.079.068.082.065.078.001.002.068.083.067.084.063.081.001.002.067.087.002.002.063.084.001.001.064.087.008.01.008.01.095.12.093.121.09.119.087.119.088.122.086.123.084.12.081.122.001.002.084.126.08.126.08.127.077.126.079.131.074.127.075.131.073.131.07.13.07.133.069.133.045.09.086.137.109.119.13.096.144.07.156.042.16.013.16-.017.155-.047.143-.075.126-.1.106-.121.082-.14.054-.151.025-.16-.005-.16-.035-.158-.05-.124-.048-.095-.002-.004-.002-.004-.073-.14-.002-.005-.002-.004-.074-.14-.002-.004-.002-.004-.076-.14-.002-.003-.002-.004-.077-.139-.003-.004-.002-.004-.078-.138-.003-.004-.002-.003-.08-.137-.002-.004-.003-.004-.081-.136-.002-.004-.003-.004-.083-.136-.002-.003-.002-.004-.085-.135-.002-.004-.003-.003-.085-.134-.003-.004-.002-.004-.087-.132-.003-.004-.003-.004-.088-.132-.003-.003-.002-.004-.09-.13-.003-.005-.003-.003-.091-.13-.003-.004-.002-.004-.093-.129-.003-.003-.003-.004-.094-.128-.003-.004-.003-.003-.095-.127-.003-.004-.003-.004-.097-.125-.003-.004-.003-.004-.09-.114-.06-.082-.003-.003-.002-.003-.069-.091-.002-.004-.002-.003-.07-.09-.003-.003-.002-.003-.07-.09-.003-.003-.002-.003-.071-.09-.002-.003-.003-.002-.072-.089-.002-.003-.002-.003-.073-.088-.002-.003-.002-.002-.074-.087-.002-.003-.002-.003-.074-.086-.003-.003-.002-.003-.074-.086-.003-.002-.002-.003-.075-.085-.003-.003-.002-.002-.076-.084-.002-.003-.003-.003-.076-.083-.002-.003-.003-.003-.077-.082-.002-.003-.003-.002-.077-.082-.003-.003-.003-.002-.078-.081-.002-.003-.003-.003-.078-.08-.003-.002-.003-.003-.079-.08-.002-.002-.003-.002-.08-.08-.002-.002-.003-.002-.08-.078-.003-.003-.003-.002-.08-.077-.003-.003-.003-.002-.082-.077-.002-.002-.003-.002-.082-.076-.003-.002-.002-.003-.083-.075-.003-.002-.002-.003-.084-.074-.002-.002-.003-.002-.084-.074-.003-.002-.002-.002-.085-.073-.002-.002-.003-.003-.085-.071-.003-.003-.002-.002-.086-.07-.003-.003-.002-.002-.086-.07-.003-.003-.003-.002-.086-.07-.003-.002-.003-.002-.087-.069-.002-.002-.003-.002-.088-.068-.002-.002-.003-.002-.088-.067-.003-.003-.003-.002-.088-.066-.003-.002-.003-.002-.089-.066-.003-.002-.003-.002-.057-.042-.14-.082-.15-.055-.16-.026-.16.004zM6.377 3.21l-.157.037-.148.066-.111.074-.007.006-.003.002-.003.002-.086.069-.003.002-.002.002-.086.07-.003.002-.002.002-.086.07-.002.003-.003.002-.085.071-.002.002-.003.003-.084.071-.003.003-.002.002-.084.072-.003.003-.002.002-.083.073-.003.003-.002.002-.083.074-.002.002-.003.003-.082.074-.003.003-.002.002-.081.076-.003.002-.003.002-.08.077-.003.002-.003.003-.08.076-.002.003-.003.002-.08.078-.002.002-.003.003-.079.078-.002.003-.003.002-.078.08-.003.002-.002.002-.078.08-.002.003-.003.002-.077.08-.003.004-.002.002-.077.081-.002.003-.003.003-.076.082-.002.002-.003.003-.075.082-.002.003-.003.003-.074.083-.003.003-.002.003-.074.084-.003.003-.002.002-.074.085-.002.003-.002.003-.073.085-.003.003-.002.003-.072.086-.002.003-.003.003-.071.087-.003.003-.002.002-.07.088-.003.003-.002.003-.07.088-.003.003-.002.003-.07.09-.002.002-.002.003-.069.09-.002.003-.003.003-.068.09-.002.003-.002.003-.067.092-.003.003-.002.003-.067.092-.002.003-.002.003-.066.092-.002.003-.002.004-.066.093-.002.003-.002.003-.065.094-.002.003-.002.004-.064.094-.002.003-.002.004-.063.095-.002.003-.002.003-.063.097-.002.003-.002.003-.046.073-.05.07-.003.002-.002.003-.067.093-.003.003-.002.003-.066.094-.002.003-.002.003-.066.094-.002.003-.002.003-.064.094-.002.004-.002.003-.064.094-.002.004-.002.003-.062.095-.002.003-.002.003-.062.096-.002.003-.002.003-.06.096-.003.003-.002.003-.06.096-.001.004-.002.003-.059.096-.002.004-.002.003-.058.097-.002.003-.001.003-.057.098-.002.003-.002.003-.056.098-.002.003-.002.003-.055.098-.002.004-.001.003-.055.098-.001.004-.002.003-.054.099-.001.003-.002.003-.052.1-.002.002-.002.004-.051.1-.002.002-.002.004-.05.1-.002.003-.002.003-.05.1v.003l-.002.004-.05.1v.003l-.002.004-.048.1-.002.004-.001.003-.047.101-.002.003-.001.004-.013.027-.052.152-.024.16.006.16.037.157.064.148.091.133.114.114.134.09.147.065.157.036.162.006.159-.024.152-.053.14-.08.122-.105.1-.126.066-.117.01-.023.044-.095.045-.095.002-.003.042-.087.048-.097.048-.095v-.001l.048-.092.001-.001.047-.09.05-.093.002-.002.049-.09.052-.092.001-.002.051-.089.001-.002.051-.087.053-.088.001-.002.055-.091.057-.091.057-.09.001-.002.057-.089.055-.083.001-.002.06-.09.06-.088.062-.089.001-.001.06-.084.063-.088.065-.089.017-.023.016-.025.06-.094.059-.09v-.002l.058-.086.057-.086.001-.001.062-.09.062-.088.001-.002.06-.085.002-.002.06-.082.063-.087.064-.084.002-.002.061-.08.065-.084.064-.08v-.001l.067-.083.067-.082.07-.083.069-.08.063-.074.074-.083.068-.077.002-.002.07-.076.07-.075.072-.077.001-.001.067-.07.076-.078.002-.002.07-.07.075-.075.002-.002.072-.07.075-.072.002-.002.073-.069.074-.068.001-.001.08-.073.076-.068.002-.002.072-.063v-.001l.078-.067.079-.068.002-.001.08-.068.002-.002.077-.063.082-.066.001-.001.075-.06.002-.002.006-.004.117-.111.094-.131.068-.146.04-.156.01-.161-.019-.16-.049-.154-.076-.141-.102-.125-.123-.105-.14-.079-.153-.052-.16-.023-.16.007zm24.596 11.088l-.156.04-.146.067-.131.094-.112.117-.087.135-.061.15-.033.157-.004.134.007.142.005.152.004.15.002.149v.153l.001.011v.015l.004.11.002.11v.002l.002.106v.321l-.003.102-.002.106-.004.107-.005.105-.006.106-.006.106-.008.106v.002l-.008.103v.002l-.01.1-.01.105-.01.105-.013.105-.012.099v.002l-.014.108-.014.1-.016.105-.016.103v.002l-.017.099-.018.104-.019.103v.002l-.019.097-.02.104-.022.103v.001l-.022.098-.023.103v.002l-.024.096-.025.103v.002l-.024.096-.027.102v.003l-.026.093v.001l-.029.103v.002l-.03.099-.028.097v.002l-.03.095-.03.096v.001l-.033.1-.031.095v.002l-.035.1v.003l-.034.094v.003l-.035.096v.001l-.034.09v.002l-.038.098-.036.093v.002l-.038.095-.079.194-.08.188-.085.189-.087.19-.09.184-.092.183-.095.184-.05.093-.064.148-.034.158-.005.16.026.16.054.151.082.14.106.12.127.1.143.075.154.046.16.017.161-.013.156-.042.144-.071.13-.096.109-.119.072-.112.053-.099.003-.005.003-.006.102-.195.003-.006.003-.006.098-.196.003-.006.003-.006.096-.197.002-.006.003-.006.093-.2.002-.006.003-.006.09-.2.002-.006.003-.007.086-.202.003-.006.002-.006.084-.203.002-.005.001-.005.04-.102.002-.003.001-.003.04-.103.001-.003.001-.003.04-.103v-.004l.001-.003.039-.103v-.003l.002-.003.037-.104.001-.003.001-.003.037-.104v-.004l.002-.003.035-.104.002-.003v-.004l.035-.104.002-.004v-.003l.034-.105.002-.003v-.003l.034-.105v-.004l.002-.003.032-.106.001-.003.001-.003.031-.106.001-.003.001-.004.031-.106.001-.003.001-.004.03-.106v-.003l.002-.004.028-.107.001-.003.001-.003.028-.107.001-.004.001-.003.027-.107.001-.004v-.003l.027-.108.001-.003v-.004l.026-.108.001-.003v-.004l.025-.108.001-.003v-.004l.025-.108v-.004l.001-.003.023-.109v-.003l.001-.004.022-.109v-.003l.002-.004.02-.109.001-.004v-.003l.02-.11.002-.003v-.004l.02-.11v-.007l.019-.11v-.003l.001-.004.017-.11v-.004l.001-.003.017-.11v-.008l.016-.11v-.004l.001-.004.015-.11v-.008l.015-.111v-.008l.013-.111v-.007l.013-.112v-.007l.011-.112v-.004l.001-.004.01-.112v-.007l.01-.112v-.008l.008-.112v-.008l.007-.113v-.007l.007-.113v-.008l.005-.113v-.007l.005-.114v-.007l.003-.114v-.007l.003-.114v-.129l.001-.114v-.13l-.003-.114v-.008l-.003-.115v-.007l-.003-.102v-.155l-.003-.158v-.01l-.004-.158v-.01l-.006-.158v-.01l-.007-.148-.023-.16-.051-.152-.08-.14-.103-.124-.125-.102-.142-.077-.153-.05-.16-.02-.161.01zm-30.213.66l-.157.034-.149.063-.134.09-.115.113-.092.132-.067.147-.037.156-.009.134.001.11V15.95l.006.22v.012l.01.22v.012l.012.22v.006l.001.006.015.22v.005l.001.006.018.22.001.006v.006l.022.219v.006l.001.006.024.219.001.006v.006l.028.218.001.006v.006l.031.218.001.006.001.006.033.218.001.006.001.005.037.218v.006l.002.005.04.217v.006l.001.006.043.216.001.006.001.006.046.216v.005l.002.006.048.215.002.006.001.006.051.214.002.006v.006l.055.214.002.005.001.006.057.213.002.006.001.005.06.213.002.005.001.006.063.212.002.005.001.006.066.21.002.006.002.006.068.21.002.005.002.005.07.21.003.005.002.005.074.208.002.006.002.005.077.207.002.006.002.005.08.206.002.005.002.006.082.204.002.006.002.005.086.204.002.005.002.006.088.202.002.005.003.006.09.2.003.006.002.005.094.2.002.006.003.005.096.199.002.005.003.005.03.062.086.137.11.118.128.097.145.07.156.043.16.013.16-.017.155-.047.143-.074.127-.1.106-.121.081-.14.055-.15.025-.16-.005-.161-.034-.158-.05-.124-.028-.055-.092-.19-.087-.188-.087-.192-.083-.19-.08-.193-.078-.194-.076-.196-.073-.195-.07-.197-.067-.198-.065-.199-.063-.2-.059-.2-.056-.2-.055-.204-.05-.201-.049-.202-.046-.205-.043-.206-.04-.203-.038-.207-.034-.204-.032-.207-.028-.205-.026-.207-.023-.208-.02-.207-.018-.207-.014-.208-.011-.207-.009-.208-.005-.207-.002-.104-.017-.16-.046-.155-.074-.143-.1-.126-.121-.107-.139-.081-.152-.055-.159-.025-.161.004zm24.585 11.83l-.156.039-.146.068-.11.076-.015.012-.163.129-.166.127-.168.125-.17.124-.17.12-.172.118-.173.115-.176.114-.177.111-.18.11-.178.105-.182.104-.182.101-.184.1-.184.095-.189.095-.186.09-.188.089-.19.086-.19.082-.193.081-.195.078-.191.074-.197.073-.195.07-.196.065-.198.064-.198.061-.2.058-.2.055-.2.052-.2.049-.151.035-.153.05-.141.078-.125.103-.103.124-.078.14-.05.154-.022.16.009.16.038.157.067.147.093.132.116.112.134.089.149.062.158.034.16.003.133-.02.158-.035.006-.002.006-.001.213-.052.006-.002.007-.001.212-.056.006-.001.006-.002.212-.058.006-.002.006-.002.211-.061.006-.002.006-.002.21-.064.006-.002.006-.002.21-.067.005-.002.006-.002.208-.07.006-.002.006-.003.207-.073.006-.002.006-.002.206-.077.006-.002.005-.002.206-.08.005-.001.006-.003.204-.082.006-.002.005-.002.203-.085.006-.003.005-.002.202-.088.006-.002.005-.003.2-.09.006-.003.006-.003.2-.093.005-.003.005-.002.198-.096.006-.003.005-.003.197-.099.005-.002.005-.003.196-.102.005-.002.005-.003.195-.105.005-.002.005-.003.193-.107.005-.003.005-.003.191-.11.005-.003.005-.003.19-.112.005-.003.005-.003.189-.115.005-.003.005-.003.187-.117.005-.003.004-.004.186-.12.005-.003.004-.003.184-.122.005-.003.005-.004.182-.125.004-.003.005-.003.18-.128.005-.003.005-.003.179-.13.004-.003.005-.004.177-.132.004-.004.005-.003.175-.135.005-.003.004-.004.173-.137.005-.003.004-.004.019-.015.115-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.052-.153-.079-.14-.103-.124-.125-.102-.142-.078-.153-.05-.16-.02-.16.01zm-19.17.054l-.153.051-.14.079-.124.103-.103.125-.077.141-.05.153-.02.16.009.161.04.156.067.147.093.131.095.094.047.04.005.004.005.004.17.14.005.004.005.004.172.137.004.004.005.003.086.067.003.002.003.002.087.067.003.002.003.002.088.066.002.003.003.002.089.065.002.002.003.002.09.065.002.002.003.002.09.064.002.002.003.002.09.063.003.002.003.002.09.063.003.002.003.002.092.062.002.002.003.002.092.061.003.002.003.002.092.06.003.003.003.001.093.06.003.002.003.002.093.06.003.001.003.002.094.058.003.002.003.002.095.058.003.001.003.002.095.057.003.002.003.002.095.056.003.002.003.002.096.055.004.002.003.001.096.055.003.002.003.002.098.053.003.002.003.002.097.053.004.002.003.001.098.053.003.001.003.002.099.052.003.001.003.002.1.05.003.002.003.002.1.05.003.002.003.001.1.05h.003l.004.003.1.048.004.001.003.002.101.048.003.001.004.002.101.046.004.002.003.001.102.046.004.002.003.001.103.045.003.002.003.001.103.045.004.001.003.002.104.043.003.001.004.002.104.042.003.002.004.001.104.042.004.001.003.002.105.04.004.002.003.001.106.04.003.002h.004l.106.04.004.001.003.002.107.038.003.001.004.001.107.038.003.001.004.001.107.037.004.001.004.001.108.036.003.001.004.001.108.035.004.001.003.001.11.034.003.001.004.001.109.033.004.002h.003l.11.033h.004l.003.002.11.031.004.001.004.001.084.023.081.028.004.001.003.001.109.037.003.001.004.001.109.036.003.001.004.001.109.035h.003l.004.002.11.033.003.001.003.001.11.033.003.001.004.001.109.031.004.002h.003l.11.031.003.001.004.001.11.03h.003l.003.001.11.029h.004l.003.002.11.027.003.001.004.001.11.027h.003l.004.001.004.001.16.022.16-.008.157-.038.147-.067.132-.092.112-.116.09-.134.062-.149.034-.157.004-.161-.025-.16-.055-.151-.082-.139-.107-.12-.127-.1-.143-.074-.124-.04h-.003l-.104-.025-.103-.026h-.002l-.095-.026h-.001l-.101-.027h-.002l-.1-.028h-.002l-.103-.03-.104-.032-.097-.03h-.002l-.103-.033-.102-.033-.101-.034-.106-.036-.027-.01-.027-.007-.107-.03-.104-.029-.104-.03h-.002l-.097-.03-.102-.032-.102-.032-.102-.034-.103-.035-.096-.034-.1-.036-.101-.037h-.002l-.094-.036-.096-.037-.097-.04h-.002l-.099-.04-.098-.042h-.002l-.092-.04-.097-.043-.095-.043-.097-.044h-.002l-.09-.043-.094-.045-.094-.046-.093-.047-.09-.046-.096-.05-.088-.047-.002-.001-.09-.049-.094-.052-.002-.002-.087-.049-.087-.05h-.002l-.088-.053h-.001l-.09-.055-.086-.052-.002-.001-.089-.055-.084-.054h-.002l-.09-.059h-.001l-.085-.056-.001-.001-.084-.056-.082-.056h-.001l-.086-.06-.082-.058H7.79l-.086-.062-.002-.002-.08-.058-.081-.06h-.001l-.085-.064-.002-.002-.076-.058-.002-.002-.082-.064-.161-.128-.162-.133-.04-.034-.132-.092-.147-.066-.157-.038-.16-.008-.16.022z", + opacity: ".98" +}))); + +function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); } +var StartEventNonInterruptingSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$d({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16.007 8.82L9.21 21.022h13.596L16.007 8.82zm0 1.775l5.328 9.563H10.68l5.327-9.563zM16.14.386c-1.571.236-4.195-.284-4.9 1.381.619 1.703 2.745.069 4.085.365 1.421-.13 2.84.2 4.235.259C21.27.784 18.19.344 17 .413a20.456 20.456 0 00-.86-.027zM25 3.162c-2.19.694.401 2.26 1.181 3.094 1.083 1.152 1.954 2.484 2.715 3.864 1.48 1.005 1.845-1.26.81-2.03-1.158-1.897-2.613-3.704-4.513-4.89l-.192-.038zm-18.438.423c-1.793.712-2.909 2.548-4.01 4.061-.773.814-2.211 3.653.005 3.211 1.123-1.469 1.87-3.306 3.267-4.614.664-.7 2.73-2.013.738-2.658zm24.57 11.072c-1.659.435-.468 2.667-.99 3.895a13.427 13.427 0 01-1.497 4.435c-.23 1.659 1.991 1.165 2.018-.199a14.277 14.277 0 001.254-7.552.865.865 0 00-.785-.579zm-30.18.666c-1.677.386-.633 2.667-.608 3.876.371 1.623.792 3.35 1.79 4.696 2.382.321.571-2.338.292-3.492a15.92 15.92 0 01-.684-4.39.877.877 0 00-.79-.69zm24.558 11.81c-1.755.865-3.303 2.266-5.274 2.765-1.162-.016-3.074 1.271-1.331 2.102 2.66-.447 5.163-1.733 7.236-3.445.472-.506.06-1.432-.631-1.421zm-19.151.043c-2.004.786.416 2.405 1.43 2.913 1.608.904 3.379 1.636 5.208 1.877 1.77-.804-.228-2.094-1.357-2.073-1.75-.537-3.403-1.396-4.798-2.586l-.227-.104-.256-.027z" +}))); + +function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); } +var StartEventNonInterruptingTimerIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$c({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.991 8.7c-3.018-.042-5.92 1.925-7.03 4.725-1.138 2.695-.509 6.011 1.537 8.102 1.99 2.142 5.267 2.93 8.013 1.927 2.877-.98 4.99-3.826 5.067-6.87.153-2.956-1.624-5.88-4.299-7.135a7.551 7.551 0 00-3.288-.75zm0 1.383c2.758-.052 5.372 1.972 6.014 4.654.704 2.578-.482 5.516-2.79 6.867-2.358 1.48-5.682 1.085-7.617-.919-2.043-1.97-2.407-5.38-.84-7.743 1.11-1.764 3.149-2.88 5.233-2.86zm1.962 1.764l-2.074 3.762c-.64.068-.793 1.04-.202 1.3.39.27.696-.18 1.052-.165h3.17v-.865h-3.182l1.993-3.614-.757-.418zM16.12.358h-.232l-.22.004h-.012l-.221.006h-.012l-.22.01h-.012l-.22.013h-.012l-.22.016h-.012l-.22.019h-.005l-.006.001-.22.021h-.006l-.005.001-.22.025h-.011l-.22.028h-.005l-.006.002-.219.03h-.005l-.006.001-.218.033-.006.001-.006.001-.217.036-.006.001-.006.001-.217.039-.006.001-.006.001-.216.042-.006.001-.006.001-.215.045-.006.001-.006.002-.215.047-.006.002-.006.001-.214.05-.006.002-.006.002-.115.029-.152.053-.14.081-.122.106-.1.126-.075.143-.047.154-.018.16.012.16.042.156.07.145.095.13.118.11.137.086.15.059.158.03h.161l.132-.022.11-.028.202-.047.203-.046.208-.043.202-.039.206-.037.206-.034.205-.03.208-.03.205-.025.209-.023.208-.02.21-.017.209-.015.207-.011.21-.009.21-.006.207-.003h.21l.21.002.207.005.207.008.212.011.207.014.208.017.209.019.208.022.205.025.206.028.207.03.208.035.205.036.202.039.052.01.16.018.16-.012.156-.042.146-.07.13-.096.109-.119.085-.136.06-.15.03-.159v-.16l-.03-.16-.059-.15-.086-.136L19.823.9l-.13-.096-.145-.07-.128-.038-.057-.011-.006-.002h-.006L19.135.64l-.006-.001-.006-.001-.217-.039H18.9l-.006-.002-.217-.035-.006-.001-.006-.001-.218-.032-.006-.001-.006-.001-.218-.03h-.006l-.006-.001-.219-.027h-.011l-.22-.024-.005-.001h-.006l-.22-.021h-.006L17.512.42l-.22-.017-.005-.001h-.006l-.22-.015h-.012l-.22-.012h-.012l-.22-.01h-.012l-.22-.005h-.012l-.221-.003h-.012zm8.715 2.783l-.157.034-.149.063-.134.089-.116.112-.092.132-.067.147-.038.157-.008.16.021.16.051.153.079.141.103.124.102.087.052.038h.001l.087.064v.001l.082.061.002.001.076.059h.001l.084.065.082.066.002.001.079.063.002.002.077.063.081.067.002.002.077.065.076.065.001.002.08.07.078.07h.002l.075.068.077.072.002.001.073.069.077.073.072.07.002.001.077.076.07.07v.001l.075.076.07.073.002.001.074.079.002.002.069.074.069.075.074.082.07.08.002.001.068.079h.001l.067.079.068.082.065.078.001.002.068.083.067.084.063.081.001.002.067.087.002.002.063.084.001.001.064.087.008.01.008.01.095.12.093.121.09.119.087.119.088.122.086.123.084.12.081.122.001.002.084.126.08.126.08.127.077.126.079.131.074.127.075.131.073.131.07.13.07.133.069.133.045.09.086.137.109.119.13.096.144.07.156.042.16.013.16-.017.155-.047.143-.075.126-.1.106-.121.082-.14.054-.151.025-.16-.005-.16-.035-.158-.05-.124-.048-.095-.002-.004-.002-.004-.073-.14-.002-.005-.002-.004-.074-.14-.002-.004-.002-.004-.076-.14-.002-.003-.002-.004-.077-.139-.003-.004-.002-.004-.078-.138-.003-.004-.002-.003-.08-.137-.002-.004-.003-.004-.081-.136-.002-.004-.003-.004-.083-.136-.002-.003-.002-.004-.085-.135-.002-.004-.003-.003-.085-.134-.003-.004-.002-.004-.087-.132-.003-.004-.003-.004-.088-.132-.003-.003-.002-.004-.09-.13-.003-.005-.003-.003-.091-.13-.003-.004-.002-.004-.093-.129-.003-.003-.003-.004-.094-.128-.003-.004-.003-.003-.095-.127-.003-.004-.003-.004-.097-.125-.003-.004-.003-.004-.09-.114-.06-.082-.003-.003-.002-.003-.069-.091-.002-.004-.002-.003-.07-.09-.003-.003-.002-.003-.07-.09-.003-.003-.002-.003-.071-.09-.002-.003-.003-.002-.072-.089-.002-.003-.002-.003-.073-.088-.002-.003-.002-.002-.074-.087-.002-.003-.002-.003-.074-.086-.003-.003-.002-.003-.074-.086-.003-.002-.002-.003-.075-.085-.003-.003-.002-.002-.076-.084-.002-.003-.003-.003-.076-.083-.002-.003-.003-.003-.077-.082-.002-.003-.003-.002-.077-.082-.003-.003-.003-.002-.078-.081-.002-.003-.003-.003-.078-.08-.003-.002-.003-.003-.079-.08-.002-.002-.003-.002-.08-.08-.002-.002-.003-.002-.08-.078-.003-.003-.003-.002-.08-.077-.003-.003-.003-.002-.082-.077-.002-.002-.003-.002-.082-.076-.003-.002-.002-.003-.083-.075-.003-.002-.002-.003-.084-.074-.002-.002-.003-.002-.084-.074-.003-.002-.002-.002-.085-.073-.002-.002-.003-.003-.085-.071-.003-.003-.002-.002-.086-.07-.003-.003-.002-.002-.086-.07-.003-.003-.003-.002-.086-.07-.003-.002-.003-.002-.087-.069-.002-.002-.003-.002-.088-.068-.002-.002-.003-.002-.088-.067-.003-.003-.003-.002-.088-.066-.003-.002-.003-.002-.089-.066-.003-.002-.003-.002-.057-.042-.14-.082-.15-.055-.16-.026-.16.004zm-18.458.426l-.157.037-.148.066-.111.074-.007.006-.003.002-.003.002-.086.069-.003.002-.002.002-.086.07-.003.002-.002.002-.086.07-.002.003-.003.002-.085.071-.002.002-.003.003-.084.071-.003.003-.002.002-.084.072-.003.003-.002.002-.083.073-.003.003-.002.002-.083.074-.002.002-.003.003-.082.074-.003.003-.002.002-.081.076-.003.002-.003.002-.08.077-.003.002-.003.003-.08.076-.002.003-.003.002-.08.078-.002.002-.003.003-.079.078-.002.003-.003.002-.078.08-.003.002-.002.002-.078.08-.002.003-.003.002-.077.08-.003.004-.002.002-.077.081-.002.003-.003.003-.076.082-.002.002-.003.003-.075.082-.002.003-.003.003-.074.083-.003.003-.002.003-.074.084-.003.003-.002.002-.074.085-.002.003-.002.003-.073.085-.003.003-.002.003-.072.086-.002.003-.003.003-.071.087-.003.003-.002.002-.07.088-.003.003-.002.003-.07.088-.003.003-.002.003-.07.09-.002.002-.002.003-.069.09-.002.003-.003.003-.068.09-.002.003-.002.003-.067.092-.003.003-.002.003-.067.092-.002.003-.002.003-.066.092-.002.003-.002.004-.066.093-.002.003-.002.003-.065.094-.002.003-.002.004-.064.094-.002.003-.002.004-.063.095-.002.003-.002.003-.063.097-.002.003-.002.003-.046.073-.05.07-.003.002-.002.003-.067.093-.003.003-.002.003-.066.094-.002.003-.002.003-.066.094-.002.003-.002.003-.064.094-.002.004-.002.003-.064.094-.002.004-.002.003-.062.095-.002.003-.002.003-.062.096-.002.003-.002.003-.06.096-.003.003-.002.003-.06.096-.001.004-.002.003-.059.096-.002.004-.002.003-.058.097-.002.003-.001.003-.057.098-.002.003-.002.003-.056.098-.002.003-.002.003-.055.098-.002.004-.001.003-.055.098-.001.004-.002.003-.054.099-.001.003-.002.003-.052.1-.002.002-.002.004-.051.1-.002.002-.002.004-.05.1-.002.003-.002.003-.05.1v.003l-.002.004-.05.1V9.5l-.002.004-.048.1-.002.004-.001.003-.047.101-.002.003-.001.004-.013.027-.052.152-.024.16.006.16.037.157.064.148.091.133.114.114.134.09.147.065.157.036.162.006.159-.024.152-.053.14-.08.122-.105.1-.126.066-.117.01-.023.044-.095.045-.095.002-.003.042-.087.048-.097.048-.095v-.001l.048-.092.001-.001.047-.09.05-.093.002-.002.049-.09.052-.092.001-.002.051-.089.001-.002.051-.087.053-.088.001-.002.055-.091.057-.091.057-.09.001-.002.057-.089.055-.083.001-.002.06-.09.06-.088.062-.089.001-.001.06-.084.063-.088.065-.089.017-.023.016-.025.06-.094.059-.09v-.002l.058-.086.057-.086.001-.001.062-.09.062-.088.001-.002.06-.085.002-.002.06-.082.063-.087.064-.084.002-.002.061-.08.065-.084.064-.08v-.001l.067-.083.067-.082.07-.083.069-.08.063-.074.074-.083.068-.077.002-.002.07-.076.07-.075.072-.077.001-.001.067-.07.076-.078.002-.002.07-.07.075-.075.002-.002.072-.07.075-.072.002-.002.073-.069.074-.068.001-.001.08-.073.076-.068.002-.002.072-.063v-.001l.078-.067.079-.068.002-.001.08-.068.002-.002.077-.063.082-.066.001-.001.075-.06.002-.002.006-.004.117-.111.094-.131.068-.146.04-.156.01-.161-.019-.16-.049-.154-.076-.141-.102-.125-.123-.105-.14-.079-.153-.052-.16-.023-.16.007zm24.596 11.088l-.156.04-.146.067-.131.094-.112.117-.087.135-.061.15-.033.157-.004.134.007.142.005.152.004.15.002.149v.153l.001.011v.015l.004.11.002.11v.002l.002.106v.321l-.003.102-.002.106-.004.107-.005.105-.006.106-.006.106-.008.106v.002l-.008.103v.002l-.01.1-.01.105-.01.105-.013.105-.012.099v.002l-.014.108-.014.1-.016.105-.016.103v.002l-.017.099-.018.104-.019.103v.002l-.019.097-.02.104-.022.103v.001l-.022.098-.023.103v.002l-.024.096-.025.103v.002l-.024.096-.027.102v.003l-.026.093v.001l-.029.103v.002l-.03.099-.028.097v.002l-.03.095-.03.096v.001l-.033.1-.031.095v.002l-.035.1v.003l-.034.094v.003l-.035.096v.001l-.034.09v.002l-.038.098-.036.093v.002l-.038.095-.079.194-.08.188-.085.189-.087.19-.09.184-.092.183-.095.184-.05.093-.064.148-.034.158-.005.16.026.16.054.151.082.14.106.12.127.1.143.075.154.046.16.017.161-.013.156-.042.144-.071.13-.096.109-.119.072-.112.053-.099.003-.005.003-.006.102-.195.003-.006.003-.006.098-.196.003-.006.003-.006.096-.197.002-.006.003-.006.093-.2.002-.006.003-.006.09-.2.002-.006.003-.007.086-.202.003-.006.002-.006.084-.203.002-.005.001-.005.04-.102.002-.003.001-.003.04-.103.001-.003.001-.003.04-.103v-.004l.001-.003.039-.103v-.003l.002-.003.037-.104.001-.003.001-.003.037-.104v-.004l.002-.003.035-.104.002-.003v-.004l.035-.104.002-.004v-.003l.034-.105.002-.003v-.003l.034-.105v-.004l.002-.003.032-.106.001-.003.001-.003.031-.106.001-.003.001-.004.031-.106.001-.003.001-.004.03-.106v-.003l.002-.004.028-.107.001-.003.001-.003.028-.107.001-.004.001-.003.027-.107.001-.004v-.003l.027-.108.001-.003v-.004l.026-.108.001-.003v-.004l.025-.108.001-.003v-.004l.025-.108v-.004l.001-.003.023-.109v-.003l.001-.004.022-.109v-.003l.002-.004.02-.109.001-.004v-.003l.02-.11.002-.003v-.004l.02-.11v-.007l.019-.11v-.003l.001-.004.017-.11v-.004l.001-.003.017-.11v-.008l.016-.11v-.004l.001-.004.015-.11v-.008l.015-.111v-.008l.013-.111v-.007l.013-.112v-.007l.011-.112v-.004l.001-.004.01-.112v-.007l.01-.112v-.008l.008-.112v-.008l.007-.113v-.007l.007-.113v-.008l.005-.113v-.007l.005-.114v-.007l.003-.114v-.007l.003-.114v-.129l.001-.114v-.13l-.003-.114V16.5l-.003-.115v-.007l-.003-.102v-.155l-.003-.158v-.01l-.004-.158v-.01l-.006-.158v-.01l-.007-.148-.023-.16-.051-.152-.08-.14-.103-.124-.125-.102-.142-.077-.153-.05-.16-.02-.161.01zm-30.213.66l-.157.034-.149.063-.134.09-.115.113-.092.132-.067.147-.037.156-.009.134.001.11V16.308l.006.22v.012l.01.22v.012l.012.22v.006l.001.006.015.22v.005l.001.006.018.22.001.006v.006l.022.219v.006l.001.006.024.219.001.006v.006l.028.218.001.006v.006l.031.218.001.006.001.006.033.218.001.006.001.005.037.218v.006l.002.005.04.217v.006l.001.006.043.216.001.006.001.006.046.216v.005l.002.006.048.215.002.006.001.006.051.214.002.006v.006l.055.214.002.005.001.006.057.213.002.006.001.005.06.213.002.005.001.006.063.212.002.005.001.006.066.21.002.006.002.006.068.21.002.005.002.005.07.21.003.005.002.005.074.208.002.006.002.005.077.207.002.006.002.005.08.206.002.005.002.006.082.204.002.006.002.005.086.204.002.005.002.006.088.202.002.005.003.006.09.2.003.006.002.005.094.2.002.006.003.005.096.199.002.005.003.005.03.062.086.137.11.118.128.097.145.07.156.043.16.013.16-.017.155-.047.143-.074.127-.1.106-.121.081-.14.055-.15.025-.16-.005-.161-.034-.158-.05-.124-.028-.055-.092-.19-.087-.188-.087-.192-.083-.19-.08-.193-.078-.194-.076-.196-.073-.195-.07-.197-.067-.198-.065-.199-.063-.2-.059-.2-.056-.2-.055-.204-.05-.201-.049-.202-.046-.205-.043-.206-.04-.203-.038-.207-.034-.204-.032-.207-.028-.205-.026-.207-.023-.208-.02-.207-.018-.207-.014-.208-.011-.207-.009-.208-.005-.207-.002-.104-.017-.16-.046-.155-.074-.143-.1-.126-.121-.107-.139-.081-.152-.055-.159-.025-.161.004zm24.585 11.83l-.156.039-.146.068-.11.076-.015.012-.163.129-.166.127-.168.125-.17.124-.17.12-.172.118-.173.115-.176.114-.177.111-.18.11-.178.105-.182.104-.182.101-.184.1-.184.095-.189.095-.186.09-.188.089-.19.086-.19.082-.193.081-.195.078-.191.074-.197.073-.195.07-.196.065-.198.064-.198.061-.2.058-.2.055-.2.052-.2.049-.151.035-.153.05-.141.078-.125.103-.103.124-.078.14-.05.154-.022.16.009.16.038.157.067.147.093.132.116.112.134.089.149.062.158.034.16.003.133-.02.158-.035.006-.002.006-.001.213-.052.006-.002.007-.001.212-.056.006-.001.006-.002.212-.058.006-.002.006-.002.211-.061.006-.002.006-.002.21-.064.006-.002.006-.002.21-.067.005-.002.006-.002.208-.07.006-.002.006-.003.207-.073.006-.002.006-.002.206-.077.006-.002.005-.002.206-.08.005-.001.006-.003.204-.082.006-.002.005-.002.203-.085.006-.003.005-.002.202-.088.006-.002.005-.003.2-.09.006-.003.006-.003.2-.093.005-.003.005-.002.198-.096.006-.003.005-.003.197-.099.005-.002.005-.003.196-.102.005-.002.005-.003.195-.105.005-.002.005-.003.193-.107.005-.003.005-.003.191-.11.005-.003.005-.003.19-.112.005-.003.005-.003.189-.115.005-.003.005-.003.187-.117.005-.003.004-.004.186-.12.005-.003.004-.003.184-.122.005-.003.005-.004.182-.125.004-.003.005-.003.18-.128.005-.003.005-.003.179-.13.004-.003.005-.004.177-.132.004-.004.005-.003.175-.135.005-.003.004-.004.173-.137.005-.003.004-.004.019-.015.115-.113.092-.132.066-.147.038-.157.008-.16-.022-.16-.052-.153-.079-.14-.103-.124-.125-.102-.142-.078-.153-.05-.16-.02-.16.01zm-19.17.054l-.153.051-.14.079-.124.103-.103.125-.077.141-.05.153-.02.16.009.161.04.156.067.147.093.131.095.094.047.04.005.004.005.004.17.14.005.004.005.004.172.137.004.004.005.003.086.067.003.002.003.002.087.067.003.002.003.002.088.066.002.003.003.002.089.065.002.002.003.002.09.065.002.002.003.002.09.064.002.002.003.002.09.063.003.002.003.002.09.063.003.002.003.002.092.062.002.002.003.002.092.061.003.002.003.002.092.06.003.003.003.001.093.06.003.002.003.002.093.06.003.001.003.002.094.058.003.002.003.002.095.058.003.001.003.002.095.057.003.002.003.002.095.056.003.002.003.002.096.055.004.002.003.001.096.055.003.002.003.002.098.053.003.002.003.002.097.053.004.002.003.001.098.053.003.001.003.002.099.052.003.001.003.002.1.05.003.002.003.002.1.05.003.002.003.001.1.05h.003l.004.003.1.048.004.001.003.002.101.048.003.001.004.002.101.046.004.002.003.001.102.046.004.002.003.001.103.045.003.002.003.001.103.045.004.001.003.002.104.043.003.001.004.002.104.042.003.002.004.001.104.042.004.001.003.002.105.04.004.002.003.001.106.04.003.002h.004l.106.04.004.001.003.002.107.038.003.001.004.001.107.038.003.001.004.001.107.037.004.001.004.001.108.036.003.001.004.001.108.035.004.001.003.001.11.034.003.001.004.001.109.033.004.002h.003l.11.033h.004l.003.002.11.031.004.001.004.001.084.023.081.028.004.001.003.001.109.037.003.001.004.001.109.036.003.001.004.001.109.035h.003l.004.002.11.033.003.001.003.001.11.033.003.001.004.001.109.031.004.002h.003l.11.031.003.001.004.001.11.03h.003l.003.001.11.029h.004l.003.002.11.027.003.001.004.001.11.027h.003l.004.001.004.001.16.022.16-.008.157-.038.147-.067.132-.092.112-.116.09-.134.062-.149.034-.157.004-.161-.025-.16-.055-.151-.082-.139-.107-.12-.127-.1-.143-.074-.124-.04h-.003l-.104-.025-.103-.026h-.002l-.095-.026h-.001l-.101-.027h-.002l-.1-.028h-.002l-.103-.03-.104-.032-.097-.03h-.002l-.103-.033-.102-.033-.101-.034-.106-.036-.027-.01-.027-.007-.107-.03-.104-.029-.104-.03h-.002l-.097-.03-.102-.032-.102-.032-.102-.034-.103-.035-.096-.034-.1-.036-.101-.037h-.002l-.094-.036-.096-.037-.097-.04h-.002l-.099-.04-.098-.042h-.002l-.092-.04-.097-.043-.095-.043-.097-.044h-.002l-.09-.043-.094-.045-.094-.046-.093-.047-.09-.046-.096-.05-.088-.047-.002-.001-.09-.049-.094-.052-.002-.002-.087-.049-.087-.05h-.002l-.088-.053h-.001l-.09-.055-.086-.052-.002-.001-.089-.055-.084-.054h-.002l-.09-.059h-.001l-.085-.056-.001-.001-.084-.056-.082-.056h-.001l-.086-.06-.082-.058H7.79l-.086-.062-.002-.002-.08-.058-.081-.06h-.001l-.085-.064-.002-.002-.076-.058-.002-.002-.082-.064-.161-.128-.162-.133-.04-.034-.132-.092-.147-.066-.157-.038-.16-.008-.16.022z" +}))); + +function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); } +var StartEventNoneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$b({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.847.004C9.61-.016 3.624 4.014 1.257 9.78-1.235 15.49.06 22.581 4.42 27.034c4.193 4.513 11.101 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.268.403-6.228-3.26-12.441-8.87-15.154A15.924 15.924 0 0015.846.004zm.439 1.729c6.105.033 11.856 4.45 13.435 10.359 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.625-4.814-3.84-6.538-10.94-4.067-16.57 2.14-5.206 7.515-8.775 13.147-8.71.097-.001.194-.002.29-.001z" +}))); + +function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); } +var StartEventParallelMultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$a({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.847 0C9.61-.02 3.624 4.01 1.257 9.775-1.235 15.485.06 22.577 4.42 27.03c4.193 4.513 11.101 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.268.403-6.228-3.26-12.441-8.87-15.154A15.924 15.924 0 0015.846 0zm.439 1.729c6.105.033 11.856 4.45 13.435 10.359 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.625C2.101 23.17.377 16.07 2.848 10.44c2.134-5.2 7.522-8.78 13.147-8.71.097-.001.194-.002.29-.001zM13.504 9.08v4.427H9.077v4.98h4.427v4.427h4.98v-4.427h4.428v-4.98h-4.427V9.08h-4.98zm.83.83h3.32v4.427h4.428v3.32h-4.427v4.427h-3.32v-4.453H9.906v-3.294h4.427V9.91z" +}))); + +function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); } +var StartEventSignalIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$9({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M15.995.005C9.705-.08 3.643 3.968 1.257 9.78-1.235 15.49.06 22.581 4.42 27.034c4.193 4.513 11.102 6.17 16.887 4.058 5.996-2.042 10.423-7.93 10.664-14.269.403-6.227-3.26-12.44-8.87-15.153A15.924 15.924 0 0015.994.005zm0 1.73c6.213-.108 12.122 4.355 13.726 10.357 1.678 5.653-.592 12.198-5.463 15.547-5.06 3.719-12.564 3.45-17.343-.626-4.814-3.838-6.538-10.939-4.067-16.57 2.14-5.205 7.515-8.774 13.147-8.708zm0 6.776L9.19 20.724H22.8L15.995 8.511zm0 1.777l5.332 9.572H10.662l5.333-9.572z" +}))); + +function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); } +var StartEventTimerIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$8({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M16 0C7.174 0 0 7.174 0 16s7.174 16 16 16 16-7.174 16-16S24.826 0 16 0zm0 1.73c7.892 0 14.27 6.378 14.27 14.27 0 7.891-6.379 14.27-14.27 14.27S1.73 23.891 1.73 16C1.73 8.108 8.108 1.73 16 1.73zm-.143 6.676c-2.967.02-5.797 1.97-6.89 4.727-1.138 2.695-.51 6.012 1.537 8.102 1.99 2.142 5.268 2.932 8.014 1.928 2.878-.98 4.992-3.827 5.068-6.87.153-2.957-1.624-5.881-4.3-7.137a7.552 7.552 0 00-3.43-.75zm.27 1.383c2.71.012 5.254 2.015 5.886 4.656.704 2.577-.482 5.517-2.791 6.867-2.358 1.48-5.682 1.085-7.618-.918-2.043-1.971-2.407-5.381-.84-7.745 1.11-1.763 3.15-2.88 5.234-2.86h.13zm1.833 1.765l-2.074 3.763c-.64.068-.793 1.04-.202 1.3.39.27.696-.18 1.052-.165h3.17v-.865h-3.181l1.992-3.615-.757-.418z" +}))); + +function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); } +var SubprocessCollapsedIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$7({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M5.637 3A5.644 5.644 0 000 8.637v15.417a5.644 5.644 0 005.637 5.637h20.726A5.644 5.644 0 0032 24.054V8.637A5.644 5.644 0 0026.363 3H5.637zm0 1.778h20.726a3.83 3.83 0 013.859 3.859v15.417a3.83 3.83 0 01-3.859 3.858h-4.201V16.695H9.838v11.217H5.637a3.83 3.83 0 01-3.859-3.858V8.637a3.83 3.83 0 013.859-3.859zm5.33 13.046h10.066v10.065H10.967V17.824zm4.189 1.431V22.06H12.35v1.689h2.804V26.554h1.69V23.749h2.804V22.06h-2.804V19.255h-1.69z" +}))); + +function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); } +var SubprocessExpandedIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$6({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M5.636 3A5.642 5.642 0 000 8.636v15.418a5.643 5.643 0 005.636 5.636h20.728A5.643 5.643 0 0032 24.054V8.636A5.642 5.642 0 0026.364 3H5.636zm0 1.778h20.728a3.83 3.83 0 013.858 3.858v15.418a3.83 3.83 0 01-3.858 3.858h-4.203V16.723H9.84v11.189H5.636a3.83 3.83 0 01-3.858-3.858V8.636a3.83 3.83 0 013.858-3.858zm5.331 13.074h10.066v10.06H10.967v-10.06zm1.336 3.996v1.711h7.394v-1.71h-7.394z" +}))); + +function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); } +var TaskNoneIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$5({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M6.494 2.667C2.916 2.667 0 5.57 0 9.142v13.383C0 26.097 2.916 29 6.494 29h19.012C29.084 29 32 26.097 32 22.525V9.142c0-3.572-2.916-6.475-6.494-6.475H6.494zm0 2h19.012c2.509 0 4.494 1.98 4.494 4.475v13.383C30 25.02 28.015 27 25.506 27H6.494C3.985 27 2 25.02 2 22.525V9.142c0-2.495 1.985-4.475 4.494-4.475z" +}))); + +function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); } +var TextAnnotationicon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$4({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M22.087 0v31.647H32v-1.788h-8.125V1.788H32V0h-9.913zm-2.924 13.999l-2.737 2.167 2.167 2.738 2.738-2.167-2.168-2.738zm-5.475 4.335L10.95 20.5l2.168 2.738 2.737-2.168-2.167-2.737zm-5.475 4.335l-2.738 2.167 2.168 2.738 2.737-2.168-2.167-2.737zm-5.476 4.335L0 29.17l2.167 2.738 2.738-2.168-2.168-2.737z" +}))); + +function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); } +var TransactionIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$3({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + d: "M5.422 3A5.424 5.424 0 000 8.422v15.822a5.424 5.424 0 005.422 5.423h21.156A5.424 5.424 0 0032 24.244V8.422A5.424 5.424 0 0026.578 3H5.422zm0 1.244h21.156a4.155 4.155 0 014.178 4.178v15.822a4.155 4.155 0 01-4.178 4.178H5.422a4.155 4.155 0 01-4.178-4.178V8.422a4.155 4.155 0 014.178-4.178zm1.056 1.778a3.373 3.373 0 00-3.367 3.366v13.89a3.373 3.373 0 003.367 3.366h19.044a3.373 3.373 0 003.367-3.366V9.388a3.373 3.373 0 00-3.367-3.366H6.478zm0 1.245h19.044c1.187 0 2.122.935 2.122 2.121v13.89a2.104 2.104 0 01-2.122 2.122H6.478a2.104 2.104 0 01-2.122-2.122V9.388c0-1.186.935-2.121 2.122-2.121z" +}))); + +function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); } +var UserTaskIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$2({ + xmlns: "http://www.w3.org/2000/svg", + width: "32", + height: "32" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fillRule: "evenodd", + d: "M10.263 7.468c-1.698 0-2.912 1.305-2.915 2.791v.001c0 .45.121.924.311 1.352.138.309.308.593.516.82-1.235.423-2.683 1.119-3.414 2.49l-.04.075v4.44h11.083v-4.44l-.04-.074c-.72-1.352-2.136-2.047-3.36-2.471.597-.608.774-1.392.774-2.192-.004-1.487-1.218-2.792-2.915-2.792zm-1.16 1.583c.08 0 .165.003.26.008.757.045 1.012.181 1.207.31.196.13.334.252.851.268.404-.016.598-.087.737-.169.056-.033.103-.067.152-.1.128.275.197.578.198.893 0 .894-.154 1.52-.975 2.034l.08.604c.171.052.348.11.527.171.025.105.054.242.073.387.02.153.029.311.016.43a.422.422 0 01-.056.19c-.417.417-1.157.66-1.908.66-.75 0-1.49-.243-1.908-.66a.422.422 0 01-.056-.19 1.949 1.949 0 01.016-.43c.02-.146.049-.284.074-.388.177-.062.352-.118.521-.17l.048-.648a.616.616 0 00-.126-.118c-.183-.138-.405-.44-.562-.793-.157-.353-.254-.757-.254-1.08 0-.387.105-.758.297-1.079l.11-.04c.143-.046.339-.09.679-.09zm-1.448 4.304l-.002.014c-.025.185-.04.387-.018.589.021.202.074.42.248.593.595.594 1.494.857 2.382.857.889 0 1.788-.263 2.382-.857.174-.174.227-.391.249-.593a2.496 2.496 0 00-.018-.59l-.002-.01c.903.396 1.776.963 2.258 1.81v3.599H13.53v-2.538h-.67v2.538H7.651v-2.538h-.67v2.538H5.39v-3.599c.483-.849 1.359-1.416 2.264-1.813zM6.495 3C2.914 3 0 5.903 0 9.475v13.383c0 3.572 2.916 6.475 6.494 6.475h19.012c3.578 0 6.494-2.903 6.494-6.475V9.475C32 5.903 29.084 3 25.506 3H6.494zm0 2h19.01C28.016 5 30 6.98 30 9.475v13.383c0 2.495-1.985 4.475-4.494 4.475H6.494C3.985 27.333 2 25.353 2 22.858V9.475C2 6.98 3.985 5 6.494 5z" +}))); + +var iconsByType = { + 'Association': AssociationIcon, + 'BusinessRuleTask': BusinessRuleTaskIcon, + 'CallActivity': CallActivityIcon, + 'Collaboration': CollaborationIcon, + 'ConditionalFlow': ConditionalFlowIcon, + 'SequenceFlow': ConnectionIcon, + 'DataInput': DataInputIcon, + 'DataInputAssociation': DataInputOutputAssociationIcon, + 'DataOutput': DataOutputIcon, + 'DataOutputAssociation': DataInputOutputAssociationIcon, + 'DataObjectReference': DataObjectIcon, + 'DataStoreReference': DataStoreIcon, + 'DefaultFlow': DefaultFlowIcon, + 'CancelEndEvent': EndEventCancelIcon, + 'CompensateEndEvent': EndEventCompensationIcon, + 'ErrorEndEvent': EndEventErrorIcon, + 'EscalationEndEvent': EndEventEscalationIcon, + 'LinkEndEvent': EndEventLinkIcon, + 'MessageEndEvent': EndEventMessageIcon, + 'MultipleEndEvent': EndEventMultipleIcon, + 'EndEvent': EndEventNoneIcon, + 'SignalEndEvent': EndEventSignalIcon, + 'TerminateEndEvent': EndEventTerminateIcon, + 'EventSubProcess': EventSubProcessExpandedIcon, + 'ComplexGateway': GatewayComplexIcon, + 'EventBasedGateway': GatewayEventBasedIcon, + 'ExclusiveGateway': GatewayXorIcon, + 'Gateway': GatewayNoneIcon, + 'InclusiveGateway': GatewayOrIcon, + 'ParallelGateway': GatewayParallelIcon, + 'Group': GroupIcon, + 'CancelIntermediateCatchEvent': IntermediateEventCatchCancelIcon, + 'CompensateIntermediateCatchEvent': IntermediateEventCatchCompensationIcon, + 'ConditionalIntermediateCatchEvent': IntermediateEventCatchConditionIcon, + 'ErrorIntermediateCatchEvent': IntermediateEventCatchErrorIcon, + 'EscalationIntermediateCatchEvent': IntermediateEventCatchEscalationIcon, + 'LinkIntermediateCatchEvent': IntermediateEventCatchLinkIcon, + 'MessageIntermediateCatchEvent': IntermediateEventCatchMessageIcon, + 'MultipleIntermediateCatchEvent': IntermediateEventCatchMultipleIcon, + 'ConditionalIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingConditionIcon, + 'EscalationIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingEscalationIcon, + 'MessageIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingMessageIcon, + 'MultipleIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingMultipleIcon, + 'ParallelIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingParallelIcon, + 'SignalIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingSignalIcon, + 'TimerIntermediateCatchEventNonInterrupting': IntermediateEventCatchNonInterruptingTimerIcon, + 'ParallelMultipleIntermediateCatchEvent': IntermediateEventCatchParallelMultipleIcon, + 'SignalIntermediateCatchEvent': IntermediateEventCatchSignalIcon, + 'TimerIntermediateCatchEvent': IntermediateEventCatchTimerIcon, + 'IntermediateThrowEvent': IntermediateEventNoneIcon, + 'CompensateIntermediateThrowEvent': IntermediateEventThrowCompensationIcon, + 'EscalationIntermediateThrowEvent': IntermediateEventThrowEscalationIcon, + 'LinkIntermediateThrowEvent': IntermediateEventThrowLinkIcon, + 'MessageIntermediateThrowEvent': IntermediateEventThrowMessageIcon, + 'MultipleIntermediateThrowEvent': IntermediateEventThrowMultipleIcon, + 'SignalIntermediateThrowEvent': IntermediateEventThrowSignalIcon, + 'Lane': LaneIcon, + 'ManualTask': ManualTaskIcon, + 'MessageFlow': MessageFlowIcon, + 'Participant': ParticipantIcon, + 'Process': ProcessIcon, + 'ReceiveTask': ReceiveTaskIcon, + 'ScriptTask': ScriptTaskIcon, + 'SendTask': SendTaskIcon, + 'ServiceTask': ServiceTaskIcon, + 'CompensateStartEvent': StartEventCompensationIcon, + 'ConditionalStartEvent': StartEventConditionIcon, + 'ErrorStartEvent': StartEventErrorIcon, + 'EscalationStartEvent': StartEventEscalationIcon, + 'MessageStartEvent': StartEventMessageIcon, + 'MultipleStartEvent': StartEventMultipleIcon, + 'ConditionalStartEventNonInterrupting': StartEventNonInterruptingConditionIcon, + 'EscalationStartEventNonInterrupting': StartEventNonInterruptingEscalationIcon, + 'MessageStartEventNonInterrupting': StartEventNonInterruptingMessageIcon, + 'MultipleStartEventNonInterrupting': StartEventNonInterruptingMultipleIcon, + 'ParallelMultipleStartEventNonInterrupting': StartEventNonInterruptingParallelMultipleIcon, + 'SignalStartEventNonInterrupting': StartEventNonInterruptingSignalIcon, + 'TimerStartEventNonInterrupting': StartEventNonInterruptingTimerIcon, + 'CancelBoundaryEvent': IntermediateEventCatchCancelIcon, + 'CompensateBoundaryEvent': IntermediateEventCatchCompensationIcon, + 'ConditionalBoundaryEvent': IntermediateEventCatchConditionIcon, + 'ErrorBoundaryEvent': IntermediateEventCatchErrorIcon, + 'EscalationBoundaryEvent': IntermediateEventCatchEscalationIcon, + 'LinkBoundaryEvent': IntermediateEventCatchLinkIcon, + 'MessageBoundaryEvent': IntermediateEventCatchMessageIcon, + 'MultipleBoundaryEvent': IntermediateEventCatchMultipleIcon, + 'BoundaryEvent': IntermediateEventNoneIcon, + 'ConditionalBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingConditionIcon, + 'EscalationBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingEscalationIcon, + 'MessageBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingMessageIcon, + 'MultipleBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingMultipleIcon, + 'ParallelBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingParallelIcon, + 'SignalBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingSignalIcon, + 'TimerBoundaryEventNonInterrupting': IntermediateEventCatchNonInterruptingTimerIcon, + 'ParallelMultipleBoundaryEvent': IntermediateEventCatchParallelMultipleIcon, + 'SignalBoundaryEvent': IntermediateEventCatchSignalIcon, + 'TimerBoundaryEvent': IntermediateEventCatchTimerIcon, + 'StartEvent': StartEventNoneIcon, + 'ParallelMultipleStartEvent': StartEventParallelMultipleIcon, + 'SignalStartEvent': StartEventSignalIcon, + 'TimerStartEvent': StartEventTimerIcon, + 'CollapsedSubProcess': SubprocessCollapsedIcon, + 'CollapsedAdHocSubProcess': SubprocessCollapsedIcon, + 'ExpandedSubProcess': SubprocessExpandedIcon, + 'ExpandedAdHocSubProcess': SubprocessExpandedIcon, + 'Task': TaskNoneIcon, + 'TextAnnotation': TextAnnotationicon, + 'Transaction': TransactionIcon, + 'UserTask': UserTaskIcon +}; + +function getConcreteType(element) { + const { + type: elementType + } = element; + let type = getRawType(elementType); + + // (1) event definition types + const eventDefinition = getEventDefinition$2(element); + if (eventDefinition) { + type = `${getEventDefinitionPrefix(eventDefinition)}${type}`; + + // (1.1) interrupting / non interrupting + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && !(0,bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isInterrupting)(element) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BoundaryEvent') && !isCancelActivity(element)) { + type = `${type}NonInterrupting`; + } + return type; + } + + // (2) sub process types + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SubProcess') && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Transaction')) { + if ((0,bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isEventSubProcess)(element)) { + type = `Event${type}`; + } else { + const expanded = (0,bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element) && !isPlane(element); + type = `${expanded ? 'Expanded' : 'Collapsed'}${type}`; + } + } + + // (3) conditional + default flows + if (isDefaultFlow(element)) { + type = 'DefaultFlow'; + } + if (isConditionalFlow(element)) { + type = 'ConditionalFlow'; + } + return type; +} +const PanelHeaderProvider = { + getDocumentationRef: element => { + const elementTemplates = getTemplatesService(); + if (elementTemplates) { + return getTemplateDocumentation(element, elementTemplates); + } + }, + getElementLabel: element => { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process')) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).name; + } + return (0,bpmn_js_lib_features_label_editing_LabelUtil__WEBPACK_IMPORTED_MODULE_11__.getLabel)(element); + }, + getElementIcon: element => { + const concreteType = getConcreteType(element); + + // eslint-disable-next-line react-hooks/rules-of-hooks + const config = useService('config.elementTemplateIconRenderer', false); + const { + iconProperty = 'zeebe:modelerTemplateIcon' + } = config || {}; + const templateIcon = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get(iconProperty); + if (templateIcon) { + return () => (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", { + class: "bio-properties-panel-header-template-icon", + width: "32", + height: "32", + src: templateIcon + }); + } + return iconsByType[concreteType]; + }, + getTypeLabel: element => { + const elementTemplates = getTemplatesService(); + if (elementTemplates) { + const template = getTemplate(element, elementTemplates); + if (template && template.name) { + return template.name; + } + } + const concreteType = getConcreteType(element); + return concreteType.replace(/(\B[A-Z])/g, ' $1').replace(/(\bNon Interrupting)/g, '($1)'); + } +}; + +// helpers /////////////////////// + +function isCancelActivity(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject && businessObject.cancelActivity !== false; +} +function getEventDefinition$2(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + eventDefinitions = businessObject.eventDefinitions; + return eventDefinitions && eventDefinitions[0]; +} +function getRawType(type) { + return type.split(':')[1]; +} +function getEventDefinitionPrefix(eventDefinition) { + const rawType = getRawType(eventDefinition.$type); + return rawType.replace('EventDefinition', ''); +} +function isDefaultFlow(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const sourceBusinessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element.source); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow') || !sourceBusinessObject) { + return false; + } + return sourceBusinessObject.default && sourceBusinessObject.default === businessObject && ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(sourceBusinessObject, 'bpmn:Gateway') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(sourceBusinessObject, 'bpmn:Activity')); +} +function isConditionalFlow(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const sourceBusinessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element.source); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow') || !sourceBusinessObject) { + return false; + } + return businessObject.conditionExpression && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(sourceBusinessObject, 'bpmn:Activity'); +} +function isPlane(element) { + // Backwards compatibility for bpmn-js<8 + const di = element && (element.di || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).di); + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(di, 'bpmndi:BPMNPlane'); +} +function getTemplatesService() { + // eslint-disable-next-line react-hooks/rules-of-hooks + return useService('elementTemplates', false); +} +function getTemplate(element, elementTemplates) { + return elementTemplates.get(element); +} +function getTemplateDocumentation(element, elementTemplates) { + const template = getTemplate(element, elementTemplates); + return template && template.documentationRef; +} + +function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); } +var EmptyIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends$1({ + xmlns: "http://www.w3.org/2000/svg", + xmlnsXlink: "http://www.w3.org/1999/xlink", + width: "64", + height: "64" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("defs", null, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("rect", { + id: "a", + width: "57", + height: "47", + x: "3", + y: "8", + rx: "7" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("mask", { + id: "b", + width: "57", + height: "47", + x: "0", + y: "0", + fill: "#fff", + maskContentUnits: "userSpaceOnUse", + maskUnits: "objectBoundingBox" +}, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("use", { + xlinkHref: "#a" +}))), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("g", { + fill: "none", + fillRule: "evenodd" +}, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#818798", + d: "M52 11a5 5 0 015 5v31a5 5 0 01-5 5H11a5 5 0 01-5-5V16a5 5 0 015-5h41zm0 2H11a3 3 0 00-2.995 2.824L8 16v31a3 3 0 002.824 2.995L11 50h41a3 3 0 002.995-2.824L55 47V16a3 3 0 00-2.824-2.995L52 13z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#D5D7DD", + d: "M16 24h31v6H16zM21 33h21v6H21z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("use", { + stroke: "#B9BCC6", + strokeDasharray: "5 2", + strokeWidth: "2", + mask: "url(#b)", + xlinkHref: "#a" +})))); + +function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +var MultipleIcon = (({ + styles = {}, + ...props +}) => /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("svg", _extends({ + xmlns: "http://www.w3.org/2000/svg", + xmlnsXlink: "http://www.w3.org/1999/xlink", + width: "128", + height: "64" +}, props), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("defs", null, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + id: "a", + d: "M9 9h110v47H9z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("mask", { + id: "b", + width: "110", + height: "47", + x: "0", + y: "0", + fill: "#fff", + maskContentUnits: "userSpaceOnUse", + maskUnits: "objectBoundingBox" +}, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("use", { + xlinkHref: "#a" +}))), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("g", { + fill: "none", + fillRule: "evenodd" +}, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#818798", + d: "M25 20.272L37.728 33 25 45.728 12.272 33 25 20.272zm0 2.829L15.1 33l9.9 9.9 9.9-9.9-9.9-9.9z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#D5D7DD", + d: "M17 47h16v6H17z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#818798", + d: "M35 32h27v2H35z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#818798", + d: "M60 30v6l6-3z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#D5D7DD", + d: "M80 34h21v6H80z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("g", null, /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#818798", + d: "M111 12a5 5 0 015 5v31a5 5 0 01-5 5H70a5 5 0 01-5-5V17a5 5 0 015-5h41zm0 2H70a3 3 0 00-3 3v31a3 3 0 003 3h41a3 3 0 003-3V17a3 3 0 00-3-3z" +}), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("path", { + fill: "#D5D7DD", + d: "M75 25h31v6H75z" +})), /*#__PURE__*/_bpmn_io_properties_panel_preact_compat__WEBPACK_IMPORTED_MODULE_3__["default"].createElement("use", { + stroke: "#B9BCC6", + strokeDasharray: "5 2", + strokeWidth: "2", + mask: "url(#b)", + xlinkHref: "#a" +})))); + +const PanelPlaceholderProvider = translate => { + if (!translate) translate = text => text; + return { + getEmpty: () => { + return { + text: translate('Select an element to edit its properties.'), + icon: EmptyIcon + }; + }, + getMultiple: () => { + return { + text: translate('Multiple elements are selected. Select a single element to edit its properties.'), + icon: MultipleIcon + }; + } + }; +}; + +function BpmnPropertiesPanel(props) { + const { + element, + injector, + getProviders, + layoutConfig: initialLayoutConfig, + descriptionConfig, + tooltipConfig, + feelPopupContainer + } = props; + const canvas = injector.get('canvas'); + const elementRegistry = injector.get('elementRegistry'); + const eventBus = injector.get('eventBus'); + const translate = injector.get('translate'); + const [state, setState] = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)({ + selectedElement: element + }); + const selectedElement = state.selectedElement; + + /** + * @param {djs.model.Base | Array} element + */ + const _update = element => { + if (!element) { + return; + } + let newSelectedElement = element; + + // handle labels + if (newSelectedElement && newSelectedElement.type === 'label') { + newSelectedElement = newSelectedElement.labelTarget; + } + setState({ + ...state, + selectedElement: newSelectedElement + }); + + // notify interested parties on property panel updates + eventBus.fire('propertiesPanel.updated', { + element: newSelectedElement + }); + }; + + // (2) react on element changes + + // (2a) selection changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const onSelectionChanged = e => { + const { + newSelection = [] + } = e; + if (newSelection.length > 1) { + return _update(newSelection); + } + const newElement = newSelection[0]; + const rootElement = canvas.getRootElement(); + if (isImplicitRoot$1(rootElement)) { + return; + } + _update(newElement || rootElement); + }; + eventBus.on('selection.changed', onSelectionChanged); + return () => { + eventBus.off('selection.changed', onSelectionChanged); + }; + }, []); + + // (2b) selected element changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const onElementsChanged = e => { + const elements = e.elements; + const updatedElement = findElement(elements, selectedElement); + if (updatedElement && elementExists(updatedElement, elementRegistry)) { + _update(updatedElement); + } + }; + eventBus.on('elements.changed', onElementsChanged); + return () => { + eventBus.off('elements.changed', onElementsChanged); + }; + }, [selectedElement]); + + // (2c) root element changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const onRootAdded = e => { + const element = e.element; + _update(element); + }; + eventBus.on('root.added', onRootAdded); + return () => { + eventBus.off('root.added', onRootAdded); + }; + }, [selectedElement]); + + // (2d) provided entries changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const onProvidersChanged = () => { + _update(selectedElement); + }; + eventBus.on('propertiesPanel.providersChanged', onProvidersChanged); + return () => { + eventBus.off('propertiesPanel.providersChanged', onProvidersChanged); + }; + }, [selectedElement]); + + // (2e) element templates changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const onTemplatesChanged = () => { + _update(selectedElement); + }; + eventBus.on('elementTemplates.changed', onTemplatesChanged); + return () => { + eventBus.off('elementTemplates.changed', onTemplatesChanged); + }; + }, [selectedElement]); + + // (3) create properties panel context + const bpmnPropertiesPanelContext = { + selectedElement, + injector, + getService(type, strict) { + return injector.get(type, strict); + } + }; + + // (4) retrieve groups for selected element + const providers = getProviders(selectedElement); + const groups = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.reduce)(providers, function (groups, provider) { + // do not collect groups for multi element state + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isArray)(selectedElement)) { + return []; + } + const updater = provider.getGroups(selectedElement); + return updater(groups); + }, []); + }, [providers, selectedElement]); + + // (5) notify layout changes + const [layoutConfig, setLayoutConfig] = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(initialLayoutConfig || {}); + const onLayoutChanged = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newLayout => { + eventBus.fire('propertiesPanel.layoutChanged', { + layout: newLayout + }); + }, [eventBus]); + + // React to external layout changes + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const cb = e => { + const { + layout + } = e; + setLayoutConfig(layout); + }; + eventBus.on('propertiesPanel.setLayout', cb); + return () => eventBus.off('propertiesPanel.setLayout', cb); + }, [eventBus, setLayoutConfig]); + + // (6) notify description changes + const onDescriptionLoaded = description => { + eventBus.fire('propertiesPanel.descriptionLoaded', { + description + }); + }; + + // (7) notify tooltip changes + const onTooltipLoaded = tooltip => { + eventBus.fire('propertiesPanel.tooltipLoaded', { + tooltip + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(BpmnPropertiesPanelContext.Provider, { + value: bpmnPropertiesPanelContext, + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.PropertiesPanel, { + element: selectedElement, + headerProvider: PanelHeaderProvider, + placeholderProvider: PanelPlaceholderProvider(translate), + groups: groups, + layoutConfig: layoutConfig, + layoutChanged: onLayoutChanged, + descriptionConfig: descriptionConfig, + descriptionLoaded: onDescriptionLoaded, + tooltipConfig: tooltipConfig, + tooltipLoaded: onTooltipLoaded, + feelPopupContainer: feelPopupContainer, + eventBus: eventBus + }) + }); +} + +// helpers ////////////////////////// + +function isImplicitRoot$1(element) { + // Backwards compatibility for diagram-js<7.4.0, see https://github.com/bpmn-io/bpmn-properties-panel/pull/102 + return element && (element.isImplicit || element.id === '__implicitroot'); +} +function findElement(elements, element) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.find)(elements, e => e === element); +} +function elementExists(element, elementRegistry) { + return element && elementRegistry.get(element.id); +} + +const DEFAULT_PRIORITY = 1000; + +/** + * @typedef { import('@bpmn-io/properties-panel').GroupDefinition } GroupDefinition + * @typedef { import('@bpmn-io/properties-panel').ListGroupDefinition } ListGroupDefinition + * @typedef { { getGroups: (ModdleElement) => (Array{GroupDefinition|ListGroupDefinition}) => Array{GroupDefinition|ListGroupDefinition}) } PropertiesProvider + */ - module.exports.addEmptyParameter = addEmptyParameter; +class BpmnPropertiesPanelRenderer { + constructor(config, injector, eventBus) { + const { + parent, + layout: layoutConfig, + description: descriptionConfig, + tooltip: tooltipConfig, + feelPopupContainer + } = config || {}; + this._eventBus = eventBus; + this._injector = injector; + this._layoutConfig = layoutConfig; + this._descriptionConfig = descriptionConfig; + this._tooltipConfig = tooltipConfig; + this._feelPopupContainer = feelPopupContainer; + this._container = (0,min_dom__WEBPACK_IMPORTED_MODULE_13__.domify)('
'); + var commandStack = injector.get('commandStack', false); + commandStack && setupKeyboard(this._container, eventBus, commandStack); + eventBus.on('diagram.init', () => { + if (parent) { + this.attachTo(parent); + } + }); + eventBus.on('diagram.destroy', () => { + this.detach(); + }); + eventBus.on('root.added', event => { + const { + element + } = event; + this._render(element); + }); + } + + /** + * Attach the properties panel to a parent node. + * + * @param {HTMLElement} container + */ + attachTo(container) { + if (!container) { + throw new Error('container required'); + } + + // unwrap jQuery if provided + if (container.get && container.constructor.prototype.jquery) { + container = container.get(0); + } + if (typeof container === 'string') { + container = (0,min_dom__WEBPACK_IMPORTED_MODULE_13__.query)(container); + } + + // (1) detach from old parent + this.detach(); + + // (2) append to parent container + container.appendChild(this._container); + + // (3) notify interested parties + this._eventBus.fire('propertiesPanel.attach'); + } + + /** + * Detach the properties panel from its parent node. + */ + detach() { + const parentNode = this._container.parentNode; + if (parentNode) { + parentNode.removeChild(this._container); + this._eventBus.fire('propertiesPanel.detach'); + } + } + + /** + * Register a new properties provider to the properties panel. + * + * @param {Number} [priority] + * @param {PropertiesProvider} provider + */ + registerProvider(priority, provider) { + if (!provider) { + provider = priority; + priority = DEFAULT_PRIORITY; + } + if (typeof provider.getGroups !== 'function') { + console.error('Properties provider does not implement #getGroups(element) API'); + return; + } + this._eventBus.on('propertiesPanel.getProviders', priority, function (event) { + event.providers.push(provider); + }); + this._eventBus.fire('propertiesPanel.providersChanged'); + } + + /** + * Updates the layout of the properties panel. + * @param {Object} layout + */ + setLayout(layout) { + this._eventBus.fire('propertiesPanel.setLayout', { + layout + }); + } + _getProviders() { + const event = this._eventBus.createEvent({ + type: 'propertiesPanel.getProviders', + providers: [] + }); + this._eventBus.fire(event); + return event.providers; + } + _render(element) { + const canvas = this._injector.get('canvas'); + if (!element) { + element = canvas.getRootElement(); + } + if (isImplicitRoot(element)) { + return; + } + (0,_bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_2__.render)((0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(BpmnPropertiesPanel, { + element: element, + injector: this._injector, + getProviders: this._getProviders.bind(this), + layoutConfig: this._layoutConfig, + descriptionConfig: this._descriptionConfig, + tooltipConfig: this._tooltipConfig, + feelPopupContainer: this._feelPopupContainer + }), this._container); + this._eventBus.fire('propertiesPanel.rendered'); + } + _destroy() { + if (this._container) { + (0,_bpmn_io_properties_panel_preact__WEBPACK_IMPORTED_MODULE_2__.render)(null, this._container); + this._eventBus.fire('propertiesPanel.destroyed'); + } + } +} +BpmnPropertiesPanelRenderer.$inject = ['config.propertiesPanel', 'injector', 'eventBus']; + +// helpers /////////////////////// + +function isImplicitRoot(element) { + // Backwards compatibility for diagram-js<7.4.0, see https://github.com/bpmn-io/bpmn-properties-panel/pull/102 + return element && (element.isImplicit || element.id === '__implicitroot'); +} + +/** + * Setup keyboard bindings (undo, redo) on the given container. + * + * @param {Element} container + * @param {EventBus} eventBus + * @param {CommandStack} commandStack + */ +function setupKeyboard(container, eventBus, commandStack) { + function cancel(event) { + event.preventDefault(); + event.stopPropagation(); + } + function handleKeys(event) { + if ((0,diagram_js_lib_features_keyboard_KeyboardUtil__WEBPACK_IMPORTED_MODULE_14__.isUndo)(event)) { + commandStack.undo(); + return cancel(event); + } + if ((0,diagram_js_lib_features_keyboard_KeyboardUtil__WEBPACK_IMPORTED_MODULE_14__.isRedo)(event)) { + commandStack.redo(); + return cancel(event); + } + } + eventBus.on('keyboard.bind', function () { + min_dom__WEBPACK_IMPORTED_MODULE_13__.event.bind(container, 'keydown', handleKeys); + }); + eventBus.on('keyboard.unbind', function () { + min_dom__WEBPACK_IMPORTED_MODULE_13__.event.unbind(container, 'keydown', handleKeys); + }); +} + +/** + * A handler that combines and executes multiple commands. + * + * All updates are bundled on the command stack and executed in one step. + * This also makes it possible to revert the changes in one step. + * + * Example use case: remove the camunda:formKey attribute and in addition + * add all form fields needed for the camunda:formData property. + */ +class MultiCommandHandler { + constructor(commandStack) { + this._commandStack = commandStack; + } + preExecute(context) { + const commandStack = this._commandStack; + (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.forEach)(context, function (command) { + commandStack.execute(command.cmd, command.context); + }); + } +} +MultiCommandHandler.$inject = ['commandStack']; + +const HANDLERS = { + 'properties-panel.multi-command-executor': MultiCommandHandler +}; +function CommandInitializer(eventBus, commandStack) { + eventBus.on('diagram.init', function () { + (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.forEach)(HANDLERS, function (handler, id) { + commandStack.registerHandler(id, handler); + }); + }); +} +CommandInitializer.$inject = ['eventBus', 'commandStack']; +var Commands = { + __init__: [CommandInitializer] +}; + +var index$3 = { + __depends__: [Commands, _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.DebounceInputModule, _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.FeelPopupModule], + __init__: ['propertiesPanel'], + propertiesPanel: ['type', BpmnPropertiesPanelRenderer] +}; + +function ReferenceSelectEntry(props) { + const { + autoFocusEntry, + element, + getOptions + } = props; + const options = getOptions(element); + const prevOptions = (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.usePrevious)(options); + + // auto focus specifc other entry when options changed + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (autoFocusEntry && prevOptions && options.length > prevOptions.length) { + const entry = (0,min_dom__WEBPACK_IMPORTED_MODULE_13__.query)(`[data-entry-id="${autoFocusEntry}"]`); + const focusableInput = (0,min_dom__WEBPACK_IMPORTED_MODULE_13__.query)('.bio-properties-panel-input', entry); + if (focusableInput) { + focusableInput.select(); + } + } + }, [options]); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + ...props + }); +} + +function isErrorSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:EndEvent']) && !!getErrorEventDefinition(element); +} +function getErrorEventDefinition(element) { + return getEventDefinition$1(element, 'bpmn:ErrorEventDefinition'); +} +function getTimerEventDefinition$1(element) { + return getEventDefinition$1(element, 'bpmn:TimerEventDefinition'); +} +function getError(element) { + const errorEventDefinition = getErrorEventDefinition(element); + return errorEventDefinition && errorEventDefinition.get('errorRef'); +} +function getEventDefinition$1(element, eventType) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const eventDefinitions = businessObject.get('eventDefinitions') || []; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.find)(eventDefinitions, function (definition) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(definition, eventType); + }); +} +function isMessageSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ReceiveTask') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:StartEvent', 'bpmn:EndEvent', 'bpmn:IntermediateThrowEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent']) && !!getMessageEventDefinition(element); +} +function getMessageEventDefinition(element) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ReceiveTask')) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + } + return getEventDefinition$1(element, 'bpmn:MessageEventDefinition'); +} +function getMessage(element) { + const messageEventDefinition = getMessageEventDefinition(element); + return messageEventDefinition && messageEventDefinition.get('messageRef'); +} +function getLinkEventDefinition(element) { + return getEventDefinition$1(element, 'bpmn:LinkEventDefinition'); +} +function getSignalEventDefinition$1(element) { + return getEventDefinition$1(element, 'bpmn:SignalEventDefinition'); +} +function isLinkSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:IntermediateThrowEvent', 'bpmn:IntermediateCatchEvent']) && !!getLinkEventDefinition(element); +} +function isSignalSupported$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Event') && !!getSignalEventDefinition$1(element); +} +function getSignal$1(element) { + const signalEventDefinition = getSignalEventDefinition$1(element); + return signalEventDefinition && signalEventDefinition.get('signalRef'); +} +function getEscalationEventDefinition(element) { + return getEventDefinition$1(element, 'bpmn:EscalationEventDefinition'); +} +function isEscalationSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Event') && !!getEscalationEventDefinition(element); +} +function getEscalation(element) { + const escalationEventDefinition = getEscalationEventDefinition(element); + return escalationEventDefinition && escalationEventDefinition.get('escalationRef'); +} +function isCompensationSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']) && !!getCompensateEventDefinition(element); +} +function getCompensateEventDefinition(element) { + return getEventDefinition$1(element, 'bpmn:CompensateEventDefinition'); +} +function getCompensateActivity(element) { + const compensateEventDefinition = getCompensateEventDefinition(element); + return compensateEventDefinition && compensateEventDefinition.get('activityRef'); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ +/** + * @returns {Array} entries + */ +function CompensationProps(props) { + const { + element + } = props; + if (!isCompensationSupported(element)) { + return []; + } + return [{ + id: 'waitForCompletion', + component: WaitForCompletion, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }, { + id: 'activityRef', + component: ActivityRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; +} +function WaitForCompletion(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const compensateEventDefinition = getCompensateEventDefinition(element); + const getValue = () => { + return compensateEventDefinition.get('waitForCompletion'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: compensateEventDefinition, + properties: { + waitForCompletion: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'waitForCompletion', + label: translate('Wait for completion'), + getValue, + setValue + }); +} +function ActivityRef(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const elementRegistry = useService('elementRegistry'); + const translate = useService('translate'); + const compensateEventDefinition = getCompensateEventDefinition(element); + const getValue = () => { + const activityRef = getCompensateActivity(element); + return activityRef && activityRef.get('id'); + }; + const setValue = value => { + // update (or remove) activityRef + const activityRef = value ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(elementRegistry.get(value)) : undefined; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: compensateEventDefinition, + properties: { + activityRef + } + }); + }; + const getOptions = () => { + let options = [{ + value: '', + label: translate('') + }]; + const activities = findActivityRefs(element); + sortByName$6(activities).forEach(function (activity) { + options.push({ + value: activity.id, + label: createOptionLabel(activity) + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'activityRef', + label: translate('Activity reference'), + getValue, + setValue, + getOptions + }); +} + +// helper ///////////////////////// + +function getFlowElements(element, type) { + const { + flowElements + } = element; + return flowElements.filter(function (flowElement) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(flowElement, type); + }); +} +function getContainedActivities(element) { + return getFlowElements(element, 'bpmn:Activity'); +} +function getContainedBoundaryEvents(element) { + return getFlowElements(element, 'bpmn:BoundaryEvent'); +} + +/** + * Checks whether an Activity is attaching a CompensateEvent of the parent container. + * + * @param {ModdleElement} activity + * @param {Array} boundaryEvents + * @returns {Boolean} + */ +function hasCompensationEventAttached(activity, boundaryEvents) { + const { + id: activityId + } = activity; + return !!(0,min_dash__WEBPACK_IMPORTED_MODULE_12__.find)(boundaryEvents, function (boundaryEvent) { + const { + attachedToRef + } = boundaryEvent; + const compensateEventDefinition = getCompensateEventDefinition(boundaryEvent); + return attachedToRef && compensateEventDefinition && attachedToRef.id === activityId; + }); +} + +/** + * Checks whether an Activity can be compensated. That's the case when it is + * a) a CallActivity + * b) a SubProcess, when it is not event based and not a compensation + * c) any other Activity, when it is attaching a CompensateEvent of the parent container + * + * @param {ModdleElement} activity + * @param {Array} boundaryEvents + * @returns {Boolean} + */ +function canBeCompensated(activity, boundaryEvents) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(activity, 'bpmn:CallActivity') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(activity, 'bpmn:SubProcess') && !activity.triggeredByEvent && !activity.isForCompensation || hasCompensationEventAttached(activity, boundaryEvents); +} +function getActivitiesForCompensation(element) { + const activities = getContainedActivities(element); + const boundaryEvents = getContainedBoundaryEvents(element); + return activities.filter(function (activity) { + return canBeCompensated(activity, boundaryEvents); + }); +} + +/** + * Retrieves all possible activities to reference for a Compensation. + * + * @param {djs.model.Base} element + * @returns {Array} + */ +function findActivityRefs(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let parent = businessObject.$parent; + + // (1) get all activities in parent container + let activities = getActivitiesForCompensation(parent); + + // (2) if throwing compensation event is inside an EventSubProcess, + // also get all activities outside of the event sub process + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:SubProcess') && parent.triggeredByEvent) { + parent = parent.$parent; + if (parent) { + activities = [...activities, ...getActivitiesForCompensation(parent)]; + } + } + return activities; +} + +/** + * Retrieves an option label in the form + * a) with name: "my Task (id=Task_1)" + * b) without name: "(id=Task_1)" + * + * @param {ModdleElement} activity + * @returns {String} + */ +function createOptionLabel(activity) { + const { + id, + name + } = activity; + return `${name ? name + ' ' : ''}(id=${id})`; +} +function sortByName$6(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +const DOCUMENTATION_TEXT_FORMAT = 'text/plain'; + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - /** - * returns a list with all root elements for the given parameter 'referencedType' - */ - function refreshOptionsModel(businessObject, referencedType) { - var model = []; - var referableObjects = findRootElementsByType(businessObject, referencedType); - forEach(referableObjects, function(obj) { - model.push({ - label: (obj.name || '') + ' (id='+obj.id+')', - value: obj.id, - name: obj.name - }); - }); - return model; - } +/** + * @returns {Array} entries + */ +function DocumentationProps(props) { + const { + element + } = props; + const entries = [{ + id: 'documentation', + component: ElementDocumentationProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited + }]; + if (hasProcessRef$2(element)) { + entries.push({ + id: 'processDocumentation', + component: ProcessDocumentationProperty, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited + }); + } + return entries; +} +function ElementDocumentationProperty(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = getDocumentation((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element)); + const setValue = setDocumentation(element, (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), bpmnFactory, commandStack); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)({ + element, + id: 'documentation', + label: translate('Element documentation'), + getValue, + setValue, + debounce + }); +} +function ProcessDocumentationProperty(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const processRef = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).processRef; + const getValue = getDocumentation(processRef); + const setValue = setDocumentation(element, processRef, bpmnFactory, commandStack); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)({ + element, + id: 'processDocumentation', + label: translate('Process documentation'), + getValue, + setValue, + debounce + }); +} + +// helper //////////////////////////// + +function hasProcessRef$2(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && element.businessObject.get('processRef'); +} +function findDocumentation(docs) { + return docs.find(function (d) { + return (d.textFormat || DOCUMENTATION_TEXT_FORMAT) === DOCUMENTATION_TEXT_FORMAT; + }); +} + +/** + * Retrieves a documentation element from a given moddle element. + * + * @param {ModdleElement} businessObject + * + * @returns {ModdleElement} documentation element inside the given moddle element. + */ +function getDocumentation(businessObject) { + return function () { + const documentation = findDocumentation(businessObject && businessObject.get('documentation')); + return documentation && documentation.text; + }; +} + +/** + * Sets a documentation element for a given moddle element. + * + * @param {ModdleElement} businessObject + */ +function setDocumentation(element, businessObject, bpmnFactory, commandStack) { + return function (value) { + let documentation = findDocumentation(businessObject && businessObject.get('documentation')); + + // (1) update or removing existing documentation + if (documentation) { + if (value) { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: documentation, + properties: { + text: value + } + }); + } else { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + documentation: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(businessObject.get('documentation'), documentation) + } + }); + } + } + + // (2) create new documentation entry + if (value) { + documentation = bpmnFactory.create('bpmn:Documentation', { + text: value + }); + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + documentation: [...businessObject.get('documentation'), documentation] + } + }); + } + }; +} + +/** + * Create a new element and (optionally) set its parent. + * + * @param {string} type + * @param {Object} properties + * @param {import('bpmn-js/lib/model/Types').ModdleElement} parent + * @param {import('bpmn-js/lib/features/modeling/BpmnFactory').default} bpmnFactory + * + * @returns {import('bpmn-js/lib/model/Types').ModdleElement} + */ +function createElement(type, properties, parent, bpmnFactory) { + const element = bpmnFactory.create(type, properties); + if (parent) { + element.$parent = parent; + } + return element; +} + +/** + * generate a semantic id with given prefix + */ +function nextId(prefix) { + const ids = new ids__WEBPACK_IMPORTED_MODULE_5__["default"]([32, 32, 1]); + return ids.nextPrefixed(prefix); +} +function getRoot(businessObject) { + let parent = businessObject; + while (parent.$parent) { + parent = parent.$parent; + } + return parent; +} +function filterElementsByType(objectList, type) { + const list = objectList || []; + return list.filter(element => (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, type)); +} +function findRootElementsByType(businessObject, referencedType) { + const root = getRoot(businessObject); + return filterElementsByType(root.get('rootElements'), referencedType); +} +function findRootElementById(businessObject, type, id) { + const elements = findRootElementsByType(businessObject, type); + return elements.find(element => element.id === id); +} + +const EMPTY_OPTION$4 = ''; +const CREATE_NEW_OPTION$4 = 'create-new'; + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - module.exports.refreshOptionsModel = refreshOptionsModel; +/** + * @returns {Array} entries + */ +function ErrorProps$2(props) { + const { + element + } = props; + if (!isErrorSupported(element)) { + return []; + } + const error = getError(element); + let entries = [{ + id: 'errorRef', + component: ErrorRef$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + if (error) { + entries = [...entries, { + id: 'errorName', + component: ErrorName$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'errorCode', + component: ErrorCode$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + } + return entries; +} +function ErrorRef$1(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const errorEventDefinition = getErrorEventDefinition(element); + const getValue = () => { + const error = getError(element); + if (error) { + return error.get('id'); + } + return EMPTY_OPTION$4; + }; + const setValue = value => { + const root = getRoot(errorEventDefinition); + const commands = []; + let error; + + // (1) create new error + if (value === CREATE_NEW_OPTION$4) { + error = createElement('bpmn:Error', { + name: nextId('Error_') + }, root, bpmnFactory); + value = error.get('id'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: root, + properties: { + rootElements: [...root.get('rootElements'), error] + } + } + }); + } + + // (2) update (or remove) errorRef + error = error || findRootElementById(errorEventDefinition, 'bpmn:Error', value); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: errorEventDefinition, + properties: { + errorRef: error + } + } + }); + + // (3) commit all updates + return commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + let options = [{ + value: EMPTY_OPTION$4, + label: translate('') + }, { + value: CREATE_NEW_OPTION$4, + label: translate('Create new ...') + }]; + const errors = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), 'bpmn:Error'); + sortByName$5(errors).forEach(error => { + options.push({ + value: error.get('id'), + label: error.get('name') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'errorRef', + label: translate('Global error reference'), + autoFocusEntry: 'errorName', + getValue, + setValue, + getOptions + }); +} +function ErrorName$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const error = getError(element); + const getValue = () => { + return error.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'errorName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function ErrorCode$2(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const error = getError(element); + const getValue = () => { + return error.get('errorCode'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + errorCode: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'errorCode', + label: translate('Code'), + getValue, + setValue, + debounce + }); +} + +// helper ///////////////////////// + +function sortByName$5(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +const CREATE_NEW_OPTION$3 = 'create-new'; + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ +/** + * @returns {Array} entries + */ +function EscalationProps$2(props) { + const { + element + } = props; + if (!isEscalationSupported(element)) { + return []; + } + const escalation = getEscalation(element); + let entries = [{ + id: 'escalationRef', + component: EscalationRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + if (escalation) { + entries = [...entries, { + id: 'escalationName', + component: EscalationName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'escalationCode', + component: EscalationCode$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + } + return entries; +} +function EscalationRef(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const escalationEventDefinition = getEscalationEventDefinition(element); + const getValue = () => { + const escalation = getEscalation(element); + return escalation && escalation.get('id'); + }; + const setValue = value => { + const root = getRoot(escalationEventDefinition); + const commands = []; + let escalation; + + // (1) create new escalation + if (value === CREATE_NEW_OPTION$3) { + const id = nextId('Escalation_'); + escalation = createElement('bpmn:Escalation', { + id, + name: id + }, root, bpmnFactory); + value = escalation.get('id'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: root, + properties: { + rootElements: [...root.get('rootElements'), escalation] + } + } + }); + } + + // (2) update (or remove) escalationRef + escalation = escalation || findRootElementById(escalationEventDefinition, 'bpmn:Escalation', value); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: escalationEventDefinition, + properties: { + escalationRef: escalation + } + } + }); + + // (3) commit all updates + return commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + let options = [{ + value: '', + label: translate('') + }, { + value: CREATE_NEW_OPTION$3, + label: translate('Create new ...') + }]; + const escalations = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), 'bpmn:Escalation'); + sortByName$4(escalations).forEach(escalation => { + options.push({ + value: escalation.get('id'), + label: escalation.get('name') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'escalationRef', + label: translate('Global escalation reference'), + autoFocusEntry: 'escalationName', + getValue, + setValue, + getOptions + }); +} +function EscalationName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const escalation = getEscalation(element); + const getValue = () => { + return escalation.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: escalation, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'escalationName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function EscalationCode$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const escalation = getEscalation(element); + const getValue = () => { + return escalation.get('escalationCode'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: escalation, + properties: { + escalationCode: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'escalationCode', + label: translate('Code'), + getValue, + setValue, + debounce + }); +} + +// helper ///////////////////////// + +function sortByName$4(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - /** - * fills the drop down with options - */ - function updateOptionsDropDown(domSelector, businessObject, referencedType, entryNode) { - var options = refreshOptionsModel(businessObject, referencedType); - addEmptyParameter(options); - var selectBox = domQuery(domSelector, entryNode); - domClear(selectBox); - - forEach(options, function(option) { - var optionEntry = domify(''); - selectBox.appendChild(optionEntry); - }); - return options; - } +/** + * @returns {Array} entries + */ +function ExecutableProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !hasProcessRef$1(element)) { + return []; + } + return [{ + id: 'isExecutable', + component: Executable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }]; +} +function Executable(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + let getValue, setValue; + setValue = value => { + modeling.updateProperties(element, { + isExecutable: value + }); + }; + getValue = element => { + return element.businessObject.isExecutable; + }; + + // handle properties on processRef level for participants + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant')) { + const process = element.businessObject.get('processRef'); + setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + isExecutable: value + } + }); + }; + getValue = () => { + return process.get('isExecutable'); + }; + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'isExecutable', + label: translate('Executable'), + getValue, + setValue + }); +} + +// helper ///////////////////// + +function hasProcessRef$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && element.businessObject.get('processRef'); +} + +const SPACE_REGEX = /\s/; - module.exports.updateOptionsDropDown = updateOptionsDropDown; +// for QName validation as per http://www.w3.org/TR/REC-xml/#NT-NameChar +const QNAME_REGEX = /^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i; +// for ID validation as per BPMN Schema (QName - Namespace) +const ID_REGEX = /^[a-z_][\w-.]*$/i; - /** - * checks whether the id value is valid - * - * @param {ModdleElement} bo - * @param {String} idValue - * @param {Function} translate - * - * @return {String} error message - */ - function isIdValid(bo, idValue, translate) { - var assigned = bo.$model.ids.assigned(idValue); +/** + * checks whether the id value is valid + * + * @param {ModdleElement} element + * @param {String} idValue + * @param {Function} translate + * + * @return {String} error message + */ +function isIdValid(element, idValue, translate) { + const assigned = element.$model.ids.assigned(idValue); + const idAlreadyExists = assigned && assigned !== element; + if (!idValue) { + return translate('ID must not be empty.'); + } + if (idAlreadyExists) { + return translate('ID must be unique.'); + } + return validateId(idValue, translate); +} +function validateId(idValue, translate) { + if (containsSpace(idValue)) { + return translate('ID must not contain spaces.'); + } + if (!ID_REGEX.test(idValue)) { + if (QNAME_REGEX.test(idValue)) { + return translate('ID must not contain prefix.'); + } + return translate('ID must be a valid QName.'); + } +} +function containsSpace(value) { + return SPACE_REGEX.test(value); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - var idExists = assigned && assigned !== bo; +/** + * @returns {Array} entries + */ +function IdProps() { + return [{ + id: 'id', + component: Id$3, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function Id$3(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const debounce = useService('debounceInput'); + const translate = useService('translate'); + const setValue = (value, error) => { + if (error) { + return; + } + modeling.updateProperties(element, { + id: value + }); + }; + const getValue = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(element => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).id; + }, [element]); + const validate = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(value => { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return isIdValid(businessObject, value, translate); + }, [element, translate]); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'id', + label: translate((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') ? 'Participant ID' : 'ID'), + getValue, + setValue, + debounce, + validate + }); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - if (!idValue || idExists) { - return translate('Element must have an unique id.'); - } +/** + * @returns {Array} entries + */ +function LinkProps(props) { + const { + element + } = props; + if (!isLinkSupported(element)) { + return []; + } + return [{ + id: 'linkName', + component: LinkName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function LinkName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const linkEventDefinition = getLinkEventDefinition(element); + const getValue = () => { + return linkEventDefinition.get('name'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: linkEventDefinition, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'linkName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} + +const EMPTY_OPTION$3 = ''; +const CREATE_NEW_OPTION$2 = 'create-new'; + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - return validateId(idValue, translate); - } +/** + * @returns {Array} entries + */ +function MessageProps$1(props) { + const { + element + } = props; + if (!isMessageSupported(element)) { + return []; + } + const message = getMessage(element); + let entries = [{ + id: 'messageRef', + component: MessageRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + if (message) { + entries = [...entries, { + id: 'messageName', + component: MessageName$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + } + return entries; +} +function MessageRef(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const messageEventDefinition = getMessageEventDefinition(element); + const getValue = () => { + const message = getMessage(element); + if (message) { + return message.get('id'); + } + return EMPTY_OPTION$3; + }; + const setValue = value => { + const root = getRoot(messageEventDefinition); + const commands = []; + let message; + + // (1) create new message + if (value === CREATE_NEW_OPTION$2) { + const id = nextId('Message_'); + message = createElement('bpmn:Message', { + id, + name: id + }, root, bpmnFactory); + value = message.get('id'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: root, + properties: { + rootElements: [...root.get('rootElements'), message] + } + } + }); + } + + // (2) update (or remove) messageRef + message = message || findRootElementById(messageEventDefinition, 'bpmn:Message', value); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: messageEventDefinition, + properties: { + messageRef: message + } + } + }); + + // (3) commit all updates + return commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + let options = [{ + value: EMPTY_OPTION$3, + label: translate('') + }, { + value: CREATE_NEW_OPTION$2, + label: translate('Create new ...') + }]; + const messages = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), 'bpmn:Message'); + sortByName$3(messages).forEach(message => { + options.push({ + value: message.get('id'), + label: message.get('name') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'messageRef', + label: translate('Global message reference'), + autoFocusEntry: 'messageName', + getValue, + setValue, + getOptions + }); +} +function MessageName$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const message = getMessage(element); + const getValue = () => { + return message.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: message, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'messageName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} + +// helper ///////////////////////// + +function sortByName$3(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - module.exports.isIdValid = isIdValid; +/** + * @returns {Array} entries + */ +function MultiInstanceProps$2(props) { + const { + element + } = props; + if (!isMultiInstanceSupported$1(element)) { + return []; + } + const entries = [{ + id: 'loopCardinality', + component: LoopCardinality, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'completionCondition', + component: CompletionCondition$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + return entries; +} +function LoopCardinality(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getLoopCardinalityValue(element); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'loopCardinality', value, bpmnFactory)); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'loopCardinality', + label: translate('Loop cardinality'), + getValue, + setValue, + debounce + }); +} +function CompletionCondition$1(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getCompletionConditionValue(element); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'completionCondition', value, bpmnFactory)); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'completionCondition', + label: translate('Completion condition'), + getValue, + setValue, + debounce + }); +} + +// helper //////////////////////////// + +// generic /////////////////////////// + +/** + * isMultiInstanceSupported - check whether given element supports MultiInstanceLoopCharacteristics. + * + * @param {djs.model.Base} element + * @return {boolean} + */ +function isMultiInstanceSupported$1(element) { + const loopCharacteristics = getLoopCharacteristics$2(element); + return !!loopCharacteristics && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics'); +} +/** + * getBody - get the body of a given expression. + * + * @param {ModdleElement} expression + * @return {string} the body (value) of the expression + */ +function getBody(expression) { + return expression && expression.get('body'); +} - function validateId(idValue, translate) { +/** + * getProperty - get a property value of the loop characteristics. + * + * @param {djs.model.Base} element + * @param {string} propertyName + * + * @return {any} the property value + */ +function getProperty$2(element, propertyName) { + const loopCharacteristics = getLoopCharacteristics$2(element); + return loopCharacteristics && loopCharacteristics.get(propertyName); +} - if (containsSpace(idValue)) { - return translate('Id must not contain spaces.'); - } +/** + * getLoopCharacteristics - get loopCharacteristics of a given element. + * + * @param {djs.model.Base} element + * @return {ModdleElement | undefined} + */ +function getLoopCharacteristics$2(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return bo.loopCharacteristics; +} - if (!ID_REGEX.test(idValue)) { +/** + * createFormalExpression - creates a 'bpmn:FormalExpression' element. + * + * @param {ModdleElement} parent + * @param {string} body + * @param {BpmnFactory} bpmnFactory + * + * @result {ModdleElement} a formal expression + */ +function createFormalExpression$1(parent, body, bpmnFactory) { + return createElement('bpmn:FormalExpression', { + body: body + }, parent, bpmnFactory); +} + +/** + * updateFormalExpression - updates a specific formal expression of the loop characteristics. + * + * @param {djs.model.Base} element + * @param {string} propertyName + * @param {string} newValue + * @param {BpmnFactory} bpmnFactory + */ +function updateFormalExpression(element, propertyName, newValue, bpmnFactory) { + const loopCharacteristics = getLoopCharacteristics$2(element); + const expressionProps = {}; + if (!newValue) { + // remove formal expression + expressionProps[propertyName] = undefined; + return { + element, + moddleElement: loopCharacteristics, + properties: expressionProps + }; + } + const existingExpression = loopCharacteristics.get(propertyName); + if (!existingExpression) { + // add formal expression + expressionProps[propertyName] = createFormalExpression$1(loopCharacteristics, newValue, bpmnFactory); + return { + element, + moddleElement: loopCharacteristics, + properties: expressionProps + }; + } + + // edit existing formal expression + return { + element, + moddleElement: existingExpression, + properties: { + body: newValue + } + }; +} + +// loopCardinality + +/** + * getLoopCardinality - get the loop cardinality of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {ModdleElement} an expression representing the loop cardinality + */ +function getLoopCardinality(element) { + return getProperty$2(element, 'loopCardinality'); +} - if (QNAME_REGEX.test(idValue)) { - return translate('Id must not contain prefix.'); - } +/** + * getLoopCardinalityValue - get the loop cardinality value of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {string} the loop cardinality value + */ +function getLoopCardinalityValue(element) { + const loopCardinality = getLoopCardinality(element); + return getBody(loopCardinality); +} - return translate('Id must be a valid QName.'); - } - } +// completionCondition ///////////////////// - module.exports.validateId = validateId; +/** + * getCompletionCondition - get the completion condition of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {ModdleElement} an expression representing the completion condition + */ +function getCompletionCondition$1(element) { + return getProperty$2(element, 'completionCondition'); +} +/** + * getCompletionConditionValue - get the completion condition value of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {string} the completion condition value + */ +function getCompletionConditionValue(element) { + const completionCondition = getCompletionCondition$1(element); + return getBody(completionCondition); +} - function containsSpace(value) { - return SPACE_REGEX.test(value); - } +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - module.exports.containsSpace = containsSpace; +/** + * @returns {Array} entries + */ +function NameProps(props) { + const { + element + } = props; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:Collaboration', 'bpmn:DataAssociation', 'bpmn:Association'])) { + return []; + } + return [{ + id: 'name', + component: Name$3, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited + }]; +} +function Name$3(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const debounce = useService('debounceInput'); + const canvas = useService('canvas'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + + // (1) default: name + let options = { + element, + id: 'name', + label: translate('Name'), + debounce, + setValue: value => { + modeling.updateProperties(element, { + name: value + }); + }, + getValue: element => { + return element.businessObject.name; + }, + autoResize: true + }; + + // (2) text annotations + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:TextAnnotation')) { + options = { + ...options, + setValue: value => { + modeling.updateProperties(element, { + text: value + }); + }, + getValue: element => { + return element.businessObject.text; + } + }; + } + + // (3) groups + else if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Group')) { + options = { + ...options, + setValue: value => { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + categoryValueRef = businessObject.categoryValueRef; + if (!categoryValueRef) { + initializeCategory(businessObject, canvas.getRootElement(), bpmnFactory); + } + modeling.updateLabel(element, value); + }, + getValue: element => { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + categoryValueRef = businessObject.categoryValueRef; + return categoryValueRef && categoryValueRef.value; + } + }; + } + + // (4) participants (only update label) + else if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant')) { + options.label = translate('Participant Name'); + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)(options); +} + +// helpers //////////////////////// + +function initializeCategory(businessObject, rootElement, bpmnFactory) { + const definitions = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(rootElement).$parent; + const categoryValue = createCategoryValue(definitions, bpmnFactory); + businessObject.categoryValueRef = categoryValue; +} +function createCategoryValue(definitions, bpmnFactory) { + const categoryValue = bpmnFactory.create('bpmn:CategoryValue'); + const category = bpmnFactory.create('bpmn:Category', { + categoryValue: [categoryValue] + }); + + // add to correct place + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_15__.add)(definitions.get('rootElements'), category); + (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(category).$parent = definitions; + (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(categoryValue).$parent = category; + return categoryValue; +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - /** - * generate a semantic id with given prefix - */ - function nextId(prefix) { - var ids = new Ids([32,32,1]); +/** + * @returns {Array} entries + */ +function ProcessProps(props) { + const { + element + } = props; + if (!hasProcessRef(element)) { + return []; + } + return [{ + id: 'processId', + component: ProcessId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'processName', + component: ProcessName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function ProcessName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const process = element.businessObject.get('processRef'); + const getValue = () => { + return process.get('name'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'processName', + label: translate('Process name'), + getValue, + setValue, + debounce + }); +} +function ProcessId(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const process = element.businessObject.get('processRef'); + const getValue = () => { + return process.get('id'); + }; + const setValue = (value, error) => { + if (error) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + id: value + } + }); + }; + const validate = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(value => { + return isIdValid(process, value, translate); + }, [process, translate]); + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'processId', + label: translate('Process ID'), + getValue, + setValue, + debounce, + validate + }); +} + +// helper //////////////// + +function hasProcessRef(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && element.businessObject.get('processRef'); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - return ids.nextPrefixed(prefix); - } +const EMPTY_OPTION$2 = ''; +const CREATE_NEW_OPTION$1 = 'create-new'; - module.exports.nextId = nextId; +/** + * @returns {Entry[]} + */ +function SignalProps$1(props) { + const { + element + } = props; + if (!isSignalSupported$1(element)) { + return []; + } + const signal = getSignal$1(element); + let entries = [{ + id: 'signalRef', + component: SignalRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + if (signal) { + entries = [...entries, { + id: 'signalName', + component: SignalName$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + } + return entries; +} +function SignalRef(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const signalEventDefinition = getSignalEventDefinition$1(element); + const getValue = () => { + const signal = getSignal$1(element); + if (signal) { + return signal.get('id'); + } + return EMPTY_OPTION$2; + }; + const setValue = value => { + const root = getRoot(signalEventDefinition); + const commands = []; + let signal; + + // (1) create new signal + if (value === CREATE_NEW_OPTION$1) { + const id = nextId('Signal_'); + signal = createElement('bpmn:Signal', { + id, + name: id + }, root, bpmnFactory); + value = signal.get('id'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: root, + properties: { + rootElements: [...root.get('rootElements'), signal] + } + } + }); + } + + // (2) update (or remove) signalRef + signal = signal || findRootElementById(signalEventDefinition, 'bpmn:Signal', value); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: signalEventDefinition, + properties: { + signalRef: signal + } + } + }); + + // (3) commit all updates + return commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + let options = [{ + value: EMPTY_OPTION$2, + label: translate('') + }, { + value: CREATE_NEW_OPTION$1, + label: translate('Create new ...') + }]; + const signals = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), 'bpmn:Signal'); + sortByName$2(signals).forEach(signal => { + options.push({ + value: signal.get('id'), + label: signal.get('name') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: 'signalRef', + label: translate('Global signal reference'), + autoFocusEntry: 'signalName', + getValue, + setValue, + getOptions + }); +} +function SignalName$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const signal = getSignal$1(element); + const getValue = () => { + return signal.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: signal, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'signalName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} + +// helper ///////////////////////// + +function sortByName$2(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +function isTimerSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:StartEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:BoundaryEvent']) && !!getTimerEventDefinition(element); +} + +/** + * Get the timer definition type for a given timer event definition. + * + * @param {ModdleElement} timer + * + * @return {string|undefined} the timer definition type + */ +function getTimerDefinitionType(timer) { + if (!timer) { + return; + } + const timeDate = timer.get('timeDate'); + if (typeof timeDate !== 'undefined') { + return 'timeDate'; + } + const timeCycle = timer.get('timeCycle'); + if (typeof timeCycle !== 'undefined') { + return 'timeCycle'; + } + const timeDuration = timer.get('timeDuration'); + if (typeof timeDuration !== 'undefined') { + return 'timeDuration'; + } +} +function getTimerEventDefinition(element) { + return getEventDefinition(element, 'bpmn:TimerEventDefinition'); +} +function getEventDefinition(element, eventType) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const eventDefinitions = businessObject.get('eventDefinitions') || []; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.find)(eventDefinitions, function (definition) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(definition, eventType); + }); +} +function getSignalEventDefinition(element) { + return getEventDefinition(element, 'bpmn:SignalEventDefinition'); +} +function isSignalSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Event') && !!getSignalEventDefinition(element); +} +function getSignal(element) { + const signalEventDefinition = getSignalEventDefinition(element); + return signalEventDefinition && signalEventDefinition.get('signalRef'); +} + +function TimerProps$2(props) { + const { + element, + idPrefix + } = props; + let { + timerEventDefinition + } = props; + if (!timerEventDefinition) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + timerEventDefinition = getTimerEventDefinition(businessObject); + } + const timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); + + // (1) Only show for supported elements + if (!isTimerSupported(element)) { + return []; + } + + // (2) Provide entries, have a value only if selection was made + const entries = []; + entries.push({ + id: getId$1(idPrefix, 'timerEventDefinitionType'), + component: TimerEventDefinitionType$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + timerEventDefinition, + timerEventDefinitionType + }); + if (timerEventDefinitionType) { + entries.push({ + id: getId$1(idPrefix, 'timerEventDefinitionValue'), + component: TimerEventDefinitionValue$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + timerEventDefinition, + timerEventDefinitionType + }); + } + return entries; +} + +/** + * TimerEventDefinitionType - Generic select entry allowing to select a specific + * timerEventDefintionType. To be used together with timerEventDefinitionValue. + * + * @param {type} props + * @return {SelectEntry} + */ +function TimerEventDefinitionType$2(props) { + const { + element, + timerEventDefinition, + timerEventDefinitionType + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'); + const getValue = () => { + return timerEventDefinitionType || ''; + }; + const setValue = value => { + // (1) Check if value is different to current type + if (value === timerEventDefinitionType) { + return; + } + + // (2) Create empty formalExpression element + const formalExpression = bpmnFactory.create('bpmn:FormalExpression', { + body: undefined + }); + formalExpression.$parent = timerEventDefinition; + + // (3) Set the value for selected timerEventDefinitionType + const newProps = { + timeDuration: undefined, + timeDate: undefined, + timeCycle: undefined + }; + if (value !== '') { + newProps[value] = formalExpression; + } + + // (4) Execute businessObject update + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventDefinition, + properties: newProps + }); + }; + const getOptions = element => { + return [{ + value: '', + label: translate('') + }, { + value: 'timeDate', + label: translate('Date') + }, { + value: 'timeDuration', + label: translate('Duration') + }, { + value: 'timeCycle', + label: translate('Cycle') + }]; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'timerEventDefinitionType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} + +/** + * TimerEventDefinitionValue - Generic textField entry allowing to specify the + * timerEventDefintionValue based on the set timerEventDefintionType. To be used + * together with timerEventDefinitionType. + * + * @param {type} props + * @return {TextFieldEntry} + */ +function TimerEventDefinitionValue$2(props) { + const { + element, + timerEventDefinition, + timerEventDefinitionType + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const timerEventFormalExpression = timerEventDefinition.get(timerEventDefinitionType); + const getValue = () => { + return timerEventFormalExpression && timerEventFormalExpression.get('body'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventFormalExpression, + properties: { + body: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'timerEventDefinitionValue', + label: translate('Value'), + getValue, + setValue, + debounce, + tooltip: getTimerEventDefinitionValueDescription$2(timerEventDefinitionType, translate) + }); +} + +// helper ////////////////////////// + +function getTimerEventDefinitionValueDescription$2(timerDefinitionType, translate) { + switch (timerDefinitionType) { + case 'timeDate': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A specific point in time defined as ISO 8601 combined date and time representation.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-01T12:00:00Z" + }), " - ", translate('UTC time')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-02T08:09:40+02:00" + }), " - ", translate('UTC plus 2 hours zone offset')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-date", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + case 'timeCycle': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A cycle defined as ISO 8601 repeating intervals format.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R5/PT10S" + }), " - ", translate('every 10 seconds, up to 5 times')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R/P1D" + }), " - ", translate('every day, infinitely')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-cycle", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + case 'timeDuration': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A time duration defined as ISO 8601 durations format.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT15S" + }), " - ", translate('15 seconds')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT1H30M" + }), " - ", translate('1 hour and 30 minutes')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "P14D" + }), " - ", translate('14 days')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-duration", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + } +} +function getId$1(idPrefix, id) { + return idPrefix ? idPrefix + id : id; +} + +function GeneralGroup(element, injector) { + const translate = injector.get('translate'); + const entries = [...NameProps({ + element + }), ...IdProps(), ...ProcessProps({ + element + }), ...ExecutableProps({ + element + })]; + return { + id: 'general', + label: translate('General'), + entries, + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; +} +function CompensationGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Compensation'), + id: 'compensation', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...CompensationProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function DocumentationGroup(element, injector) { + const translate = injector.get('translate'); + const entries = [...DocumentationProps({ + element + })]; + return { + id: 'documentation', + label: translate('Documentation'), + entries, + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; +} +function ErrorGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + id: 'error', + label: translate('Error'), + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...ErrorProps$2({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function MessageGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + id: 'message', + label: translate('Message'), + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...MessageProps$1({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function SignalGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + id: 'signal', + label: translate('Signal'), + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...SignalProps$1({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function LinkGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Link'), + id: 'link', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...LinkProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function EscalationGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + id: 'escalation', + label: translate('Escalation'), + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...EscalationProps$2({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function TimerGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Timer'), + id: 'timer', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...TimerProps$2({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function MultiInstanceGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Multi-instance'), + id: 'multiInstance', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...MultiInstanceProps$2({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function getGroups(element, injector) { + const groups = [GeneralGroup(element, injector), DocumentationGroup(element, injector), CompensationGroup(element, injector), ErrorGroup(element, injector), LinkGroup(element, injector), MessageGroup(element, injector), MultiInstanceGroup(element, injector), SignalGroup(element, injector), EscalationGroup(element, injector), TimerGroup(element, injector)]; + + // contract: if a group returns null, it should not be displayed at all + return groups.filter(group => group !== null); +} +class BpmnPropertiesProvider { + constructor(propertiesPanel, injector) { + propertiesPanel.registerProvider(this); + this._injector = injector; + } + getGroups(element) { + return groups => { + groups = groups.concat(getGroups(element, this._injector)); + return groups; + }; + } +} +BpmnPropertiesProvider.$inject = ['propertiesPanel', 'injector']; + +var index$2 = { + __init__: ['bpmnPropertiesProvider'], + bpmnPropertiesProvider: ['type', BpmnPropertiesProvider] +}; + +/** + * Get extension elements of business object. Optionally filter by type. + * + * @param {ModdleElement} businessObject + * @param {string} [type=undefined] + * @returns {Array} + */ +function getExtensionElementsList(businessObject, type = undefined) { + const extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + return []; + } + const values = extensionElements.get('values'); + if (!values || !values.length) { + return []; + } + if (type) { + return values.filter(value => (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(value, type)); + } + return values; +} + +/** + * Add one or more extension elements. Create bpmn:ExtensionElements if it doesn't exist. + * + * @param {ModdleElement} element + * @param {ModdleElement} businessObject + * @param {ModdleElement|Array} extensionElementsToAdd + * @param {CommandStack} commandStack + */ +function addExtensionElements(element, businessObject, extensionElementToAdd, bpmnFactory, commandStack) { + const commands = []; + let extensionElements = businessObject.get('extensionElements'); + + // (1) create bpmn:ExtensionElements if it doesn't exist + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + extensionElementToAdd.$parent = extensionElements; + + // (2) add extension element to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), extensionElementToAdd] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); +} + +/** + * Remove one or more extension elements. Remove bpmn:ExtensionElements afterwards if it's empty. + * + * @param {ModdleElement} element + * @param {ModdleElement} businessObject + * @param {ModdleElement|Array} extensionElementsToRemove + * @param {CommandStack} commandStack + */ +function removeExtensionElements(element, businessObject, extensionElementsToRemove, commandStack) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isArray)(extensionElementsToRemove)) { + extensionElementsToRemove = [extensionElementsToRemove]; + } + const extensionElements = businessObject.get('extensionElements'), + values = extensionElements.get('values').filter(value => !extensionElementsToRemove.includes(value)); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: extensionElements, + properties: { + values + } + }); +} + +const fallbackResolver = { + getVariablesForElement: bo => (0,_bpmn_io_extract_process_variables_zeebe__WEBPACK_IMPORTED_MODULE_6__.getVariablesForElement)(bo) +}; +function withVariableContext(Component) { + return props => { + const { + bpmnElement, + element + } = props; + const bo = (bpmnElement || element).businessObject; + const [variables, setVariables] = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + const eventBus = useService('eventBus'); + const variableResolver = useServiceIfAvailable('variableResolver', fallbackResolver); + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const extractVariables = async () => { + const variables = await variableResolver.getVariablesForElement(bo, element); + setVariables(variables.map(variable => { + return { + ...variable, + info: variable.info || variable.origin && 'Written in ' + variable.origin.map(origin => origin.name || origin.id).join(', ') + }; + })); + }; + + // The callback must return undefined, so the event propagation is not canceled. + // Cf. https://github.com/camunda/camunda-modeler/issues/3392 + const callback = () => { + extractVariables(); + }; + eventBus.on('commandStack.changed', callback); + callback(); + return () => { + eventBus.off('commandStack.changed', callback); + }; + }, [bo]); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Component, { + ...props, + variables: variables + }); + }; +} + +// helpers ////////// + +function useServiceIfAvailable(service, fallback) { + const resolved = useService(service, false); + if (!resolved) { + return fallback; + } + return resolved; +} + +function withTooltipContainer(Component) { + return props => { + const tooltipContainer = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const config = useService('config'); + return config && config.propertiesPanel && config.propertiesPanel.feelTooltipContainer; + }, []); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Component, { + ...props, + tooltipContainer: tooltipContainer + }); + }; +} + +const FeelEntry = withTooltipContainer(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.FeelEntry); +const FeelEntryWithVariableContext = withVariableContext(FeelEntry); + +function AssignmentDefinitionProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask')) { + return []; + } + return [{ + id: 'assignmentDefinitionAssignee', + component: Assignee$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'assignmentDefinitionCandidateGroups', + component: CandidateGroups$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'assignmentDefinitionCandidateUsers', + component: CandidateUsers$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function Assignee$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getAssignmentDefinition(element) || {}).assignee; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure AssignmentDefinition + let assignmentDefinition = getAssignmentDefinition(element); + if (!assignmentDefinition) { + assignmentDefinition = createElement('zeebe:AssignmentDefinition', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), assignmentDefinition] + } + } + }); + } + + // (3) update assignee definition type + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: assignmentDefinition, + properties: { + assignee: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'assignmentDefinitionAssignee', + label: translate('Assignee'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function CandidateGroups$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getAssignmentDefinition(element) || {}).candidateGroups; + }; + const setValue = value => { + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure assignmentDefinition + let assignmentDefinition = getAssignmentDefinition(element); + if (!assignmentDefinition) { + assignmentDefinition = createElement('zeebe:AssignmentDefinition', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), assignmentDefinition] + } + } + }); + } + + // (3) update candidateGroups + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: assignmentDefinition, + properties: { + candidateGroups: value + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'assignmentDefinitionCandidateGroups', + label: translate('Candidate groups'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function CandidateUsers$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getAssignmentDefinition(element) || {}).candidateUsers; + }; + const setValue = value => { + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure assignmentDefinition + let assignmentDefinition = getAssignmentDefinition(element); + if (!assignmentDefinition) { + assignmentDefinition = createElement('zeebe:AssignmentDefinition', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), assignmentDefinition] + } + } + }); + } + + // (3) update candidateUsers + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: assignmentDefinition, + properties: { + candidateUsers: value + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'assignmentDefinitionCandidateUsers', + label: translate('Candidate users'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function getAssignmentDefinition(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:AssignmentDefinition')[0]; +} + +function isZeebeServiceTask(element) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'zeebe:ZeebeServiceTask')) return false; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:EndEvent') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:IntermediateThrowEvent')) { + return !!getMessageEventDefinition(element); + } + + // BusinessRuleTask and ScriptTask are ServiceTasks only if they have a TaskDefinition + // (ie. if the implementation is set to ==JobWorker) + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:BusinessRuleTask', 'bpmn:ScriptTask']) && !getTaskDefinition$3(element)) { + return false; + } + return true; +} +function isMessageEndEvent(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:EndEvent') && !!getMessageEventDefinition(element); +} +function isMessageThrowEvent(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:IntermediateThrowEvent') && !!getMessageEventDefinition(element); +} + +// helper //////////////// + +function getTaskDefinition$3(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskDefinition')[0]; +} + +function areHeadersSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask') || isZeebeServiceTask(element); +} + +/** + * Get first zeebe:TaskHeaders element for a specific element. + * + * @param {ModdleElement} element + * + * @return {ModdleElement} a zeebe:TaskHeader element + */ +function getTaskHeaders$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[0]; +} +/** + * Retrieve all zeebe:Header elements for a specific element. + * + * @param {ModdleElement} element + * + * @return {Array} a list of zeebe:Header elements + */ +function getHeaders(element) { + const taskHeaders = getTaskHeaders$1(element); + return taskHeaders ? taskHeaders.get('values') : []; +} + +const DMN_IMPLEMENTATION_OPTION = 'dmn', + JOB_WORKER_IMPLEMENTATION_OPTION$1 = 'jobWorker', + DEFAULT_IMPLEMENTATION_OPTION$1 = ''; +function BusinessRuleImplementationProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BusinessRuleTask')) { + return []; + } + return [{ + id: 'businessRuleImplementation', + component: BusinessRuleImplementation, + isEdited: () => isBusinessRuleImplementationEdited(element) + }]; +} +function BusinessRuleImplementation(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + if (getCalledDecision$1(element)) { + return DMN_IMPLEMENTATION_OPTION; + } + if (getTaskDefinition$2(element)) { + return JOB_WORKER_IMPLEMENTATION_OPTION$1; + } + return DEFAULT_IMPLEMENTATION_OPTION$1; + }; + + /** + * Set value by either creating a zeebe:calledDecision or a zeebe:taskDefintion + * extension element. Note that they must not exist both at the same time, however + * this will be ensured by a bpmn-js behavior (and not by the propPanel). + */ + const setValue = value => { + let extensionElement, extensionElementType; + if (value === DMN_IMPLEMENTATION_OPTION) { + extensionElement = getCalledDecision$1(element); + extensionElementType = 'zeebe:CalledDecision'; + } else if (value === JOB_WORKER_IMPLEMENTATION_OPTION$1) { + extensionElement = getTaskDefinition$2(element); + extensionElementType = 'zeebe:TaskDefinition'; + } else { + resetElement$1(element, commandStack); + } + if (!extensionElement && extensionElementType) { + extensionElement = createElement(extensionElementType, {}, null, bpmnFactory); + updateExtensionElements$1(element, extensionElement, bpmnFactory, commandStack); + } + }; + const getOptions = () => { + const options = [{ + value: DEFAULT_IMPLEMENTATION_OPTION$1, + label: translate('') + }, { + value: DMN_IMPLEMENTATION_OPTION, + label: translate('DMN decision') + }, { + value: JOB_WORKER_IMPLEMENTATION_OPTION$1, + label: translate('Job worker') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id, + label: translate('Implementation'), + getValue, + setValue, + getOptions + }); +} + +// helper /////////////////////// + +function getTaskDefinition$2(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskDefinition')[0]; +} +function getCalledDecision$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:CalledDecision')[0]; +} +function isBusinessRuleImplementationEdited(element) { + return getTaskDefinition$2(element); +} +function resetElement$1(element, commandStack) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const toRemove = [getTaskDefinition$2(element), getTaskHeaders$1(element), getCalledDecision$1(element)].filter(Boolean); + removeExtensionElements(element, businessObject, toRemove, commandStack); +} +function updateExtensionElements$1(element, extensionElementToAdd, bpmnFactory, commandStack) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const commands = []; + let extensionElements = businessObject.get('extensionElements'); + let extensionElementValues; + + // (1) create bpmn:ExtensionElements if it doesn't exist + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + extensionElementToAdd.$parent = extensionElements; + + // (2) remove old exension element from extensionElements + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(extensionElementToAdd, 'zeebe:TaskDefinition')) { + extensionElementValues = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), getCalledDecision$1(element)); + } else if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(extensionElementToAdd, 'zeebe:CalledDecision')) { + extensionElementValues = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), getTaskDefinition$2(element)); + } + + // (3) add extension element to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElementValues, extensionElementToAdd] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); +} + +function CalledDecisionProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BusinessRuleTask') || !getCalledDecision(element)) { + return []; + } + return [{ + id: 'decisionId', + component: DecisionID, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'resultVariable', + component: ResultVariable$4, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function DecisionID(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getCalledDecision(element) || {}).decisionId; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure calledDecision + let calledDecision = getCalledDecision(element); + if (!calledDecision) { + calledDecision = createElement('zeebe:CalledDecision', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledDecision] + } + } + }); + } + + // (3) update caledDecision.decisionId + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: calledDecision, + properties: { + decisionId: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id, + label: translate('Decision ID'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function ResultVariable$4(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getCalledDecision(element) || {}).resultVariable; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure calledDecision + let calledDecision = getCalledDecision(element); + if (!calledDecision) { + calledDecision = createElement('zeebe:CalledDecision', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledDecision] + } + } + }); + } + + // (3) update caledDecision.decisionId + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: calledDecision, + properties: { + resultVariable: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id, + label: translate('Result variable'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function getCalledDecision(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:CalledDecision')[0]; +} + +function ConditionProps$1(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow')) { + return []; + } + const conditionProps = []; + if (isConditionalSource$1(element.source)) { + conditionProps.push({ + id: 'conditionExpression', + component: ConditionExpression$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }); + } + return conditionProps; +} +function ConditionExpression$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const getValue = () => { + return getConditionExpression$1(element); + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + + // (1) If we set value to a default flow, make it a non-default flow + // by updating the element source + const source = element.source; + if (source.businessObject.default === businessObject) { + commands.push({ + cmd: 'element.updateProperties', + context: { + element: source, + properties: { + 'default': undefined + } + } + }); + } + + // (2) Create and set formalExpression element containing the conditionExpression, + // unless the provided value is empty + const formalExpressionElement = value && value != '' ? createElement('bpmn:FormalExpression', { + body: value + }, businessObject, bpmnFactory) : undefined; + commands.push({ + cmd: 'element.updateProperties', + context: { + element: element, + properties: { + conditionExpression: formalExpressionElement + } + } + }); + + // (3) Execute the commands + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'conditionExpression', + label: translate('Condition expression'), + feel: 'required', + getValue, + setValue, + debounce + }); +} + +// helper ////////////////////////// + +const CONDITIONAL_SOURCES$1 = ['bpmn:Activity', 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway']; +function isConditionalSource$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, CONDITIONAL_SOURCES$1); +} + +/** + * getConditionExpression - get the body value of a condition expression for a given element + * + * @param {ModdleElement} element + * + * @return {string|undefined} + */ +function getConditionExpression$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const conditionExpression = businessObject.conditionExpression; + if (conditionExpression) { + return conditionExpression.get('body'); + } +} + +function ErrorProps$1(props) { + const { + element + } = props; + const error = getError(element); + const entries = []; + if (error && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ThrowEvent')) { + entries.push({ + id: 'errorCode', + component: ErrorCode$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }); + } + return entries; +} +function ErrorCode$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const error = getError(element); + const getValue = () => { + return error.get('errorCode'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + errorCode: value + } + }); + }; + return FeelEntryWithVariableContext({ + element, + id: 'errorCode', + label: translate('Code'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - function triggerClickEvent(element) { - var evt; - var eventType = 'click'; +/** + * @returns {Array} entries + */ +function EscalationProps$1(props) { + const { + element + } = props; + + // update throw events only + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ThrowEvent')) { + return []; + } + const escalation = getEscalation(element); + const entries = []; + if (escalation) { + entries.push({ + id: 'escalationCode', + component: EscalationCode, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }); + } + return entries; +} +function EscalationCode(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const escalation = getEscalation(element); + const getValue = () => { + return escalation.get('escalationCode'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: escalation, + properties: { + escalationCode: value + } + }); + }; + return FeelEntryWithVariableContext({ + element, + id: 'escalationCode', + label: translate('Code'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +const FORM_KEY_PREFIX = 'camunda-forms:bpmn:', + USER_TASK_FORM_ID_PREFIX = 'UserTaskForm_'; +const FORM_TYPES = { + CAMUNDA_FORM_EMBEDDED: 'camunda-form-embedded', + CAMUNDA_FORM_LINKED: 'camunda-form-linked', + CUSTOM_FORM: 'custom-form' +}; +function getFormDefinition(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const formDefinitions = getExtensionElementsList(businessObject, 'zeebe:FormDefinition'); + return formDefinitions[0]; +} +function getUserTaskForm(element, rootElement) { + rootElement = rootElement || getRootElement$1(element); + const formDefinition = getFormDefinition(element); + if (!formDefinition) { + return; + } + const formKey = formDefinition.get('formKey'); + const userTaskForms = getExtensionElementsList(rootElement, 'zeebe:UserTaskForm'); + return userTaskForms.find(userTaskForm => { + return userTaskFormIdToFormKey(userTaskForm.get('id')) === formKey; + }); +} +function userTaskFormIdToFormKey(userTaskFormId) { + return `${FORM_KEY_PREFIX}${userTaskFormId}`; +} +function createUserTaskFormId() { + return nextId(USER_TASK_FORM_ID_PREFIX); +} +function getRootElement$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let parent = businessObject; + while (parent.$parent && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:Process')) { + parent = parent.$parent; + } + return parent; +} +function getFormType$1(element) { + const formDefinition = getFormDefinition(element); + if (!formDefinition) { + return; + } + const formId = formDefinition.get('formId'), + formKey = formDefinition.get('formKey'); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(formId)) { + return FORM_TYPES.CAMUNDA_FORM_LINKED; + } + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(formKey)) { + if (getUserTaskForm(element)) { + return FORM_TYPES.CAMUNDA_FORM_EMBEDDED; + } + return FORM_TYPES.CUSTOM_FORM; + } +} + +function FormProps$1(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask')) { + return []; + } + const entries = [{ + id: 'formType', + component: FormType$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + const formType = getFormType$1(element); + if (formType === FORM_TYPES.CAMUNDA_FORM_EMBEDDED) { + entries.push({ + id: 'formConfiguration', + component: FormConfiguration, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited + }); + } else if (formType === FORM_TYPES.CAMUNDA_FORM_LINKED) { + entries.push({ + id: 'formId', + component: FormId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (formType === FORM_TYPES.CUSTOM_FORM) { + entries.push({ + id: 'customFormKey', + component: CustomFormKey, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function FormType$1(props) { + const { + element + } = props; + const injector = useService('injector'), + translate = useService('translate'); + const getValue = () => { + return getFormType$1(element) || ''; + }; + const setValue = value => { + if (value === FORM_TYPES.CAMUNDA_FORM_EMBEDDED) { + setUserTaskForm(injector, element, ''); + } else if (value === FORM_TYPES.CAMUNDA_FORM_LINKED) { + setFormId(injector, element, ''); + } else if (value === FORM_TYPES.CUSTOM_FORM) { + setCustomFormKey(injector, element, ''); + } else { + removeFormDefinition(injector, element); + } + }; + const getOptions = () => { + return [{ + value: '', + label: translate('') + }, { + value: FORM_TYPES.CAMUNDA_FORM_LINKED, + label: translate('Camunda Form (linked)') + }, { + value: FORM_TYPES.CAMUNDA_FORM_EMBEDDED, + label: translate('Camunda Form (embedded)') + }, { + value: FORM_TYPES.CUSTOM_FORM, + label: translate('Custom form key') + }]; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'formType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function FormConfiguration(props) { + const { + element + } = props; + const debounce = useService('debounceInput'), + injector = useService('injector'), + translate = useService('translate'); + const getValue = () => { + return getUserTaskForm(element).get('body'); + }; + const setValue = value => { + setUserTaskForm(injector, element, (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(value) ? '' : value); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)({ + element, + id: 'formConfiguration', + label: translate('Form JSON configuration'), + rows: 4, + getValue, + setValue, + debounce + }); +} +function FormId(props) { + const { + element + } = props; + const debounce = useService('debounceInput'), + injector = useService('injector'), + translate = useService('translate'); + const getValue = () => { + return getFormDefinition(element).get('formId'); + }; + const setValue = value => { + setFormId(injector, element, (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(value) ? '' : value); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'formId', + label: translate('Form ID'), + getValue, + setValue, + debounce + }); +} +function CustomFormKey(props) { + const { + element + } = props; + const debounce = useService('debounceInput'), + injector = useService('injector'), + translate = useService('translate'); + const getValue = () => { + return getFormDefinition(element).get('formKey'); + }; + const setValue = value => { + setCustomFormKey(injector, element, (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(value) ? '' : value); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'customFormKey', + label: translate('Form key'), + getValue, + setValue, + debounce + }); +} + +// helpers ///////////// + +/** + * @typedef { { cmd: string, context: Object } } Command + * @typedef {Command[]} Commands + * + * @typedef {import('diagram-js/lib/model/Types').Element} Element + * @typedef {import('bpmn-js/lib/model/Types').ModdleElement} ModdleElement + * + * @param {import('didi').Injector} Injector + */ - if (document.createEvent) { - try { - // Chrome, Safari, Firefox - evt = new MouseEvent((eventType), { view: window, bubbles: true, cancelable: true }); - } catch (e) { - // IE 11, PhantomJS (wat!) - evt = document.createEvent('MouseEvent'); +/** + * @param {Injector} injector + * @param {Element} element + * + * @returns { { + * commands: Commands, + * extensionElements: ModdleElement + * } } + */ +function getOrCreateExtensionElements(injector, element, moddleElement) { + const businessObject = moddleElement || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + if (extensionElements) { + return { + commands: [], + extensionElements + }; + } + const bpmnFactory = injector.get('bpmnFactory'); + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + return { + commands: [createUpdateModdlePropertiesCommand(element, businessObject, { + extensionElements + })], + extensionElements + }; +} + +/** + * @param {Injector} injector + * @param {Element} element + * + * @returns { { +* commands: Commands, +* formDefinition: ModdleElement +* } } +*/ +function getOrCreateFormDefintition(injector, element) { + let formDefinition = getFormDefinition(element); + if (formDefinition) { + return { + commands: [], + formDefinition + }; + } + const { + extensionElements, + commands + } = getOrCreateExtensionElements(injector, element); + formDefinition = createFormDefinition(injector, {}, extensionElements); + return { + commands: [...commands, createUpdateModdlePropertiesCommand(element, extensionElements, { + values: [...extensionElements.get('values'), formDefinition] + })], + formDefinition + }; +} + +/** + * @param {Injector} injector + * @param {Element} element + * + * @returns { { + * commands: Commands, + * formDefinition: ModdleElement, + * userTaskForm: ModdleElement + * } } + */ +function getOrCreateUserTaskForm(injector, element) { + let userTaskForm = getUserTaskForm(element); + if (userTaskForm) { + return { + commands: [], + formDefinition: getFormDefinition(element), + userTaskForm + }; + } + const rootElement = getRootElement$1(element); + const { + extensionElements, + commands: extensionElementsCommands + } = getOrCreateExtensionElements(injector, element, rootElement); + const { + formDefinition, + commands: formDefinitionCommands + } = getOrCreateFormDefintition(injector, element); + const formId = createUserTaskFormId(); + userTaskForm = createUserTaskForm(injector, { + id: formId + }, extensionElements); + return { + commands: [...extensionElementsCommands, ...formDefinitionCommands, createUpdateModdlePropertiesCommand(element, extensionElements, { + values: [...extensionElements.get('values'), userTaskForm] + }), createUpdateModdlePropertiesCommand(element, formDefinition, { + formKey: userTaskFormIdToFormKey(formId) + })], + formDefinition, + userTaskForm + }; +} +function setFormId(injector, element, formId) { + let { + commands, + formDefinition + } = getOrCreateFormDefintition(injector, element); + const commandStack = injector.get('commandStack'); + commandStack.execute('properties-panel.multi-command-executor', [...commands, createUpdateModdlePropertiesCommand(element, formDefinition, { + formId + })]); +} +function setCustomFormKey(injector, element, formKey) { + let { + commands, + formDefinition + } = getOrCreateFormDefintition(injector, element); + const commandStack = injector.get('commandStack'); + commandStack.execute('properties-panel.multi-command-executor', [...commands, createUpdateModdlePropertiesCommand(element, formDefinition, { + formKey + })]); +} +function setUserTaskForm(injector, element, body) { + let { + commands, + userTaskForm + } = getOrCreateUserTaskForm(injector, element); + const commandStack = injector.get('commandStack'); + commandStack.execute('properties-panel.multi-command-executor', [...commands, createUpdateModdlePropertiesCommand(element, userTaskForm, { + body + })]); +} +function removeFormDefinition(injector, element) { + const formDefinition = getFormDefinition(element); + + /** + * @type {import('bpmn-js/lib/features/modeling/Modeling').default} + */ + const modeling = injector.get('modeling'); + if (formDefinition) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + extensionElements = businessObject.get('extensionElements'); + modeling.updateModdleProperties(element, extensionElements, { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), formDefinition) + }); + } +} + +/** + * @param {Injector} injector + * @param {Object} properties + * @param {ModdleElement} parent + * + * @returns {ModdleElement} + */ +function createFormDefinition(injector, properties, parent) { + const bpmnFactory = injector.get('bpmnFactory'); + return createElement('zeebe:FormDefinition', properties, parent, bpmnFactory); +} + +/** + * @param {Injector} injector + * @param {Object} properties + * @param {ModdleElement} parent + * + * @returns {ModdleElement} + */ +function createUserTaskForm(injector, properties, parent) { + const bpmnFactory = injector.get('bpmnFactory'); + return createElement('zeebe:UserTaskForm', properties, parent, bpmnFactory); +} + +/** + * @param {Element} element + * @param {ModdleElement} moddleElement + * @param {Object} properties + * + * @returns {Command} + */ +function createUpdateModdlePropertiesCommand(element, moddleElement, properties) { + return { + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement, + properties + } + }; +} + +function Header(props) { + const { + idPrefix, + header + } = props; + const entries = [{ + id: idPrefix + '-key', + component: KeyProperty, + header, + idPrefix + }, { + id: idPrefix + '-value', + component: ValueProperty$2, + header, + idPrefix + }]; + return entries; +} +function KeyProperty(props) { + const { + idPrefix, + element, + header + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: header, + properties: { + key: value + } + }); + }; + const getValue = header => { + return header.key; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: header, + id: idPrefix + '-key', + label: translate('Key'), + getValue, + setValue, + debounce + }); +} +function ValueProperty$2(props) { + const { + idPrefix, + element, + header + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: header, + properties: { + value + } + }); + }; + const getValue = header => { + return header.value; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: header, + id: idPrefix + '-value', + label: translate('Value'), + getValue, + setValue, + debounce + }); +} + +function HeaderProps({ + element, + injector +}) { + if (!areHeadersSupported(element)) { + return null; + } + const headers = getHeaders(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = headers.map((header, index) => { + const id = element.id + '-header-' + index; + return { + id, + label: header.get('key') || '', + entries: Header({ + idPrefix: id, + element, + header + }), + autoFocusEntry: id + '-key', + remove: removeFactory$c({ + commandStack, + element, + header + }) + }; + }); + return { + items, + add: addFactory$9({ + bpmnFactory, + commandStack, + element + }), + shouldSort: false + }; +} +function removeFactory$c({ + commandStack, + element, + header +}) { + return function (event) { + event.stopPropagation(); + let commands = []; + const taskHeaders = getTaskHeaders$1(element); + if (!taskHeaders) { + return; + } + const newTaskHeaders = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(taskHeaders.get('values'), header); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskHeaders, + properties: { + values: newTaskHeaders + } + } + }); + + // remove zeebe:TaskHeaders if there are no headers anymore + if (!newTaskHeaders.length) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + extensionElements = businessObject.get('extensionElements'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), taskHeaders) + } + } + }); + } + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} +function addFactory$9({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:TaskHeaders + let taskHeaders = getTaskHeaders$1(element); + if (!taskHeaders) { + const parent = extensionElements; + taskHeaders = createElement('zeebe:TaskHeaders', { + values: [] + }, parent, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskHeaders] + } + } + }); + } + + // (3) create header + const header = createElement('zeebe:Header', {}, taskHeaders, bpmnFactory); + + // (4) add header to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskHeaders, + properties: { + values: [...taskHeaders.get('values'), header] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} + +function getProcessId(element) { + const calledElement = getCalledElement(element); + return calledElement ? calledElement.get('processId') : ''; +} +function getCalledElement(element) { + const calledElements = getCalledElements(element); + return calledElements[0]; +} +function getCalledElements(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const extElements = getExtensionElementsList(bo, 'zeebe:CalledElement'); + return extElements; +} + +function InputPropagationProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return []; + } + return [{ + id: 'propagateAllParentVariables', + component: PropagateAllParentVariables, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isToggleSwitchEntryEdited + }]; +} +function PropagateAllParentVariables(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'); + const propagateAllParentVariables = isPropagateAllParentVariables(element); + const getValue = () => { + return propagateAllParentVariables; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + + // (1) ensure extension elements + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:calledElement + let calledElement = getCalledElement(businessObject); + if (!calledElement) { + calledElement = createElement('zeebe:CalledElement', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledElement] + } + } + }); + } + + // (3) Update propagateAllParentVariables attribute + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: calledElement, + properties: { + propagateAllParentVariables: value + } + } + }); + + // (4) Execute the commands + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ToggleSwitchEntry)({ + id: 'propagateAllParentVariables', + label: translate('Propagate all parent process variables'), + switcherLabel: propagateAllParentVariables ? translate('On') : translate('Off'), + tooltip: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('If turned on, all variables from the parent process instance will be propagated to the child process instance.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('Otherwise, only variables defined via input mappings will be propagated.') + })] + }), + getValue, + setValue + }); +} + +// helper ////////////////////////// + +/** + * Check whether the propagateAllParentVariables attribute is set on an element. + * @param {Object} element + * + * @returns {boolean} + */ +function isPropagateAllParentVariables(element) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return undefined; + } + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + calledElement = getCalledElement(bo); + return calledElement && (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.has)(calledElement, 'propagateAllParentVariables') ? calledElement.get('propagateAllParentVariables') : /* default value */true; +} + +function InputOutputParameter$1(props) { + const { + idPrefix, + parameter + } = props; + const entries = [{ + id: idPrefix + '-target', + component: TargetProperty, + idPrefix, + parameter + }, { + id: idPrefix + '-source', + component: SourceProperty, + idPrefix, + parameter + }]; + return entries; +} +function TargetProperty(props) { + const { + idPrefix, + element, + parameter + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: parameter, + properties: { + target: value + } + }); + }; + const getValue = parameter => { + return parameter.target; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: parameter, + id: idPrefix + '-target', + label: translate((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parameter, 'zeebe:Input') ? 'Local variable name' : 'Process variable name'), + getValue, + setValue, + debounce + }); +} +function SourceProperty(props) { + const { + idPrefix, + element, + parameter + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: parameter, + properties: { + source: value + } + }); + }; + const getValue = parameter => { + return parameter.source; + }; + return FeelEntryWithVariableContext({ + bpmnElement: element, + element: parameter, + id: idPrefix + '-source', + label: translate('Variable assignment value'), + feel: 'required', + getValue, + setValue, + debounce + }); +} + +function getElements$1(bo, type, prop) { + const elems = getExtensionElementsList(bo, type); + return !prop ? elems : (elems[0] || {})[prop] || []; +} +function getParameters$1(element, prop) { + const ioMapping = getIoMapping(element); + return ioMapping && ioMapping.get(prop) || []; +} + +/** + * Get a ioMapping from the business object + * + * @param {djs.model.Base} element + * + * @return {ModdleElement} the ioMapping object + */ +function getIoMapping(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return (getElements$1(bo, 'zeebe:IoMapping') || [])[0]; +} + +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {djs.model.Base} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters$1(element) { + return getParameters$1.apply(this, [element, 'inputParameters']); +} - evt.initEvent((eventType), true, true); - } - return element.dispatchEvent(evt); - } else { - // Welcome IE - evt = document.createEventObject(); +/** + * Return all output parameters existing in the business object, and + * an empty array if none exist. + * + * @param {djs.model.Base} element + * + * @return {Array} a list of output parameter objects + */ +function getOutputParameters$1(element) { + return getParameters$1.apply(this, [element, 'outputParameters']); +} +function areInputParametersSupported$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:UserTask', 'bpmn:SubProcess', 'bpmn:CallActivity', 'bpmn:BusinessRuleTask', 'bpmn:ScriptTask']) || isZeebeServiceTask(element) || isSignalThrowEvent(element); +} +function areOutputParametersSupported$1(element) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:EndEvent') && getErrorEventDefinition(element)) { + return false; + } + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['zeebe:ZeebeServiceTask', 'bpmn:UserTask', 'bpmn:SubProcess', 'bpmn:ReceiveTask', 'bpmn:CallActivity', 'bpmn:Event', 'bpmn:BusinessRuleTask']); +} +function createIOMapping(properties, parent, bpmnFactory) { + return createElement('zeebe:IoMapping', properties, parent, bpmnFactory); +} +function isSignalThrowEvent(element) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'])) { + return false; + } + return !!getEventDefinition$1(element, 'bpmn:SignalEventDefinition'); +} + +function InputProps$1({ + element, + injector +}) { + if (!areInputParametersSupported$1(element)) { + return null; + } + const inputParameters = getInputParameters$1(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = inputParameters.map((parameter, index) => { + const id = element.id + '-input-' + index; + return { + id, + label: parameter.get('target') || '', + entries: InputOutputParameter$1({ + idPrefix: id, + element, + parameter + }), + autoFocusEntry: id + '-target', + remove: removeFactory$b({ + commandStack, + element, + parameter + }) + }; + }); + return { + items, + add: addFactory$8({ + element, + bpmnFactory, + commandStack + }), + shouldSort: false + }; +} +function removeFactory$b({ + commandStack, + element, + parameter +}) { + return function (event) { + event.stopPropagation(); + const commands = []; + const ioMapping = getIoMapping(element); + if (!ioMapping) { + return; + } + const inputParameters = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(ioMapping.get('inputParameters'), parameter); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: ioMapping, + properties: { + inputParameters + } + } + }); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + extensionElements = businessObject.get('extensionElements'), + values = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), ioMapping); + + // remove ioMapping if there are no input/output parameters anymore + if (!inputParameters.length && !ioMapping.get('outputParameters').length) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values + } + } + }); + } + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} +function addFactory$8({ + element, + bpmnFactory, + commandStack +}) { + return function (event) { + event.stopPropagation(); + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure IoMapping + let ioMapping = getIoMapping(element); + if (!ioMapping) { + ioMapping = createIOMapping({ + inputParameters: [], + outputParameters: [] + }, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), ioMapping] + } + } + }); + } + + // (3) create parameter + const newParameter = createElement('zeebe:Input', { + target: nextId('InputVariable_') + }, ioMapping, bpmnFactory); + + // (4) add parameter to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: ioMapping, + properties: { + inputParameters: [...ioMapping.get('inputParameters'), newParameter] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} + +function MessageProps(props) { + const { + element + } = props; + const message = getMessage(element); + const entries = []; + if (message) { + entries.push({ + id: 'messageName', + component: MessageName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }); + } + if (message && canHaveSubscriptionCorrelationKey(element)) { + entries.push({ + id: 'messageSubscriptionCorrelationKey', + component: SubscriptionCorrelationKey, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }); + } + return entries; +} +function MessageName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const message = getMessage(element); + const getValue = () => { + return message.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: message, + properties: { + name: value + } + }); + }; + return FeelEntryWithVariableContext({ + element, + id: 'messageName', + label: translate('Name'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function SubscriptionCorrelationKey(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getCorrelationKey(element); + }; + const setValue = value => { + const commands = []; + const properties = { + correlationKey: value + }; + const message = getMessage(element); + let extensionElements = message.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, message, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: message, + properties: { + extensionElements + } + } + }); + } + let subscription = getSubscription(element); + + // (2a) add subscription with correlation key + if (!subscription) { + subscription = createElement('zeebe:Subscription', properties, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), subscription] + } + } + }); + } else { + // (2b) update existing subscription's correlation key + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + properties, + moddleElement: subscription + } + }); + } + + // (3) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'messageSubscriptionCorrelationKey', + label: translate('Subscription correlation key'), + feel: 'required', + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function canHaveSubscriptionCorrelationKey(element) { + // (1) allow for receive task + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ReceiveTask')) { + return true; + } + + // (2) allow for non start events + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent')) { + return true; + } + + // (3) allow for start events inside event sub processes + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && (0,bpmn_js_lib_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isEventSubProcess)(element.parent)) { + return true; + } + return false; +} +function getCorrelationKey(element) { + const subscription = getSubscription(element); + return subscription ? subscription.get('correlationKey') : ''; +} +function getSubscription(element) { + const message = getMessage(element); + const subscriptions = getSubscriptions(message); + return subscriptions[0]; +} +function getSubscriptions(message) { + const extensionElements = getExtensionElementsList(message, 'zeebe:Subscription'); + return extensionElements; +} + +function MultiInstanceProps$1(props) { + const { + element + } = props; + if (!supportsMultiInstances(element)) { + return []; + } + return [{ + id: 'multiInstance-inputCollection', + component: InputCollection, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'multiInstance-inputElement', + component: InputElement, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'multiInstance-outputCollection', + component: OutputCollection, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'multiInstance-outputElement', + component: OutputElement, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'multiInstance-completionCondition', + component: CompletionCondition, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function InputCollection(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getProperty$1(element, 'inputCollection'); + }; + const setValue = value => { + return setProperty(element, 'inputCollection', value, commandStack, bpmnFactory); + }; + return FeelEntryWithVariableContext({ + element, + id: 'multiInstance-inputCollection', + label: translate('Input collection'), + feel: 'required', + getValue, + setValue, + debounce + }); +} +function InputElement(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getProperty$1(element, 'inputElement'); + }; + const setValue = value => { + return setProperty(element, 'inputElement', value, commandStack, bpmnFactory); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'multiInstance-inputElement', + label: translate('Input element'), + getValue, + setValue, + debounce + }); +} +function OutputCollection(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getProperty$1(element, 'outputCollection'); + }; + const setValue = value => { + return setProperty(element, 'outputCollection', value, commandStack, bpmnFactory); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'multiInstance-outputCollection', + label: translate('Output collection'), + getValue, + setValue, + debounce + }); +} +function OutputElement(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getProperty$1(element, 'outputElement'); + }; + const setValue = value => { + return setProperty(element, 'outputElement', value, commandStack, bpmnFactory); + }; + return FeelEntryWithVariableContext({ + element, + id: 'multiInstance-outputElement', + label: translate('Output element'), + feel: 'required', + getValue, + setValue, + debounce + }); +} +function CompletionCondition(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + const completionCondition = getCompletionCondition(element); + return completionCondition && completionCondition.get('body'); + }; + const setValue = value => { + if (value && value !== '') { + const loopCharacteristics = getLoopCharacteristics$1(element); + const completionCondition = createElement('bpmn:FormalExpression', { + body: value + }, loopCharacteristics, bpmnFactory); + setCompletionCondition(element, commandStack, completionCondition); + } else { + setCompletionCondition(element, commandStack, undefined); + } + }; + return FeelEntryWithVariableContext({ + element, + id: 'multiInstance-completionCondition', + label: translate('Completion condition'), + feel: 'required', + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function getLoopCharacteristics$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject.get('loopCharacteristics'); +} +function getZeebeLoopCharacteristics(loopCharacteristics) { + const extensionElements = getExtensionElementsList(loopCharacteristics, 'zeebe:LoopCharacteristics'); + return extensionElements && extensionElements[0]; +} +function supportsMultiInstances(element) { + return !!getLoopCharacteristics$1(element); +} +function getCompletionCondition(element) { + return getLoopCharacteristics$1(element).get('completionCondition'); +} +function setCompletionCondition(element, commandStack, completionCondition = undefined) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: getLoopCharacteristics$1(element), + properties: { + completionCondition + } + }); +} +function getProperty$1(element, propertyName) { + const loopCharacteristics = getLoopCharacteristics$1(element), + zeebeLoopCharacteristics = getZeebeLoopCharacteristics(loopCharacteristics); + return zeebeLoopCharacteristics && zeebeLoopCharacteristics.get(propertyName); +} +function setProperty(element, propertyName, value, commandStack, bpmnFactory) { + const loopCharacteristics = getLoopCharacteristics$1(element); + const commands = []; + + // (1) ensure extension elements + let extensionElements = loopCharacteristics.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, loopCharacteristics, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: loopCharacteristics, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe loop characteristics + let zeebeLoopCharacteristics = getZeebeLoopCharacteristics(loopCharacteristics); + if (!zeebeLoopCharacteristics) { + zeebeLoopCharacteristics = createElement('zeebe:LoopCharacteristics', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), zeebeLoopCharacteristics] + } + } + }); + } + + // (3) update defined property + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: zeebeLoopCharacteristics, + properties: { + [propertyName]: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); +} + +function OutputPropagationProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return []; + } + return [{ + id: 'propagateAllChildVariables', + component: PropagateAllChildVariables, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isToggleSwitchEntryEdited + }]; +} +function PropagateAllChildVariables(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'); + const propagateAllChildVariables = isPropagateAllChildVariables(element); + const getValue = () => { + return propagateAllChildVariables; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + + // (1) ensure extension elements + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:calledElement + let calledElement = getCalledElement(businessObject); + if (!calledElement) { + calledElement = createElement('zeebe:CalledElement', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledElement] + } + } + }); + } + + // (3) Update propagateAllChildVariables attribute + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: calledElement, + properties: { + propagateAllChildVariables: value + } + } + }); + + // (4) Execute the commands + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ToggleSwitchEntry)({ + id: 'propagateAllChildVariables', + label: translate('Propagate all child process variables'), + switcherLabel: propagateAllChildVariables ? translate('On') : translate('Off'), + tooltip: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('If turned on, all variables from the child process instance will be propagated to the parent process instance.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('Otherwise, only variables defined via output mappings will be propagated.') + })] + }), + getValue, + setValue + }); +} + +// helper ////////////////////////// + +/** + * Determine default value for propagateAllChildVariables attribute + * @param {Object} element representing a bpmn:CallActivity + * + * @returns {boolean} + */ +function determinePropAllChildVariablesDefault(element) { + const outputParameters = getOutputParameters$1(element); + if (outputParameters) { + return outputParameters.length > 0 ? false : true; + } +} + +/** + * Check whether the propagateAllChildVariables attribute is set on an element. + * Note that a default logic will be determine if it is not explicitly set. + * @param {Object} element + * + * @returns {boolean} + */ +function isPropagateAllChildVariables(element) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return undefined; + } + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + calledElement = getCalledElement(bo); + return calledElement && (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.has)(calledElement, 'propagateAllChildVariables') ? calledElement.get('propagateAllChildVariables') : determinePropAllChildVariablesDefault(element); +} + +function OutputProps$1({ + element, + injector +}) { + if (!areOutputParametersSupported$1(element)) { + return null; + } + const outputParameters = getOutputParameters$1(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = outputParameters.map((parameter, index) => { + const id = element.id + '-output-' + index; + return { + id, + label: parameter.get('target') || '', + entries: InputOutputParameter$1({ + idPrefix: id, + element, + parameter + }), + autoFocusEntry: id + '-target', + remove: removeFactory$a({ + commandStack, + element, + parameter + }) + }; + }); + return { + items, + add: addFactory$7({ + element, + bpmnFactory, + commandStack + }), + shouldSort: false + }; +} +function removeFactory$a({ + commandStack, + element, + parameter +}) { + return function (event) { + event.stopPropagation(); + let commands = []; + const ioMapping = getIoMapping(element); + if (!ioMapping) { + return; + } + const outputParameters = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(ioMapping.get('outputParameters'), parameter); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: ioMapping, + properties: { + outputParameters + } + } + }); + + // remove ioMapping if there are no input/output parameters anymore + if (!ioMapping.get('inputParameters').length && !outputParameters.length) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + extensionElements = businessObject.get('extensionElements'), + values = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), ioMapping); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values + } + } + }); + } + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} +function addFactory$7({ + element, + bpmnFactory, + commandStack +}) { + return function (event) { + event.stopPropagation(); + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure IoMapping + let ioMapping = getIoMapping(element); + if (!ioMapping) { + const parent = extensionElements; + ioMapping = createIOMapping({ + inputParameters: [], + outputParameters: [] + }, parent, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), ioMapping] + } + } + }); + } + + // (3) create parameter + const newParameter = createElement('zeebe:Output', { + target: nextId('OutputVariable_') + }, ioMapping, bpmnFactory); + + // (4) add parameter to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: ioMapping, + properties: { + outputParameters: [...ioMapping.get('outputParameters'), newParameter] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} + +const SCRIPT_IMPLEMENTATION_OPTION = 'script', + JOB_WORKER_IMPLEMENTATION_OPTION = 'jobWorker', + DEFAULT_IMPLEMENTATION_OPTION = ''; +function ScriptImplementationProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ScriptTask')) { + return []; + } + return [{ + id: 'scriptImplementation', + component: ScriptImplementation, + isEdited: () => isScriptImplementationEdited(element) + }]; +} +function ScriptImplementation(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + if (getScript$1(element)) { + return SCRIPT_IMPLEMENTATION_OPTION; + } + if (getTaskDefinition$1(element)) { + return JOB_WORKER_IMPLEMENTATION_OPTION; + } + return DEFAULT_IMPLEMENTATION_OPTION; + }; + + /** + * Set value by either creating a zeebe:script or a zeebe:taskDefintion + * extension element. Note that they must not exist both at the same time, however + * this will be ensured by a bpmn-js behavior (and not by the propPanel). + */ + const setValue = value => { + let extensionElement, extensionElementType; + if (value === SCRIPT_IMPLEMENTATION_OPTION) { + extensionElement = getScript$1(element); + extensionElementType = 'zeebe:Script'; + } else if (value === JOB_WORKER_IMPLEMENTATION_OPTION) { + extensionElement = getTaskDefinition$1(element); + extensionElementType = 'zeebe:TaskDefinition'; + } else { + resetElement(element, commandStack); + } + if (!extensionElement && extensionElementType) { + extensionElement = createElement(extensionElementType, {}, null, bpmnFactory); + updateExtensionElements(element, extensionElement, bpmnFactory, commandStack); + } + }; + const getOptions = () => { + const options = [{ + value: DEFAULT_IMPLEMENTATION_OPTION, + label: translate('') + }, { + value: SCRIPT_IMPLEMENTATION_OPTION, + label: translate('FEEL expression') + }, { + value: JOB_WORKER_IMPLEMENTATION_OPTION, + label: translate('Job worker') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id, + label: translate('Implementation'), + getValue, + setValue, + getOptions + }); +} + +// helper /////////////////////// + +function getTaskDefinition$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskDefinition')[0]; +} +function getScript$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:Script')[0]; +} +function getTaskHeaders(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders'); +} +function isScriptImplementationEdited(element) { + return getTaskDefinition$1(element) || getScript$1(element); +} +function resetElement(element, commandStack) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const taskDefinition = getTaskDefinition$1(element); + const taskHeaders = getTaskHeaders(element); + const script = getScript$1(element); + if (taskDefinition) { + const removed = [taskDefinition, taskHeaders].filter(Boolean); + removeExtensionElements(element, businessObject, removed, commandStack); + return; + } + if (script) { + removeExtensionElements(element, businessObject, script, commandStack); + } +} +function updateExtensionElements(element, extensionElementToAdd, bpmnFactory, commandStack) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const commands = []; + let extensionElements = businessObject.get('extensionElements'); + let extensionElementValues; + + // (1) create bpmn:ExtensionElements if it doesn't exist + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + extensionElementToAdd.$parent = extensionElements; + + // (2) remove old exension element from extensionElements + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(extensionElementToAdd, 'zeebe:TaskDefinition')) { + extensionElementValues = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), getScript$1(element)); + } else if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(extensionElementToAdd, 'zeebe:Script')) { + const matcher = extension => (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(extension, ['zeebe:TaskDefinition', 'zeebe:TaskHeaders']); + extensionElementValues = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), matcher); + } + + // (3) add extension element to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElementValues, extensionElementToAdd] + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); +} + +function ScriptProps$1(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ScriptTask') || !getScript(element)) { + return []; + } + return [{ + id: 'resultVariable', + component: ResultVariable$3, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'scriptExpression', + component: Expression$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function Expression$2(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getScript(element) || {}).get('expression'); + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure script + let script = getScript(element); + if (!script) { + script = createElement('zeebe:Script', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), script] + } + } + }); + } + + // (3) update script.expression + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: script, + properties: { + expression: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id, + label: translate('FEEL expression'), + feel: 'required', + getValue, + setValue, + debounce + }); +} +function ResultVariable$3(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getScript(element) || {}).resultVariable; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure script + let script = getScript(element); + if (!script) { + script = createElement('zeebe:Script', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), script] + } + } + }); + } + + // (3) update script.resultVariable + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: script, + properties: { + resultVariable: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id, + label: translate('Result variable'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function getScript(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:Script')[0]; +} + +/** + * @returns {Entry[]} + */ +function SignalProps(props) { + const { + element + } = props; + if (!isSignalSupported(element)) { + return []; + } + const signal = getSignal(element); + let entries = []; + if (signal) { + entries = [...entries, { + id: 'signalName', + component: SignalName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; + } + return entries; +} +function SignalName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const signal = getSignal(element); + const getValue = () => { + return signal.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: signal, + properties: { + name: value + } + }); + }; + return FeelEntryWithVariableContext({ + element, + id: 'signalName', + label: translate('Name'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +function TargetProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return []; + } + return [{ + id: 'targetProcessId', + component: TargetProcessId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function TargetProcessId(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const getValue = () => { + return getProcessId(element); + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + + // (1) ensure extension elements + let extensionElements = businessObject.get('extensionElements'); + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:calledElement + let calledElement = getCalledElement(businessObject); + if (!calledElement) { + calledElement = createElement('zeebe:CalledElement', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), calledElement] + } + } + }); + } + + // (3) Update processId attribute + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: calledElement, + properties: { + processId: value + } + } + }); + + // (4) Execute the commands + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id, + label: translate('Process ID'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +function TaskDefinitionProps(props) { + const { + element + } = props; + if (!isZeebeServiceTask(element)) { + return []; + } + return [{ + id: 'taskDefinitionType', + component: TaskDefinitionType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'taskDefinitionRetries', + component: TaskDefinitionRetries, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function TaskDefinitionType(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getTaskDefinition(element) || {}).type; + }; + const setValue = value => { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure task definition + let taskDefinition = getTaskDefinition(element); + if (!taskDefinition) { + taskDefinition = createElement('zeebe:TaskDefinition', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskDefinition] + } + } + }); + } + + // (3) update task definition type + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskDefinition, + properties: { + type: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id, + label: translate('Type'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function TaskDefinitionRetries(props) { + const { + element, + id + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (getTaskDefinition(element) || {}).retries; + }; + const setValue = value => { + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure task definition + let taskDefinition = getTaskDefinition(element); + if (!taskDefinition) { + taskDefinition = createElement('zeebe:TaskDefinition', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskDefinition] + } + } + }); + } + + // (3) update task definition retries + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskDefinition, + properties: { + retries: value + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id, + label: translate('Retries'), + feel: 'optional', + getValue, + setValue, + debounce, + tooltip: translate('Specifies the number of times the job is retried when a worker signals failure. The default is three.') + }); +} + +// helper /////////////////////// + +function getTaskDefinition(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskDefinition')[0]; +} + +function TaskScheduleProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask')) { + return []; + } + return [{ + id: 'taskScheduleDueDate', + component: DueDate$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }, { + id: 'taskScheduleFollowUpDate', + component: FollowUpDate$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited + }]; +} +function DueDate$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + const taskSchedule = getTaskSchedule(element); + if (!taskSchedule) { + return; + } + return taskSchedule.get('dueDate'); + }; + const setValue = value => { + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:TaskSchedule + let taskSchedule = getTaskSchedule(element); + if (!taskSchedule) { + taskSchedule = createElement('zeebe:TaskSchedule', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskSchedule] + } + } + }); + } + + // (3) update zeebe:dueDate + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskSchedule, + properties: { + dueDate: value + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'taskScheduleDueDate', + label: translate('Due date'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} +function FollowUpDate$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + const taskSchedule = getTaskSchedule(element); + if (!taskSchedule) { + return; + } + return taskSchedule.get('followUpDate'); + }; + const setValue = value => { + let commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure zeebe:TaskSchedule + let taskSchedule = getTaskSchedule(element); + if (!taskSchedule) { + taskSchedule = createElement('zeebe:TaskSchedule', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), taskSchedule] + } + } + }); + } + + // (3) update zeebe:followUpDate + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: taskSchedule, + properties: { + followUpDate: value + } + } + }); + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return FeelEntryWithVariableContext({ + element, + id: 'taskScheduleFollowUpDate', + label: translate('Follow up date'), + feel: 'optional', + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function getTaskSchedule(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'zeebe:TaskSchedule')[0]; +} + +/** + * Check whether a given timer expression type is supported for a given element. + * + * @param {string} type + * @param {Element|ModdleElement} element + * + * @return {boolean} + */ +function isTimerExpressionTypeSupported(type, element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + switch (type) { + case 'timeDate': + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:StartEvent']); + case 'timeCycle': + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && !hasParentEventSubProcess(businessObject) || !isInterrupting(businessObject)) { + return true; + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BoundaryEvent') && !isInterrupting(businessObject)) { + return true; + } + return false; + case 'timeDuration': + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent'])) { + return true; + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && hasParentEventSubProcess(businessObject)) { + return true; + } + return false; + default: + return false; + } +} +function isInterrupting(businessObject) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:BoundaryEvent')) { + return businessObject.get('cancelActivity') !== false; + } + return businessObject.get('isInterrupting') !== false; +} +function hasParentEventSubProcess(businessObject) { + const parent = businessObject.$parent; + return parent && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:SubProcess') && parent.get('triggeredByEvent'); +} + +function TimerProps$1(props) { + const { + element, + injector + } = props; + const translate = injector.get('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + timerEventDefinition = getTimerEventDefinition(businessObject), + timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); + + // (1) Only show for supported elements + if (!isTimerSupported(element)) { + return []; + } + const timerOptions = getTimerOptions(element, translate); + const entries = []; + entries.push({ + id: 'timerEventDefinitionType', + component: TimerEventDefinitionType$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + options: timerOptions + }); + if (timerEventDefinitionType) { + entries.push({ + id: 'timerEventDefinitionValue', + component: TimerEventDefinitionValue$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isFeelEntryEdited, + timerEventDefinitionType: timerEventDefinitionType || timerOptions[0].value + }); + } + return entries; +} +function getTimerOptions(element, translate) { + const options = []; + if (isTimerExpressionTypeSupported('timeDate', element)) { + options.push({ + value: 'timeDate', + label: translate('Date') + }); + } + if (isTimerExpressionTypeSupported('timeDuration', element)) { + options.push({ + value: 'timeDuration', + label: translate('Duration') + }); + } + if (isTimerExpressionTypeSupported('timeCycle', element)) { + options.push({ + value: 'timeCycle', + label: translate('Cycle') + }); + } + return options; +} + +/** + * TimerEventDefinitionType - Generic select entry allowing to select a specific + * timerEventDefintionType. To be used together with timerEventDefinitionValue. + * + * @param {type} props + * @return {SelectEntry} + */ +function TimerEventDefinitionType$1(props) { + const { + element, + options + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + timerEventDefinition = getTimerEventDefinition(businessObject), + timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); + const getValue = () => { + return timerEventDefinitionType || ''; + }; + const setValue = value => { + // (1) Check if value is different to current type + if (value === timerEventDefinitionType) { + return; + } + + // (2) Create empty formalExpression element + const formalExpression = createTimerFormalExpression(bpmnFactory, timerEventDefinition); + + // (3) Set the value for selected timerEventDefinitionType + const newProps = { + timeDuration: undefined, + timeDate: undefined, + timeCycle: undefined + }; + if (value !== '') { + newProps[value] = formalExpression; + } + + // (4) Execute businessObject update + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventDefinition, + properties: newProps + }); + }; + const getOptions = element => { + return [{ + value: '', + label: translate('') + }, ...options]; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'timerEventDefinitionType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} + +/** + * TimerEventDefinitionValue - Generic textField entry allowing to specify the + * timerEventDefintionValue based on the set timerEventDefintionType. To be used + * together with timerEventDefinitionType. + * + * @param {object} props + * @param {ModdleElement} props.element + * @param {'timeCycle'|'timeDate'|'timeDuration'} props.timerEventDefinitionType? + * @param {string} props.label? + * @return {TextFieldEntry} + */ +function TimerEventDefinitionValue$1(props) { + const { + element, + label, + timerEventDefinitionType + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'), + bpmnFactory = useService('bpmnFactory'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + timerEventDefinition = getTimerEventDefinition(businessObject), + timerEventFormalExpression = timerEventDefinition.get(timerEventDefinitionType); + const getValue = () => { + return timerEventFormalExpression && timerEventFormalExpression.get('body'); + }; + const setValue = value => { + if (!timerEventFormalExpression) { + const expression = createTimerFormalExpression(bpmnFactory, timerEventDefinition); + expression.set('body', value); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventDefinition, + properties: { + [timerEventDefinitionType]: expression + } + }); + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventFormalExpression, + properties: { + body: value + } + }); + }; + return FeelEntryWithVariableContext({ + element, + id: 'timerEventDefinitionValue', + label: label || translate('Value'), + feel: 'optional', + getValue, + setValue, + debounce, + tooltip: getTimerEventDefinitionValueDescription$1(timerEventDefinitionType, translate) + }); +} + +// helper ////////////////////////// + +function createTimerFormalExpression(bpmnFactory, eventDefinition) { + const formalExpression = bpmnFactory.create('bpmn:FormalExpression', { + body: undefined + }); + formalExpression.$parent = eventDefinition; + return formalExpression; +} +function getTimerEventDefinitionValueDescription$1(timerDefinitionType, translate) { + switch (timerDefinitionType) { + case 'timeDate': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A specific point in time defined as ISO 8601 combined date and time representation.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-01T12:00:00Z" + }), " - ", translate('UTC time')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-02T08:09:40+02:00" + }), " - ", translate('UTC plus 2 hours zone offset')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/reference/bpmn-processes/timer-events/timer-events#time-date", + target: "_blank", + rel: "noopener", + title: translate('Timer documentation'), + children: translate('How to configure a timer') + })] + }); + case 'timeCycle': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A cycle defined as ISO 8601 repeating intervals format, or a cron expression.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R5/PT10S" + }), " - ", translate('every 10 seconds, up to 5 times')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R/P1D" + }), " - ", translate('every day, infinitely')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "0 0 9-17 * * MON-FRI" + }), " - ", translate('every hour on the hour from 9-5 p.m. UTC Monday-Friday')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/reference/bpmn-processes/timer-events/timer-events#time-cycle", + target: "_blank", + rel: "noopener", + title: translate('Timer documentation'), + children: translate('How to configure a timer') + })] + }); + case 'timeDuration': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A time duration defined as ISO 8601 durations format.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT15S" + }), " - ", translate('15 seconds')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT1H30M" + }), " - ", translate('1 hour and 30 minutes')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "P14D" + }), " - ", translate('14 days')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/reference/bpmn-processes/timer-events/timer-events#time-duration", + target: "_blank", + rel: "noopener", + title: translate('Timer documentation'), + children: translate('How to configure a timer') + })] + }); + } +} + +function ExtensionProperty(props) { + const { + idPrefix, + property + } = props; + const entries = [{ + id: idPrefix + '-name', + component: NameProperty$1, + idPrefix, + property + }, { + id: idPrefix + '-value', + component: ValueProperty$1, + idPrefix, + property + }]; + return entries; +} +function NameProperty$1(props) { + const { + idPrefix, + element, + property + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: property, + properties: { + name: value + } + }); + }; + const getValue = () => { + return property.name; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: property, + id: idPrefix + '-name', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function ValueProperty$1(props) { + const { + idPrefix, + element, + property + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: property, + properties: { + value + } + }); + }; + const getValue = () => { + return property.value; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: property, + id: idPrefix + '-value', + label: translate('Value'), + getValue, + setValue, + debounce + }); +} + +function ExtensionPropertiesProps({ + element, + injector, + namespace = 'camunda' +}) { + let businessObject = getRelevantBusinessObject(element); + + // do not offer for empty pools + if (!businessObject) { + return; + } + const properties = getPropertiesList(businessObject, namespace) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = properties.map((property, index) => { + const id = element.id + '-extensionProperty-' + index; + return { + id, + label: property.get('name') || '', + entries: ExtensionProperty({ + idPrefix: id, + element, + property + }), + autoFocusEntry: id + '-name', + remove: removeFactory$9({ + commandStack, + element, + property, + namespace + }) + }; + }); + return { + items, + add: addFactory$6({ + bpmnFactory, + commandStack, + element, + namespace + }), + shouldSort: false + }; +} +function removeFactory$9({ + commandStack, + element, + property, + namespace +}) { + return function (event) { + event.stopPropagation(); + const commands = []; + const businessObject = getRelevantBusinessObject(element); + const extensionElements = businessObject.get('extensionElements'); + const properties = getProperties(businessObject, namespace); + if (!properties) { + return; + } + const propertyName = getPropertyName(namespace); + const values = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(properties.get(propertyName), property); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: properties, + properties: { + [propertyName]: values + } + } + }); + + // remove camunda:Properties if there are no properties anymore + if (!values.length) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), properties) + } + } + }); + } + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} +function addFactory$6({ + bpmnFactory, + commandStack, + element, + namespace +}) { + return function (event) { + event.stopPropagation(); + let commands = []; + const businessObject = getRelevantBusinessObject(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + const propertyName = getPropertyName(namespace); + + // (2) ensure camunda:Properties + let properties = getProperties(businessObject, namespace); + if (!properties) { + const parent = extensionElements; + properties = createElement(`${namespace}:Properties`, { + [propertyName]: [] + }, parent, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), properties] + } + } + }); + } + + // (3) create camunda:Property + const property = createElement(`${namespace}:Property`, {}, properties, bpmnFactory); + + // (4) add property to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: properties, + properties: { + [propertyName]: [...properties.get(propertyName), property] + } + } + }); + + // (5) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} + +// helper ////////////////// + +function getRelevantBusinessObject(element) { + let businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant')) { + return businessObject.get('processRef'); + } + return businessObject; +} +function getPropertyName(namespace = 'camunda') { + if (namespace === 'zeebe') { + return 'properties'; + } + return 'values'; +} +function getProperties(element, namespace = 'camunda') { + const businessObject = getRelevantBusinessObject(element); + return getExtensionElementsList(businessObject, `${namespace}:Properties`)[0]; +} +function getPropertiesList(element, namespace = 'camunda') { + const businessObject = getRelevantBusinessObject(element); + const properties = getProperties(businessObject, namespace); + return properties && properties.get(getPropertyName(namespace)); +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - return element.fireEvent('on' + eventType, evt); - } - } +const LOW_PRIORITY$1 = 500; +const ZEEBE_GROUPS = [BusinessRuleImplementationGroup, CalledDecisionGroup, ScriptImplementationGroup, ScriptGroup$1, TaskDefinitionGroup, AssignmentDefinitionGroup, FormGroup$1, ConditionGroup$1, TargetGroup, InputPropagationGroup, InputGroup$1, OutputPropagationGroup, OutputGroup$1, HeaderGroup, ExtensionPropertiesGroup$1]; +class ZeebePropertiesProvider { + constructor(propertiesPanel, injector) { + propertiesPanel.registerProvider(LOW_PRIORITY$1, this); + this._injector = injector; + } + getGroups(element) { + return groups => { + // (1) add zeebe specific groups + groups = groups.concat(this._getGroups(element)); + + // (2) update existing groups with zeebe specific properties + updateErrorGroup$1(groups, element); + updateEscalationGroup$1(groups, element); + updateMessageGroup(groups, element); + updateSignalGroup(groups, element); + updateTimerGroup$1(groups, element, this._injector); + updateMultiInstanceGroup$1(groups, element); + + // (3) remove message group when not applicable + groups = removeMessageGroup(groups, element); + return groups; + }; + } + _getGroups(element) { + const groups = ZEEBE_GROUPS.map(createGroup => createGroup(element, this._injector)); + return groups.filter(group => group !== null); + } +} +ZeebePropertiesProvider.$inject = ['propertiesPanel', 'injector']; +function CalledDecisionGroup(element) { + const group = { + id: 'calledDecision', + label: 'Called decision', + entries: [...CalledDecisionProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function ScriptGroup$1(element) { + const group = { + id: 'script', + label: 'Script', + entries: [...ScriptProps$1({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function TaskDefinitionGroup(element) { + const group = { + id: 'taskDefinition', + label: 'Task definition', + entries: [...TaskDefinitionProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function InputGroup$1(element, injector) { + const group = { + id: 'inputs', + label: 'Inputs', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...InputProps$1({ + element, + injector + }) + }; + return group.items ? group : null; +} +function OutputGroup$1(element, injector) { + const group = { + id: 'outputs', + label: 'Outputs', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...OutputProps$1({ + element, + injector + }) + }; + return group.items ? group : null; +} +function ConditionGroup$1(element) { + const group = { + id: 'condition', + label: 'Condition', + entries: [...ConditionProps$1({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function FormGroup$1(element, injector) { + const group = { + id: 'form', + label: 'Form', + entries: [...FormProps$1({ + element, + injector + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function TargetGroup(element) { + const group = { + id: 'calledElement', + label: 'Called element', + entries: [...TargetProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function HeaderGroup(element, injector) { + const group = { + id: 'headers', + label: 'Headers', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...HeaderProps({ + element, + injector + }) + }; + return group.items ? group : null; +} +function OutputPropagationGroup(element) { + const group = { + id: 'outputPropagation', + label: 'Output propagation', + entries: [...OutputPropagationProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function InputPropagationGroup(element) { + const group = { + id: 'inputPropagation', + label: 'Input propagation', + entries: [...InputPropagationProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function BusinessRuleImplementationGroup(element) { + const group = { + id: 'businessRuleImplementation', + label: 'Implementation', + entries: [...BusinessRuleImplementationProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function ScriptImplementationGroup(element) { + const group = { + id: 'scriptImplementation', + label: 'Implementation', + entries: [...ScriptImplementationProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function AssignmentDefinitionGroup(element) { + const group = { + id: 'assignmentDefinition', + label: 'Assignment', + entries: [...AssignmentDefinitionProps({ + element + }), ...TaskScheduleProps({ + element + })], + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group + }; + return group.entries.length ? group : null; +} +function ExtensionPropertiesGroup$1(element, injector) { + const group = { + label: 'Extension properties', + id: 'Zeebe__ExtensionProperties', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ExtensionPropertiesProps({ + element, + injector, + namespace: 'zeebe' + }) + }; + if (group.items) { + return group; + } + return null; +} +function updateErrorGroup$1(groups, element) { + const errorGroup = findGroup$1(groups, 'error'); + if (!errorGroup) { + return; + } + errorGroup.entries = replaceEntries(errorGroup.entries, ErrorProps$1({ + element + })); +} +function updateEscalationGroup$1(groups, element) { + const escalationGroup = findGroup$1(groups, 'escalation'); + if (!escalationGroup) { + return; + } + escalationGroup.entries = replaceEntries(escalationGroup.entries, EscalationProps$1({ + element + })); +} +function updateSignalGroup(groups, element) { + const signalGroup = findGroup$1(groups, 'signal'); + if (!signalGroup) { + return; + } + signalGroup.entries = replaceEntries(signalGroup.entries, SignalProps({ + element + })); +} +function updateMessageGroup(groups, element) { + const messageGroup = findGroup$1(groups, 'message'); + if (!messageGroup) { + return; + } + messageGroup.entries = replaceEntries(messageGroup.entries, MessageProps({ + element + })); +} + +// overwrite bpmn generic timerEventDefinition group with zeebe-specific one +function updateTimerGroup$1(groups, element, injector) { + const timerEventGroup = findGroup$1(groups, 'timer'); + if (!timerEventGroup) { + return; + } + timerEventGroup.entries = [...TimerProps$1({ + element, + injector + })]; +} + +// overwrite bpmn generic multiInstance group with zeebe-specific one +function updateMultiInstanceGroup$1(groups, element) { + const multiInstanceGroup = findGroup$1(groups, 'multiInstance'); + if (!multiInstanceGroup) { + return; + } + multiInstanceGroup.entries = [...MultiInstanceProps$1({ + element + })]; +} + +// remove message group from Message End Event & Message Throw Event +function removeMessageGroup(groups, element) { + const messageGroup = findGroup$1(groups, 'message'); + if (isMessageEndEvent(element) || isMessageThrowEvent(element)) { + groups = groups.filter(g => g != messageGroup); + } + return groups; +} + +// helper ///////////////////// + +function findGroup$1(groups, id) { + return groups.find(g => g.id === id); +} + +/** + * Replace entries with the same ID. + *s + * @param {Entry[]} oldEntries + * @param {Entry[]} newEntries + * + * @returns {Entry[]} combined entries + */ +function replaceEntries(oldEntries, newEntries) { + const filteredEntries = oldEntries.filter(oldEntry => !newEntries.find(newEntry => newEntry.id === oldEntry.id)); + return [...filteredEntries, ...newEntries]; +} + +var index$1 = { + __init__: ['zeebePropertiesProvider'], + zeebePropertiesProvider: ['type', ZeebePropertiesProvider] +}; + +function AsynchronousContinuationsProps(props) { + const { + element + } = props; + const checkboxIsEditedInverted = node => { + return node && !node.checked; + }; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const entries = []; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:AsyncCapable')) { + entries.push({ + id: 'asynchronousContinuationBefore', + component: AsynchronousContinuationBefore, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }, { + id: 'asynchronousContinuationAfter', + component: AsynchronousContinuationAfter, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }); + if (isAsyncBefore$2(businessObject) || isAsyncAfter$2(businessObject)) { + entries.push({ + id: 'exclusive', + component: Exclusive, + isEdited: checkboxIsEditedInverted + }); + } + } + return entries; +} +function AsynchronousContinuationBefore(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return isAsyncBefore$2(businessObject); + }; + const setValue = value => { + // overwrite the legacy `async` property, we will use the more explicit `asyncBefore` + const props = { + 'camunda:asyncBefore': value, + 'camunda:async': undefined + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: props + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'asynchronousContinuationBefore', + label: translate('Before'), + getValue, + setValue + }); +} +function AsynchronousContinuationAfter(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return isAsyncAfter$2(businessObject); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:asyncAfter': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'asynchronousContinuationAfter', + label: translate('After'), + getValue, + setValue + }); +} +function Exclusive(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return isExclusive$1(businessObject); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:exclusive': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'exclusive', + label: translate('Exclusive'), + getValue, + setValue + }); +} + +// helper ////////////////// + +/** + * Returns true if the attribute 'camunda:asyncBefore' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isAsyncBefore$2(bo) { + return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async')); +} - module.exports.triggerClickEvent = triggerClickEvent; +/** + * Returns true if the attribute 'camunda:asyncAfter' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isAsyncAfter$2(bo) { + return !!bo.get('camunda:asyncAfter'); +} +/** + * Returns true if the attribute 'camunda:exclusive' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isExclusive$1(bo) { + return !!bo.get('camunda:exclusive'); +} + +const EMPTY_OPTION$1 = ''; +function BusinessKeyProps$1(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') || !hasFormFields(element)) { + return []; + } + return [{ + id: 'businessKey', + component: BusinessKey$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; +} +function BusinessKey$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const formData = getFormData$2(element); + const getValue = () => { + return formData.get('camunda:businessKey') || ''; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formData, + properties: { + 'camunda:businessKey': value + } + }); + }; + const getOptions = () => { + const options = [{ + value: EMPTY_OPTION$1, + label: translate('') + }]; + const fields = formData.get('fields'); + fields.forEach(field => { + const id = field.get('camunda:id'); + if (id) { + options.push({ + value: id, + label: id + }); + } + }); + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'businessKey', + label: translate('Key'), + getValue, + setValue, + getOptions + }); +} + +// helper /////////////////// + +function getFormData$2(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'camunda:FormData')[0]; +} +function hasFormFields(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const formData = getFormData$2(businessObject); + return formData && formData.get('camunda:fields').length; +} + +function CalledBpmnProps(props) { + const { + element + } = props; + const entries = [{ + id: 'calledElement', + component: CalledElement, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'calledElementBinding', + component: CalledElementBinding, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }, { + id: 'calledElementTenantId', + component: CalledElementTenantId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + const binding = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:calledElementBinding'); + if (binding === 'version') { + entries.splice(-1, 0, { + id: 'calledElementVersion', + component: CalledElementVersion, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (binding === 'versionTag') { + entries.splice(-1, 0, { + id: 'calledElementVersionTag', + component: CalledElementVersionTag, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function CalledElement(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('calledElement'); + }; + const setValue = value => { + modeling.updateProperties(element, { + calledElement: value || '' + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElement", + label: translate('Called element'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function CalledElementBinding(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:calledElementBinding') || 'latest'; + }; + const setValue = value => { + modeling.updateProperties(element, { + calledElementBinding: value === 'latest' ? undefined : value, + calledElementVersion: undefined, + calledElementVersionTag: undefined + }); + }; + const getOptions = () => [{ + value: 'latest', + label: translate('latest') + }, { + value: 'deployment', + label: translate('deployment') + }, { + value: 'version', + label: translate('version') + }, { + value: 'versionTag', + label: translate('version tag') + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + element: element, + id: "calledElementBinding", + label: translate('Binding'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function CalledElementVersion(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:calledElementVersion'); + }; + const setValue = value => { + modeling.updateProperties(element, { + calledElementVersion: value + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementVersion", + label: translate('Version'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function CalledElementVersionTag(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:calledElementVersionTag'); + }; + const setValue = value => { + modeling.updateProperties(element, { + calledElementVersionTag: value + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementVersionTag", + label: translate('Version tag'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function CalledElementTenantId(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:calledElementTenantId'); + }; + const setValue = value => { + modeling.updateProperties(element, { + calledElementTenantId: value + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementTenantId", + label: translate('Tenant ID'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} + +function CalledCmmnProps(props) { + const { + element + } = props; + const entries = [{ + id: 'calledElementCaseRef', + component: CaseRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'calledElementCaseBinding', + component: CaseBinding, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }, { + id: 'calledElementCaseTenantId', + component: CaseTenantId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:caseBinding') === 'version') { + entries.splice(-1, 0, { + id: 'calledElementCaseVersion', + component: CaseVersion, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function CaseRef(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:caseRef'); + }; + const setValue = value => { + modeling.updateProperties(element, { + caseRef: value || '' + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementCaseRef", + label: translate('Case ref'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function CaseBinding(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:caseBinding') || 'latest'; + }; + const setValue = value => { + modeling.updateProperties(element, { + caseBinding: value === 'latest' ? undefined : value, + caseVersion: undefined + }); + }; + const getOptions = () => [{ + value: 'latest', + label: translate('latest') + }, { + value: 'deployment', + label: translate('deployment') + }, { + value: 'version', + label: translate('version') + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + element: element, + id: "calledElementCaseBinding", + label: translate('Binding'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function CaseVersion(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:caseVersion'); + }; + const setValue = value => { + modeling.updateProperties(element, { + caseVersion: value + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementCaseVersion", + label: translate('Version'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function CaseTenantId(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:caseTenantId'); + }; + const setValue = value => { + modeling.updateProperties(element, { + caseTenantId: value + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementCaseTenantId", + label: translate('Tenant ID'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} + +function DelegateVariableMappingProps(props) { + const { + element + } = props; + const entries = [{ + id: 'calledElementDelegateVariableMappingType', + component: DelegateVariableMappingType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; + const type = getDelegateVariableMappingType(element); + if (type === 'class') { + entries.push({ + id: 'calledElementVariableMappingClass', + component: VariableMappingClass, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (type === 'delegateExpression') { + entries.push({ + id: 'calledElementVariableMappingDelegateExpression', + component: VariableMappingDelegateExpression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +const DEFAULT_PROPS$5 = { + 'camunda:variableMappingClass': undefined, + 'camunda:variableMappingDelegateExpression': undefined +}; +function DelegateVariableMappingType(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getDelegateVariableMappingType(element); + }; + const setValue = value => { + const properties = { + ...DEFAULT_PROPS$5 + }; + if (value === 'class') { + properties['camunda:variableMappingClass'] = ''; + } else if (value === 'delegateExpression') { + properties['camunda:variableMappingDelegateExpression'] = ''; + } + commandStack.execute('element.updateProperties', { + element, + properties + }); + }; + const getOptions = () => [{ + value: 'none', + label: translate('') + }, { + value: 'class', + label: translate('Class') + }, { + value: 'delegateExpression', + label: translate('Delegate expression') + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + element: element, + id: "calledElementDelegateVariableMappingType", + label: translate('Delegate Variable Mapping'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function VariableMappingDelegateExpression(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:variableMappingDelegateExpression'); + }; + const setValue = value => { + modeling.updateProperties(element, { + variableMappingDelegateExpression: value || '', + variableMappingClass: undefined + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementVariableMappingDelegateExpression", + label: translate('Delegate Expression'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function VariableMappingClass(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('camunda:variableMappingClass'); + }; + const setValue = value => { + modeling.updateProperties(element, { + variableMappingDelegateExpression: undefined, + variableMappingClass: value || '' + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementVariableMappingClass", + label: translate('Delegate Class'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} + +// helper ///// + +function getDelegateVariableMappingType(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (businessObject.get('camunda:variableMappingClass') !== undefined) { + return 'class'; + } else if (businessObject.get('camunda:variableMappingDelegateExpression') !== undefined) { + return 'delegateExpression'; + } + return 'none'; +} + +function CallActivityProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity')) { + return []; + } + const entries = []; + entries.push({ + id: 'calledElementType', + component: CalledElementType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + const calledElementType = getCalledElementType(element); + if (calledElementType === 'bpmn') { + entries.push(...CalledBpmnProps({ + element + }), ...BusinessKeyProps({ + element + }), ...DelegateVariableMappingProps({ + element + })); + } else if (calledElementType === 'cmmn') { + entries.push(...CalledCmmnProps({ + element + }), ...BusinessKeyProps({ + element + })); + } else { + entries.push(...BusinessKeyProps({ + element + })); + } + return entries; +} +const DEFAULT_PROPS$4 = { + calledElement: undefined, + 'camunda:calledElementBinding': undefined, + 'camunda:calledElementVersion': undefined, + 'camunda:calledElementTenantId': undefined, + 'camunda:variableMappingClass': undefined, + 'camunda:variableMappingDelegateExpression': undefined, + 'camunda:caseRef': undefined, + 'camunda:caseBinding': undefined, + 'camunda:caseVersion': undefined, + 'camunda:caseTenantId': undefined +}; +const DEFAULT_BUSINESS_KEY = '#{execution.processBusinessKey}'; +function CalledElementType(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getCalledElementType(element); + }; + const setValue = value => { + const properties = { + ...DEFAULT_PROPS$4 + }; + if (value === 'bpmn') { + properties['calledElement'] = ''; + } else if (value === 'cmmn') { + properties['camunda:caseRef'] = ''; + } + commandStack.execute('element.updateProperties', { + element, + properties + }); + }; + const getOptions = () => [{ + value: '', + label: translate('') + }, { + value: 'bpmn', + label: translate('BPMN') + }, { + value: 'cmmn', + label: translate('CMMN') + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + element: element, + id: "calledElementType", + label: translate('Type'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function BusinessKeyProps(props) { + const { + element + } = props; + const entries = [{ + id: 'calledElementBusinessKey', + component: BusinessKey, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }]; + if (hasBusinessKey(element)) { + entries.push({ + id: 'calledElementBusinessKeyExpression', + component: BusinessKeyExpression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function BusinessKey(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const modeling = useService('modeling'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + return hasBusinessKey(element); + }; + const setValue = value => { + if (value) { + addBusinessKey(); + } else { + removeBusinessKey(); + } + }; + function addBusinessKey() { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) If there are no extension elements, create camunda:In and update element's properties + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', {}, businessObject, bpmnFactory); + const businessKeyItem = createBusinessKey(extensionElements); + extensionElements.set('values', [businessKeyItem]); + modeling.updateProperties(element, { + extensionElements + }); + } else { + // (2) Otherwise, add camunda:In to the existing values + const businessKeyItem = createBusinessKey(extensionElements); + addExtensionElements(element, businessObject, businessKeyItem, bpmnFactory, commandStack); + } + } + function createBusinessKey(parent) { + return createElement('camunda:In', { + businessKey: DEFAULT_BUSINESS_KEY + }, parent, bpmnFactory); + } + function removeBusinessKey() { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const camundaInList = getExtensionElementsList(businessObject, 'camunda:In'); + const businessKeyItems = camundaInList.filter(camundaIn => camundaIn.get('businessKey') !== undefined); + removeExtensionElements(element, businessObject, businessKeyItems, commandStack); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry, { + element: element, + id: "calledElementBusinessKey", + label: translate('Business key'), + getValue: getValue, + setValue: setValue + }); +} +function BusinessKeyExpression(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => getBusinessKey(element); + const setValue = value => { + const camundaIn = findCamundaInWithBusinessKey(element); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: camundaIn, + properties: { + businessKey: value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "calledElementBusinessKeyExpression", + label: translate('Business key expression'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} + +// helper ////// + +function getCalledElementType(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (businessObject.get('calledElement') !== undefined) { + return 'bpmn'; + } else if (businessObject.get('camunda:caseRef') !== undefined) { + return 'cmmn'; + } + return ''; +} +function hasBusinessKey(element) { + return getBusinessKey(element) !== undefined; +} +function getBusinessKey(element) { + const camundaIn = findCamundaInWithBusinessKey(element); + if (camundaIn) { + return camundaIn.get('businessKey'); + } +} +function findCamundaInWithBusinessKey(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const camundaInList = getExtensionElementsList(businessObject, 'camunda:In'); + for (const camundaIn of camundaInList) { + const businessKey = camundaIn.get('businessKey'); + if (businessKey !== undefined) { + return camundaIn; + } + } +} + +function CandidateStarterProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef'))) { + return []; + } + return [{ + id: 'candidateStarterGroups', + component: CandidateStarterGroups, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'candidateStarterUsers', + component: CandidateStarterUsers, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function CandidateStarterGroups(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const process = getProcess$3(element); + const getValue = () => { + return process.get('camunda:candidateStarterGroups') || ''; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: process, + properties: { + 'camunda:candidateStarterGroups': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'candidateStarterGroups', + label: translate('Candidate starter groups'), + description: translate('Specify more than one group as a comma separated list.'), + getValue, + setValue, + debounce + }); +} +function CandidateStarterUsers(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const process = getProcess$3(element); + const getValue = () => { + return process.get('camunda:candidateStarterUsers') || ''; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: process, + properties: { + 'camunda:candidateStarterUsers': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'candidateStarterUsers', + label: translate('Candidate starter users'), + description: translate('Specify more than one user as a comma separated list.'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +/** + * getProcess - get the businessObject of the process referred to by a bpmn:Process + * or by a bpmn:Participant + * + * @param {ModdleElement} element either a bpmn:Process or a bpmn:Participant + * @return {BusinessObject} + */ +function getProcess$3(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element) : (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef'); +} + +function ConditionProps(props) { + const { + element + } = props; + if (!((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow') && isConditionalSource(element.source)) && !getConditionalEventDefinition(element)) { + return []; + } + const entries = []; + if (getConditionalEventDefinition(element)) { + entries.push(...VariableEventProps({ + element + })); + } + entries.push({ + id: 'conditionType', + component: ConditionType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + const conditionType = getConditionType(element); + if (conditionType === 'script') { + entries.push(...ConditionScriptProps({ + element + })); + } else if (conditionType === 'expression') { + entries.push({ + id: 'conditionExpression', + component: ConditionExpression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function ConditionType(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + return getConditionType(element); + }; + const setValue = value => { + // (1) Remove formalExpression if is selected + if (value === '') { + updateCondition(element, commandStack, undefined); + } else { + // (2) Create and set formalExpression element containing the conditionExpression + const attributes = { + body: '', + language: value === 'script' ? '' : undefined + }; + const formalExpressionElement = createFormalExpression(element, attributes, bpmnFactory); + updateCondition(element, commandStack, formalExpressionElement); + } + }; + const getOptions = () => [{ + value: '', + label: translate('') + }, { + value: 'script', + label: translate('Script') + }, { + value: 'expression', + label: translate('Expression') + }]; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + element: element, + id: "conditionType", + label: translate('Type'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function ConditionExpression(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const getValue = () => { + return getConditionExpression(element).get('body'); + }; + const setValue = value => { + const conditionExpression = createFormalExpression(element, { + body: value + }, bpmnFactory); + updateCondition(element, commandStack, conditionExpression); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "conditionExpression", + label: translate('Condition Expression'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function ConditionScriptProps(props) { + const { + element + } = props; + const entries = []; + const scriptType = getScriptType$1(element); + + // (1) language + entries.push({ + id: 'conditionScriptLanguage', + component: Language, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + + // (2) type + entries.push({ + id: 'conditionScriptType', + component: ScriptType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + + // (3) script + if (scriptType === 'script') { + entries.push({ + id: 'conditionScriptValue', + component: Script$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited + }); + } else if (scriptType === 'resource') { + // (4) resource + entries.push({ + id: 'conditionScriptResource', + component: Resource$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function Language(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getConditionExpression(element).get('language'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionExpression(element), + properties: { + language: value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "conditionScriptLanguage", + label: translate('Format'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function ScriptType(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getScriptType$1(element); + }; + const setValue = value => { + // reset script properties on type change + const updatedProperties = { + 'body': value === 'script' ? '' : undefined, + 'camunda:resource': value === 'resource' ? '' : undefined + }; + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionExpression(element), + properties: updatedProperties + }); + }; + const getOptions = () => { + const options = [{ + value: 'resource', + label: translate('External resource') + }, { + value: 'script', + label: translate('Inline script') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'conditionScriptType', + label: translate('Script type'), + getValue, + setValue, + getOptions + }); +} +function Script$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getConditionExpression(element).get('body'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionExpression(element), + properties: { + 'body': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry, { + element: element, + id: "conditionScriptValue", + label: translate('Script'), + getValue: getValue, + setValue: setValue, + debounce: debounce, + monospace: true + }); +} +function Resource$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getConditionExpression(element).get('camunda:resource'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionExpression(element), + properties: { + 'camunda:resource': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: true, + id: "conditionScriptResource", + label: translate('Resource'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function VariableEventProps(props) { + const { + element + } = props; + const entries = []; + entries.push({ + id: 'conditionVariableName', + component: VariableName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') || isInEventSubProcess(element)) { + entries.push({ + id: 'conditionVariableEvents', + component: VariableEvents, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function VariableName(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getConditionalEventDefinition(element).get('variableName'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionalEventDefinition(element), + properties: { + variableName: value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "conditionVariableName", + label: translate('Variable name'), + getValue: getValue, + setValue: setValue, + debounce: debounce + }); +} +function VariableEvents(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return getConditionalEventDefinition(element).get('variableEvents'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: getConditionalEventDefinition(element), + properties: { + variableEvents: value || '' + } + }); + }; + const tooltip = (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('Specify more than one variable change event as a comma separated list. Variable change events are:') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("li", { + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "create" + }) + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("li", { + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "update" + }) + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("li", { + children: (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "delete" + }) + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-attributes/#variableevents", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Variable events') + })] + }); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry, { + element: element, + id: "conditionVariableEvents", + label: translate('Variable events'), + getValue: getValue, + setValue: setValue, + debounce: debounce, + tooltip: tooltip + }); +} + +// helper //////////////////// + +const CONDITIONAL_SOURCES = ['bpmn:Activity', 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway', 'bpmn:ComplexGateway']; +function isConditionalSource(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, CONDITIONAL_SOURCES); +} +function getConditionalEventDefinition(element) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Event')) { + return false; + } + return getEventDefinition$1(element, 'bpmn:ConditionalEventDefinition'); +} +function getConditionType(element) { + const conditionExpression = getConditionExpression(element); + if (!conditionExpression) { + return ''; + } else { + return conditionExpression.get('language') === undefined ? 'expression' : 'script'; + } +} + +/** + * getConditionExpression - get the body value of a condition expression for a given element + * + * @param {ModdleElement} element + * + * @return {string|undefined} + */ +function getConditionExpression(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:SequenceFlow')) { + return businessObject.get('conditionExpression'); + } else if (getConditionalEventDefinition(businessObject)) { + return getConditionalEventDefinition(businessObject).get('condition'); + } +} +function getScriptType$1(element) { + const conditionExpression = getConditionExpression(element); + const resource = conditionExpression.get('camunda:resource'); + if (typeof resource !== 'undefined') { + return 'resource'; + } else { + return 'script'; + } +} +function updateCondition(element, commandStack, condition = undefined) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow')) { + commandStack.execute('element.updateProperties', { + element, + properties: { + conditionExpression: condition + } + }); + } else { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: getConditionalEventDefinition(element), + properties: { + condition + } + }); + } +} +function createFormalExpression(parent, attributes, bpmnFactory) { + return createElement('bpmn:FormalExpression', attributes, (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:SequenceFlow') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(parent) : getConditionalEventDefinition(parent), bpmnFactory); +} +function isInEventSubProcess(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), + parent = bo.$parent; + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:SubProcess') && parent.triggeredByEvent; +} + +/** + * Cf. https://docs.camunda.org/manual/latest/user-guide/process-engine/scripting/ + */ +function ScriptProps(props) { + const { + element, + script, + prefix + } = props; + const entries = []; + const scriptType = getScriptType(script || element); + const idPrefix = prefix || ''; + + // (1) scriptFormat + entries.push({ + id: idPrefix + 'scriptFormat', + component: Format, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + idPrefix, + script + }); + + // (2) type + entries.push({ + id: idPrefix + 'scriptType', + component: Type$3, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + idPrefix, + script + }); + + // (3) script + if (scriptType === 'script') { + entries.push({ + id: idPrefix + 'scriptValue', + component: Script, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited, + idPrefix, + script + }); + } + + // (4) resource + if (scriptType === 'resource') { + entries.push({ + id: idPrefix + 'scriptResource', + component: Resource, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + idPrefix, + script + }); + } + return entries; +} +function Format(props) { + const { + element, + idPrefix, + script + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = script || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('scriptFormat'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + scriptFormat: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: idPrefix + 'scriptFormat', + label: translate('Format'), + getValue, + setValue, + debounce + }); +} +function Type$3(props) { + const { + element, + idPrefix, + script + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const businessObject = script || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const scriptProperty = getScriptProperty(businessObject); + const getValue = () => { + return getScriptType(businessObject); + }; + const setValue = value => { + // reset script properties on type change + const properties = { + [scriptProperty]: value === 'script' ? '' : undefined, + 'camunda:resource': value === 'resource' ? '' : undefined + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties + }); + }; + const getOptions = () => { + const options = [{ + value: '', + label: translate('') + }, { + value: 'resource', + label: translate('External resource') + }, { + value: 'script', + label: translate('Inline script') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: idPrefix + 'scriptType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function Script(props) { + const { + element, + idPrefix, + script + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = script || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const scriptProperty = getScriptProperty(businessObject); + const getValue = () => { + return getScriptValue(businessObject); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + [scriptProperty]: value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)({ + element, + id: idPrefix + 'scriptValue', + label: translate('Script'), + getValue, + setValue, + debounce, + monospace: true + }); +} +function Resource(props) { + const { + element, + idPrefix, + script + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = script || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:resource'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:resource': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: idPrefix + 'scriptResource', + label: translate('Resource'), + getValue, + setValue, + debounce + }); +} + +// helper //////////////////// + +function getScriptType(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const scriptValue = getScriptValue(businessObject); + if (typeof scriptValue !== 'undefined') { + return 'script'; + } + const resource = businessObject.get('camunda:resource'); + if (typeof resource !== 'undefined') { + return 'resource'; + } +} +function getScriptValue(businessObject) { + return businessObject.get(getScriptProperty(businessObject)); +} +function isScript$2(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Script'); +} +function getScriptProperty(businessObject) { + return isScript$2(businessObject) ? 'value' : 'script'; +} + +function getElements(businessObject, type, property) { + const elements = getExtensionElementsList(businessObject, type); + return !property ? elements : (elements[0] || {})[property] || []; +} +function getParameters(element, prop) { + const inputOutput = getInputOutput(element); + return inputOutput && inputOutput.get(prop) || []; +} + +/** + * Get a camunda:inputOutput from the business object + * + * @param {djs.model.Base | ModdleElement} element + * + * @return {ModdleElement} the inputOutput object + */ +function getInputOutput(element) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Connector')) { + return element.get('inputOutput'); + } + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return (getElements(businessObject, 'camunda:InputOutput') || [])[0]; +} + +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {djs.model.Base} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters(element) { + return getParameters(element, 'inputParameters'); +} - function escapeHTML(str) { - str = '' + str; +/** + * Return all output parameters existing in the business object, and + * an empty array if none exist. + * + * @param {djs.model.Base} element + * + * @return {Array} a list of output parameter objects + */ +function getOutputParameters(element) { + return getParameters(element, 'outputParameters'); +} +function isInputOutputSupported(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:FlowNode') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(businessObject, ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:Gateway']) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:SubProcess') && businessObject.get('triggeredByEvent')); +} +function areInputParametersSupported(element) { + return isInputOutputSupported(element); +} +function areOutputParametersSupported(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return isInputOutputSupported(element) && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:EndEvent') && !businessObject.loopCharacteristics; +} +function getInputOutputType(parameter) { + const definitionTypes = { + 'camunda:Map': 'map', + 'camunda:List': 'list', + 'camunda:Script': 'script' + }; + let type = 'stringOrExpression'; + const definition = parameter.get('definition'); + if (typeof definition !== 'undefined') { + type = definitionTypes[definition.$type]; + } + return type; +} +function CreateParameterCmd(element, type, parent, bpmnFactory) { + const isInput = type === 'camunda:InputParameter'; + const newParameter = createElement(type, { + name: nextId(isInput ? 'Input_' : 'Output_') + }, parent, bpmnFactory); + const propertyName = isInput ? 'inputParameters' : 'outputParameters'; + return { + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: parent, + properties: { + [propertyName]: [...parent.get(propertyName), newParameter] + } + } + }; +} +function AddParameterCmd(element, type, bpmnFactory) { + const commands = []; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure inputOutput + let inputOutput = getInputOutput(element); + if (!inputOutput) { + const parent = extensionElements; + inputOutput = createElement('camunda:InputOutput', { + inputParameters: [], + outputParameters: [] + }, parent, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), inputOutput] + } + } + }); + } + + // (3) create + add parameter + commands.push(CreateParameterCmd(element, type, inputOutput, bpmnFactory)); + return commands; +} + +function ListProp(props) { + const { + element, + id: idPrefix, + index, + item + } = props; + const id = `${idPrefix}-listItem-${index}`; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(ListItem, { + idPrefix: id, + element: element, + item: item + }); +} +function ListProps(props) { + const { + idPrefix, + element, + parameter + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const list = parameter.get('definition'); + const items = list.get('items'); + function addItem() { + const value = createElement('camunda:Value', {}, parameter, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: list, + properties: { + items: [...list.get('items'), value] + } + }); + } + function removeItem(item) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: list, + properties: { + items: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(list.get('items'), item) + } + }); + } + function compareFn(item, anotherItem) { + const [value = '', anotherValue = ''] = [item.value, anotherItem.value]; + return value === anotherValue ? 0 : value > anotherValue ? 1 : -1; + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry)({ + element, + autoFocusEntry: true, + compareFn, + id: idPrefix + '-list', + items, + label: translate('List values'), + onAdd: addItem, + onRemove: removeItem, + component: ListProp + }); +} +function ListItem(props) { + const { + idPrefix, + element, + item + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const definitionLabels = { + 'camunda:Map': translate('Map'), + 'camunda:List': translate('List'), + 'camunda:Script': translate('Script') + }; + const getValue = () => { + if (isDefinitionType$1(item)) { + return definitionLabels[item.$type]; + } + return item.get('value'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: item, + properties: { + value + } + }); + }; + return ListValue({ + id: idPrefix + '-value', + disabled: isDefinitionType$1(item), + getValue, + setValue + }); +} +function ListValue(props) { + const { + id, + disabled, + getValue, + setValue + } = props; + const debounce = useService('debounceInput', true); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SimpleEntry, { + id: id, + getValue: getValue, + setValue: setValue, + disabled: disabled, + debounce: debounce + }); +} + +// helper ////////////////////// + +function isScript$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Script'); +} +function isList$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:List'); +} +function isMap$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Map'); +} +function isDefinitionType$1(element) { + return isScript$1(element) || isList$1(element) || isMap$1(element); +} + +function MapProp(props) { + const { + element, + id: idPrefix, + index, + item: entry, + open + } = props; + const id = `${idPrefix}-mapEntry-${index}`; + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CollapsibleEntry, { + id: id, + element: element, + entries: MapEntry({ + element, + entry, + idPrefix: id + }), + label: entry.get('key') || translate(''), + open: open + }); +} +function MapProps(props) { + const { + idPrefix, + element, + parameter + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const map = parameter.get('definition'); + const entries = map.get('entries'); + function addEntry() { + const entry = createElement('camunda:Entry', {}, parameter, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: map, + properties: { + entries: [...map.get('entries'), entry] + } + }); + } + function removeEntry(entry) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: map, + properties: { + entries: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(map.get('entries'), entry) + } + }); + } + function compareFn(entry, anotherEntry) { + const [key = '', anotherKey = ''] = [entry.key, anotherEntry.key]; + return key === anotherKey ? 0 : key > anotherKey ? 1 : -1; + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry)({ + element, + autoFocusEntry: true, + compareFn, + id: idPrefix + '-map', + items: entries, + label: translate('Map entries'), + onAdd: addEntry, + onRemove: removeEntry, + component: MapProp + }); +} +function MapEntry(props) { + const { + element, + entry, + idPrefix + } = props; + const entries = [{ + id: idPrefix + '-key', + component: MapKey, + entry, + idPrefix, + element + }, { + id: idPrefix + '-value', + component: MapValue, + entry, + idPrefix, + element + }]; + return entries; +} +function MapKey(props) { + const { + element, + entry, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: entry, + properties: { + key: value + } + }); + }; + const getValue = () => { + return entry.get('key'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: entry, + id: idPrefix + '-key', + label: translate('Key'), + getValue, + setValue, + debounce + }); +} +function MapValue(props) { + const { + element, + entry, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const definition = entry.get('definition'); + const definitionLabels = { + 'camunda:Map': translate('Map'), + 'camunda:List': translate('List'), + 'camunda:Script': translate('Script') + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: entry, + properties: { + value + } + }); + }; + const getValue = () => { + if (isDefinitionType(definition)) { + return definitionLabels[definition.$type]; + } + return entry.get('value'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: entry, + id: idPrefix + '-value', + label: translate('Value'), + getValue, + setValue, + disabled: isDefinitionType(definition), + debounce + }); +} + +// helper /////////////////// + +function isScript(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Script'); +} +function isList(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:List'); +} +function isMap(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Map'); +} +function isDefinitionType(element) { + return isScript(element) || isList(element) || isMap(element); +} + +const DEFAULT_PROPS$3 = { + value: undefined, + definition: undefined +}; +function InputOutputParameter(props) { + const { + idPrefix, + element, + parameter + } = props; + const inputOutputType = getInputOutputType(parameter); + let entries = [{ + id: idPrefix + '-name', + component: Name$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + idPrefix, + parameter + }, { + id: idPrefix + '-type', + component: Type$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + idPrefix, + parameter + }]; + + // (1) String or expression + if (inputOutputType === 'stringOrExpression') { + entries.push({ + id: idPrefix + '-stringOrExpression', + component: StringOrExpression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextAreaEntryEdited, + idPrefix, + parameter + }); + + // (2) Script + } else if (inputOutputType === 'script') { + const script = parameter.get('definition'); + entries = [...entries, ...ScriptProps({ + element, + prefix: idPrefix + '-', + script + })]; + + // (3) List + } else if (inputOutputType === 'list') { + entries.push({ + id: `${idPrefix}-list`, + component: ListProps, + idPrefix, + parameter + }); + + // (4) Map + } else if (inputOutputType === 'map') { + entries.push({ + id: `${idPrefix}-map`, + component: MapProps, + idPrefix, + parameter + }); + } + return entries; +} +function Name$2(props) { + const { + idPrefix, + element, + parameter + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: parameter, + properties: { + name: value + } + }); + }; + const getValue = parameter => { + return parameter.get('name'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: parameter, + id: idPrefix + '-name', + label: translate(isInput(parameter) ? 'Local variable name' : 'Process variable name'), + getValue, + setValue, + debounce + }); +} +function Type$2(props) { + const { + idPrefix, + element, + parameter + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const createDefinitionElement = type => { + return createElement(type, {}, parameter, bpmnFactory); + }; + const getValue = mapping => { + return getInputOutputType(mapping); + }; + const setValue = value => { + let properties = { + ...DEFAULT_PROPS$3 + }; + if (value === 'script') { + properties.definition = createDefinitionElement('camunda:Script'); + } else if (value === 'list') { + properties.definition = createDefinitionElement('camunda:List'); + } else if (value === 'map') { + properties.definition = createDefinitionElement('camunda:Map'); + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: parameter, + properties + }); + }; + const getOptions = () => { + const options = [{ + label: translate('List'), + value: 'list' + }, { + label: translate('Map'), + value: 'map' + }, { + label: translate('Script'), + value: 'script' + }, { + label: translate('String or expression'), + value: 'stringOrExpression' + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element: parameter, + id: idPrefix + '-type', + label: translate('Assignment type'), + getValue, + setValue, + getOptions + }); +} +function StringOrExpression(props) { + const { + idPrefix, + element, + parameter + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: parameter, + properties: { + value + } + }); + }; + const getValue = parameter => { + return parameter.get('value'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextAreaEntry)({ + element: parameter, + id: idPrefix + '-stringOrExpression', + label: translate('Value'), + description: translate('Start typing "${}" to create an expression.'), + getValue, + setValue, + rows: 1, + debounce + }); +} + +// helper ///////////////////// + +function isInput(parameter) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parameter, 'camunda:InputParameter'); +} + +/** + * Check whether an element is camunda:ServiceTaskLike + * + * @param {djs.model.Base} element + * + * @return {boolean} a boolean value + */ +function isServiceTaskLike(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:ServiceTaskLike'); +} - return str && str.replace(/[&<>"']/g, function(match) { - return HTML_ESCAPE_MAP[match]; - }); - } +/** + * Returns 'true' if the given element is 'camunda:DmnCapable' + * + * @param {djs.model.Base} element + * + * @return {boolean} a boolean value + */ +function isDmnCapable(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:DmnCapable'); +} - module.exports.escapeHTML = escapeHTML; +/** + * Returns 'true' if the given element is 'camunda:ExternalCapable' + * + * @param {djs.model.Base} element + * + * @return {boolean} a boolean value + */ +function isExternalCapable(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:ExternalCapable'); +} - },{"bpmn-js/lib/util/ModelUtil":240,"ids":437,"lodash/forEach":613,"min-dom":647}],6:[function(require,module,exports){ - 'use strict'; +/** + * getServiceTaskLikeBusinessObject - Get a 'camunda:ServiceTaskLike' business object. + * + * If the given element is not a 'camunda:ServiceTaskLike', then 'false' + * is returned. + * + * @param {djs.model.Base} element + * @return {ModdleElement} the 'camunda:ServiceTaskLike' business object + */ +function getServiceTaskLikeBusinessObject(element) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:IntermediateThrowEvent') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:EndEvent')) { + // change business object to 'messageEventDefinition' when + // the element is a message intermediate throw event or message end event + // because the camunda extensions (e.g. camunda:class) are in the message + // event definition tag and not in the intermediate throw event or end event tag + const messageEventDefinition = getMessageEventDefinition(element); + if (messageEventDefinition) { + element = messageEventDefinition; + } + } + return isServiceTaskLike(element) && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); +} + +/** + * Returns the implementation type of the given element. + * + * Possible implementation types are: + * - dmn + * - connector + * - external + * - class + * - expression + * - delegateExpression + * - script + * - or undefined, when no matching implementation type is found + * + * @param {djs.model.Base} element + * + * @return {String} the implementation type + */ +function getImplementationType(element) { + const businessObject = getListenerBusinessObject(element) || getServiceTaskLikeBusinessObject(element); + if (!businessObject) { + return; + } + if (isDmnCapable(businessObject)) { + const decisionRef = businessObject.get('camunda:decisionRef'); + if (typeof decisionRef !== 'undefined') { + return 'dmn'; + } + } + if (isServiceTaskLike(businessObject)) { + const connectors = getExtensionElementsList(businessObject, 'camunda:Connector'); + if (connectors.length) { + return 'connector'; + } + } + if (isExternalCapable(businessObject)) { + const type = businessObject.get('camunda:type'); + if (type === 'external') { + return 'external'; + } + } + const cls = businessObject.get('camunda:class'); + if (typeof cls !== 'undefined') { + return 'class'; + } + const expression = businessObject.get('camunda:expression'); + if (typeof expression !== 'undefined') { + return 'expression'; + } + const delegateExpression = businessObject.get('camunda:delegateExpression'); + if (typeof delegateExpression !== 'undefined') { + return 'delegateExpression'; + } + const script = businessObject.get('script'); + if (typeof script !== 'undefined') { + return 'script'; + } +} +function getListenerBusinessObject(businessObject) { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(businessObject, ['camunda:ExecutionListener', 'camunda:TaskListener'])) { + return businessObject; + } +} + +function areConnectorsSupported(element) { + const businessObject = getServiceTaskLikeBusinessObject(element); + return businessObject && getImplementationType(businessObject) === 'connector'; +} +function getConnectors$2(businessObject) { + return getExtensionElementsList(businessObject, 'camunda:Connector'); +} +function getConnector$1(element) { + const businessObject = getServiceTaskLikeBusinessObject(element); + const connectors = getConnectors$2(businessObject); + return connectors[0]; +} + +function ConnectorInputProps(props) { + const { + element, + injector + } = props; + if (!areConnectorsSupported(element)) { + return null; + } + const connector = getConnector$1(element); + const commandStack = injector.get('commandStack'), + bpmnFactory = injector.get('bpmnFactory'); + const inputParameters = getInputParameters(connector) || []; + const items = inputParameters.map((parameter, index) => { + const id = element.id + '-connector-inputParameter-' + index; + return { + id, + label: parameter.get('name') || '', + entries: InputOutputParameter({ + element, + idPrefix: id, + parameter + }), + autoFocusEntry: id + '-name', + remove: removeFactory$8({ + connector, + element, + parameter, + commandStack + }) + }; + }); + function add(event) { + event.stopPropagation(); + const commands = []; + + // (1) ensure inputOutput + let inputOutput = getInputOutput(connector); + if (!inputOutput) { + inputOutput = createElement('camunda:InputOutput', { + inputParameters: [], + outputParameters: [] + }, connector, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element: element, + moddleElement: connector, + properties: { + inputOutput + } + } + }); + } + + // (2) create + add parameter + commands.push(CreateParameterCmd(element, 'camunda:InputParameter', inputOutput, bpmnFactory)); + + // (3) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + } + return { + items, + add + }; +} +function removeFactory$8(props) { + const { + commandStack, + connector, + element, + parameter + } = props; + return function (event) { + event.stopPropagation(); + const inputOutput = getInputOutput(connector); + if (!inputOutput) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: inputOutput, + properties: { + inputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(inputOutput.get('inputParameters'), parameter) + } + }); + }; +} + +function ConnectorOutputProps(props) { + const { + element, + injector + } = props; + if (!areConnectorsSupported(element)) { + return null; + } + const connector = getConnector$1(element); + const commandStack = injector.get('commandStack'), + bpmnFactory = injector.get('bpmnFactory'); + const outputParameters = getOutputParameters(connector) || []; + const items = outputParameters.map((parameter, index) => { + const id = element.id + '-connector-outputParameter-' + index; + return { + id, + label: parameter.get('name') || '', + entries: InputOutputParameter({ + idPrefix: id, + element, + parameter + }), + autoFocusEntry: id + '-name', + remove: removeFactory$7({ + connector, + element, + commandStack, + parameter + }) + }; + }); + function add(event) { + event.stopPropagation(); + const commands = []; + + // (1) ensure inputOutput + let inputOutput = getInputOutput(connector); + if (!inputOutput) { + inputOutput = createElement('camunda:InputOutput', { + inputParameters: [], + outputParameters: [] + }, connector, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element: element, + moddleElement: connector, + properties: { + inputOutput + } + } + }); + } + + // (2) create + add parameter + commands.push(CreateParameterCmd(element, 'camunda:OutputParameter', inputOutput, bpmnFactory)); + + // (3) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + } + return { + items, + add + }; +} +function removeFactory$7(props) { + const { + commandStack, + connector, + element, + parameter + } = props; + return function (event) { + event.stopPropagation(); + const inputOutput = getInputOutput(connector); + if (!inputOutput) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: inputOutput, + properties: { + outputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(inputOutput.get('outputParameters'), parameter) + } + }); + }; +} + +function ErrorProps(props) { + const { + element, + entries + } = props; + if (!isErrorSupported(element)) { + return entries; + } + const error = getError(element); + + // (1) errorMessage (error) + if (error) { + const idx = findPlaceToInsert(entries, 'errorCode'); + + // place below errorCode + entries.splice(idx, 0, { + id: 'errorMessage', + component: ErrorMessage$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + if (!canHaveErrorVariables(element)) { + return entries; + } + + // (2) errorCodeVariable + errorMessageVariable (errorEventDefinition) + entries.push({ + id: 'errorCodeVariable', + component: ErrorCodeVariable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'errorMessageVariable', + component: ErrorMessageVariable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + return entries; +} +function ErrorMessage$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const error = getError(element); + const getValue = () => { + return error.get('camunda:errorMessage'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + 'camunda:errorMessage': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'errorMessage', + label: translate('Message'), + getValue, + setValue, + debounce + }); +} +function ErrorCodeVariable(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const errorEventDefinition = getErrorEventDefinition(element); + const getValue = () => { + return errorEventDefinition.get('camunda:errorCodeVariable'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: errorEventDefinition, + properties: { + 'camunda:errorCodeVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'errorCodeVariable', + label: translate('Code variable'), + description: translate('Define the name of the variable that will contain the error code.'), + getValue, + setValue, + debounce + }); +} +function ErrorMessageVariable(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const errorEventDefinition = getErrorEventDefinition(element); + const getValue = () => { + return errorEventDefinition.get('camunda:errorMessageVariable'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: errorEventDefinition, + properties: { + 'camunda:errorMessageVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'errorMessageVariable', + label: translate('Message variable'), + description: translate('Define the name of the variable that will contain the error message.'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function canHaveErrorVariables(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BoundaryEvent'); +} +function findPlaceToInsert(entries, idx) { + const entryIndex = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.findIndex)(entries, entry => entry.id === idx); + return entryIndex >= 0 ? entryIndex + 1 : entries.length; +} + +const EMPTY_OPTION = ''; +const CREATE_NEW_OPTION = 'create-new'; +function Error$1(props) { + const { + idPrefix, + errorEventDefinition + } = props; + let entries = [{ + id: idPrefix + '-errorRef', + component: ErrorRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + errorEventDefinition, + idPrefix + }]; + const error = errorEventDefinition.get('errorRef'); + if (error) { + entries = [...entries, { + id: idPrefix + '-errorName', + component: ErrorName, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + error, + errorEventDefinition, + idPrefix + }, { + id: idPrefix + '-errorCode', + component: ErrorCode, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + error, + errorEventDefinition, + idPrefix + }, { + id: idPrefix + '-errorMessage', + component: ErrorMessage, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + error, + errorEventDefinition, + idPrefix + }]; + } + entries.push({ + id: idPrefix + '-expression', + component: Expression$1, + errorEventDefinition, + idPrefix + }); + return entries; +} +function ErrorRef(props) { + const { + element, + errorEventDefinition, + idPrefix + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + const error = errorEventDefinition.get('errorRef'); + if (error) { + return error.get('id'); + } + return EMPTY_OPTION; + }; + const setValue = value => { + const root = getRoot(businessObject); + const commands = []; + let error; + + // (1) create new error + if (value === CREATE_NEW_OPTION) { + error = createElement('bpmn:Error', { + name: nextId('Error_') + }, root, bpmnFactory); + value = error.get('id'); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: root, + properties: { + rootElements: [...root.get('rootElements'), error] + } + } + }); + } + + // (2) update (or remove) errorRef + error = error || findRootElementById(businessObject, 'bpmn:Error', value); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: errorEventDefinition, + properties: { + errorRef: error + } + } + }); + + // (3) commit all updates + return commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + let options = [{ + value: EMPTY_OPTION, + label: translate('') + }, { + value: CREATE_NEW_OPTION, + label: translate('Create new ...') + }]; + const errors = findRootElementsByType((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element), 'bpmn:Error'); + sortByName$1(errors).forEach(error => { + options.push({ + value: error.get('id'), + label: error.get('name') || error.get('id') + }); + }); + return options; + }; + return ReferenceSelectEntry({ + element, + id: idPrefix + '-errorRef', + label: translate('Global error reference'), + autoFocusEntry: idPrefix + '-errorName', + getValue, + setValue, + getOptions + }); +} +function ErrorName(props) { + const { + element, + error, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return error.get('name'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + name: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: idPrefix + '-errorName', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function ErrorCode(props) { + const { + element, + error, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return error.get('errorCode'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + errorCode: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: idPrefix + '-errorCode', + label: translate('Code'), + getValue, + setValue, + debounce + }); +} +function ErrorMessage(props) { + const { + element, + error, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return error.get('errorMessage'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: error, + properties: { + errorMessage: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: idPrefix + '-errorMessage', + label: translate('Message'), + getValue, + setValue, + debounce + }); +} +function Expression$1(props) { + const { + element, + errorEventDefinition, + idPrefix + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: errorEventDefinition, + properties: { + 'camunda:expression': value + } + }); + }; + const getValue = () => { + return errorEventDefinition.get('camunda:expression'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: errorEventDefinition, + id: idPrefix + '-expression', + label: translate('Throw expression'), + getValue, + setValue, + debounce + }); +} + +// helpers ////////// + +function sortByName$1(elements) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(elements, e => (e.name || '').toLowerCase()); +} + +function ErrorsProps({ + element, + injector +}) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ServiceTask') || getImplementationType(element) !== 'external') { + return null; + } + const errorEventDefinitions = getExtensionElementsList(businessObject, 'camunda:ErrorEventDefinition'); + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = errorEventDefinitions.map((errorEventDefinition, index) => { + const id = element.id + '-error-' + index; + return { + id, + label: getErrorLabel(errorEventDefinition), + entries: Error$1({ + idPrefix: id, + element, + errorEventDefinition + }), + autoFocusEntry: id + '-errorRef', + remove: removeFactory$6({ + commandStack, + element, + errorEventDefinition + }) + }; + }); + return { + items, + add: addFactory$5({ + bpmnFactory, + commandStack, + element + }), + shouldSort: false + }; +} +function removeFactory$6({ + commandStack, + element, + errorEventDefinition +}) { + return function (event) { + event.stopPropagation(); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + removeExtensionElements(element, businessObject, errorEventDefinition, commandStack); + }; +} +function addFactory$5({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const error = createElement('camunda:ErrorEventDefinition', {}, undefined, bpmnFactory); + addExtensionElements(element, businessObject, error, bpmnFactory, commandStack); + }; +} + +// helpers ////////// + +function getErrorLabel(errorEventDefinition) { + const error = errorEventDefinition.get('errorRef'); + if (!error) { + return ''; + } + const errorCode = error.get('errorCode'), + name = error.get('name') || ''; + if (errorCode) { + return `${name} (code = ${errorCode})`; + } + return name; +} + +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ - var elementHelper = require('../helper/ElementHelper'); +/** + * @returns {Array} entries + */ +function EscalationProps(props) { + const { + element, + entries + } = props; + if (!(isEscalationSupported(element) && canHaveEscalationVariables(element))) { + return entries; + } + entries.push({ + id: 'escalationCodeVariable', + component: EscalationCodeVariable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + return entries; +} +function EscalationCodeVariable(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const escalationEventDefinition = getEscalationEventDefinition(element); + const getValue = () => { + return escalationEventDefinition.get('camunda:escalationCodeVariable'); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: escalationEventDefinition, + properties: { + 'camunda:escalationCodeVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'escalationCodeVariable', + label: translate('Code variable'), + description: translate('Define the name of the variable that will contain the escalation code.'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////////// + +function canHaveEscalationVariables(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BoundaryEvent'); +} + +function ExternalTaskPriorityProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef')) && !isExternalTaskLike(element)) { + return []; + } + return [{ + id: 'externalTaskPriority', + component: ExternalTaskPriority, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function ExternalTaskPriority(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + let businessObject; + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant')) { + businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef'); + } else if (isExternalTaskLike(element)) { + businessObject = getServiceTaskLikeBusinessObject(element); + } else { + businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + } + const getValue = () => { + return businessObject.get('camunda:taskPriority'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:taskPriority': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'externalTaskPriority', + label: translate('Priority'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +function isExternalTaskLike(element) { + const bo = getServiceTaskLikeBusinessObject(element), + type = bo && bo.get('camunda:type'); + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(bo, 'camunda:ServiceTaskLike') && type && type === 'external'; +} + +const DEFAULT_PROPS$2 = { + 'stringValue': undefined, + 'string': undefined, + 'expression': undefined +}; +function FieldInjection(props) { + const { + element, + idPrefix, + field + } = props; + const entries = [{ + id: idPrefix + '-name', + component: NameProperty, + field, + idPrefix, + element + }, { + id: idPrefix + '-type', + component: TypeProperty, + field, + idPrefix, + element + }, { + id: idPrefix + '-value', + component: ValueProperty, + field, + idPrefix, + element + }]; + return entries; +} +function NameProperty(props) { + const { + idPrefix, + element, + field + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: field, + properties: { + name: value + } + }); + }; + const getValue = field => { + return field.name; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: field, + id: idPrefix + '-name', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function TypeProperty(props) { + const { + idPrefix, + element, + field + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'); + const getValue = field => { + return determineType(field); + }; + const setValue = value => { + const properties = Object.assign({}, DEFAULT_PROPS$2); + properties[value] = ''; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: field, + properties + }); + }; + const getOptions = element => { + const options = [{ + value: 'string', + label: translate('String') + }, { + value: 'expression', + label: translate('Expression') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element: field, + id: idPrefix + '-type', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function ValueProperty(props) { + const { + idPrefix, + element, + field + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + // (1) determine which type we have set + const type = determineType(field); + + // (2) set property accordingly + const properties = Object.assign({}, DEFAULT_PROPS$2); + properties[type] = value || ''; + + // (3) execute the update command + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: field, + properties + }); + }; + const getValue = field => { + return field.string || field.stringValue || field.expression; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: field, + id: idPrefix + '-value', + label: translate('Value'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////// + +/** + * determineType - get the type of a fieldInjection based on the attributes + * set on it + * + * @param {ModdleElement} field + * @return {('string'|'expression')} + */ +function determineType(field) { + // string is the default type + return 'string' in field && 'string' || 'expression' in field && 'expression' || 'stringValue' in field && 'string' || 'string'; +} + +function FieldInjectionProps({ + element, + injector +}) { + const businessObject = getServiceTaskLikeBusinessObject(element); + if (!businessObject) { + return null; + } + const fieldInjections = getExtensionElementsList(businessObject, 'camunda:Field'); + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = fieldInjections.map((field, index) => { + const id = element.id + '-fieldInjection-' + index; + return { + id, + label: getFieldLabel(field), + entries: FieldInjection({ + idPrefix: id, + element, + field + }), + autoFocusEntry: id + '-name', + remove: removeFactory$5({ + commandStack, + element, + field + }) + }; + }); + return { + items, + add: addFactory$4({ + bpmnFactory, + commandStack, + element + }) + }; +} +function removeFactory$5({ + commandStack, + element, + field +}) { + return function (event) { + event.stopPropagation(); + const businessObject = getServiceTaskLikeBusinessObject(element); + removeExtensionElements(element, businessObject, field, commandStack); + }; +} +function addFactory$4({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + const businessObject = getServiceTaskLikeBusinessObject(element); + const fieldInjection = createElement('camunda:Field', { + name: undefined, + string: '', + // string is the default type + stringValue: undefined + }, null, bpmnFactory); + addExtensionElements(element, businessObject, fieldInjection, bpmnFactory, commandStack); + }; +} + +// helper /////////////// + +function getFieldLabel(field) { + return field.name || ''; +} + +function FormFieldConstraint(props) { + const { + constraint, + element, + idPrefix + } = props; + const entries = [{ + id: idPrefix + '-name', + component: Name$1, + constraint, + idPrefix, + element + }, { + id: idPrefix + '-config', + component: Config, + constraint, + idPrefix, + element + }]; + return entries; +} +function Name$1(props) { + const { + idPrefix, + element, + constraint + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: constraint, + properties: { + name: value + } + }); + }; + const getValue = () => { + return constraint.name; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: constraint, + id: idPrefix + '-name', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} +function Config(props) { + const { + idPrefix, + element, + constraint + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: constraint, + properties: { + config: value + } + }); + }; + const getValue = () => { + return constraint.config; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: constraint, + id: idPrefix + '-config', + label: translate('Config'), + getValue, + setValue, + debounce + }); +} + +function FormFieldProperty(props) { + const { + element, + idPrefix, + property + } = props; + const entries = [{ + id: idPrefix + '-id', + component: Id$2, + idPrefix, + property, + element + }, { + id: idPrefix + '-value', + component: Value$1, + idPrefix, + property, + element + }]; + return entries; +} +function Id$2(props) { + const { + idPrefix, + element, + property + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: property, + properties: { + id: value + } + }); + }; + const getValue = () => { + return property.id; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: property, + id: idPrefix + '-id', + label: translate('ID'), + getValue, + setValue, + debounce + }); +} +function Value$1(props) { + const { + idPrefix, + element, + property + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: property, + properties: { + value + } + }); + }; + const getValue = () => { + return property.value; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: property, + id: idPrefix + '-value', + label: translate('Value'), + getValue, + setValue, + debounce + }); +} + +function FormFieldValue(props) { + const { + element, + idPrefix, + value + } = props; + const entries = [{ + id: idPrefix + '-id', + component: Id$1, + idPrefix, + value, + element + }, { + id: idPrefix + '-name', + component: Name, + idPrefix, + value, + element + }]; + return entries; +} +function Id$1(props) { + const { + idPrefix, + element, + value + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = val => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: value, + properties: { + id: val + } + }); + }; + const getValue = () => { + return value.id; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: value, + id: idPrefix + '-id', + label: translate('ID'), + getValue, + setValue, + debounce + }); +} +function Name(props) { + const { + idPrefix, + element, + value + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const setValue = val => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: value, + properties: { + name: val + } + }); + }; + const getValue = () => { + return value.name; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: value, + id: idPrefix + '-name', + label: translate('Name'), + getValue, + setValue, + debounce + }); +} + +const CUSTOM_TYPE_VALUE = '', + DEFINED_TYPE_VALUES = ['boolean', 'date', 'enum', 'long', 'string', undefined]; +function FormField(props) { + const { + idPrefix, + formField + } = props; + const entries = [{ + id: idPrefix + '-formFieldID', + component: Id, + idPrefix, + formField + }, { + id: idPrefix + '-formFieldLabel', + component: Label, + idPrefix, + formField + }, { + id: idPrefix + '-formFieldType', + component: Type$1, + idPrefix, + formField + }]; + if (!DEFINED_TYPE_VALUES.includes(formField.get('type'))) { + entries.push({ + id: idPrefix + '-formFieldCustomType', + component: CustomType, + idPrefix, + formField + }); + } + entries.push({ + id: idPrefix + '-formFieldDefaultValue', + component: DefaultValue, + idPrefix, + formField + }); + if (formField.get('type') === 'enum') { + entries.push({ + id: idPrefix + '-formFieldValues', + component: ValueList, + formField, + idPrefix + }); + } + entries.push({ + id: idPrefix + '-formFieldConstraints', + component: ConstraintList, + formField, + idPrefix + }, { + id: idPrefix + '-formFieldProperties', + component: PropertiesList, + formField, + idPrefix + }); + return entries; +} +function Id(props) { + const { + idPrefix, + element, + formField + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formField, + properties: { + id: value + } + }); + }; + const getValue = () => { + return formField.get('id'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: formField, + id: idPrefix + '-formFieldID', + label: translate('ID'), + description: translate('Refers to the process variable name'), + getValue, + setValue, + debounce + }); +} +function Label(props) { + const { + idPrefix, + element, + formField + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formField, + properties: { + label: value + } + }); + }; + const getValue = () => { + return formField.get('label'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: formField, + id: idPrefix + '-formFieldLabel', + label: translate('Label'), + getValue, + setValue, + debounce + }); +} +function Type$1(props) { + const { + idPrefix, + element, + formField + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formField, + properties: { + type: value + } + }); + }; + const getValue = () => { + const type = formField.get('type'); + return DEFINED_TYPE_VALUES.includes(type) ? type : CUSTOM_TYPE_VALUE; + }; + const getOptions = () => { + const options = [{ + label: translate('boolean'), + value: 'boolean' + }, { + label: translate('date'), + value: 'date' + }, { + label: translate('enum'), + value: 'enum' + }, { + label: translate('long'), + value: 'long' + }, { + label: translate('string'), + value: 'string' + }, { + label: translate(''), + value: CUSTOM_TYPE_VALUE + }]; + + // for the initial state only, we want to show an empty state + if (formField.get('type') === undefined) { + options.unshift({ + label: translate(''), + value: '' + }); + } + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element: formField, + id: idPrefix + '-formFieldType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function CustomType(props) { + const { + idPrefix, + element, + formField + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + const type = value || ''; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formField, + properties: { + type + } + }); + }; + const getValue = () => { + return formField.get('type'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: formField, + id: idPrefix + '-formFieldCustomType', + label: translate('Custom type'), + getValue, + setValue, + debounce + }); +} +function DefaultValue(props) { + const { + idPrefix, + element, + formField + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formField, + properties: { + defaultValue: value + } + }); + }; + const getValue = () => { + return formField.get('defaultValue'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: formField, + id: idPrefix + '-formFieldDefaultValue', + label: translate('Default value'), + getValue, + setValue, + debounce + }); +} +function Value(props) { + const { + element, + id: idPrefix, + index, + item: value, + open + } = props; + const translate = useService('translate'); + const id = `${idPrefix}-value-${index}`; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CollapsibleEntry, { + id: id, + element: element, + entries: FormFieldValue({ + idPrefix: id, + element, + value + }), + label: value.get('id') || translate(''), + open: open + }); +} +function ValueList(props) { + const { + element, + formField, + idPrefix + } = props; + const id = `${idPrefix}-formFieldValues`; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const values = formField.get('values') || []; + function addValue() { + const value = createElement('camunda:Value', { + id: undefined, + name: undefined + }, formField, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: formField, + properties: { + values: [...formField.get('values'), value] + } + }); + } + function removeValue(value) { + commandStack.execute('element.updateModdleProperties', { + element: element, + moddleElement: formField, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(formField.get('values'), value) + } + }); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry, { + element: element, + autoFocusEntry: `[data-entry-id="${id}-value-${values.length - 1}"] input`, + id: id, + label: translate('Values'), + items: values, + component: Value, + onAdd: addValue, + onRemove: removeValue + }); +} +function Constraint(props) { + const { + element, + id: idPrefix, + index, + item: constraint, + open + } = props; + const translate = useService('translate'); + const id = `${idPrefix}-constraint-${index}`; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CollapsibleEntry, { + id: id, + element: element, + entries: FormFieldConstraint({ + constraint, + element, + idPrefix: id + }), + label: constraint.get('name') || translate(''), + open: open + }); +} +function ConstraintList(props) { + const { + element, + formField, + idPrefix + } = props; + const id = `${idPrefix}-formFieldConstraints`; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let validation = formField.get('validation'); + const constraints = validation && validation.get('constraints') || []; + function addConstraint() { + const commands = []; + + // (1) ensure validation + if (!validation) { + validation = createElement('camunda:Validation', {}, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: formField, + properties: { + validation + } + } + }); + } + + // (2) add constraint + const constraint = createElement('camunda:Constraint', { + name: undefined, + config: undefined + }, validation, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: validation, + properties: { + constraints: [...validation.get('constraints'), constraint] + } + } + }); + + // (3) commit updates + commandStack.execute('properties-panel.multi-command-executor', commands); + } + function removeConstraint(constraint) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: validation, + properties: { + constraints: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(validation.get('constraints'), constraint) + } + }); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry, { + element: element, + autoFocusEntry: `[data-entry-id="${id}-constraint-${constraints.length - 1}"] input`, + id: id, + label: translate('Constraints'), + items: constraints, + component: Constraint, + onAdd: addConstraint, + onRemove: removeConstraint + }); +} +function Property(props) { + const { + element, + id: idPrefix, + index, + item: property, + open + } = props; + const translate = useService('translate'); + const id = `${idPrefix}-property-${index}`; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CollapsibleEntry, { + id: id, + element: element, + entries: FormFieldProperty({ + element, + idPrefix: id, + property + }), + label: property.get('id') || translate(''), + open: open + }); +} +function PropertiesList(props) { + const { + element, + formField, + idPrefix + } = props; + const id = `${idPrefix}-formFieldProperties`; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + let properties = formField.get('properties'); + const propertyEntries = properties && properties.get('values') || []; + function addProperty() { + const commands = []; + + // (1) ensure properties + if (!properties) { + properties = createElement('camunda:Properties', {}, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: formField, + properties: { + properties + } + } + }); + } + + // (2) add property + const property = createElement('camunda:Property', { + id: undefined, + value: undefined + }, properties, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: properties, + properties: { + values: [...properties.get('values'), property] + } + } + }); + + // (3) commit updates + commandStack.execute('properties-panel.multi-command-executor', commands); + } + function removeProperty(property) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: properties, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(properties.get('values'), property) + } + }); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry, { + element: element, + autoFocusEntry: true, + id: id, + compareFn: createAlphanumericCompare('id'), + label: translate('Properties'), + items: propertyEntries, + component: Property, + onAdd: addProperty, + onRemove: removeProperty + }); +} + +// helper ////////////////// + +function createAlphanumericCompare(field) { + return function (entry, anotherEntry) { + const [key = '', anotherKey = ''] = [entry[field], anotherEntry[field]]; + return key === anotherKey ? 0 : key > anotherKey ? 1 : -1; + }; +} + +function FormDataProps({ + element, + injector +}) { + if (!isFormDataSupported(element)) { + return; + } + const formFields = getFormFieldsList(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = formFields.map((formField, index) => { + const id = element.id + '-formField-' + index; + return { + id, + label: formField.get('id') || '', + entries: FormField({ + idPrefix: id, + element, + formField + }), + autoFocusEntry: id + '-formFieldID', + remove: removeFactory$4({ + commandStack, + element, + formField + }) + }; + }); + return { + items, + add: addFactory$3({ + bpmnFactory, + commandStack, + element + }), + shouldSort: false + }; +} +function addFactory$3({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + const commands = []; + + // (1) get camunda:FormData + const formData = getFormData$1(element); + + // (2) create camunda:FormField + const formField = createElement('camunda:FormField', {}, formData, bpmnFactory); + + // (3) add formField to list + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: formData, + properties: { + fields: [...formData.get('fields'), formField] + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; +} +function removeFactory$4({ + commandStack, + element, + formField +}) { + return function (event) { + event.stopPropagation(); + const formData = getFormData$1(element), + formFields = getFormFieldsList(element); + if (!formFields || !formFields.length) { + return; + } + const fields = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(formData.get('fields'), formField); + + // update formData + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: formData, + properties: { + fields + } + }); + }; +} + +// helper /////////////////////////////// + +function isFormDataSupported(element) { + const formData = getFormData$1(element); + return ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element.parent, 'bpmn:SubProcess') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask')) && formData; +} +function getFormData$1(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(bo, 'camunda:FormData')[0]; +} +function getFormFieldsList(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const formData = getFormData$1(businessObject); + return formData && formData.fields; +} + +const FORM_KEY_PROPS = { + 'camunda:formRef': undefined, + 'camunda:formRefBinding': undefined, + 'camunda:formRefVersion': undefined +}; +const FORM_REF_PROPS = { + 'camunda:formKey': undefined +}; +function FormTypeProps(props) { + return [{ + id: 'formType', + component: FormType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; +} +function FormType(props) { + const { + element + } = props; + const translate = useService('translate'); + const bpmnFactory = useService('bpmnFactory'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const commandStack = useService('commandStack'); + let extensionElements = businessObject.get('extensionElements'); + const getValue = () => { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(businessObject.get('camunda:formKey'))) { + return 'formKey'; + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(businessObject.get('camunda:formRef'))) { + return 'formRef'; + } else if (getFormData(element)) { + return 'formData'; + } + return ''; + }; + const setValue = value => { + const commands = removePropertiesCommands(element); + if (value === 'formData') { + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) create camunda:FormData + const parent = extensionElements; + const formData = createElement('camunda:FormData', { + fields: [] + }, parent, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), formData] + } + } + }); + } else if (value === 'formKey') { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + 'camunda:formKey': '' + } + } + }); + } else if (value === 'formRef') { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + 'camunda:formRef': '' + } + } + }); + } + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + return [{ + value: '', + label: translate('') + }, { + value: 'formRef', + label: translate('Camunda Forms') + }, { + value: 'formKey', + label: translate('Embedded or External Task Forms') + }, { + value: 'formData', + label: translate('Generated Task Forms') + }]; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'formType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function getFormData(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(bo, 'camunda:FormData')[0]; +} +function removePropertiesCommands(element, commandStack) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const extensionElements = businessObject.get('extensionElements'); + const commands = []; + + // (1) reset formKey and formRef + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + ...FORM_KEY_PROPS, + ...FORM_REF_PROPS + } + } + }); + + // (2) remove formData if defined + if (extensionElements && getFormData(element)) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), getFormData(element)) + } + } + }); + } + return commands; +} + +function getFormRefBinding(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject.get('camunda:formRefBinding') || 'latest'; +} +function getFormType(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(businessObject.get('camunda:formKey'))) { + return 'formKey'; + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isDefined)(businessObject.get('camunda:formRef'))) { + return 'formRef'; + } +} +function isFormSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:StartEvent') && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element.parent, 'bpmn:SubProcess') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask'); +} + +function FormProps(props) { + const { + element + } = props; + if (!isFormSupported(element)) { + return []; + } + const formType = getFormType(element), + bindingType = getFormRefBinding(element); + + // (1) display form type select + const entries = [...FormTypeProps()]; + + // (2) display form properties based on type + if (formType === 'formKey') { + entries.push({ + id: 'formKey', + component: FormKey, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (formType === 'formRef') { + entries.push({ + id: 'formRef', + component: FormRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'formRefBinding', + component: Binding$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + if (bindingType === 'version') { + entries.push({ + id: 'formRefVersion', + component: Version$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + } + return entries; +} +function FormKey(props) { + const { + element + } = props; + const debounce = useService('debounceInput'); + const modeling = useService('modeling'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:formKey'); + }; + const setValue = value => { + modeling.updateProperties(element, { + 'camunda:formKey': (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(value) ? '' : value + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'formKey', + label: translate('Form key'), + getValue, + setValue, + debounce + }); +} +function FormRef(props) { + const { + element + } = props; + const debounce = useService('debounceInput'); + const modeling = useService('modeling'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:formRef'); + }; + const setValue = value => { + modeling.updateProperties(element, { + 'camunda:formRef': (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(value) ? '' : value + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'formRef', + label: translate('Form reference'), + getValue, + setValue, + debounce + }); +} +function Binding$1(props) { + const { + element + } = props; + const modeling = useService('modeling'); + const translate = useService('translate'); + const getValue = () => { + return getFormRefBinding(element); + }; + const setValue = value => { + modeling.updateProperties(element, { + 'camunda:formRefBinding': value + }); + }; + + // Note: default is "latest", + // cf. https://docs.camunda.org/manual/develop/reference/bpmn20/custom-extensions/extension-attributes/#formrefbinding + const getOptions = () => { + const options = [{ + value: 'deployment', + label: translate('deployment') + }, { + value: 'latest', + label: translate('latest') + }, { + value: 'version', + label: translate('version') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'formRefBinding', + label: translate('Binding'), + getValue, + setValue, + getOptions + }); +} +function Version$1(props) { + const { + element + } = props; + const debounce = useService('debounceInput'); + const modeling = useService('modeling'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:formRefVersion'); + }; + const setValue = value => { + modeling.updateProperties(element, { + 'camunda:formRefVersion': value + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'formRefVersion', + label: translate('Version'), + getValue, + setValue, + debounce + }); +} + +function HistoryCleanupProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef'))) { + return []; + } + return [{ + id: 'historyTimeToLive', + component: HistoryTimeToLive, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function HistoryTimeToLive(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const process = getProcess$2(element); + const getValue = () => { + return process.get('camunda:historyTimeToLive') || ''; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + 'camunda:historyTimeToLive': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'historyTimeToLive', + label: translate('Time to live'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +function getProcess$2(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element) : (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef'); +} + +function DmnImplementationProps(props) { + const { + element + } = props; + const entries = []; + const implementationType = getImplementationType(element); + const bindingType = getDecisionRefBinding(element); + if (implementationType !== 'dmn') { + return entries; + } + + // (1) decisionRef + entries.push({ + id: 'decisionRef', + component: DecisionRef, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + + // (2) binding + entries.push({ + id: 'decisionRefBinding', + component: Binding, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + + // (3) version + if (bindingType === 'version') { + entries.push({ + id: 'decisionRefVersion', + component: Version, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + + // (4) versionTag + if (bindingType === 'versionTag') { + entries.push({ + id: 'decisionRefVersionTag', + component: VersionTag$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + + // (5) tenantId + entries.push({ + id: 'decisionRefTenantId', + component: TenantId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + + // (6) resultVariable + entries.push({ + id: 'decisionRefResultVariable', + component: ResultVariable$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + + // (7) mapDecisionResult + if (getResultVariable(element)) { + entries.push({ + id: 'mapDecisionResult', + component: MapDecisionResult, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }); + } + return entries; +} +function DecisionRef(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:decisionRef'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:decisionRef': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'decisionRef', + label: translate('Decision reference'), + getValue, + setValue, + debounce + }); +} +function Binding(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getDecisionRefBinding(element); + }; + const setValue = value => { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + + // reset version properties on binding type change + const updatedProperties = { + 'camunda:decisionRefVersion': undefined, + 'camunda:decisionRefVersionTag': undefined, + 'camunda:decisionRefBinding': value + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: updatedProperties + }); + }; + + // Note: default is "latest", + // cf. https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-attributes/#decisionrefbinding + const getOptions = () => { + const options = [{ + value: 'deployment', + label: translate('deployment') + }, { + value: 'latest', + label: translate('latest') + }, { + value: 'version', + label: translate('version') + }, { + value: 'versionTag', + label: translate('versionTag') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'decisionRefBinding', + label: translate('Binding'), + getValue, + setValue, + getOptions + }); +} +function Version(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:decisionRefVersion'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:decisionRefVersion': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'decisionRefVersion', + label: translate('Version'), + getValue, + setValue, + debounce + }); +} +function VersionTag$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:decisionRefVersionTag'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:decisionRefVersionTag': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'decisionRefVersionTag', + label: translate('Version tag'), + getValue, + setValue, + debounce + }); +} +function TenantId(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:decisionRefTenantId'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:decisionRefTenantId': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'decisionRefTenantId', + label: translate('Tenant ID'), + getValue, + setValue, + debounce + }); +} +function ResultVariable$2(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return getResultVariable(businessObject); + }; + + // Note: camunda:mapDecisionResult got cleaned up in modeling behavior + // cf. https://github.com/camunda/camunda-bpmn-js/blob/main/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:resultVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'decisionRefResultVariable', + label: translate('Result variable'), + getValue, + setValue, + debounce + }); +} +function MapDecisionResult(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:mapDecisionResult') || 'resultList'; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:mapDecisionResult': value + } + }); + }; + + // Note: default is "resultList", + // cf. https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-attributes/#mapdecisionresult + const getOptions = () => { + const options = [{ + value: 'collectEntries', + label: translate('collectEntries (List)') + }, { + value: 'resultList', + label: translate('resultList (List>)') + }, { + value: 'singleEntry', + label: translate('singleEntry (TypedValue)') + }, { + value: 'singleResult', + label: translate('singleResult (Map)') + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'mapDecisionResult', + label: translate('Map decision result'), + getValue, + setValue, + getOptions + }); +} + +// helper //////////////////// + +function getDecisionRefBinding(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject.get('camunda:decisionRefBinding') || 'latest'; +} +function getResultVariable(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject.get('camunda:resultVariable'); +} + +const DELEGATE_PROPS = { + 'camunda:class': undefined, + 'camunda:expression': undefined, + 'camunda:delegateExpression': undefined, + 'camunda:resultVariable': undefined +}; +const DMN_CAPABLE_PROPS = { + 'camunda:decisionRef': undefined, + 'camunda:decisionRefBinding': 'latest', + 'camunda:decisionRefVersion': undefined, + 'camunda:mapDecisionResult': 'resultList', + 'camunda:decisionRefTenantId': undefined +}; +const EXTERNAL_CAPABLE_PROPS = { + 'camunda:type': undefined, + 'camunda:topic': undefined +}; +const IMPLEMENTATION_TYPE_NONE_LABEL = '', + IMPLEMENTATION_TYPE_JAVA_LABEL = 'Java class', + IMPLEMENTATION_TYPE_EXPRESSION_LABEL = 'Expression', + IMPLEMENTATION_TYPE_DELEGATE_LABEL = 'Delegate expression', + IMPLEMENTATION_TYPE_DMN_LABEL = 'DMN', + IMPLEMENTATION_TYPE_EXTERNAL_LABEL = 'External', + IMPLEMENTATION_TYPE_CONNECTOR_LABEL = 'Connector'; +function ImplementationTypeProps(props) { + return [{ + id: 'implementationType', + component: ImplementationType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited + }]; +} +function ImplementationType(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return getImplementationType(element) || ''; + }; + const setValue = value => { + const oldType = getImplementationType(element); + const businessObject = getServiceTaskLikeBusinessObject(element); + const commands = []; + let updatedProperties = DELEGATE_PROPS; + let extensionElements = businessObject.get('extensionElements'); + + // (1) class, expression, delegateExpression + if (isDelegateType(value)) { + updatedProperties = { + ...updatedProperties, + [value]: isDelegateType(oldType) ? businessObject.get(`camunda:${oldType}`) : '' + }; + } + + // (2) dmn + if (isDmnCapable(businessObject)) { + updatedProperties = { + ...updatedProperties, + ...DMN_CAPABLE_PROPS + }; + if (value === 'dmn') { + updatedProperties = { + ...updatedProperties, + 'camunda:decisionRef': '' + }; + } + } + + // (3) external + // Note: error event definition elements got cleaned up in modeling behavior + // cf. https://github.com/camunda/camunda-bpmn-js/blob/main/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js + if (isExternalCapable(businessObject)) { + updatedProperties = { + ...updatedProperties, + ...EXTERNAL_CAPABLE_PROPS + }; + if (value === 'external') { + updatedProperties = { + ...updatedProperties, + 'camunda:type': 'external', + 'camunda:topic': '' + }; + } + } + + // (4) connector + if (isServiceTaskLike(businessObject)) { + // (4.1) remove all connectors on type change + const connectors = getConnectors$1(businessObject); + if (connectors.length) { + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(extensionElements.get('values'), value => connectors.includes(value)) + } + } + }); + } + + // (4.2) create connector + if (value === 'connector') { + // ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push(UpdateModdlePropertiesCommand(element, businessObject, { + extensionElements + })); + } + const connector = createElement('camunda:Connector', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), connector] + } + } + }); + } + } + + // (5) collect all property updates + commands.push(UpdateModdlePropertiesCommand(element, businessObject, updatedProperties)); + + // (6) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + const getOptions = () => { + const businessObject = getServiceTaskLikeBusinessObject(element); + const options = [{ + value: '', + label: translate(IMPLEMENTATION_TYPE_NONE_LABEL) + }, { + value: 'class', + label: translate(IMPLEMENTATION_TYPE_JAVA_LABEL) + }, { + value: 'expression', + label: translate(IMPLEMENTATION_TYPE_EXPRESSION_LABEL) + }, { + value: 'delegateExpression', + label: translate(IMPLEMENTATION_TYPE_DELEGATE_LABEL) + }]; + if (isDmnCapable(businessObject)) { + options.push({ + value: 'dmn', + label: translate(IMPLEMENTATION_TYPE_DMN_LABEL) + }); + } + if (isExternalCapable(businessObject)) { + options.push({ + value: 'external', + label: translate(IMPLEMENTATION_TYPE_EXTERNAL_LABEL) + }); + } + if (isServiceTaskLike(businessObject)) { + options.push({ + value: 'connector', + label: translate(IMPLEMENTATION_TYPE_CONNECTOR_LABEL) + }); + } + return sortByPriority(options); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'implementationType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} + +// helper /////////////////////// + +function isDelegateType(type) { + return ['class', 'expression', 'delegateExpression'].includes(type); +} +function getConnectors$1(businessObject) { + return getExtensionElementsList(businessObject, 'camunda:Connector'); +} +function UpdateModdlePropertiesCommand(element, businessObject, newProperties) { + return { + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: newProperties + } + }; +} +function sortByPriority(options) { + const priorities = { + [IMPLEMENTATION_TYPE_NONE_LABEL]: 0, + [IMPLEMENTATION_TYPE_JAVA_LABEL]: 3, + [IMPLEMENTATION_TYPE_EXPRESSION_LABEL]: 4, + [IMPLEMENTATION_TYPE_DELEGATE_LABEL]: 5, + [IMPLEMENTATION_TYPE_DMN_LABEL]: 1, + [IMPLEMENTATION_TYPE_EXTERNAL_LABEL]: 2, + [IMPLEMENTATION_TYPE_CONNECTOR_LABEL]: 6 + }; + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(options, o => priorities[o.label]); +} + +function ImplementationProps(props) { + const { + element + } = props; + if (!getServiceTaskLikeBusinessObject(element)) { + return []; + } + const implementationType = getImplementationType(element); + + // (1) display implementation type select + const entries = [...ImplementationTypeProps()]; + + // (2) display implementation properties based on type + if (implementationType === 'class') { + entries.push({ + id: 'javaClass', + component: JavaClass, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (implementationType === 'expression') { + entries.push({ + id: 'expression', + component: Expression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'expressionResultVariable', + component: ResultVariable$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (implementationType === 'delegateExpression') { + entries.push({ + id: 'delegateExpression', + component: DelegateExpression, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (implementationType === 'dmn') { + entries.push(...DmnImplementationProps({ + element + })); + } else if (implementationType === 'external') { + entries.push({ + id: 'externalTopic', + component: Topic, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } else if (implementationType === 'connector') { + entries.push({ + id: 'connectorId', + component: ConnectorId, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function JavaClass(props) { + const { + element, + businessObject = getServiceTaskLikeBusinessObject(element), + id = 'javaClass' + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return businessObject.get('camunda:class'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:class': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id, + label: translate('Java class'), + getValue, + setValue, + debounce + }); +} +function Expression(props) { + const { + element, + businessObject = getServiceTaskLikeBusinessObject(element), + id = 'expression' + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return businessObject.get('camunda:expression'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:expression': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id, + label: translate('Expression'), + getValue, + setValue, + debounce + }); +} +function ResultVariable$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = getServiceTaskLikeBusinessObject(element); + const getValue = () => { + return businessObject.get('camunda:resultVariable'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:resultVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'expressionResultVariable', + label: translate('Result variable'), + getValue, + setValue, + debounce + }); +} +function DelegateExpression(props) { + const { + element, + businessObject = getServiceTaskLikeBusinessObject(element), + id = 'delegateExpression' + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const getValue = () => { + return businessObject.get('camunda:delegateExpression'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:delegateExpression': value || '' + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id, + label: translate('Delegate expression'), + getValue, + setValue, + debounce + }); +} +function Topic(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = getServiceTaskLikeBusinessObject(element); + const getValue = () => { + return businessObject.get('camunda:topic'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:topic': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'externalTopic', + label: translate('Topic'), + getValue, + setValue, + debounce + }); +} +function ConnectorId(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const connector = getConnector(element); + const getValue = () => { + return connector.get('camunda:connectorId'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: connector, + properties: { + 'camunda:connectorId': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'connectorId', + label: translate('Connector ID'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +function getConnectors(businessObject) { + return getExtensionElementsList(businessObject, 'camunda:Connector'); +} +function getConnector(element) { + const businessObject = getServiceTaskLikeBusinessObject(element); + const connectors = getConnectors(businessObject); + return connectors[0]; +} + +function InitiatorProps(props) { + const { + element + } = props; + if (!isInitiator(element)) { + return []; + } + return [{ + id: 'initiator', + component: Initiator, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function Initiator(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:initiator'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:initiator': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'initiator', + label: translate('Initiator'), + getValue, + setValue, + debounce + }); +} + +// helper /////////////////// + +function isInitiator(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Initiator') && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element.parent, 'bpmn:SubProcess'); +} + +/** + * Cf. https://docs.camunda.org/manual/7.15/reference/bpmn20/subprocesses/call-activity/#passing-variables + */ +function InMappingPropagationProps(props) { + const { + element + } = props; + if (!areInMappingsSupported$1(element)) { + return []; + } + const entries = [{ + id: 'inMapping-propagation', + component: PropagateAll$1, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }]; + if (isPropagateAll$1(element)) { + entries.push({ + id: 'inMapping-propagation-local', + component: Local$2, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }); + } + return entries; +} +function PropagateAll$1(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + return isPropagateAll$1(element); + }; + const setValue = value => { + if (value) { + addInMapping(); + } else { + removeInMapping(); + } + }; + function addInMapping() { + const businessObject = getSignalEventDefinition$1(element) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const mapping = createElement('camunda:In', { + variables: 'all' + }, null, bpmnFactory); + addExtensionElements(element, businessObject, mapping, bpmnFactory, commandStack); + } + function removeInMapping() { + const businessObject = getSignalEventDefinition$1(element) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const mappings = findRelevantInMappings(element); + removeExtensionElements(element, businessObject, mappings, commandStack); + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + id: 'inMapping-propagation', + label: translate('Propagate all variables'), + getValue, + setValue + }); +} +function Local$2(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const mapping = findRelevantInMappings(element)[0]; + const getValue = () => { + return mapping.get('camunda:local'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + local: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'inMapping-propagation-local', + label: translate('Local'), + getValue, + setValue + }); +} + +// helper ////////////////////////// + +function areInMappingsSupported$1(element) { + const signalEventDefinition = getSignalEventDefinition$1(element); + if (signalEventDefinition) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:IntermediateThrowEvent', 'bpmn:EndEvent']); + } + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity'); +} +function getInMappings$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const signalEventDefinition = getSignalEventDefinition$1(businessObject); + return getExtensionElementsList(signalEventDefinition || businessObject, 'camunda:In'); +} +function findRelevantInMappings(element) { + const inMappings = getInMappings$1(element); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.filter)(inMappings, function (mapping) { + const variables = mapping.get('variables'); + return variables && variables === 'all'; + }); +} +function isPropagateAll$1(element) { + const mappings = findRelevantInMappings(element); + return !!mappings.length; +} + +const DEFAULT_PROPS$1 = { + 'source': undefined, + 'sourceExpression': undefined +}; +function InOutMapping(props) { + const { + idPrefix, + mapping + } = props; + const type = getInOutType(mapping); + const entries = []; + + // (1) Type + entries.push({ + id: idPrefix + '-type', + component: Type, + idPrefix, + mapping + }); + + // (2) Source + if (type === 'source') { + entries.push({ + id: idPrefix + '-source', + component: Source, + idPrefix, + mapping + }); + } + + // (3) Source expression + if (type === 'sourceExpression') { + entries.push({ + id: idPrefix + '-sourceExpression', + component: SourceExpression, + idPrefix, + mapping + }); + } + + // (4) Target + entries.push({ + id: idPrefix + '-target', + component: Target, + idPrefix, + mapping + }); + + // (5) Local + entries.push({ + id: idPrefix + '-local', + component: Local$1, + idPrefix, + mapping + }); + return entries; +} +function Type(props) { + const { + idPrefix, + element, + mapping + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = mapping => { + return getInOutType(mapping); + }; + const setValue = value => { + const properties = { + ...DEFAULT_PROPS$1, + [value]: '' + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties + }); + }; + const getOptions = () => { + const options = [{ + label: translate('Source'), + value: 'source' + }, { + label: translate('Source expression'), + value: 'sourceExpression' + }]; + return options; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element: mapping, + id: idPrefix + '-type', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} +function Source(props) { + const { + idPrefix, + element, + mapping + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + source: value + } + }); + }; + const getValue = mapping => { + return mapping.get('camunda:source'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: mapping, + id: idPrefix + '-source', + label: translate('Source'), + getValue, + setValue, + debounce + }); +} +function SourceExpression(props) { + const { + idPrefix, + element, + mapping + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + sourceExpression: value + } + }); + }; + const getValue = mapping => { + return mapping.get('camunda:sourceExpression'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: mapping, + id: idPrefix + '-sourceExpression', + label: translate('Source expression'), + getValue, + setValue, + debounce + }); +} +function Target(props) { + const { + idPrefix, + element, + mapping + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + target: value + } + }); + }; + const getValue = mapping => { + return mapping.get('camunda:target'); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element: mapping, + id: idPrefix + '-target', + label: translate('Target'), + getValue, + setValue, + debounce + }); +} +function Local$1(props) { + const { + idPrefix, + element, + mapping + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const getValue = () => { + return mapping.get('camunda:local'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + local: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: idPrefix + '-local', + label: translate('Local'), + getValue, + setValue + }); +} + +// helper /////////////////// + +function getInOutType(mapping) { + let inOutType = ''; + if (typeof mapping.source !== 'undefined') { + inOutType = 'source'; + } else if (typeof mapping.sourceExpression !== 'undefined') { + inOutType = 'sourceExpression'; + } + return inOutType; +} + +/** + * Cf. https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-elements/#in + */ +function InMappingProps({ + element, + injector +}) { + if (!areInMappingsSupported(element)) { + return null; + } + const variableMappings = getInMappings(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = variableMappings.map((mapping, index) => { + const id = element.id + '-inMapping-' + index; + return { + id, + label: mapping.get('target') || '', + entries: InOutMapping({ + idPrefix: id, + element, + mapping + }), + autoFocusEntry: id + '-target', + remove: removeFactory$3({ + commandStack, + element, + mapping + }) + }; + }); + return { + items, + add: addFactory$2({ + bpmnFactory, + commandStack, + element + }) + }; +} +function removeFactory$3({ + commandStack, + element, + mapping +}) { + return function (event) { + event.stopPropagation(); + const businessObject = getSignalEventDefinition$1(element) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + removeExtensionElements(element, businessObject, mapping, commandStack); + }; +} +function addFactory$2({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + const businessObject = getSignalEventDefinition$1(element) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const newMapping = createElement('camunda:In', { + source: '' // source is the default type + }, null, bpmnFactory); + addExtensionElements(element, businessObject, newMapping, bpmnFactory, commandStack); + }; +} + +// helper /////////////// + +function getInMappings(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const signalEventDefinition = getSignalEventDefinition$1(businessObject); + const mappings = getExtensionElementsList(signalEventDefinition || businessObject, 'camunda:In'); + + // only retrieve relevant mappings here, others are handled in other groups + // mapping.businessKey => camunda-platform/CallAvtivityProps + // mapping.variables => camunda-platform/InMappingPropagationProps + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.filter)(mappings, function (mapping) { + return !mapping.businessKey && !(mapping.variables && mapping.variables === 'all'); + }); +} +function areInMappingsSupported(element) { + const signalEventDefinition = getSignalEventDefinition$1(element); + if (signalEventDefinition) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:IntermediateThrowEvent', 'bpmn:EndEvent']); + } + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity'); +} + +function InputProps(props) { + const { + element, + injector + } = props; + if (!areInputParametersSupported(element)) { + return null; + } + const inputParameters = getInputParameters(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = inputParameters.map((parameter, index) => { + const id = element.id + '-inputParameter-' + index; + return { + id, + label: parameter.get('name') || '', + entries: InputOutputParameter({ + idPrefix: id, + element, + parameter + }), + autoFocusEntry: id + '-name', + remove: removeFactory$2({ + element, + commandStack, + parameter + }) + }; + }); + function add(event) { + event.stopPropagation(); + commandStack.execute('properties-panel.multi-command-executor', AddParameterCmd(element, 'camunda:InputParameter', bpmnFactory)); + } + return { + items, + add, + shouldSort: false + }; +} +function removeFactory$2(props) { + const { + commandStack, + element, + parameter + } = props; + return function (event) { + event.stopPropagation(); + const inputOutput = getInputOutput(element); + if (!inputOutput) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOutput, + properties: { + inputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(inputOutput.get('inputParameters'), parameter) + } + }); + }; +} + +function JobExecutionProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const entries = []; + + // (1) add retryTimeCycle field for camunda:asyncCapable enabled Elements + // or TimerEvents + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:AsyncCapable') && isAsync$1(businessObject) || isTimerEvent(element)) { + entries.push({ + id: 'retryTimeCycle', + component: RetryTimeCycle, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + + // (2) add jobPriority field for camunda:jobPriorized with async enabled + // or Processes + // or Processes referred to by participants + // or TimerEvents + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:JobPriorized') && isAsync$1(businessObject) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef') || isTimerEvent(element)) { + entries.push({ + id: 'jobPriority', + component: JobPriority, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function JobPriority(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef') : (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:jobPriority'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:jobPriority': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'jobPriority', + label: translate('Priority'), + getValue, + setValue, + debounce + }); +} +function RetryTimeCycle(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'), + commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + const failedJobRetryTimeCycle = getExtensionElementsList(businessObject, 'camunda:FailedJobRetryTimeCycle')[0]; + return failedJobRetryTimeCycle && failedJobRetryTimeCycle.body; + }; + const setValue = value => { + const commands = []; + let extensionElements = businessObject.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, businessObject, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: businessObject, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure failedJobRetryTimeCycle + let failedJobRetryTimeCycle = getExtensionElementsList(businessObject, 'camunda:FailedJobRetryTimeCycle')[0]; + if (!failedJobRetryTimeCycle) { + failedJobRetryTimeCycle = createElement('camunda:FailedJobRetryTimeCycle', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), failedJobRetryTimeCycle] + } + } + }); + } + + // (3) update failedJobRetryTimeCycle value + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: failedJobRetryTimeCycle, + properties: { + body: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'retryTimeCycle', + label: translate('Retry time cycle'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +/** + * @param {ModdleElement} bo + * @return {boolean} a boolean value + */ +function isAsyncBefore$1(bo) { + return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async')); +} - /** - * A handler capable of creating a new element under a provided parent - * and updating / creating a reference to it in one atomic action. - * - * @class - * @constructor - */ - function CreateAndReferenceElementHandler(elementRegistry, bpmnFactory) { - this._elementRegistry = elementRegistry; - this._bpmnFactory = bpmnFactory; - } +/** + * @param {ModdleElement} bo + * @return {boolean} + */ +function isAsyncAfter$1(bo) { + return !!bo.get('camunda:asyncAfter'); +} - CreateAndReferenceElementHandler.$inject = [ 'elementRegistry', 'bpmnFactory' ]; +/** + * isAsync - returns true if the attribute 'camunda:asyncAfter' or 'camunda:asyncBefore' + * is set to true. + * + * @param {ModdleElement} bo + * @return {boolean} + */ +function isAsync$1(bo) { + return isAsyncAfter$1(bo) || isAsyncBefore$1(bo); +} - module.exports = CreateAndReferenceElementHandler; +/** + * isTimerEvent - returns true if the element is a bpmn:Event with a timerEventDefinition + * + * @param {ModdleElement} element + * @return {boolean} + */ +function isTimerEvent(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Event') && getTimerEventDefinition$1(element); +} +/** + * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry + */ -// api //////////////////// +/** + * @returns {Array} entries + */ +function MultiInstanceProps(props) { + const { + element + } = props; + const loopCharacteristics = getLoopCharacteristics(element); + let entries = props.entries || []; + if (!isMultiInstanceSupported(element)) { + return entries; + } + entries.push({ + id: 'collection', + component: Collection, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'elementVariable', + component: ElementVariable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'multiInstanceAsynchronousBefore', + component: MultiInstanceAsynchronousBefore, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }, { + id: 'multiInstanceAsynchronousAfter', + component: MultiInstanceAsynchronousAfter, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }); + if (isAsync(loopCharacteristics)) { + entries.push({ + id: 'multiInstanceExclusive', + component: MultiInstanceExclusive, + isEdited: checkboxIsEditedInverted + }, { + id: 'multiInstanceRetryTimeCycle', + component: MultiInstanceRetryTimeCycle, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + } + return entries; +} +function Collection(props) { + const { + element + } = props; + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + return getCollection(element); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: loopCharacteristics, + properties: { + 'camunda:collection': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'collection', + label: translate('Collection'), + getValue, + setValue, + debounce + }); +} +function ElementVariable(props) { + const { + element + } = props; + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + return getElementVariable(element); + }; + const setValue = value => { + return commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: loopCharacteristics, + properties: { + 'camunda:elementVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'elementVariable', + label: translate('Element variable'), + getValue, + setValue, + debounce + }); +} +function MultiInstanceAsynchronousBefore(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + return isAsyncBefore(loopCharacteristics); + }; + const setValue = value => { + // overwrite the legacy `async` property, we will use the more explicit `asyncBefore` + const properties = { + 'camunda:asyncBefore': value, + 'camunda:async': undefined + }; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: loopCharacteristics, + properties + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'multiInstanceAsynchronousBefore', + label: translate('Asynchronous before'), + getValue, + setValue + }); +} +function MultiInstanceAsynchronousAfter(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + return isAsyncAfter(loopCharacteristics); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: loopCharacteristics, + properties: { + 'camunda:asyncAfter': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'multiInstanceAsynchronousAfter', + label: translate('Asynchronous after'), + getValue, + setValue + }); +} +function MultiInstanceExclusive(props) { + const { + element + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + return isExclusive(loopCharacteristics); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: loopCharacteristics, + properties: { + 'camunda:exclusive': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'multiInstanceExclusive', + label: translate('Exclusive'), + getValue, + setValue + }); +} +function MultiInstanceRetryTimeCycle(props) { + const { + element + } = props; + const bpmnFactory = useService('bpmnFactory'), + commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const loopCharacteristics = getLoopCharacteristics(element); + const getValue = () => { + const failedJobRetryTimeCycle = getExtensionElementsList(loopCharacteristics, 'camunda:FailedJobRetryTimeCycle')[0]; + return failedJobRetryTimeCycle && failedJobRetryTimeCycle.body; + }; + const setValue = value => { + const commands = []; + let extensionElements = loopCharacteristics.get('extensionElements'); + + // (1) ensure extension elements + if (!extensionElements) { + extensionElements = createElement('bpmn:ExtensionElements', { + values: [] + }, loopCharacteristics, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: loopCharacteristics, + properties: { + extensionElements + } + } + }); + } + + // (2) ensure failedJobRetryTimeCycle + let failedJobRetryTimeCycle = getExtensionElementsList(loopCharacteristics, 'camunda:FailedJobRetryTimeCycle')[0]; + if (!failedJobRetryTimeCycle) { + failedJobRetryTimeCycle = createElement('camunda:FailedJobRetryTimeCycle', {}, extensionElements, bpmnFactory); + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element: loopCharacteristics, + moddleElement: extensionElements, + properties: { + values: [...extensionElements.get('values'), failedJobRetryTimeCycle] + } + } + }); + } + + // (3) update failedJobRetryTimeCycle value + commands.push({ + cmd: 'element.updateModdleProperties', + context: { + element, + moddleElement: failedJobRetryTimeCycle, + properties: { + body: value + } + } + }); + + // (4) commit all updates + commandStack.execute('properties-panel.multi-command-executor', commands); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'multiInstanceRetryTimeCycle', + label: translate('Retry time cycle'), + getValue, + setValue, + debounce + }); +} + +// helper //////////////////////////// + +// generic /////////////////////////// + +/** + * isMultiInstanceSupported - check whether given element supports camunda specific props + * for multiInstance (ref. ). + * + * @param {djs.model.Base} element + * @return {boolean} + */ +function isMultiInstanceSupported(element) { + const loopCharacteristics = getLoopCharacteristics(element); + return !!loopCharacteristics && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(loopCharacteristics, 'camunda:Collectable'); +} - /** - * Creates a new element under a provided parent and updates / creates a reference to it in - * one atomic action. - * - * @method CreateAndReferenceElementHandler#execute - * - * @param {Object} context - * @param {djs.model.Base} context.element which is the context for the reference - * @param {moddle.referencingObject} context.referencingObject the object which creates the reference - * @param {String} context.referenceProperty the property of the referencingObject which makes the reference - * @param {moddle.newObject} context.newObject the new object to add - * @param {moddle.newObjectContainer} context.newObjectContainer the container for the new object - * - * @returns {Array} the updated element - */ - CreateAndReferenceElementHandler.prototype.execute = function(context) { +/** + * getProperty - get a property value of the loop characteristics. + * + * @param {djs.model.Base} element + * @param {string} propertyName + * + * @return {any} the property value + */ +function getProperty(element, propertyName) { + var loopCharacteristics = getLoopCharacteristics(element); + return loopCharacteristics && loopCharacteristics.get(propertyName); +} - var referencingObject = ensureNotNull(context.referencingObject, 'referencingObject'), - referenceProperty = ensureNotNull(context.referenceProperty, 'referenceProperty'), - newObject = ensureNotNull(context.newObject, 'newObject'), - newObjectContainer = ensureNotNull(context.newObjectContainer, 'newObjectContainer'), - newObjectParent = ensureNotNull(context.newObjectParent, 'newObjectParent'), - changed = [ context.element ]; // this will not change any diagram-js elements +/** + * getLoopCharacteristics - get loopCharacteristics of a given element. + * + * @param {djs.model.Base} element + * @return {ModdleElement | undefined} + */ +function getLoopCharacteristics(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return bo.loopCharacteristics; +} - // create new object - var referencedObject = elementHelper - .createElement(newObject.type, newObject.properties, newObjectParent, this._bpmnFactory); - context.referencedObject = referencedObject; +// collection - // add to containing list - newObjectContainer.push(referencedObject); +/** + * getCollection - get the 'camunda:collection' attribute value of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {string} the 'camunda:collection' value + */ +function getCollection(element) { + return getProperty(element, 'camunda:collection'); +} - // adjust reference attribute - context.previousReference = referencingObject[referenceProperty]; - referencingObject[referenceProperty] = referencedObject; +// elementVariable - context.changed = changed; +/** + * getElementVariable - get the 'camunda:elementVariable' attribute value of the loop characteristics. + * + * @param {djs.model.Base} element + * + * @return {string} the 'camunda:elementVariable' value + */ +function getElementVariable(element) { + return getProperty(element, 'camunda:elementVariable'); +} - // indicate changed on objects affected by the update - return changed; - }; +// asyncBefore asyncAfter - /** - * Reverts the update - * - * @method CreateAndReferenceElementHandler#revert - * - * @param {Object} context - * - * @returns {djs.mode.Base} the updated element - */ - CreateAndReferenceElementHandler.prototype.revert = function(context) { +/** + * Returns true if the attribute 'camunda:asyncBefore' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isAsyncBefore(bo) { + return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async')); +} - var referencingObject = context.referencingObject, - referenceProperty = context.referenceProperty, - previousReference = context.previousReference, - referencedObject = context.referencedObject, - newObjectContainer = context.newObjectContainer; +/** + * Returns true if the attribute 'camunda:asyncAfter' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isAsyncAfter(bo) { + return !!bo.get('camunda:asyncAfter'); +} - // reset reference - referencingObject.set(referenceProperty, previousReference); +/** + * Returns true if the attribute 'camunda:exclusive' is set + * to true. + * + * @param {ModdleElement} bo + * + * @return {boolean} a boolean value + */ +function isExclusive(bo) { + return !!bo.get('camunda:exclusive'); +} - // remove new element - newObjectContainer.splice(newObjectContainer.indexOf(referencedObject), 1); +/** + * isAsync - returns true if the attribute 'camunda:asyncAfter' or 'camunda:asyncBefore' + * is set to true. + * + * @param {ModdleElement} bo + * @return {boolean} + */ +function isAsync(bo) { + return isAsyncAfter(bo) || isAsyncBefore(bo); +} - return context.changed; - }; +// Checkbox +function checkboxIsEditedInverted(node) { + return node && !node.checked; +} +/** + * Cf. https://docs.camunda.org/manual/7.15/reference/bpmn20/subprocesses/call-activity/#passing-variables + */ +function OutMappingPropagationProps(props) { + const { + element + } = props; + if (!areOutMappingsSupported$1(element)) { + return []; + } + const entries = [{ + id: 'outMapping-propagation', + component: PropagateAll, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }]; + if (isPropagateAll(element)) { + entries.push({ + id: 'outMapping-propagation-local', + component: Local, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isCheckboxEntryEdited + }); + } + return entries; +} +function PropagateAll(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const bpmnFactory = useService('bpmnFactory'); + const translate = useService('translate'); + const getValue = () => { + return isPropagateAll(element); + }; + const setValue = value => { + if (value) { + addOutMapping(); + } else { + removeOutMapping(); + } + }; + function addOutMapping() { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const mapping = createElement('camunda:Out', { + variables: 'all' + }, null, bpmnFactory); + addExtensionElements(element, businessObject, mapping, bpmnFactory, commandStack); + } + function removeOutMapping() { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const mappings = findRelevantOutMappings(element); + removeExtensionElements(element, businessObject, mappings, commandStack); + } + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + id: 'outMapping-propagation', + label: translate('Propagate all variables'), + getValue, + setValue + }); +} +function Local(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const mapping = findRelevantOutMappings(element)[0]; + const getValue = () => { + return mapping.get('camunda:local'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: mapping, + properties: { + local: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'outMapping-propagation-local', + label: translate('Local'), + getValue, + setValue + }); +} + +// helper ////////////////////////// + +function areOutMappingsSupported$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity'); +} +function getOutMappings$1(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return getExtensionElementsList(businessObject, 'camunda:Out'); +} +function findRelevantOutMappings(element) { + const inMappings = getOutMappings$1(element); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.filter)(inMappings, function (mapping) { + const variables = mapping.get('variables'); + return variables && variables === 'all'; + }); +} +function isPropagateAll(element) { + const mappings = findRelevantOutMappings(element); + return !!mappings.length; +} + +/** + * Cf. https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-elements/#out + */ +function OutMappingProps({ + element, + injector +}) { + if (!areOutMappingsSupported(element)) { + return null; + } + const variableMappings = getOutMappings(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = variableMappings.map((mapping, index) => { + const id = element.id + '-outMapping-' + index; + return { + id, + label: mapping.get('target') || '', + entries: InOutMapping({ + idPrefix: id, + element, + mapping + }), + autoFocusEntry: id + '-target', + remove: removeFactory$1({ + commandStack, + element, + mapping + }) + }; + }); + return { + items, + add: addFactory$1({ + bpmnFactory, + commandStack, + element + }) + }; +} +function removeFactory$1({ + commandStack, + element, + mapping +}) { + return function (event) { + event.stopPropagation(); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + removeExtensionElements(element, businessObject, mapping, commandStack); + }; +} +function addFactory$1({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const newMapping = createElement('camunda:Out', { + source: '' // source is the default type + }, null, bpmnFactory); + addExtensionElements(element, businessObject, newMapping, bpmnFactory, commandStack); + }; +} + +// helper /////////////// + +function getOutMappings(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const mappings = getExtensionElementsList(businessObject, 'camunda:Out'); + + // only retrieve relevant mappings here, others are handled in other groups + // mapping.businessKey => camunda-platform/CallAvtivityProps + // mapping.variables => camunda-platform/OutMappingPropagationProps + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.filter)(mappings, function (mapping) { + return !mapping.businessKey && !(mapping.variables && mapping.variables === 'all'); + }); +} +function areOutMappingsSupported(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:CallActivity'); +} + +function OutputProps({ + element, + injector +}) { + if (!areOutputParametersSupported(element)) { + return null; + } + const outputParameters = getOutputParameters(element) || []; + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const items = outputParameters.map((parameter, index) => { + const id = element.id + '-outputParameter-' + index; + return { + id, + label: parameter.get('name') || '', + entries: InputOutputParameter({ + idPrefix: id, + element, + parameter + }), + autoFocusEntry: id + '-name', + remove: removeFactory({ + commandStack, + element, + parameter + }) + }; + }); + return { + items, + add: addFactory({ + bpmnFactory, + commandStack, + element + }), + shouldSort: false + }; +} +function removeFactory({ + commandStack, + element, + parameter +}) { + return function (event) { + event.stopPropagation(); + const inputOutput = getInputOutput(element); + if (!inputOutput) { + return; + } + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: inputOutput, + properties: { + outputParameters: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(inputOutput.get('outputParameters'), parameter) + } + }); + }; +} +function addFactory({ + bpmnFactory, + commandStack, + element +}) { + return function (event) { + event.stopPropagation(); + commandStack.execute('properties-panel.multi-command-executor', AddParameterCmd(element, 'camunda:OutputParameter', bpmnFactory)); + }; +} + +function TimerProps(props) { + const { + element, + listener, + idPrefix + } = props; + let { + timerEventDefinition + } = props; + if (!timerEventDefinition) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + timerEventDefinition = getTimerEventDefinition(businessObject); + } + const timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); + + // (1) Only show for supported elements + if (!isTimerSupported(element) && !isTimerSupportedOnListener(listener)) { + return []; + } + + // (2) Provide entries, have a value only if selection was made + const entries = []; + entries.push({ + id: getId(idPrefix, 'timerEventDefinitionType'), + component: TimerEventDefinitionType, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isSelectEntryEdited, + timerEventDefinition, + timerEventDefinitionType + }); + if (timerEventDefinitionType) { + entries.push({ + id: getId(idPrefix, 'timerEventDefinitionValue'), + component: TimerEventDefinitionValue, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + timerEventDefinition, + timerEventDefinitionType + }); + } + return entries; +} + +/** + * TimerEventDefinitionType - Generic select entry allowing to select a specific + * timerEventDefintionType. To be used together with timerEventDefinitionValue. + * + * @param {type} props + * @return {SelectEntry} + */ +function TimerEventDefinitionType(props) { + const { + element, + timerEventDefinition, + timerEventDefinitionType + } = props; + const commandStack = useService('commandStack'), + bpmnFactory = useService('bpmnFactory'), + translate = useService('translate'); + const getValue = () => { + return timerEventDefinitionType || ''; + }; + const setValue = value => { + // (1) Check if value is different to current type + if (value === timerEventDefinitionType) { + return; + } + + // (2) Create empty formalExpression element + const formalExpression = bpmnFactory.create('bpmn:FormalExpression', { + body: undefined + }); + formalExpression.$parent = timerEventDefinition; + + // (3) Set the value for selected timerEventDefinitionType + const newProps = { + timeDuration: undefined, + timeDate: undefined, + timeCycle: undefined + }; + if (value !== '') { + newProps[value] = formalExpression; + } + + // (4) Execute businessObject update + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventDefinition, + properties: newProps + }); + }; + const getOptions = element => { + return [{ + value: '', + label: translate('') + }, { + value: 'timeDate', + label: translate('Date') + }, { + value: 'timeDuration', + label: translate('Duration') + }, { + value: 'timeCycle', + label: translate('Cycle') + }]; + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry)({ + element, + id: 'timerEventDefinitionType', + label: translate('Type'), + getValue, + setValue, + getOptions + }); +} + +/** + * TimerEventDefinitionValue - Generic textField entry allowing to specify the + * timerEventDefintionValue based on the set timerEventDefintionType. To be used + * together with timerEventDefinitionType. + * + * @param {type} props + * @return {TextFieldEntry} + */ +function TimerEventDefinitionValue(props) { + const { + element, + timerEventDefinition, + timerEventDefinitionType + } = props; + const commandStack = useService('commandStack'), + translate = useService('translate'), + debounce = useService('debounceInput'); + const timerEventFormalExpression = timerEventDefinition.get(timerEventDefinitionType); + const getValue = () => { + return timerEventFormalExpression && timerEventFormalExpression.get('body'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: timerEventFormalExpression, + properties: { + body: value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'timerEventDefinitionValue', + label: translate('Value'), + getValue, + setValue, + debounce, + tooltip: getTimerEventDefinitionValueDescription(timerEventDefinitionType, translate) + }); +} + +// helper ////////////////////////// + +function getTimerEventDefinitionValueDescription(timerDefinitionType, translate) { + switch (timerDefinitionType) { + case 'timeDate': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A specific point in time defined as ISO 8601 combined date and time representation.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-01T12:00:00Z" + }), " - ", translate('UTC time')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "2019-10-02T08:09:40+02:00" + }), " - ", translate('UTC plus 2 hours zone offset')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-date", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + case 'timeCycle': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A cycle defined as ISO 8601 repeating intervals format, or a cron expression.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R5/PT10S" + }), " - ", translate('every 10 seconds, up to 5 times')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "R/P1D" + }), " - ", translate('every day, infinitely')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "0 0 9-17 * * MON-FRI" + }), " - ", translate('every hour on the hour from 9-5 p.m. UTC Monday-Friday')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-cycle", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + case 'timeDuration': + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { + children: translate('A time duration defined as ISO 8601 durations format.') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("ul", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT15S" + }), " - ", translate('15 seconds')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "PT1H30M" + }), " - ", translate('1 hour and 30 minutes')] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "P14D" + }), " - ", translate('14 days')] + })] + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-duration", + target: "_blank", + rel: "noopener", + children: translate('Documentation: Timer events') + })] + }); + } +} +function isTimerSupportedOnListener(listener) { + return listener && (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(listener, 'camunda:TaskListener') && getTimerEventDefinition(listener); +} +function getId(idPrefix, id) { + return idPrefix ? idPrefix + id : id; +} + +const LISTENER_ALLOWED_TYPES = ['bpmn:Activity', 'bpmn:Event', 'bpmn:Gateway', 'bpmn:SequenceFlow', 'bpmn:Process', 'bpmn:Participant']; +const SCRIPT_PROPS = { + 'script': undefined, + 'resource': undefined, + 'scriptFormat': undefined +}; +const CLASS_PROPS = { + 'class': undefined +}; +const EXPRESSION_PROPS = { + 'expression': undefined +}; +const DELEGATE_EXPRESSION_PROPS = { + 'delegateExpression': undefined +}; +const DEFAULT_PROPS = { + ...SCRIPT_PROPS, + ...CLASS_PROPS, + ...EXPRESSION_PROPS, + ...DELEGATE_EXPRESSION_PROPS +}; +const DEFAULT_EVENT_PROPS = { + 'eventDefinitions': undefined, + 'event': undefined +}; +const IMPLEMENTATION_TYPE_TO_LABEL = { + class: 'Java class', + expression: 'Expression', + delegateExpression: 'Delegate expression', + script: 'Script' +}; +const EVENT_TO_LABEL = { + start: 'Start', + end: 'End', + take: 'Take', + create: 'Create', + assignment: 'Assignment', + complete: 'Complete', + delete: 'Delete', + update: 'Update', + timeout: 'Timeout' +}; + +/** + * Cf. https://docs.camunda.org/manual/latest/user-guide/process-engine/delegation-code/#execution-listener + */ +function ExecutionListenerProps({ + element, + injector +}) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, LISTENER_ALLOWED_TYPES)) { + return; + } + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && !element.businessObject.processRef) { + return; + } + const businessObject = getListenersContainer(element); + const listeners = getExtensionElementsList(businessObject, 'camunda:ExecutionListener'); + return { + items: listeners.map((listener, index) => { + const id = `${element.id}-executionListener-${index}`; + + // @TODO(barmac): Find a way to pass translate for internationalized label. + return { + id, + label: getListenerLabel(listener), + entries: ExecutionListener({ + idPrefix: id, + element, + listener + }), + remove: removeListenerFactory({ + element, + listener, + commandStack + }) + }; + }), + add: addExecutionListenerFactory({ + bpmnFactory, + commandStack, + element + }) + }; +} +function ExecutionListener(props) { + const { + idPrefix, + element, + listener + } = props; + return [{ + id: `${idPrefix}-eventType`, + component: EventType, + listener + }, { + id: `${idPrefix}-listenerType`, + component: ListenerType, + listener + }, ...ImplementationDetails({ + idPrefix, + element, + listener + }), { + id: `${idPrefix}-fields`, + component: Fields, + listener + }]; +} +function TaskListenerProps({ + element, + injector +}) { + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:UserTask')) { + return; + } + const bpmnFactory = injector.get('bpmnFactory'), + commandStack = injector.get('commandStack'); + const businessObject = getListenersContainer(element); + const listeners = getExtensionElementsList(businessObject, 'camunda:TaskListener'); + return { + items: listeners.map((listener, index) => { + const id = `${element.id}-taskListener-${index}`; + + // @TODO(barmac): Find a way to pass translate for internationalized label. + return { + id, + label: getListenerLabel(listener), + entries: TaskListener({ + idPrefix: id, + element, + listener + }), + remove: removeListenerFactory({ + element, + listener, + commandStack + }) + }; + }), + add: addTaskListenerFactory({ + bpmnFactory, + commandStack, + element + }) + }; +} +function TaskListener(props) { + const { + idPrefix, + element, + listener + } = props; + return [{ + id: `${idPrefix}-eventType`, + component: EventType, + listener + }, { + id: `${idPrefix}-listenerId`, + component: ListenerId, + listener + }, { + id: `${idPrefix}-listenerType`, + component: ListenerType, + listener + }, ...ImplementationDetails({ + idPrefix, + element, + listener + }), ...EventTypeDetails({ + idPrefix, + element, + listener + }), { + id: `${idPrefix}-fields`, + component: Fields, + listener + }]; +} +function removeListenerFactory({ + element, + listener, + commandStack +}) { + return function removeListener(event) { + event.stopPropagation(); + removeExtensionElements(element, getListenersContainer(element), listener, commandStack); + }; +} +function EventType({ + id, + element, + listener +}) { + const translate = useService('translate'); + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + function getValue() { + return listener.get('event'); + } + function setValue(value) { + const properties = getDefaultEventTypeProperties(value, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: listener, + properties + }); + } + function getOptions() { + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(listener, 'camunda:TaskListener')) { + return [{ + value: 'create', + label: translate('create') + }, { + value: 'assignment', + label: translate('assignment') + }, { + value: 'complete', + label: translate('complete') + }, { + value: 'delete', + label: translate('delete') + }, { + value: 'update', + label: translate('update') + }, { + value: 'timeout', + label: translate('timeout') + }]; + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow')) { + return [{ + value: 'take', + label: translate('take') + }]; + } + return [{ + value: 'start', + label: translate('start') + }, { + value: 'end', + label: translate('end') + }]; + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + id: id, + label: translate('Event type'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function ListenerId({ + id, + element, + listener +}) { + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + let options = { + element, + id: id, + label: translate('Listener ID'), + debounce, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited, + setValue: value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: listener, + properties: { + 'camunda:id': value + } + }); + }, + getValue: () => { + return listener.get('camunda:id'); + } + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)(options); +} +function ListenerType({ + id, + element, + listener +}) { + const modeling = useService('modeling'); + const translate = useService('translate'); + const bpmnFactory = useService('bpmnFactory'); + function getValue() { + return getListenerType(listener); + } + function setValue(value) { + const properties = getDefaultImplementationProperties(value, bpmnFactory); + modeling.updateModdleProperties(element, listener, properties); + } + function getOptions() { + return getListenerTypeOptions(translate); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.SelectEntry, { + id: id, + label: translate('Listener type'), + getValue: getValue, + setValue: setValue, + getOptions: getOptions + }); +} +function ImplementationDetails(props) { + const { + idPrefix, + element, + listener + } = props; + const type = getListenerType(listener); + if (type === 'class') { + return [{ + id: getPrefixedId(idPrefix, 'javaClass'), + component: JavaClass, + businessObject: listener + }]; + } else if (type === 'expression') { + return [{ + id: getPrefixedId(idPrefix, 'expression'), + component: Expression, + businessObject: listener + }]; + } else if (type === 'delegateExpression') { + return [{ + id: getPrefixedId(idPrefix, 'delegateExpression'), + component: DelegateExpression, + businessObject: listener + }]; + } else if (type === 'script') { + return ScriptProps({ + element, + script: listener.get('script'), + prefix: idPrefix + }); + } + + // should never happen + return []; +} +function EventTypeDetails(props) { + const { + idPrefix, + element, + listener + } = props; + const type = listener.get('event'); + if (type === 'timeout') { + return TimerProps({ + element, + listener, + timerEventDefinition: getTimerEventDefinition$1(listener), + idPrefix: idPrefix + }); + } + return []; +} +function Field(props) { + const { + element, + id: idPrefix, + index, + item: field, + open + } = props; + const fieldId = `${idPrefix}-field-${index}`; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CollapsibleEntry, { + id: fieldId, + element: element, + entries: FieldInjection({ + element, + field, + idPrefix: fieldId + }), + label: field.get('name') || '', + open: open + }); +} +function Fields(props) { + const { + id, + element, + listener + } = props; + const bpmnFactory = useService('bpmnFactory'); + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const fields = listener.get('fields'); + function addField() { + const field = createElement('camunda:Field', {}, listener, bpmnFactory); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: listener, + properties: { + fields: [...listener.get('fields'), field] + } + }); + } + function removeField(field) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: listener, + properties: { + fields: (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.without)(listener.get('fields'), field) + } + }); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListEntry, { + id: id, + element: element, + label: translate('Field injection'), + items: fields, + component: Field, + onAdd: addField, + onRemove: removeField, + compareFn: compareName, + autoFocusEntry: true + }); +} +function addListenerFactory({ + bpmnFactory, + commandStack, + element, + listenerGroup +}) { + return function (event) { + event.stopPropagation(); + const listener = bpmnFactory.create(listenerGroup, { + event: getDefaultEvent(element, listenerGroup), + class: '' + }); + const businessObject = getListenersContainer(element); + addExtensionElements(element, businessObject, listener, bpmnFactory, commandStack); + }; +} +function addTaskListenerFactory(props) { + return addListenerFactory({ + ...props, + listenerGroup: 'camunda:TaskListener' + }); +} +function addExecutionListenerFactory(props) { + return addListenerFactory({ + ...props, + listenerGroup: 'camunda:ExecutionListener' + }); +} + +// helper + +/** + * Get a readable label for a listener. + * + * @param {ModdleElement} listener + * @param {string => string} [translate] + */ +function getListenerLabel(listener, translate = value => value) { + const event = listener.get('event'); + const implementationType = getListenerType(listener); + return `${translate(EVENT_TO_LABEL[event])}: ${translate(IMPLEMENTATION_TYPE_TO_LABEL[implementationType])}`; +} +function getListenerTypeOptions(translate) { + return Object.entries(IMPLEMENTATION_TYPE_TO_LABEL).map(([value, label]) => ({ + value, + label: translate(label) + })); +} +function getListenerType(listener) { + return getImplementationType(listener); +} +function getDefaultEvent(element, listenerGroup) { + if (listenerGroup === 'camunda:TaskListener') return 'create'; + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SequenceFlow') ? 'take' : 'start'; +} +function getDefaultImplementationProperties(type, bpmnFactory) { + switch (type) { + case 'class': + return { + ...DEFAULT_PROPS, + 'class': '' + }; + case 'expression': + return { + ...DEFAULT_PROPS, + 'expression': '' + }; + case 'delegateExpression': + return { + ...DEFAULT_PROPS, + 'delegateExpression': '' + }; + case 'script': + return { + ...DEFAULT_PROPS, + 'script': bpmnFactory.create('camunda:Script') + }; + } +} +function getDefaultEventTypeProperties(type, bpmnFactory) { + switch (type) { + case 'timeout': + return { + ...DEFAULT_EVENT_PROPS, + eventDefinitions: [bpmnFactory.create('bpmn:TimerEventDefinition')], + event: type + }; + default: + return { + ...DEFAULT_EVENT_PROPS, + event: type + }; + } +} +function getPrefixedId(prefix, id) { + return `${prefix}-${id}`; +} +function compareName(field, anotherField) { + const [name = '', anotherName = ''] = [field.name, anotherField.name]; + return name === anotherName ? 0 : name > anotherName ? 1 : -1; +} +function getListenersContainer(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return businessObject.get('processRef') || businessObject; +} + +function ProcessVariablesEntry(props) { + const { + element + } = props; + const [variables, setVariables] = (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + (0,_bpmn_io_properties_panel_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(async () => { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const rootElement = getRootElement(businessObject); + const scope = getScope(element); + const rawVariables = await (0,_bpmn_io_extract_process_variables__WEBPACK_IMPORTED_MODULE_8__.getVariablesForScope)(scope, rootElement); + const withName = populateElementNames(sortByName(rawVariables)); + setVariables(withName); + }, [element]); + if (!variables.length) { + return null; + } + const byScope = groupByScope(variables); + const multiScope = isMultiScope(byScope); + let variableItems = []; + + // (2) get variables to display + if (multiScope) { + // (2a) multiple scopes, sub scopes first + // assumption: variables extractor fetches parent variables first + const reversed = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.map)(reverse((0,min_dash__WEBPACK_IMPORTED_MODULE_12__.keys)(byScope)), scopeKey => byScope[scopeKey]); + variableItems = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.flatten)(reversed); + } else { + // (2b) single scope + variableItems = variables; + } + const items = variableItems.map((variable, index) => { + const id = element.id + '-variable-' + index; + return { + id, + label: variable.name, + entries: [...ProcessVariableItem({ + idPrefix: id, + multiScope, + variable + })] + }; + }); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, { + ...props, + items: items, + shouldSort: false + }); +} +function ProcessVariablesProps(props) { + const { + element + } = props; + if (!canHaveProcessVariables(element)) { + return null; + } + return { + component: ProcessVariablesEntry, + shouldSort: false + }; +} +function ProcessVariableItem(props) { + const { + idPrefix, + multiScope, + variable + } = props; + let entries = []; + if (multiScope) { + entries.push({ + id: idPrefix + '-scope', + component: Scope, + idPrefix, + variable + }); + } + entries.push({ + id: idPrefix + '-createdIn', + component: CreatedIn, + idPrefix, + variable + }); + return entries; +} +function Scope(props) { + const { + idPrefix, + variable + } = props; + const translate = useService('translate'); + const id = idPrefix + '-scope'; + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + "data-entry-id": id, + class: "bio-properties-panel-entry", + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", { + style: "font-weight: bold", + class: "bio-properties-panel-label", + children: translate('Scope') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label", { + id: prefixId(id), + class: "bio-properties-panel-label", + children: variable.scope + })] + }); +} +function CreatedIn(props) { + const { + idPrefix, + variable + } = props; + const translate = useService('translate'); + const id = idPrefix + '-createdIn'; + const origin = variable.origin.join(', '); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + "data-entry-id": id, + class: "bio-properties-panel-entry", + children: [(0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", { + style: "font-weight: bold", + class: "bio-properties-panel-label", + children: translate('Created in') + }), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label", { + id: prefixId(id), + class: "bio-properties-panel-label", + children: origin + })] + }); +} + +// helper ////////////////////// + +function canHaveProcessVariables(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.isAny)(element, ['bpmn:Process', 'bpmn:SubProcess']) || (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef'); +} +function getRootElement(element) { + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:Participant')) { + return businessObject.processRef; + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(businessObject, 'bpmn:Process')) { + return businessObject; + } + let parent = businessObject; + while (parent.$parent && !(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(parent, 'bpmn:Process')) { + parent = parent.$parent; + } + return parent; +} +function getScope(element) { + const bo = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant')) { + return bo.processRef.id; + } + return bo.id; +} +function sortByName(variables) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.sortBy)(variables, function (variable) { + return variable.name; + }); +} +function groupByScope(variables) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.groupBy)(variables, 'scope'); +} +function populateElementNames(variables) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.forEach)(variables, function (variable) { + const names = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.map)(variable.origin, function (element) { + return element.name || element.id; + }); + variable.origin = names; + variable.scope = variable.scope.name || variable.scope.id; + }); + return variables; +} +function isMultiScope(scopedVariables) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.keys)(scopedVariables).length > 1; +} +function reverse(array) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.map)(array, function (a, i) { + return array[array.length - 1 - i]; + }); +} +function prefixId(id) { + return `bio-properties-panel-${id}`; +} + +function ScriptTaskProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ScriptTask')) { + return []; + } + const entries = [...ScriptProps({ + element + })]; + entries.push({ + id: 'scriptResultVariable', + component: ResultVariable, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }); + return entries; +} +function ResultVariable(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:resultVariable'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:resultVariable': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'scriptResultVariable', + label: translate('Result variable'), + getValue, + setValue, + debounce + }); +} + +function TasklistProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const isEdited = node => { + return node && !node.checked; + }; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef'))) { + return []; + } + return [{ + id: 'isStartableInTasklist', + component: Startable, + isEdited + }]; +} +function Startable(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const process = getProcess$1(element); + const getValue = () => { + return process.get('camunda:isStartableInTasklist'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + 'camunda:isStartableInTasklist': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.CheckboxEntry)({ + element, + id: 'isStartableInTasklist', + label: translate('Startable'), + getValue, + setValue + }); +} + +// helper ////////////////// + +function getProcess$1(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element) : (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef'); +} + +/** + * Cf. https://docs.camunda.org/manual/latest/reference/bpmn20/tasks/user-task/ + */ +function UserAssignmentProps(props) { + const { + element + } = props; + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'camunda:Assignable')) { + return []; + } + return [{ + id: 'assignee', + component: Assignee, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'candidateGroups', + component: CandidateGroups, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'candidateUsers', + component: CandidateUsers, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'dueDate', + component: DueDate, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'followUpDate', + component: FollowUpDate, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }, { + id: 'priority', + component: Priority, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function Assignee(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:assignee'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:assignee': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'assignee', + label: translate('Assignee'), + getValue, + setValue, + debounce + }); +} +function CandidateUsers(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:candidateUsers'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:candidateUsers': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'candidateUsers', + label: translate('Candidate users'), + getValue, + setValue, + debounce + }); +} +function CandidateGroups(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:candidateGroups'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:candidateGroups': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'candidateGroups', + label: translate('Candidate groups'), + getValue, + setValue, + debounce + }); +} +function DueDate(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:dueDate'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:dueDate': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'dueDate', + label: translate('Due date'), + description: translate('The due date as an EL expression (e.g. ${someDate}) or an ISO date (e.g. 2015-06-26T09:54:00).'), + getValue, + setValue, + debounce + }); +} +function FollowUpDate(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:followUpDate'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:followUpDate': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'followUpDate', + label: translate('Follow up date'), + description: translate('The follow up date as an EL expression (e.g. ${someDate}) or an ' + 'ISO date (e.g. 2015-06-26T09:54:00).'), + getValue, + setValue, + debounce + }); +} +function Priority(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + const getValue = () => { + return businessObject.get('camunda:priority'); + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + 'camunda:priority': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'priority', + label: translate('Priority'), + getValue, + setValue, + debounce + }); +} + +function VersionTagProps(props) { + const { + element + } = props; + const businessObject = (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element); + if (!(0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') && !((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Participant') && businessObject.get('processRef'))) { + return []; + } + return [{ + id: 'versionTag', + component: VersionTag, + isEdited: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.isTextFieldEntryEdited + }]; +} +function VersionTag(props) { + const { + element + } = props; + const commandStack = useService('commandStack'); + const translate = useService('translate'); + const debounce = useService('debounceInput'); + const process = getProcess(element); + const getValue = () => { + return process.get('camunda:versionTag') || ''; + }; + const setValue = value => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + 'camunda:versionTag': value + } + }); + }; + return (0,_bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.TextFieldEntry)({ + element, + id: 'versionTag', + label: translate('Version tag'), + getValue, + setValue, + debounce + }); +} + +// helper ////////////////// + +function getProcess(element) { + return (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:Process') ? (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element) : (0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.getBusinessObject)(element).get('processRef'); +} + +const LOW_PRIORITY = 500; +const CAMUNDA_PLATFORM_GROUPS = [HistoryCleanupGroup, TasklistGroup, CandidateStarterGroup, ImplementationGroup, ExternalTaskGroup, ProcessVariablesGroup, ErrorsGroup, UserAssignmentGroup, FormGroup, FormDataGroup, TaskListenerGroup, StartInitiatorGroup, ScriptGroup, ConditionGroup, CallActivityGroup, AsynchronousContinuationsGroup, JobExecutionGroup, InMappingPropagationGroup, InMappingGroup, InputGroup, ConnectorInputGroup, OutMappingPropagationGroup, OutMappingGroup, OutputGroup, ConnectorOutputGroup, ExecutionListenerGroup, ExtensionPropertiesGroup, FieldInjectionGroup, BusinessKeyGroup]; + +/** + * Provides `camunda` namespace properties. + * + * @example + * ```javascript + * import BpmnModeler from 'bpmn-js/lib/Modeler'; + * import { + * BpmnPropertiesPanelModule, + * BpmnPropertiesProviderModule, + * CamundaPlatformPropertiesProviderModule + * } from 'bpmn-js-properties-panel'; + * + * const modeler = new BpmnModeler({ + * container: '#canvas', + * propertiesPanel: { + * parent: '#properties' + * }, + * additionalModules: [ + * BpmnPropertiesPanelModule, + * BpmnPropertiesProviderModule, + * CamundaPlatformPropertiesProviderModule + * ] + * }); + * ``` + */ +class CamundaPlatformPropertiesProvider { + constructor(propertiesPanel, injector) { + propertiesPanel.registerProvider(LOW_PRIORITY, this); + this._injector = injector; + } + getGroups(element) { + return groups => { + // (1) add Camunda Platform specific groups + groups = groups.concat(this._getGroups(element)); + + // (2) update existing groups with Camunda Platform specific properties + updateGeneralGroup(groups, element); + updateErrorGroup(groups, element); + updateEscalationGroup(groups, element); + updateMultiInstanceGroup(groups, element); + updateTimerGroup(groups, element); + + // (3) move groups given specific priorities + moveImplementationGroup(groups); + return groups; + }; + } + _getGroups(element) { + const groups = CAMUNDA_PLATFORM_GROUPS.map(createGroup => createGroup(element, this._injector)); + + // contract: if a group returns null, it should not be displayed at all + return groups.filter(group => group !== null); + } +} +CamundaPlatformPropertiesProvider.$inject = ['propertiesPanel', 'injector']; + +/** + * This ensures the group always locates after + */ +function moveImplementationGroup(groups) { + const documentationGroupIdx = findGroupIndex(groups, 'documentation'); + if (documentationGroupIdx < 0) { + return; + } + return moveGroup(groups, 'CamundaPlatform__Implementation', documentationGroupIdx + 1); +} +function updateGeneralGroup(groups, element) { + const generalGroup = findGroup(groups, 'general'); + if (!generalGroup) { + return; + } + const { + entries + } = generalGroup; + + // (1) add version tag before executable (if existing) + const executableEntry = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.findIndex)(entries, entry => entry.id === 'isExecutable'); + const insertIndex = executableEntry >= 0 ? executableEntry : entries.length; + entries.splice(insertIndex, 0, ...VersionTagProps({ + element + })); +} +function updateErrorGroup(groups, element) { + const errorGroup = findGroup(groups, 'error'); + if (!errorGroup) { + return; + } + const { + entries + } = errorGroup; + ErrorProps({ + element, + entries + }); +} +function updateMultiInstanceGroup(groups, element) { + const multiInstanceGroup = findGroup(groups, 'multiInstance'); + if (!multiInstanceGroup) { + return; + } + const { + entries + } = multiInstanceGroup; + MultiInstanceProps({ + element, + entries + }); +} +function updateEscalationGroup(groups, element) { + const escalationGroup = findGroup(groups, 'escalation'); + if (!escalationGroup) { + return; + } + const { + entries + } = escalationGroup; + EscalationProps({ + element, + entries + }); +} +function updateTimerGroup(groups, element) { + const timerEventGroup = findGroup(groups, 'timer'); + if (!timerEventGroup) { + return; + } + timerEventGroup.entries = [...TimerProps({ + element + })]; +} +function ImplementationGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Implementation'), + id: 'CamundaPlatform__Implementation', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...ImplementationProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ErrorsGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Errors'), + id: 'CamundaPlatform__Errors', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ErrorsProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function UserAssignmentGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('User assignment'), + id: 'CamundaPlatform__UserAssignment', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...UserAssignmentProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ScriptGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Script'), + id: 'CamundaPlatform__Script', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...ScriptTaskProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function CallActivityGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Called element'), + id: 'CamundaPlatform__CallActivity', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...CallActivityProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ConditionGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Condition'), + id: 'CamundaPlatform__Condition', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...ConditionProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function StartInitiatorGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Start initiator'), + id: 'CamundaPlatform__StartInitiator', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...InitiatorProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ExternalTaskGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('External task'), + id: 'CamundaPlatform__ExternalTask', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...ExternalTaskPriorityProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function AsynchronousContinuationsGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Asynchronous continuations'), + id: 'CamundaPlatform__AsynchronousContinuations', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...AsynchronousContinuationsProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function JobExecutionGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Job execution'), + id: 'CamundaPlatform__JobExecution', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...JobExecutionProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function CandidateStarterGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Candidate starter'), + id: 'CamundaPlatform__CandidateStarter', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...CandidateStarterProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function FieldInjectionGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Field injections'), + id: 'CamundaPlatform__FieldInjection', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...FieldInjectionProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function HistoryCleanupGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('History cleanup'), + id: 'CamundaPlatform__HistoryCleanup', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...HistoryCleanupProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function TasklistGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Tasklist'), + id: 'CamundaPlatform__Tasklist', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...TasklistProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function InMappingGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('In mappings'), + id: 'CamundaPlatform__InMapping', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...InMappingProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function InMappingPropagationGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('In mapping propagation'), + id: 'CamundaPlatform__InMappingPropagation', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...InMappingPropagationProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function OutMappingGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Out mappings'), + id: 'CamundaPlatform__OutMapping', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...OutMappingProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function OutMappingPropagationGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Out mapping propagation'), + id: 'CamundaPlatform__OutMappingPropagation', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...OutMappingPropagationProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ProcessVariablesGroup(element, injector) { + const translate = injector.get('translate'); + const variableProps = ProcessVariablesProps({ + element, + injector + }); + if (!variableProps) { + return null; + } + const group = { + label: translate('Process variables'), + id: 'CamundaPlatform__ProcessVariables', + ...variableProps + }; + return group; +} +function FormDataGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Form fields'), + id: 'CamundaPlatform__FormData', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...FormDataProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function BusinessKeyGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Business key'), + id: 'CamundaPlatform__BusinessKey', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...BusinessKeyProps$1({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function FormGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Forms'), + id: 'CamundaPlatform__Form', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.Group, + entries: [...FormProps({ + element + })] + }; + if (group.entries.length) { + return group; + } + return null; +} +function ExecutionListenerGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Execution listeners'), + id: 'CamundaPlatform__ExecutionListener', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ExecutionListenerProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function TaskListenerGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Task listeners'), + id: 'CamundaPlatform__TaskListener', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...TaskListenerProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function InputGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Inputs'), + id: 'CamundaPlatform__Input', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...InputProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function OutputGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Outputs'), + id: 'CamundaPlatform__Output', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...OutputProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function ConnectorInputGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Connector inputs'), + id: 'CamundaPlatform__ConnectorInput', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ConnectorInputProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function ConnectorOutputGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Connector outputs'), + id: 'CamundaPlatform__ConnectorOutput', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ConnectorOutputProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} +function ExtensionPropertiesGroup(element, injector) { + const translate = injector.get('translate'); + const group = { + label: translate('Extension properties'), + id: 'CamundaPlatform__ExtensionProperties', + component: _bpmn_io_properties_panel__WEBPACK_IMPORTED_MODULE_1__.ListGroup, + ...ExtensionPropertiesProps({ + element, + injector + }) + }; + if (group.items) { + return group; + } + return null; +} + +// helper ///////////////////// + +function findGroup(groups, id) { + return groups.find(g => g.id === id); +} +function findGroupIndex(groups, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.findIndex)(groups, g => g.id === id); +} +function moveGroup(groups, id, position) { + const groupIndex = findGroupIndex(groups, id); + if (position < 0 || groupIndex < 0) { + return; + } + return (0,array_move__WEBPACK_IMPORTED_MODULE_7__.arrayMoveMutable)(groups, groupIndex, position); +} + +var index = { + __init__: ['camundaPlatformPropertiesProvider'], + camundaPlatformPropertiesProvider: ['type', CamundaPlatformPropertiesProvider] +}; + +/* eslint-disable react-hooks/rules-of-hooks */ +const TooltipProvider = { + 'group-assignmentDefinition': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define who the task is assigned to. One or all of the following attributes can be specified simultaneously. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/user-tasks/#assignments", + target: "_blank", + rel: "noopener", + title: translate('User task documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-condition': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define a boolean condition expression that defines when this flow is taken. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/exclusive-gateways/#conditions", + target: "_blank", + rel: "noopener", + title: translate('Conditions documentation'), + children: translate('Learn how to define conditions.') + })] + }); + }, + 'group-businessRuleImplementation': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Evaluate a business rule, for example a DMN. To add a custom implementation, use a job worker. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/business-rule-tasks/#defining-a-task", + target: "_blank", + rel: "noopener", + title: translate('Business rule task documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-scriptImplementation': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Implement a script task using an inline FEEL expression. To add a custom implementation, use a job worker. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/script-tasks/#defining-a-script-task", + target: "_blank", + rel: "noopener", + title: translate('Script task documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-form': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Link or embed a form created with the Camunda Forms editor. To associate a custom form, application, or URL to the user task, specify a form key. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/guides/utilizing-forms/#connect-your-form-to-a-bpmn-diagram", + target: "_blank", + rel: "noopener", + title: translate('User task form documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-message': element => { + const translate = useService('translate'); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ReceiveTask')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define the name of the message (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "Money collected" + }), translate(') and the '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "correlationKey" + }), translate(' expression (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "= orderId" + }), translate(')'), translate(' to subscribe to. '), translate('Learn more how to '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/send-tasks", + target: "_blank", + rel: "noopener", + title: translate('Send task documentation'), + children: translate('send ') + }), translate('and '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/receive-tasks", + target: "_blank", + rel: "noopener", + title: translate('Receive task documentation'), + children: translate('receive messages. ') + })] + }); + } + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define the name of the message (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "Money collected" + }), translate(') and the '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "correlationKey" + }), translate(' expression (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "= orderId" + }), translate(')'), translate(' to subscribe to. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/message-events/#messages", + target: "_blank", + rel: "noopener", + title: translate('Message event documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-calledElement': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define the ID of the process to call (e.g. '), " ", (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "shipping-process" + }), translate(' or '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "= \"shipping-\" + tenantId" + }), " ", translate('). '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/call-activities/", + target: "_blank", + rel: "noopener", + title: translate('Call activity documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-taskDefinition': element => { + const translate = useService('translate'); + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ServiceTask')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Specify which job workers handle the task work to execute a service (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "order-items" + }), translate('). '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/service-tasks", + target: "_blank", + rel: "noopener", + title: translate('Service task documentation'), + children: translate('Learn more.') + })] + }); + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:BusinessRuleTask')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Specify which job workers handle the task work to evaluate business rules. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/business-rule-tasks/#job-worker-implementation", + target: "_blank", + rel: "noopener", + title: translate('Business rule task documentation'), + children: translate('Learn more.') + })] + }); + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ScriptTask')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Specify which job workers handle the task work to execute a script. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/script-tasks/#defining-a-task", + target: "_blank", + rel: "noopener", + title: translate('Script task documentation'), + children: translate('Learn more.') + })] + }); + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:SendTask')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Specify which job workers handle the task work to send a message (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "kafka" + }), translate(' or '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "mail" + }), translate('). '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/send-tasks/#defining-a-task", + target: "_blank", + rel: "noopener", + title: translate('Send task documentation'), + children: translate('Learn more.') + })] + }); + } + if ((0,bpmn_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_9__.is)(element, 'bpmn:ThrowEvent')) { + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Specify which job workers handle the event work. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/message-events/#message-throw-events", + target: "_blank", + rel: "noopener", + title: translate('Message throw event documentation'), + children: translate('Learn more.') + })] + }); + } + }, + 'group-multiInstance': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Execute this task for each element of a given collection. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("br", {}), translate('Define an input collection expression that defines the collection to iterate over (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "= items" + }), translate('). '), translate('To collect the output define the output collection and the output element expressions. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/#defining-the-collection-to-iterate-over", + target: "_blank", + rel: "noopener", + title: translate('Multi instance documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-error': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Define an error code (e.g. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("code", { + children: "order-not-found" + }), translate('). '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/modeler/bpmn/error-events/#defining-the-error", + target: "_blank", + rel: "noopener", + title: translate('Error event documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-inputs': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Create a new local variable in the scope of this task. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/concepts/variables/#input-mappings", + target: "_blank", + rel: "noopener", + title: translate('Input mappings documentation'), + children: translate('Learn more.') + })] + }); + }, + 'group-outputs': element => { + const translate = useService('translate'); + return (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { + children: [translate('Customize how result variables are merged into the global scope of the process instance. '), (0,_bpmn_io_properties_panel_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("a", { + href: "https://docs.camunda.io/docs/components/concepts/variables/#output-mappings", + target: "_blank", + rel: "noopener", + title: translate('Output mappings documentation'), + children: translate('Learn more.') + })] + }); + } +}; + + +//# sourceMappingURL=index.esm.js.map + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/BaseModeler.js": +/*!**************************************************!*\ + !*** ../node_modules/bpmn-js/lib/BaseModeler.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BaseModeler) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ids */ "../node_modules/ids/dist/index.esm.js"); +/* harmony import */ var _BaseViewer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BaseViewer */ "../node_modules/bpmn-js/lib/BaseViewer.js"); + + + + + + + +/** + * @typedef {import('./BaseViewer').BaseViewerOptions} BaseViewerOptions + * @typedef {import('./BaseViewer').ModdleElementsById} ModdleElementsById + * + * @typedef {import('./model/Types').ModdleElement} ModdleElement + */ -// helpers ////////////// +/** + * A base modeler for BPMN 2.0 diagrams. + * + * See {@link Modeler} for a fully-featured modeler. + * + * @param {BaseViewerOptions} [options] The options to configure the modeler. + */ +function BaseModeler(options) { + _BaseViewer__WEBPACK_IMPORTED_MODULE_1__["default"].call(this, options); - function ensureNotNull(prop, name) { - if (!prop) { - throw new Error(name + ' required'); - } - return prop; - } + // hook ID collection into the modeler + this.on('import.parse.complete', function(event) { + if (!event.error) { + this._collectIds(event.definitions, event.elementsById); + } + }, this); - },{"../helper/ElementHelper":26}],7:[function(require,module,exports){ - 'use strict'; + this.on('diagram.destroy', function() { + this.get('moddle').ids.clear(); + }, this); +} - var forEach = require('lodash/forEach'); +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_2__["default"])(BaseModeler, _BaseViewer__WEBPACK_IMPORTED_MODULE_1__["default"]); - var elementHelper = require('../helper/ElementHelper'); - /** - * A handler that implements a BPMN 2.0 property update - * for business objects which are not represented in the - * diagram. - * - * This is useful in the context of the properties panel in - * order to update child elements of elements visible in - * the diagram. - * - * Example: perform an update of a specific event definition - * of an intermediate event. - * - * @class - * @constructor - */ - function CreateBusinessObjectListHandler(elementRegistry, bpmnFactory) { - this._elementRegistry = elementRegistry; - this._bpmnFactory = bpmnFactory; - } +/** + * Create a moddle instance, attaching IDs to it. + * + * @param {BaseViewerOptions} options + * + * @return {Moddle} + */ +BaseModeler.prototype._createModdle = function(options) { + var moddle = _BaseViewer__WEBPACK_IMPORTED_MODULE_1__["default"].prototype._createModdle.call(this, options); - CreateBusinessObjectListHandler.$inject = [ 'elementRegistry', 'bpmnFactory' ]; + // attach ids to moddle to be able to track and validated ids in the BPMN 2.0 + // XML document tree + moddle.ids = new ids__WEBPACK_IMPORTED_MODULE_0__["default"]([ 32, 36, 1 ]); - module.exports = CreateBusinessObjectListHandler; + return moddle; +}; - function ensureNotNull(prop, name) { - if (!prop) { - throw new Error(name + ' required'); - } - return prop; +/** + * Collect IDs processed during parsing of the definitions object. + * + * @param {ModdleElement} definitions + * @param {ModdleElementsById} elementsById + */ +BaseModeler.prototype._collectIds = function(definitions, elementsById) { + + var moddle = definitions.$model, + ids = moddle.ids, + id; + + // remove references from previous import + ids.clear(); + + for (id in elementsById) { + ids.claim(id, elementsById[ id ]); + } +}; + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/BaseViewer.js": +/*!*************************************************!*\ + !*** ../node_modules/bpmn-js/lib/BaseViewer.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BaseViewer) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var tiny_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tiny-svg */ "../node_modules/tiny-svg/dist/index.esm.js"); +/* harmony import */ var diagram_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js */ "../node_modules/diagram-js/lib/Diagram.js"); +/* harmony import */ var bpmn_moddle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! bpmn-moddle */ "../node_modules/bpmn-moddle/dist/index.esm.js"); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _import_Importer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./import/Importer */ "../node_modules/bpmn-js/lib/import/Importer.js"); +/* harmony import */ var _util_PoweredByUtil__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util/PoweredByUtil */ "../node_modules/bpmn-js/lib/util/PoweredByUtil.js"); +/** + * The code in the area + * must not be changed. + * + * @see http://bpmn.io/license for more information. + */ - } - function ensureList(prop, name) { - if (!prop || Object.prototype.toString.call(prop) !== '[object Array]') { - throw new Error(name + ' needs to be a list'); - } - return prop; - } -// api ///////////////////////////////////////////// - /** - * Creates a new element under a provided parent and updates / creates a reference to it in - * one atomic action. - * - * @method CreateBusinessObjectListHandler#execute - * - * @param {Object} context - * @param {djs.model.Base} context.element which is the context for the reference - * @param {moddle.referencingObject} context.referencingObject the object which creates the reference - * @param {String} context.referenceProperty the property of the referencingObject which makes the reference - * @param {moddle.newObject} context.newObject the new object to add - * @param {moddle.newObjectContainer} context.newObjectContainer the container for the new object - * - * @return {Array} the updated element - */ - CreateBusinessObjectListHandler.prototype.execute = function(context) { - var currentObject = ensureNotNull(context.currentObject, 'currentObject'), - propertyName = ensureNotNull(context.propertyName, 'propertyName'), - newObjects = ensureList(context.newObjects, 'newObjects'), - changed = [ context.element ]; // this will not change any diagram-js elements - var childObjects = []; - var self = this; - // create new array of business objects - forEach(newObjects, function(obj) { - var element = elementHelper.createElement(obj.type, obj.properties, currentObject, self._bpmnFactory); - childObjects.push(element); - }); - context.childObject = childObjects; - // adjust array reference in the parent business object - context.previousChilds = currentObject[propertyName]; - currentObject[propertyName] = childObjects; - context.changed = changed; - // indicate changed on objects affected by the update - return changed; - }; - /** - * Reverts the update - * - * @method CreateBusinessObjectListHandler#revert - * - * @param {Object} context - * - * @return {djs.mode.Base} the updated element - */ - CreateBusinessObjectListHandler.prototype.revert = function(context) { - var currentObject = context.currentObject, - propertyName = context.propertyName, - previousChilds = context.previousChilds; +/** + * @template T + * + * @typedef {import('diagram-js/lib/core/EventBus').EventBusEventCallback} EventBusEventCallback + */ - // remove new element - currentObject.set(propertyName, previousChilds); +/** + * @typedef {import('didi').ModuleDeclaration} ModuleDeclaration + * + * @typedef {import('./model/Types').Moddle} Moddle + * @typedef {import('./model/Types').ModdleElement} ModdleElement + * @typedef {import('./model/Types').ModdleExtension} ModdleExtension + * + * @typedef { { + * width?: number|string; + * height?: number|string; + * position?: string; + * container?: string|HTMLElement; + * moddleExtensions?: ModdleExtensions; + * additionalModules?: ModuleDeclaration[]; + * } & Record } BaseViewerOptions + * + * @typedef {Record} ModdleElementsById + * + * @typedef { { + * [key: string]: ModdleExtension; + * } } ModdleExtensions + * + * @typedef { { + * warnings: string[]; + * } } ImportXMLResult + * + * @typedef {ImportXMLResult & Error} ImportXMLError + * + * @typedef {ImportXMLResult} ImportDefinitionsResult + * + * @typedef {ImportXMLError} ImportDefinitionsError + * + * @typedef {ImportXMLResult} OpenResult + * + * @typedef {ImportXMLError} OpenError + * + * @typedef { { + * format?: boolean; + * preamble?: boolean; + * } } SaveXMLOptions + * + * @typedef { { + * xml?: string; + * error?: Error; + * } } SaveXMLResult + * + * @typedef { { + * svg: string; + * } } SaveSVGResult + * + * @typedef { { + * xml: string; + * } } ImportParseStartEvent + * + * @typedef { { + * error?: ImportXMLError; + * definitions?: ModdleElement; + * elementsById?: ModdleElementsById; + * references?: ModdleElement[]; + * warnings: string[]; + * } } ImportParseCompleteEvent + * + * @typedef { { + * error?: ImportXMLError; + * warnings: string[]; + * } } ImportDoneEvent + * + * @typedef { { + * definitions: ModdleElement; + * } } SaveXMLStartEvent + * + * @typedef {SaveXMLResult} SaveXMLDoneEvent + * + * @typedef { { + * error?: Error; + * svg: string; + * } } SaveSVGDoneEvent + */ - return context.changed; - }; +/** + * A base viewer for BPMN 2.0 diagrams. + * + * Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for + * bundles that include actual features. + * + * @param {BaseViewerOptions} [options] The options to configure the viewer. + */ +function BaseViewer(options) { - },{"../helper/ElementHelper":26,"lodash/forEach":613}],8:[function(require,module,exports){ - 'use strict'; + /** + * @type {BaseViewerOptions} + */ + options = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({}, DEFAULT_OPTIONS, options); - var forEach = require('lodash/forEach'); + /** + * @type {Moddle} + */ + this._moddle = this._createModdle(options); - /** - * A handler that combines and executes multiple commands. - * - * All updates are bundled on the command stack and executed in one step. - * This also makes it possible to revert the changes in one step. - * - * Example use case: remove the camunda:formKey attribute and in addition - * add all form fields needed for the camunda:formData property. - * - * @class - * @constructor - */ - function MultiCommandHandler(commandStack) { - this._commandStack = commandStack; - } + /** + * @type {HTMLElement} + */ + this._container = this._createContainer(options); - MultiCommandHandler.$inject = [ 'commandStack' ]; + /* */ - module.exports = MultiCommandHandler; + addProjectLogo(this._container); - MultiCommandHandler.prototype.preExecute = function(context) { + /* */ - var commandStack = this._commandStack; + this._init(this._container, this._moddle, options); +} - forEach(context, function(command) { - commandStack.execute(command.cmd, command.context); - }); - }; - },{"lodash/forEach":613}],9:[function(require,module,exports){ - 'use strict'; +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BaseViewer, diagram_js__WEBPACK_IMPORTED_MODULE_2__["default"]); - var reduce = require('lodash/transform'), - is = require('bpmn-js/lib/util/ModelUtil').is, - keys = require('lodash/keys'), - forEach = require('lodash/forEach'); +/** + * Parse and render a BPMN 2.0 diagram. + * + * Once finished the viewer reports back the result to the + * provided callback function with (err, warnings). + * + * ## Life-Cycle Events + * + * During import the viewer will fire life-cycle events: + * + * * import.parse.start (about to read model from XML) + * * import.parse.complete (model read; may have worked or not) + * * import.render.start (graphical import start) + * * import.render.complete (graphical import finished) + * * import.done (everything done) + * + * You can use these events to hook into the life-cycle. + * + * @throws {ImportXMLError} An error thrown during the import of the XML. + * + * @fires BaseViewer#ImportParseStartEvent + * @fires BaseViewer#ImportParseCompleteEvent + * @fires Importer#ImportRenderStartEvent + * @fires Importer#ImportRenderCompleteEvent + * @fires BaseViewer#ImportDoneEvent + * + * @param {string} xml The BPMN 2.0 XML to be imported. + * @param {ModdleElement|string} [bpmnDiagram] The optional diagram or Id of the BPMN diagram to open. + * + * @return {Promise} A promise resolving with warnings that were produced during the import. + */ +BaseViewer.prototype.importXML = async function importXML(xml, bpmnDiagram) { + + const self = this; + + function ParseCompleteEvent(data) { + return self.get('eventBus').createEvent(data); + } + + let aggregatedWarnings = []; + try { + + // hook in pre-parse listeners + + // allow xml manipulation + + /** + * A `import.parse.start` event. + * + * @event BaseViewer#ImportParseStartEvent + * @type {ImportParseStartEvent} + */ + xml = this._emit('import.parse.start', { xml: xml }) || xml; + + let parseResult; + try { + parseResult = await this._moddle.fromXML(xml, 'bpmn:Definitions'); + } catch (error) { + this._emit('import.parse.complete', { + error + }); + + throw error; + } + + let definitions = parseResult.rootElement; + const references = parseResult.references; + const parseWarnings = parseResult.warnings; + const elementsById = parseResult.elementsById; + + aggregatedWarnings = aggregatedWarnings.concat(parseWarnings); + + // hook in post parse listeners + + // allow definitions manipulation + + /** + * A `import.parse.complete` event. + * + * @event BaseViewer#ImportParseCompleteEvent + * @type {ImportParseCompleteEvent} + */ + definitions = this._emit('import.parse.complete', ParseCompleteEvent({ + error: null, + definitions: definitions, + elementsById: elementsById, + references: references, + warnings: aggregatedWarnings + })) || definitions; + + const importResult = await this.importDefinitions(definitions, bpmnDiagram); + + aggregatedWarnings = aggregatedWarnings.concat(importResult.warnings); + + /** + * A `import.parse.complete` event. + * + * @event BaseViewer#ImportDoneEvent + * @type {ImportDoneEvent} + */ + this._emit('import.done', { error: null, warnings: aggregatedWarnings }); + + return { warnings: aggregatedWarnings }; + } catch (err) { + let error = err; + aggregatedWarnings = aggregatedWarnings.concat(error.warnings || []); + addWarningsToError(error, aggregatedWarnings); + + error = checkValidationError(error); + + this._emit('import.done', { error, warnings: error.warnings }); + + throw error; + } +}; + + +/** + * Import parsed definitions and render a BPMN 2.0 diagram. + * + * Once finished the viewer reports back the result to the + * provided callback function with (err, warnings). + * + * ## Life-Cycle Events + * + * During import the viewer will fire life-cycle events: + * + * * import.render.start (graphical import start) + * * import.render.complete (graphical import finished) + * + * You can use these events to hook into the life-cycle. + * + * @throws {ImportDefinitionsError} An error thrown during the import of the definitions. + * + * @param {ModdleElement} definitions The definitions. + * @param {ModdleElement|string} [bpmnDiagram] The optional diagram or ID of the BPMN diagram to open. + * + * @return {Promise} A promise resolving with warnings that were produced during the import. + */ +BaseViewer.prototype.importDefinitions = async function importDefinitions(definitions, bpmnDiagram) { + this._setDefinitions(definitions); + const result = await this.open(bpmnDiagram); - /** - * A handler that implements a BPMN 2.0 property update - * for business objects which are not represented in the - * diagram. - * - * This is useful in the context of the properties panel in - * order to update child elements of elements visible in - * the diagram. - * - * Example: perform an update of a specific event definition - * of an intermediate event. - * - * @class - * @constructor - */ - function UpdateBusinessObjectHandler(elementRegistry) { - this._elementRegistry = elementRegistry; - } + return { warnings: result.warnings }; +}; - UpdateBusinessObjectHandler.$inject = [ 'elementRegistry' ]; - module.exports = UpdateBusinessObjectHandler; +/** + * Open diagram of previously imported XML. + * + * Once finished the viewer reports back the result to the + * provided callback function with (err, warnings). + * + * ## Life-Cycle Events + * + * During switch the viewer will fire life-cycle events: + * + * * import.render.start (graphical import start) + * * import.render.complete (graphical import finished) + * + * You can use these events to hook into the life-cycle. + * + * @throws {OpenError} An error thrown during opening. + * + * @param {ModdleElement|string} bpmnDiagramOrId The diagram or Id of the BPMN diagram to open. + * + * @return {Promise} A promise resolving with warnings that were produced during opening. + */ +BaseViewer.prototype.open = async function open(bpmnDiagramOrId) { - /** - * returns the root element - */ - function getRoot(businessObject) { - var parent = businessObject; - while (parent.$parent) { - parent = parent.$parent; - } - return parent; - } + const definitions = this._definitions; + let bpmnDiagram = bpmnDiagramOrId; - function getProperties(businessObject, propertyNames) { - return reduce(propertyNames, function(result, key) { - result[key] = businessObject.get(key); - return result; - }, {}); - } + if (!definitions) { + const error = new Error('no XML imported'); + addWarningsToError(error, []); + throw error; + } - function setProperties(businessObject, properties) { - forEach(properties, function(value, key) { - businessObject.set(key, value); - }); - } + if (typeof bpmnDiagramOrId === 'string') { + bpmnDiagram = findBPMNDiagram(definitions, bpmnDiagramOrId); + if (!bpmnDiagram) { + const error = new Error('BPMNDiagram <' + bpmnDiagramOrId + '> not found'); + addWarningsToError(error, []); -// api ///////////////////////////////////////////// + throw error; + } + } - /** - * Updates a business object with a list of new properties - * - * @method UpdateBusinessObjectHandler#execute - * - * @param {Object} context - * @param {djs.model.Base} context.element the element which has a child business object updated - * @param {moddle.businessObject} context.businessObject the businessObject to update - * @param {Object} context.properties a list of properties to set on the businessObject - * - * @return {Array} the updated element - */ - UpdateBusinessObjectHandler.prototype.execute = function(context) { + // clear existing rendered diagram + // catch synchronous exceptions during #clear() + try { + this.clear(); + } catch (error) { + addWarningsToError(error, []); - var element = context.element, - businessObject = context.businessObject, - rootElements = getRoot(businessObject).rootElements, - referenceType = context.referenceType, - referenceProperty = context.referenceProperty, - changed = [ element ]; // this will not change any diagram-js elements + throw error; + } - if (!element) { - throw new Error('element required'); - } + // perform graphical import + const { warnings } = await (0,_import_Importer__WEBPACK_IMPORTED_MODULE_3__.importBpmnDiagram)(this, definitions, bpmnDiagram); - if (!businessObject) { - throw new Error('businessObject required'); - } + return { warnings }; +}; - var properties = context.properties, - oldProperties = context.oldProperties || getProperties(businessObject, keys(properties)); +/** + * Export the currently displayed BPMN 2.0 diagram as + * a BPMN 2.0 XML document. + * + * ## Life-Cycle Events + * + * During XML saving the viewer will fire life-cycle events: + * + * * saveXML.start (before serialization) + * * saveXML.serialized (after xml generation) + * * saveXML.done (everything done) + * + * You can use these events to hook into the life-cycle. + * + * @throws {Error} An error thrown during export. + * + * @fires BaseViewer#SaveXMLStart + * @fires BaseViewer#SaveXMLDone + * + * @param {SaveXMLOptions} [options] The options. + * + * @return {Promise} A promise resolving with the XML. + */ +BaseViewer.prototype.saveXML = async function saveXML(options) { - // check if there the update needs an external element for reference - if (typeof referenceType !== 'undefined' && typeof referenceProperty !== 'undefined') { - forEach(rootElements, function(rootElement) { - if (is(rootElement, referenceType)) { - if (rootElement.id === properties[referenceProperty]) { - properties[referenceProperty] = rootElement; - } - } - }); - } + options = options || {}; - // update properties - setProperties(businessObject, properties); + let definitions = this._definitions, + error, xml; - // store old values - context.oldProperties = oldProperties; - context.changed = changed; + try { + if (!definitions) { + throw new Error('no definitions loaded'); + } - // indicate changed on objects affected by the update - return changed; - }; + // allow to fiddle around with definitions - /** - * Reverts the update - * - * @method UpdateBusinessObjectHandler#revert - * - * @param {Object} context - * - * @return {djs.mode.Base} the updated element - */ - UpdateBusinessObjectHandler.prototype.revert = function(context) { + /** + * A `saveXML.start` event. + * + * @event BaseViewer#SaveXMLStartEvent + * @type {SaveXMLStartEvent} + */ + definitions = this._emit('saveXML.start', { + definitions + }) || definitions; - var oldProperties = context.oldProperties, - businessObject = context.businessObject; + const result = await this._moddle.toXML(definitions, options); + xml = result.xml; - // update properties - setProperties(businessObject, oldProperties); + xml = this._emit('saveXML.serialized', { + xml + }) || xml; + } catch (err) { + error = err; + } - return context.changed; - }; + const result = error ? { error } : { xml }; - },{"bpmn-js/lib/util/ModelUtil":240,"lodash/forEach":613,"lodash/keys":630,"lodash/transform":642}],10:[function(require,module,exports){ - 'use strict'; + /** + * A `saveXML.done` event. + * + * @event BaseViewer#SaveXMLDoneEvent + * @type {SaveXMLDoneEvent} + */ + this._emit('saveXML.done', result); - var forEach = require('lodash/forEach'); + if (error) { + throw error; + } - /** - * A handler that implements a BPMN 2.0 property update - * for business object lists which are not represented in the - * diagram. - * - * This is useful in the context of the properties panel in - * order to update child elements of elements visible in - * the diagram. - * - * Example: perform an update of a specific event definition - * of an intermediate event. - * - * @class - * @constructor - */ - function UpdateBusinessObjectListHandler(elementRegistry, bpmnFactory) { - this._elementRegistry = elementRegistry; - this._bpmnFactory = bpmnFactory; - } + return result; +}; - UpdateBusinessObjectListHandler.$inject = [ 'elementRegistry', 'bpmnFactory' ]; - module.exports = UpdateBusinessObjectListHandler; +/** + * Export the currently displayed BPMN 2.0 diagram as + * an SVG image. + * + * ## Life-Cycle Events + * + * During SVG saving the viewer will fire life-cycle events: + * + * * saveSVG.start (before serialization) + * * saveSVG.done (everything done) + * + * You can use these events to hook into the life-cycle. + * + * @throws {Error} An error thrown during export. + * + * @fires BaseViewer#SaveSVGDone + * + * @return {Promise} A promise resolving with the SVG. + */ +BaseViewer.prototype.saveSVG = async function saveSVG() { + this._emit('saveSVG.start'); - function ensureNotNull(prop, name) { - if (!prop) { - throw new Error(name + 'required'); - } - return prop; - } + let svg, err; -// api ///////////////////////////////////////////// + try { + const canvas = this.get('canvas'); - /** - * Updates a element under a provided parent. - */ - UpdateBusinessObjectListHandler.prototype.execute = function(context) { + const contentNode = canvas.getActiveLayer(), + defsNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.query)('defs', canvas._svg); - var currentObject = ensureNotNull(context.currentObject, 'currentObject'), - propertyName = ensureNotNull(context.propertyName, 'propertyName'), - updatedObjectList = context.updatedObjectList, - objectsToRemove = context.objectsToRemove || [], - objectsToAdd = context.objectsToAdd || [], - changed = [ context.element], // this will not change any diagram-js elements - referencePropertyName; + const contents = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_5__.innerSVG)(contentNode), + defs = defsNode ? '' + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_5__.innerSVG)(defsNode) + '' : ''; - if (context.referencePropertyName) { - referencePropertyName = context.referencePropertyName; - } + const bbox = contentNode.getBBox(); - var objectList = currentObject[propertyName]; - // adjust array reference in the parent business object - context.previousList = currentObject[propertyName]; + svg = + '\n' + + '\n' + + '\n' + + '' + + defs + contents + + ''; + } catch (e) { + err = e; + } - if (updatedObjectList) { - currentObject[propertyName] = updatedObjectList; - } else { - var listCopy = []; - // remove all objects which should be removed - forEach(objectList, function(object) { - if (objectsToRemove.indexOf(object) == -1) { - listCopy.push(object); - } - }); - // add all objects which should be added - listCopy = listCopy.concat(objectsToAdd); + /** + * A `saveSVG.done` event. + * + * @event BaseViewer#SaveSVGDoneEvent + * @type {SaveSVGDoneEvent} + */ + this._emit('saveSVG.done', { + error: err, + svg: svg + }); - // set property to new list - if (listCopy.length > 0 || !referencePropertyName) { + if (err) { + throw err; + } - // as long as there are elements in the list update the list - currentObject[propertyName] = listCopy; - } else if (referencePropertyName) { + return { svg }; +}; - // remove the list when it is empty - var parentObject = currentObject.$parent; - parentObject.set(referencePropertyName, undefined); - } - } +BaseViewer.prototype._setDefinitions = function(definitions) { + this._definitions = definitions; +}; - context.changed = changed; +/** + * Return modules to instantiate with. + * + * @return {ModuleDeclaration[]} The modules. + */ +BaseViewer.prototype.getModules = function() { + return this._modules; +}; - // indicate changed on objects affected by the update - return changed; - }; +/** + * Remove all drawn elements from the viewer. + * + * After calling this method the viewer can still be reused for opening another + * diagram. + */ +BaseViewer.prototype.clear = function() { + if (!this.getDefinitions()) { - /** - * Reverts the update - * - * @method CreateBusinessObjectListHandler#revert - * - * @param {Object} context - * - * @return {djs.mode.Base} the updated element - */ - UpdateBusinessObjectListHandler.prototype.revert = function(context) { + // no diagram to clear + return; + } - var currentObject = context.currentObject, - propertyName = context.propertyName, - previousList = context.previousList, - parentObject = currentObject.$parent; + // remove drawn elements + diagram_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.clear.call(this); +}; - if (context.referencePropertyName) { - parentObject.set(context.referencePropertyName, currentObject); - } +/** + * Destroy the viewer instance and remove all its remainders from the document + * tree. + */ +BaseViewer.prototype.destroy = function() { - // remove new element - currentObject.set(propertyName, previousList); + // diagram destroy + diagram_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.destroy.call(this); - return context.changed; - }; + // dom detach + (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.remove)(this._container); +}; - },{"lodash/forEach":613}],11:[function(require,module,exports){ - 'use strict'; +/** + * Register an event listener. + * + * Remove an event listener via {@link BaseViewer#off}. + * + * @template T + * + * @param {string|string[]} events The event(s) to listen to. + * @param {number} [priority] The priority with which to listen. + * @param {EventBusEventCallback} callback The callback. + * @param {any} [that] Value of `this` the callback will be called with. + */ +BaseViewer.prototype.on = function(events, priority, callback, that) { + return this.get('eventBus').on(events, priority, callback, that); +}; - var forEach = require('lodash/forEach'); +/** + * Remove an event listener. + * + * @param {string|string[]} events The event(s). + * @param {Function} [callback] The callback. + */ +BaseViewer.prototype.off = function(events, callback) { + this.get('eventBus').off(events, callback); +}; - var HANDLERS = { - 'properties-panel.update-businessobject': require('./UpdateBusinessObjectHandler'), - 'properties-panel.create-and-reference': require('./CreateAndReferenceHandler'), - 'properties-panel.create-businessobject-list': require('./CreateBusinessObjectListHandler'), - 'properties-panel.update-businessobject-list': require('./UpdateBusinessObjectListHandler'), - 'properties-panel.multi-command-executor': require('./MultiCommandHandler') - }; +/** + * Attach the viewer to an HTML element. + * + * @param {HTMLElement} parentNode The parent node to attach to. + */ +BaseViewer.prototype.attachTo = function(parentNode) { + if (!parentNode) { + throw new Error('parentNode required'); + } - function CommandInitializer(eventBus, commandStack) { + // ensure we detach from the + // previous, old parent + this.detach(); - eventBus.on('diagram.init', function() { - forEach(HANDLERS, function(handler, id) { - commandStack.registerHandler(id, handler); - }); - }); - } + // unwrap jQuery if provided + if (parentNode.get && parentNode.constructor.prototype.jquery) { + parentNode = parentNode.get(0); + } - CommandInitializer.$inject = [ 'eventBus', 'commandStack' ]; + if (typeof parentNode === 'string') { + parentNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.query)(parentNode); + } - module.exports = { - __init__: [ CommandInitializer ] - }; - },{"./CreateAndReferenceHandler":6,"./CreateBusinessObjectListHandler":7,"./MultiCommandHandler":8,"./UpdateBusinessObjectHandler":9,"./UpdateBusinessObjectListHandler":10,"lodash/forEach":613}],12:[function(require,module,exports){ - 'use strict'; + parentNode.appendChild(this._container); - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - cmdHelper = require('../helper/CmdHelper'), - escapeHTML = require('../Utils').escapeHTML; + this._emit('attach', {}); - var entryFieldDescription = require('./EntryFieldDescription'); + this.get('canvas').resized(); +}; +/** + * Get the definitions model element. + * + * @return {ModdleElement} The definitions model element. + */ +BaseViewer.prototype.getDefinitions = function() { + return this._definitions; +}; - var checkbox = function(options, defaultParameters) { - var resource = defaultParameters, - id = resource.id, - label = options.label || id, - canBeDisabled = !!options.disabled && typeof options.disabled === 'function', - canBeHidden = !!options.hidden && typeof options.hidden === 'function', - description = options.description; +/** + * Detach the viewer. + * + * @fires BaseViewer#DetachEvent + */ +BaseViewer.prototype.detach = function() { - resource.html = - '' + - ''; + const container = this._container, + parentNode = container.parentNode; - // add description below checkbox entry field - if (description) { - resource.html += entryFieldDescription(description); - } + if (!parentNode) { + return; + } - resource.get = function(element) { - var bo = getBusinessObject(element), - res = {}; + /** + * A `detach` event. + * + * @event BaseViewer#DetachEvent + * @type {Object} + */ + this._emit('detach', {}); - res[options.modelProperty] = bo.get(options.modelProperty); + parentNode.removeChild(container); +}; - return res; - }; +BaseViewer.prototype._init = function(container, moddle, options) { - resource.set = function(element, values) { - var res = {}; + const baseModules = options.modules || this.getModules(options), + additionalModules = options.additionalModules || [], + staticModules = [ + { + bpmnjs: [ 'value', this ], + moddle: [ 'value', moddle ] + } + ]; - res[options.modelProperty] = !!values[options.modelProperty]; + const diagramModules = [].concat(staticModules, baseModules, additionalModules); - return cmdHelper.updateProperties(element, res); - }; + const diagramOptions = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.omit)(options, [ 'additionalModules' ]), { + canvas: (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({}, options.canvas, { container: container }), + modules: diagramModules + }); - if (typeof options.set === 'function') { - resource.set = options.set; - } + // invoke diagram constructor + diagram_js__WEBPACK_IMPORTED_MODULE_2__["default"].call(this, diagramOptions); - if (typeof options.get === 'function') { - resource.get = options.get; - } + if (options && options.container) { + this.attachTo(options.container); + } +}; - if (canBeDisabled) { - resource.isDisabled = function() { - return options.disabled.apply(resource, arguments); - }; - } +/** + * Emit an event on the underlying {@link EventBus} + * + * @param {string} type + * @param {Object} event + * + * @return {Object} The return value after calling all event listeners. + */ +BaseViewer.prototype._emit = function(type, event) { + return this.get('eventBus').fire(type, event); +}; - if (canBeHidden) { - resource.isHidden = function() { - return !options.hidden.apply(resource, arguments); - }; - } +/** + * @param {BaseViewerOptions} options + * + * @return {HTMLElement} + */ +BaseViewer.prototype._createContainer = function(options) { - resource.cssClasses = ['bpp-checkbox']; + const container = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.domify)('
'); - return resource; - }; + (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.assignStyle)(container, { + width: ensureUnit(options.width), + height: ensureUnit(options.height), + position: options.position + }); - module.exports = checkbox; + return container; +}; - },{"../Utils":5,"../helper/CmdHelper":25,"./EntryFieldDescription":15,"bpmn-js/lib/util/ModelUtil":240}],13:[function(require,module,exports){ - 'use strict'; +/** + * @param {BaseViewerOptions} options + * + * @return {Moddle} + */ +BaseViewer.prototype._createModdle = function(options) { + const moddleOptions = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({}, this._moddleExtensions, options.moddleExtensions); - var assign = require('lodash/assign'), - find = require('lodash/find'); + return new bpmn_moddle__WEBPACK_IMPORTED_MODULE_6__["default"](moddleOptions); +}; - var domQuery = require('min-dom').query; +BaseViewer.prototype._modules = []; - var escapeHTML = require('../Utils').escapeHTML; +// helpers /////////////// - var selectEntryFactory = require('./SelectEntryFactory'), - entryFieldDescription = require('./EntryFieldDescription'); +function addWarningsToError(err, warningsAry) { + err.warnings = warningsAry; + return err; +} +function checkValidationError(err) { - /** - * The combo box is a special implementation of the select entry and adds the option 'custom' to the - * select box. If 'custom' is selected, an additional text input field is shown which allows to define - * a custom value. - * - * @param {Object} options - * @param {string} options.id - * @param {string} options.label - * @param {Array} options.selectOptions list of name/value pairs - * @param {string} options.modelProperty - * @param {function} options.get - * @param {function} options.set - * @param {string} [options.customValue] custom select option value (default: 'custom') - * @param {string} [options.customName] custom select option name visible in the select box (default: 'custom') - * - * @return {Object} - */ - var comboBox = function(options) { + // check if we can help the user by indicating wrong BPMN 2.0 xml + // (in case he or the exporting tool did not get that right) - var selectOptions = options.selectOptions, - modelProperty = options.modelProperty, - customValue = options.customValue || 'custom', - customName = options.customName || 'custom ' + modelProperty, - description = options.description; + const pattern = /unparsable content <([^>]+)> detected([\s\S]*)$/; + const match = pattern.exec(err.message); - // check if a value is not a built in value - var isCustomValue = function(value) { - if (typeof value[modelProperty] === 'undefined') { - return false; - } + if (match) { + err.message = + 'unparsable content <' + match[1] + '> detected; ' + + 'this may indicate an invalid BPMN 2.0 diagram file' + match[2]; + } - var isCustom = !find(selectOptions, function(option) { - return value[modelProperty] === option.value; - }); + return err; +} - return isCustom; - }; +const DEFAULT_OPTIONS = { + width: '100%', + height: '100%', + position: 'relative' +}; - var comboOptions = assign({}, options); - // true if the selected value in the select box is customValue - comboOptions.showCustomInput = function(element, node) { - var selectBox = domQuery('[data-entry="'+ options.id +'"] select', node.parentNode); +/** + * Ensure the passed argument is a proper unit (defaulting to px) + */ +function ensureUnit(val) { + return val + ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isNumber)(val) ? 'px' : ''); +} - if (selectBox) { - return selectBox.value === customValue; - } - return false; - }; +/** + * Find BPMNDiagram in definitions by ID + * + * @param {ModdleElement} definitions + * @param {string} diagramId + * + * @return {ModdleElement|null} + */ +function findBPMNDiagram(definitions, diagramId) { + if (!diagramId) { + return null; + } - comboOptions.get = function(element, node) { - var value = options.get(element, node); + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.find)(definitions.diagrams, function(element) { + return element.id === diagramId; + }) || null; +} - var modifiedValues = {}; - if (!isCustomValue(value)) { - modifiedValues[modelProperty] = value[modelProperty] || ''; +/* */ - return modifiedValues; - } - modifiedValues[modelProperty] = customValue; - modifiedValues['custom-'+modelProperty] = value[modelProperty]; - return modifiedValues; - }; - comboOptions.set = function(element, values, node) { - var modifiedValues = {}; - // if the custom select option has been selected - // take the value from the text input field - if (values[modelProperty] === customValue) { - modifiedValues[modelProperty] = values['custom-' + modelProperty] || ''; - } - else if (options.emptyParameter && values[modelProperty] === '') { - modifiedValues[modelProperty] = undefined; - } else { - modifiedValues[modelProperty] = values[modelProperty]; - } - return options.set(element, modifiedValues, node); - }; +/** + * Adds the project logo to the diagram container as + * required by the bpmn.io license. + * + * @see http://bpmn.io/license + * + * @param {Element} container + */ +function addProjectLogo(container) { + const img = _util_PoweredByUtil__WEBPACK_IMPORTED_MODULE_7__.BPMNIO_IMG; - comboOptions.selectOptions.push({ name: customName, value: customValue }); + const linkMarkup = + '' + + img + + ''; - var comboBoxEntry = assign({}, selectEntryFactory(comboOptions, comboOptions)); + const linkElement = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.domify)(linkMarkup); - comboBoxEntry.html += '
' + - '' + - '
'; + (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.assignStyle)((0,min_dom__WEBPACK_IMPORTED_MODULE_4__.query)('svg', linkElement), _util_PoweredByUtil__WEBPACK_IMPORTED_MODULE_7__.LOGO_STYLES); + (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.assignStyle)(linkElement, _util_PoweredByUtil__WEBPACK_IMPORTED_MODULE_7__.LINK_STYLES, { + position: 'absolute', + bottom: '15px', + right: '15px', + zIndex: '100' + }); - // add description below combo box entry field - if (description) { - comboBoxEntry.html += entryFieldDescription(description); - } + container.appendChild(linkElement); - return comboBoxEntry; - }; + min_dom__WEBPACK_IMPORTED_MODULE_4__.event.bind(linkElement, 'click', function(event) { + (0,_util_PoweredByUtil__WEBPACK_IMPORTED_MODULE_7__.open)(); - module.exports = comboBox; + event.preventDefault(); + }); +} - },{"../Utils":5,"./EntryFieldDescription":15,"./SelectEntryFactory":18,"lodash/assign":604,"lodash/find":610,"min-dom":647}],14:[function(require,module,exports){ - 'use strict'; +/*
*/ - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; -// input entities - var textInputField = require('./TextInputEntryFactory'), - checkboxField = require('./CheckboxEntryFactory'), - selectBoxField = require('./SelectEntryFactory'), - comboBoxField = require('./ComboEntryFactory'), - textBoxField = require('./TextBoxEntryFactory'), - validationAwareTextInputField = require('./ValidationAwareTextInput'), - tableField = require('./TableEntryFactory'), - labelEntry = require('./LabelFactory'), - link = require('./LinkEntryFactory'); +/***/ }), - var cmdHelper = require('../helper/CmdHelper'); +/***/ "../node_modules/bpmn-js/lib/Modeler.js": +/*!**********************************************!*\ + !*** ../node_modules/bpmn-js/lib/Modeler.js ***! + \**********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -// helpers //////////////////////////////////////// +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Modeler) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _BaseModeler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseModeler */ "../node_modules/bpmn-js/lib/BaseModeler.js"); +/* harmony import */ var _Viewer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Viewer */ "../node_modules/bpmn-js/lib/Viewer.js"); +/* harmony import */ var _NavigatedViewer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NavigatedViewer */ "../node_modules/bpmn-js/lib/NavigatedViewer.js"); +/* harmony import */ var diagram_js_lib_navigation_keyboard_move__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/navigation/keyboard-move */ "../node_modules/diagram-js/lib/navigation/keyboard-move/index.js"); +/* harmony import */ var diagram_js_lib_navigation_movecanvas__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! diagram-js/lib/navigation/movecanvas */ "../node_modules/diagram-js/lib/navigation/movecanvas/index.js"); +/* harmony import */ var diagram_js_lib_navigation_zoomscroll__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! diagram-js/lib/navigation/zoomscroll */ "../node_modules/diagram-js/lib/navigation/zoomscroll/index.js"); +/* harmony import */ var _features_align_elements__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./features/align-elements */ "../node_modules/bpmn-js/lib/features/align-elements/index.js"); +/* harmony import */ var _features_auto_place__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./features/auto-place */ "../node_modules/bpmn-js/lib/features/auto-place/index.js"); +/* harmony import */ var _features_auto_resize__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./features/auto-resize */ "../node_modules/bpmn-js/lib/features/auto-resize/index.js"); +/* harmony import */ var diagram_js_lib_features_auto_scroll__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! diagram-js/lib/features/auto-scroll */ "../node_modules/diagram-js/lib/features/auto-scroll/index.js"); +/* harmony import */ var diagram_js_lib_features_bendpoints__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! diagram-js/lib/features/bendpoints */ "../node_modules/diagram-js/lib/features/bendpoints/index.js"); +/* harmony import */ var diagram_js_lib_features_connect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! diagram-js/lib/features/connect */ "../node_modules/diagram-js/lib/features/connect/index.js"); +/* harmony import */ var diagram_js_lib_features_connection_preview__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! diagram-js/lib/features/connection-preview */ "../node_modules/diagram-js/lib/features/connection-preview/index.js"); +/* harmony import */ var _features_context_pad__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./features/context-pad */ "../node_modules/bpmn-js/lib/features/context-pad/index.js"); +/* harmony import */ var _features_copy_paste__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./features/copy-paste */ "../node_modules/bpmn-js/lib/features/copy-paste/index.js"); +/* harmony import */ var diagram_js_lib_features_create__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! diagram-js/lib/features/create */ "../node_modules/diagram-js/lib/features/create/index.js"); +/* harmony import */ var _features_distribute_elements__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./features/distribute-elements */ "../node_modules/bpmn-js/lib/features/distribute-elements/index.js"); +/* harmony import */ var _features_editor_actions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./features/editor-actions */ "../node_modules/bpmn-js/lib/features/editor-actions/index.js"); +/* harmony import */ var _features_grid_snapping__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./features/grid-snapping */ "../node_modules/bpmn-js/lib/features/grid-snapping/index.js"); +/* harmony import */ var _features_interaction_events__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./features/interaction-events */ "../node_modules/bpmn-js/lib/features/interaction-events/index.js"); +/* harmony import */ var _features_keyboard__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./features/keyboard */ "../node_modules/bpmn-js/lib/features/keyboard/index.js"); +/* harmony import */ var diagram_js_lib_features_keyboard_move_selection__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! diagram-js/lib/features/keyboard-move-selection */ "../node_modules/diagram-js/lib/features/keyboard-move-selection/index.js"); +/* harmony import */ var _features_label_editing__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./features/label-editing */ "../node_modules/bpmn-js/lib/features/label-editing/index.js"); +/* harmony import */ var _features_modeling__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./features/modeling */ "../node_modules/bpmn-js/lib/features/modeling/index.js"); +/* harmony import */ var _features_modeling_feedback__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./features/modeling-feedback */ "../node_modules/bpmn-js/lib/features/modeling-feedback/index.js"); +/* harmony import */ var diagram_js_lib_features_move__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! diagram-js/lib/features/move */ "../node_modules/diagram-js/lib/features/move/index.js"); +/* harmony import */ var _features_outline__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./features/outline */ "../node_modules/bpmn-js/lib/features/outline/index.js"); +/* harmony import */ var _features_palette__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./features/palette */ "../node_modules/bpmn-js/lib/features/palette/index.js"); +/* harmony import */ var _features_replace_preview__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./features/replace-preview */ "../node_modules/bpmn-js/lib/features/replace-preview/index.js"); +/* harmony import */ var diagram_js_lib_features_resize__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! diagram-js/lib/features/resize */ "../node_modules/diagram-js/lib/features/resize/index.js"); +/* harmony import */ var _features_snapping__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./features/snapping */ "../node_modules/bpmn-js/lib/features/snapping/index.js"); +/* harmony import */ var _features_search__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./features/search */ "../node_modules/bpmn-js/lib/features/search/index.js"); - function ensureNotNull(prop) { - if (!prop) { - throw new Error(prop + ' must be set.'); - } - return prop; - } - /** - * sets the default parameters which are needed to create an entry - * - * @param options - * @returns {{id: *, description: (*|string), get: (*|Function), set: (*|Function), - * validate: (*|Function), html: string}} - */ - var setDefaultParameters = function(options) { - // default method to fetch the current value of the input field - var defaultGet = function(element) { - var bo = getBusinessObject(element), - res = {}, - prop = ensureNotNull(options.modelProperty); - res[prop] = bo.get(prop); - return res; - }; - // default method to set a new value to the input field - var defaultSet = function(element, values) { - var res = {}, - prop = ensureNotNull(options.modelProperty); - if (values[prop] !== '') { - res[prop] = values[prop]; - } else { - res[prop] = undefined; - } - return cmdHelper.updateProperties(element, res); - }; - // default validation method - var defaultValidate = function() { - return {}; - }; - return { - id : options.id, - description : (options.description || ''), - get : (options.get || defaultGet), - set : (options.set || defaultSet), - validate : (options.validate || defaultValidate), - html: '' - }; - }; - function EntryFactory() { - } - /** - * Generates an text input entry object for a property panel. - * options are: - * - id: id of the entry - String - * - * - description: description of the property - String - * - * - label: label for the input field - String - * - * - set: setter method - Function - * - * - get: getter method - Function - * - * - validate: validation mehtod - Function - * - * - modelProperty: name of the model property - String - * - * - buttonAction: Object which contains the following properties: - Object - * ---- name: name of the [data-action] callback - String - * ---- method: callback function for [data-action] - Function - * - * - buttonShow: Object which contains the following properties: - Object - * ---- name: name of the [data-show] callback - String - * ---- method: callback function for [data-show] - Function - * - * @param options - * @returns the propertyPanel entry resource object - */ - EntryFactory.textField = function(options) { - return textInputField(options, setDefaultParameters(options)); - }; - EntryFactory.validationAwareTextField = function(options) { - return validationAwareTextInputField(options, setDefaultParameters(options)); - }; - /** - * Generates a checkbox input entry object for a property panel. - * options are: - * - id: id of the entry - String - * - * - description: description of the property - String - * - * - label: label for the input field - String - * - * - set: setter method - Function - * - * - get: getter method - Function - * - * - validate: validation method - Function - * - * - modelProperty: name of the model property - String - * - * @param options - * @returns the propertyPanel entry resource object - */ - EntryFactory.checkbox = function(options) { - return checkboxField(options, setDefaultParameters(options)); - }; - EntryFactory.textBox = function(options) { - return textBoxField(options, setDefaultParameters(options)); - }; - EntryFactory.selectBox = function(options) { - return selectBoxField(options, setDefaultParameters(options)); - }; - EntryFactory.comboBox = function(options) { - return comboBoxField(options); - }; - EntryFactory.table = function(options) { - return tableField(options); - }; - EntryFactory.label = function(options) { - return labelEntry(options); - }; - EntryFactory.link = function(options) { - return link(options); - }; - module.exports = EntryFactory; - },{"../helper/CmdHelper":25,"./CheckboxEntryFactory":12,"./ComboEntryFactory":13,"./LabelFactory":16,"./LinkEntryFactory":17,"./SelectEntryFactory":18,"./TableEntryFactory":19,"./TextBoxEntryFactory":20,"./TextInputEntryFactory":21,"./ValidationAwareTextInput":22,"bpmn-js/lib/util/ModelUtil":240}],15:[function(require,module,exports){ - 'use strict'; - var escapeHTML = require('../Utils').escapeHTML; - /** - * Create a linkified and HTML escaped entry field description. - * - * As a special feature, this description may contain both markdown, - * plain links and
- * - * @param {String} description - */ - module.exports = function entryFieldDescription(description) { - // we tokenize the description to extract text, HTML and markdown links - // text, links and new lines are handled seperately - var escaped = []; - // match markdown [{TEXT}]({URL}) and HTML links
{TEXT} - var pattern = /(?:\[([^\]]+)\]\((https?:\/\/[^)]+)\))|(?:(.+?(?=<\/))<\/a>)/gi; - var index = 0; - var match; - var link, text; - while ((match = pattern.exec(description))) { - // escape + insert text before match - if (match.index > index) { - escaped.push(escapeText(description.substring(index, match.index))); - } - link = match[2] && encodeURI(match[2]) || match[3]; - text = match[1] || match[4]; - // insert safe link - escaped.push('' + escapeText(text) + ''); - index = match.index + match[0].length; - } - // escape and insert text after last match - if (index < description.length) { - escaped.push(escapeText(description.substring(index))); - } - return '
' + escaped.join('') + '
'; - }; - function escapeText(text) { - var match, index = 0, escaped = []; - // match new line

etc. - var pattern = //gi; - while ((match = pattern.exec(text))) { +var initialDiagram = + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; - if (match.index > index) { - escaped.push(escapeHTML(text.substring(index, match.index))); - } - escaped.push('
'); +/** + * @typedef {import('./BaseViewer').BaseViewerOptions} BaseViewerOptions + * @typedef {import('./BaseViewer').ImportXMLResult} ImportXMLResult + */ - index = match.index + match[0].length; - } +/** + * A modeler for BPMN 2.0 diagrams. + * + * + * ## Extending the Modeler + * + * In order to extend the viewer pass extension modules to bootstrap via the + * `additionalModules` option. An extension module is an object that exposes + * named services. + * + * The following example depicts the integration of a simple + * logging component that integrates with interaction events: + * + * + * ```javascript + * + * // logging component + * function InteractionLogger(eventBus) { + * eventBus.on('element.hover', function(event) { + * console.log() + * }) + * } + * + * InteractionLogger.$inject = [ 'eventBus' ]; // minification save + * + * // extension module + * var extensionModule = { + * __init__: [ 'interactionLogger' ], + * interactionLogger: [ 'type', InteractionLogger ] + * }; + * + * // extend the viewer + * var bpmnModeler = new Modeler({ additionalModules: [ extensionModule ] }); + * bpmnModeler.importXML(...); + * ``` + * + * + * ## Customizing / Replacing Components + * + * You can replace individual diagram components by redefining them in override modules. + * This works for all components, including those defined in the core. + * + * Pass in override modules via the `options.additionalModules` flag like this: + * + * ```javascript + * function CustomContextPadProvider(contextPad) { + * + * contextPad.registerProvider(this); + * + * this.getContextPadEntries = function(element) { + * // no entries, effectively disable the context pad + * return {}; + * }; + * } + * + * CustomContextPadProvider.$inject = [ 'contextPad' ]; + * + * var overrideModule = { + * contextPadProvider: [ 'type', CustomContextPadProvider ] + * }; + * + * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]}); + * ``` + * + * @param {BaseViewerOptions} [options] The options to configure the modeler. + */ +function Modeler(options) { + _BaseModeler__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, options); +} - if (index < text.length) { - escaped.push(escapeHTML(text.substring(index))); - } +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(Modeler, _BaseModeler__WEBPACK_IMPORTED_MODULE_0__["default"]); - return escaped.join(''); - } - },{"../Utils":5}],16:[function(require,module,exports){ - 'use strict'; +Modeler.Viewer = _Viewer__WEBPACK_IMPORTED_MODULE_2__["default"]; +Modeler.NavigatedViewer = _NavigatedViewer__WEBPACK_IMPORTED_MODULE_3__["default"]; - /** - * The label factory provides a label entry. For the label text - * it expects either a string provided by the options.labelText - * parameter or it could be generated programmatically using a - * function passed as the options.get parameter. - * - * @param {Object} options - * @param {string} options.id - * @param {string} [options.labelText] - * @param {Function} [options.get] - * @param {Function} [options.showLabel] - * @param {Boolean} [options.divider] adds a divider at the top of the label if true; default: false - */ - var label = function(options) { - return { - id: options.id, - html: '', - get: function(element, node) { - if (typeof options.get === 'function') { - return options.get(element, node); - } - return { label: options.labelText }; - }, - showLabel: function(element, node) { - if (typeof options.showLabel === 'function') { - return options.showLabel(element, node); - } - return true; - } - }; - }; +/** + * Create a new diagram to start modeling. + * + * @throws {ImportXMLError} An error thrown during the import of the XML. + * + * @return {Promise} A promise resolving with warnings that were produced during the import. + */ +Modeler.prototype.createDiagram = function createDiagram() { + return this.importXML(initialDiagram); +}; + + +Modeler.prototype._interactionModules = [ + + // non-modeling components + diagram_js_lib_navigation_keyboard_move__WEBPACK_IMPORTED_MODULE_4__["default"], + diagram_js_lib_navigation_movecanvas__WEBPACK_IMPORTED_MODULE_5__["default"], + diagram_js_lib_navigation_zoomscroll__WEBPACK_IMPORTED_MODULE_6__["default"] +]; + +Modeler.prototype._modelingModules = [ + + // modeling components + _features_align_elements__WEBPACK_IMPORTED_MODULE_7__["default"], + _features_auto_place__WEBPACK_IMPORTED_MODULE_8__["default"], + diagram_js_lib_features_auto_scroll__WEBPACK_IMPORTED_MODULE_9__["default"], + _features_auto_resize__WEBPACK_IMPORTED_MODULE_10__["default"], + diagram_js_lib_features_bendpoints__WEBPACK_IMPORTED_MODULE_11__["default"], + diagram_js_lib_features_connect__WEBPACK_IMPORTED_MODULE_12__["default"], + diagram_js_lib_features_connection_preview__WEBPACK_IMPORTED_MODULE_13__["default"], + _features_context_pad__WEBPACK_IMPORTED_MODULE_14__["default"], + _features_copy_paste__WEBPACK_IMPORTED_MODULE_15__["default"], + diagram_js_lib_features_create__WEBPACK_IMPORTED_MODULE_16__["default"], + _features_distribute_elements__WEBPACK_IMPORTED_MODULE_17__["default"], + _features_editor_actions__WEBPACK_IMPORTED_MODULE_18__["default"], + _features_grid_snapping__WEBPACK_IMPORTED_MODULE_19__["default"], + _features_interaction_events__WEBPACK_IMPORTED_MODULE_20__["default"], + _features_keyboard__WEBPACK_IMPORTED_MODULE_21__["default"], + diagram_js_lib_features_keyboard_move_selection__WEBPACK_IMPORTED_MODULE_22__["default"], + _features_label_editing__WEBPACK_IMPORTED_MODULE_23__["default"], + _features_modeling__WEBPACK_IMPORTED_MODULE_24__["default"], + _features_modeling_feedback__WEBPACK_IMPORTED_MODULE_25__["default"], + diagram_js_lib_features_move__WEBPACK_IMPORTED_MODULE_26__["default"], + _features_outline__WEBPACK_IMPORTED_MODULE_27__["default"], + _features_palette__WEBPACK_IMPORTED_MODULE_28__["default"], + _features_replace_preview__WEBPACK_IMPORTED_MODULE_29__["default"], + diagram_js_lib_features_resize__WEBPACK_IMPORTED_MODULE_30__["default"], + _features_snapping__WEBPACK_IMPORTED_MODULE_31__["default"], + _features_search__WEBPACK_IMPORTED_MODULE_32__["default"] +]; + + +// modules the modeler is composed of +// +// - viewer modules +// - interaction modules +// - modeling modules - module.exports = label; +Modeler.prototype._modules = [].concat( + _Viewer__WEBPACK_IMPORTED_MODULE_2__["default"].prototype._modules, + Modeler.prototype._interactionModules, + Modeler.prototype._modelingModules +); - },{}],17:[function(require,module,exports){ - 'use strict'; - var escapeHTML = require('../Utils').escapeHTML; +/***/ }), - var entryFieldDescription = require('./EntryFieldDescription'); +/***/ "../node_modules/bpmn-js/lib/NavigatedViewer.js": +/*!******************************************************!*\ + !*** ../node_modules/bpmn-js/lib/NavigatedViewer.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var bind = require('lodash/bind'); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ NavigatedViewer) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _Viewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Viewer */ "../node_modules/bpmn-js/lib/Viewer.js"); +/* harmony import */ var diagram_js_lib_navigation_keyboard_move__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/navigation/keyboard-move */ "../node_modules/diagram-js/lib/navigation/keyboard-move/index.js"); +/* harmony import */ var diagram_js_lib_navigation_movecanvas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/navigation/movecanvas */ "../node_modules/diagram-js/lib/navigation/movecanvas/index.js"); +/* harmony import */ var diagram_js_lib_navigation_zoomscroll__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/navigation/zoomscroll */ "../node_modules/diagram-js/lib/navigation/zoomscroll/index.js"); - /** - * An entry that renders a clickable link. - * - * A passed {@link options#handleClick} handler is responsible - * to process the click. - * - * The link may be conditionally shown or hidden. This can be - * controlled via the {@link options.showLink}. - * - * @param {Object} options - * @param {String} options.id - * @param {String} [options.label] - * @param {Function} options.handleClick - * @param {Function} [options.showLink] returning false to hide link - * @param {String} [options.description] - * - * @example - * - * var linkEntry = link({ - * id: 'foo', - * description: 'Some Description', - * handleClick: function(element, node, event) { ... }, - * showLink: function(element, node) { ... } - * }); - * - * @return {Entry} the newly created entry - */ - function link(options) { - var id = options.id, - label = options.label || id, - showLink = options.showLink, - handleClick = options.handleClick, - description = options.description; - if (showLink && typeof showLink !== 'function') { - throw new Error('options.showLink must be a function'); - } - if (typeof handleClick !== 'function') { - throw new Error('options.handleClick must be a function'); - } - var resource = { - id: id - }; - resource.html = - '' + escapeHTML(label) + ''; - // add description below link entry field - if (description) { - resource.html += entryFieldDescription(description); - } - resource.handleClick = bind(handleClick, resource); +/** + * @typedef { import('./BaseViewer').BaseViewerOptions } BaseViewerOptions + */ - if (typeof showLink === 'function') { - resource.showLink = function() { - return showLink.apply(resource, arguments); - }; - } +/** + * A viewer with mouse and keyboard navigation features. + * + * @param {BaseViewerOptions} [options] + */ +function NavigatedViewer(options) { + _Viewer__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, options); +} - return resource; - } +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(NavigatedViewer, _Viewer__WEBPACK_IMPORTED_MODULE_0__["default"]); - module.exports = link; - },{"../Utils":5,"./EntryFieldDescription":15,"lodash/bind":605}],18:[function(require,module,exports){ - 'use strict'; +NavigatedViewer.prototype._navigationModules = [ + diagram_js_lib_navigation_keyboard_move__WEBPACK_IMPORTED_MODULE_2__["default"], + diagram_js_lib_navigation_movecanvas__WEBPACK_IMPORTED_MODULE_3__["default"], + diagram_js_lib_navigation_zoomscroll__WEBPACK_IMPORTED_MODULE_4__["default"] +]; - var escapeHTML = require('../Utils').escapeHTML; +NavigatedViewer.prototype._modules = [].concat( + _Viewer__WEBPACK_IMPORTED_MODULE_0__["default"].prototype._modules, + NavigatedViewer.prototype._navigationModules +); - var domify = require('min-dom').domify; +/***/ }), - var forEach = require('lodash/forEach'); +/***/ "../node_modules/bpmn-js/lib/Viewer.js": +/*!*********************************************!*\ + !*** ../node_modules/bpmn-js/lib/Viewer.js ***! + \*********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var entryFieldDescription = require('./EntryFieldDescription'); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Viewer) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core */ "../node_modules/bpmn-js/lib/core/index.js"); +/* harmony import */ var diagram_js_lib_i18n_translate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/i18n/translate */ "../node_modules/diagram-js/lib/i18n/translate/index.js"); +/* harmony import */ var diagram_js_lib_features_selection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/features/selection */ "../node_modules/diagram-js/lib/features/selection/index.js"); +/* harmony import */ var diagram_js_lib_features_overlays__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! diagram-js/lib/features/overlays */ "../node_modules/diagram-js/lib/features/overlays/index.js"); +/* harmony import */ var _features_drilldown__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./features/drilldown */ "../node_modules/bpmn-js/lib/features/drilldown/index.js"); +/* harmony import */ var _BaseViewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseViewer */ "../node_modules/bpmn-js/lib/BaseViewer.js"); - var isList = function(list) { - return !(!list || Object.prototype.toString.call(list) !== '[object Array]'); - }; - var addEmptyParameter = function(list) { - return list.concat([ { name: '', value: '' } ]); - }; - var createOption = function(option) { - return ''; - }; - /** - * @param {Object} options - * @param {string} options.id - * @param {string} [options.label] - * @param {Array} options.selectOptions - * @param {string} options.modelProperty - * @param {boolean} options.emptyParameter - * @param {function} options.disabled - * @param {function} options.hidden - * @param {Object} defaultParameters - * - * @return {Object} - */ - var selectbox = function(options, defaultParameters) { - var resource = defaultParameters, - label = options.label || resource.id, - selectOptions = options.selectOptions || [ { name: '', value: '' } ], - modelProperty = options.modelProperty, - emptyParameter = options.emptyParameter, - canBeDisabled = !!options.disabled && typeof options.disabled === 'function', - canBeHidden = !!options.hidden && typeof options.hidden === 'function', - description = options.description; - - - if (emptyParameter) { - selectOptions = addEmptyParameter(selectOptions); - } - - - resource.html = - '' + - ''; - // add description below select box entry field - if (description && typeof options.showCustomInput !== 'function') { - resource.html += entryFieldDescription(description); - } - /** - * Fill the select box options dynamically. - * - * Calls the defined function #selectOptions in the entry to get the - * values for the options and set the value to the inputNode. - * - * @param {djs.model.Base} element - * @param {HTMLElement} entryNode - * @param {EntryDescriptor} inputNode - * @param {Object} inputName - * @param {Object} newValue - */ - resource.setControlValue = function(element, entryNode, inputNode, inputName, newValue) { - if (typeof selectOptions === 'function') { - var options = selectOptions(element, inputNode); - if (options) { - // remove existing options - while (inputNode.firstChild) { - inputNode.removeChild(inputNode.firstChild); - } +/** + * @typedef { import('./BaseViewer').BaseViewerOptions } BaseViewerOptions + */ - // add options - forEach(options, function(option) { - var template = domify(createOption(option)); +/** + * A viewer for BPMN 2.0 diagrams. + * + * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include + * additional features. + * + * + * ## Extending the Viewer + * + * In order to extend the viewer pass extension modules to bootstrap via the + * `additionalModules` option. An extension module is an object that exposes + * named services. + * + * The following example depicts the integration of a simple + * logging component that integrates with interaction events: + * + * + * ```javascript + * + * // logging component + * function InteractionLogger(eventBus) { + * eventBus.on('element.hover', function(event) { + * console.log() + * }) + * } + * + * InteractionLogger.$inject = [ 'eventBus' ]; // minification save + * + * // extension module + * var extensionModule = { + * __init__: [ 'interactionLogger' ], + * interactionLogger: [ 'type', InteractionLogger ] + * }; + * + * // extend the viewer + * var bpmnViewer = new Viewer({ additionalModules: [ extensionModule ] }); + * bpmnViewer.importXML(...); + * ``` + * + * @param {BaseViewerOptions} [options] The options to configure the viewer. + */ +function Viewer(options) { + _BaseViewer__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, options); +} + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(Viewer, _BaseViewer__WEBPACK_IMPORTED_MODULE_0__["default"]); + +// modules the viewer is composed of +Viewer.prototype._modules = [ + _core__WEBPACK_IMPORTED_MODULE_2__["default"], + diagram_js_lib_i18n_translate__WEBPACK_IMPORTED_MODULE_3__["default"], + diagram_js_lib_features_selection__WEBPACK_IMPORTED_MODULE_4__["default"], + diagram_js_lib_features_overlays__WEBPACK_IMPORTED_MODULE_5__["default"], + _features_drilldown__WEBPACK_IMPORTED_MODULE_6__["default"] +]; + +// default moddle extensions the viewer is composed of +Viewer.prototype._moddleExtensions = {}; + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/core/index.js": +/*!*************************************************!*\ + !*** ../node_modules/bpmn-js/lib/core/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _draw__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../draw */ "../node_modules/bpmn-js/lib/draw/index.js"); +/* harmony import */ var _import__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../import */ "../node_modules/bpmn-js/lib/import/index.js"); + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + _draw__WEBPACK_IMPORTED_MODULE_0__["default"], + _import__WEBPACK_IMPORTED_MODULE_1__["default"] + ] +}); + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/draw/BpmnRenderUtil.js": +/*!**********************************************************!*\ + !*** ../node_modules/bpmn-js/lib/draw/BpmnRenderUtil.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ black: () => (/* binding */ black), +/* harmony export */ getBounds: () => (/* binding */ getBounds), +/* harmony export */ getCirclePath: () => (/* binding */ getCirclePath), +/* harmony export */ getDi: () => (/* reexport safe */ _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getDi), +/* harmony export */ getDiamondPath: () => (/* binding */ getDiamondPath), +/* harmony export */ getFillColor: () => (/* binding */ getFillColor), +/* harmony export */ getHeight: () => (/* binding */ getHeight), +/* harmony export */ getLabelColor: () => (/* binding */ getLabelColor), +/* harmony export */ getRectPath: () => (/* binding */ getRectPath), +/* harmony export */ getRoundRectPath: () => (/* binding */ getRoundRectPath), +/* harmony export */ getSemantic: () => (/* reexport safe */ _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getBusinessObject), +/* harmony export */ getStrokeColor: () => (/* binding */ getStrokeColor), +/* harmony export */ getWidth: () => (/* binding */ getWidth), +/* harmony export */ isCollection: () => (/* binding */ isCollection), +/* harmony export */ isThrowEvent: () => (/* binding */ isThrowEvent), +/* harmony export */ isTypedEvent: () => (/* binding */ isTypedEvent), +/* harmony export */ white: () => (/* binding */ white) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/util/RenderUtil */ "../node_modules/diagram-js/lib/util/RenderUtil.js"); + + + + + + + +/** + * @typedef {import('../model').ModdleElement} ModdleElement + * @typedef {import('../model').Element} Element + * + * @typedef {import('../model').ShapeLike} ShapeLike + * + * @typedef {import('diagram-js/lib/util/Types').Dimensions} Dimensions + * @typedef {import('diagram-js/lib/util/Types').Rect} Rect + */ - inputNode.appendChild(template); - }); +// re-export for compatibility - } - } - // set select value - if (newValue !== undefined) { - inputNode.value = newValue; - } +var black = 'hsl(225, 10%, 15%)'; +var white = 'white'; - }; +// element utils ////////////////////// - if (canBeDisabled) { - resource.isDisabled = function() { - return options.disabled.apply(resource, arguments); - }; - } +/** + * Checks if eventDefinition of the given element matches with semantic type. + * + * @param {ModdleElement} event + * @param {string} eventDefinitionType + * + * @return {boolean} + */ +function isTypedEvent(event, eventDefinitionType) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.some)(event.eventDefinitions, function(definition) { + return definition.$type === eventDefinitionType; + }); +} + +/** + * Check if element is a throw event. + * + * @param {ModdleElement} event + * + * @return {boolean} + */ +function isThrowEvent(event) { + return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent'); +} - if (canBeHidden) { - resource.isHidden = function() { - return !options.hidden.apply(resource, arguments); - }; - } +/** + * Check if element is a throw event. + * + * @param {ModdleElement} element + * + * @return {boolean} + */ +function isCollection(element) { + var dataObject = element.dataObjectRef; - resource.cssClasses = ['bpp-dropdown']; + return element.isCollection || (dataObject && dataObject.isCollection); +} - return resource; - }; - module.exports = selectbox; +// color access ////////////////////// - },{"../Utils":5,"./EntryFieldDescription":15,"lodash/forEach":613,"min-dom":647}],19:[function(require,module,exports){ - 'use strict'; +/** + * @param {Element} element + * @param {string} [defaultColor] + * @param {string} [overrideColor] + * + * @return {string} + */ +function getFillColor(element, defaultColor, overrideColor) { + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getDi)(element); - var escapeHTML = require('../Utils').escapeHTML; + return overrideColor || di.get('color:background-color') || di.get('bioc:fill') || defaultColor || white; +} - var cmdHelper = require('../helper/CmdHelper'); +/** + * @param {Element} element + * @param {string} [defaultColor] + * @param {string} [overrideColor] + * + * @return {string} + */ +function getStrokeColor(element, defaultColor, overrideColor) { + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getDi)(element); - var domQuery = require('min-dom').query, - domAttr = require('min-dom').attr, - domClosest = require('min-dom').closest; + return overrideColor || di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black; +} - var filter = require('lodash/filter'), - forEach = require('lodash/forEach'), - keys = require('lodash/keys'); +/** + * @param {Element} element + * @param {string} [defaultColor] + * @param {string} [defaultStrokeColor] + * @param {string} [overrideColor] + * + * @return {string} + */ +function getLabelColor(element, defaultColor, defaultStrokeColor, overrideColor) { + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getDi)(element), + label = di.get('label'); - var domify = require('min-dom').domify; + return overrideColor || (label && label.get('color:color')) || defaultColor || + getStrokeColor(element, defaultStrokeColor); +} - var entryFieldDescription = require('./EntryFieldDescription'); +// cropping path customizations ////////////////////// - var updateSelection = require('selection-update'); +/** + * @param {ShapeLike} shape + * + * @return {string} path + */ +function getCirclePath(shape) { + + var cx = shape.x + shape.width / 2, + cy = shape.y + shape.height / 2, + radius = shape.width / 2; + + var circlePath = [ + [ 'M', cx, cy ], + [ 'm', 0, -radius ], + [ 'a', radius, radius, 0, 1, 1, 0, 2 * radius ], + [ 'a', radius, radius, 0, 1, 1, 0, -2 * radius ], + [ 'z' ] + ]; + + return (0,diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_2__.componentsToPath)(circlePath); +} + +/** + * @param {ShapeLike} shape + * @param {number} [borderRadius] + * + * @return {string} path + */ +function getRoundRectPath(shape, borderRadius) { + + var x = shape.x, + y = shape.y, + width = shape.width, + height = shape.height; + + var roundRectPath = [ + [ 'M', x + borderRadius, y ], + [ 'l', width - borderRadius * 2, 0 ], + [ 'a', borderRadius, borderRadius, 0, 0, 1, borderRadius, borderRadius ], + [ 'l', 0, height - borderRadius * 2 ], + [ 'a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, borderRadius ], + [ 'l', borderRadius * 2 - width, 0 ], + [ 'a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, -borderRadius ], + [ 'l', 0, borderRadius * 2 - height ], + [ 'a', borderRadius, borderRadius, 0, 0, 1, borderRadius, -borderRadius ], + [ 'z' ] + ]; + + return (0,diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_2__.componentsToPath)(roundRectPath); +} + +/** + * @param {ShapeLike} shape + * + * @return {string} path + */ +function getDiamondPath(shape) { + + var width = shape.width, + height = shape.height, + x = shape.x, + y = shape.y, + halfWidth = width / 2, + halfHeight = height / 2; + + var diamondPath = [ + [ 'M', x + halfWidth, y ], + [ 'l', halfWidth, halfHeight ], + [ 'l', -halfWidth, halfHeight ], + [ 'l', -halfWidth, -halfHeight ], + [ 'z' ] + ]; + + return (0,diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_2__.componentsToPath)(diamondPath); +} + +/** + * @param {ShapeLike} shape + * + * @return {string} path + */ +function getRectPath(shape) { + var x = shape.x, + y = shape.y, + width = shape.width, + height = shape.height; + + var rectPath = [ + [ 'M', x, y ], + [ 'l', width, 0 ], + [ 'l', 0, height ], + [ 'l', -width, 0 ], + [ 'z' ] + ]; + + return (0,diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_2__.componentsToPath)(rectPath); +} + +/** + * Get width and height from element or overrides. + * + * @param {Dimensions|Rect|ShapeLike} bounds + * @param {Object} overrides + * + * @returns {Dimensions} + */ +function getBounds(bounds, overrides = {}) { + return { + width: getWidth(bounds, overrides), + height: getHeight(bounds, overrides) + }; +} + +/** + * Get width from element or overrides. + * + * @param {Dimensions|Rect|ShapeLike} bounds + * @param {Object} overrides + * + * @returns {number} + */ +function getWidth(bounds, overrides = {}) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.has)(overrides, 'width') ? overrides.width : bounds.width; +} - var TABLE_ROW_DIV_SNIPPET = '
'; - var DELETE_ROW_BUTTON_SNIPPET = ''; +/** + * Get height from element or overrides. + * + * @param {Dimensions|Rect|ShapeLike} bounds + * @param {Object} overrides + * + * @returns {number} + */ +function getHeight(bounds, overrides = {}) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.has)(overrides, 'height') ? overrides.height : bounds.height; +} - function createInputRowTemplate(properties, canRemove) { - var template = TABLE_ROW_DIV_SNIPPET; - template += createInputTemplate(properties, canRemove); - template += canRemove ? DELETE_ROW_BUTTON_SNIPPET : ''; - template += '
'; +/***/ }), - return template; - } +/***/ "../node_modules/bpmn-js/lib/draw/BpmnRenderer.js": +/*!********************************************************!*\ + !*** ../node_modules/bpmn-js/lib/draw/BpmnRenderer.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - function createInputTemplate(properties, canRemove) { - var columns = properties.length; - var template = ''; - forEach(properties, function(prop) { - template += ''; - }); - return template; - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnRenderer) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_draw_BaseRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/draw/BaseRenderer */ "../node_modules/diagram-js/lib/draw/BaseRenderer.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../util/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var _BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BpmnRenderUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! diagram-js/lib/util/RenderUtil */ "../node_modules/diagram-js/lib/util/RenderUtil.js"); +/* harmony import */ var _BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BpmnRenderUtil */ "../node_modules/bpmn-js/lib/draw/BpmnRenderUtil.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var tiny_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tiny-svg */ "../node_modules/tiny-svg/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! diagram-js/lib/util/SvgTransformUtil */ "../node_modules/diagram-js/lib/util/SvgTransformUtil.js"); +/* harmony import */ var ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ids */ "../node_modules/ids/dist/index.esm.js"); - function createLabelRowTemplate(labels) { - var template = TABLE_ROW_DIV_SNIPPET; - template += createLabelTemplate(labels); - template += ''; - return template; - } - function createLabelTemplate(labels) { - var columns = labels.length; - var template = ''; - forEach(labels, function(label) { - template += ''; - }); - return template; - } - function pick(elements, properties) { - return (elements || []).map(function(elem) { - var newElement = {}; - forEach(properties, function(prop) { - newElement[prop] = elem[prop] || ''; - }); - return newElement; - }); - } - function diff(element, node, values, oldValues, editable) { - return filter(values, function(value, idx) { - return !valueEqual(element, node, value, oldValues[idx], editable, idx); - }); - } - function valueEqual(element, node, value, oldValue, editable, idx) { - if (value && !oldValue) { - return false; - } - var allKeys = keys(value).concat(keys(oldValue)); - return allKeys.every(function(key) { - var n = value[key] || undefined; - var o = oldValue[key] || undefined; - return !editable(element, node, key, idx) || n === o; - }); - } - function getEntryNode(node) { - return domClosest(node, '[data-entry]', true); - } - function getContainer(node) { - return domQuery('div[data-list-entry-container]', node); - } - function getSelection(node) { - return { - start: node.selectionStart, - end: node.selectionEnd - }; - } - function setSelection(node, selection) { - node.selectionStart = selection.start; - node.selectionEnd = selection.end; - } - /** - * @param {Object} options - * @param {string} options.id - * @param {string} options.description - * @param {Array} options.modelProperties - * @param {Array} options.labels - * @param {Function} options.getElements - this callback function must return a list of business object items - * @param {Function} options.removeElement - * @param {Function} options.addElement - * @param {Function} options.updateElement - * @param {Function} options.editable - * @param {Function} options.setControlValue - * @param {Function} options.show - * - * @return {Object} - */ - module.exports = function(options) { - var id = options.id, - modelProperties = options.modelProperties, - labels = options.labels, - description = options.description; - var labelRow = createLabelRowTemplate(labels); - var getElements = options.getElements; - var removeElement = options.removeElement, - canRemove = typeof removeElement === 'function'; - var addElement = options.addElement, - canAdd = typeof addElement === 'function', - addLabel = options.addLabel || 'Add Value'; - var updateElement = options.updateElement, - canUpdate = typeof updateElement === 'function'; - var editable = options.editable || function() { return true; }, - setControlValue = options.setControlValue; - var show = options.show, - canBeShown = typeof show === 'function'; - var elements = function(element, node) { - return pick(getElements(element, node), modelProperties); - }; - var factory = { - id: id, - html: (canAdd ? - '
' + - '' + - '' + - '
' : '') + - '
' + - '
' + - labelRow + - '
' + - '
' + - '
' + - '
' + - // add description below table entry field - (description ? entryFieldDescription(description) : ''), - get: function(element, node) { - var boElements = elements(element, node, this.__invalidValues); - var invalidValues = this.__invalidValues; - delete this.__invalidValues; +var rendererIds = new ids__WEBPACK_IMPORTED_MODULE_0__["default"](); - forEach(invalidValues, function(value, idx) { - var element = boElements[idx]; +var ELEMENT_LABEL_DISTANCE = 10, + INNER_OUTER_DIST = 3, + PARTICIPANT_STROKE_WIDTH = 1.5, + TASK_BORDER_RADIUS = 10; - forEach(modelProperties, function(prop) { - element[prop] = value[prop]; - }); - }); +var DEFAULT_OPACITY = 0.95, + FULL_OPACITY = 1, + LOW_OPACITY = 0.25; - return boElements; - }, +/** + * @typedef { Partial<{ + * defaultFillColor: string, + * defaultStrokeColor: string, + * defaultLabelColor: string + * }> } BpmnRendererConfig + * + * @typedef { Partial<{ + * fill: string, + * stroke: string, + * width: string, + * height: string + * }> } Attrs + */ - set: function(element, values, node) { - var action = this.__action || {}; - delete this.__action; +/** + * @typedef { import('../model/Types').Element } Element + */ - if (action.id === 'delete-element') { - return removeElement(element, node, action.idx); - } - else if (action.id === 'add-element') { - return addElement(element, node); - } - else if (canUpdate) { - var commands = [], - valuesToValidate = values; +/** + * A renderer for BPMN elements + * + * @param {BpmnRendererConfig} config + * @param {import('diagram-js/lib/core/EventBus').default} eventBus + * @param {import('diagram-js/lib/draw/Styles').default} styles + * @param {import('./PathMap').default} pathMap + * @param {import('diagram-js/lib/core/Canvas').default} canvas + * @param {import('./TextRenderer').default} textRenderer + * @param {number} [priority] + */ +function BpmnRenderer( + config, eventBus, styles, pathMap, + canvas, textRenderer, priority) { + + diagram_js_lib_draw_BaseRenderer__WEBPACK_IMPORTED_MODULE_1__["default"].call(this, eventBus, priority); + + var defaultFillColor = config && config.defaultFillColor, + defaultStrokeColor = config && config.defaultStrokeColor, + defaultLabelColor = config && config.defaultLabelColor; + + var rendererId = rendererIds.next(); + + var markers = {}; + + function shapeStyle(attrs) { + return styles.computeStyle(attrs, { + strokeLinecap: 'round', + strokeLinejoin: 'round', + stroke: _BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.black, + strokeWidth: 2, + fill: 'white' + }); + } + + function lineStyle(attrs) { + return styles.computeStyle(attrs, [ 'no-fill' ], { + strokeLinecap: 'round', + strokeLinejoin: 'round', + stroke: _BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.black, + strokeWidth: 2 + }); + } + + function addMarker(id, options) { + var { + ref = { x: 0, y: 0 }, + scale = 1, + element + } = options; + + var marker = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('marker', { + id: id, + viewBox: '0 0 20 20', + refX: ref.x, + refY: ref.y, + markerWidth: 20 * scale, + markerHeight: 20 * scale, + orient: 'auto' + }); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(marker, element); + + var defs = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.query)('defs', canvas._svg); + + if (!defs) { + defs = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('defs'); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(canvas._svg, defs); + } + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(defs, marker); + + markers[id] = marker; + } + + function colorEscape(str) { + + // only allow characters and numbers + return str.replace(/[^0-9a-zA-Z]+/g, '_'); + } + + function marker(type, fill, stroke) { + var id = type + '-' + colorEscape(fill) + '-' + colorEscape(stroke) + '-' + rendererId; + + if (!markers[id]) { + createMarker(id, type, fill, stroke); + } + + return 'url(#' + id + ')'; + } + + function createMarker(id, type, fill, stroke) { + + if (type === 'sequenceflow-end') { + var sequenceflowEnd = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'M 1 5 L 11 10 L 1 15 Z', + ...shapeStyle({ + fill: stroke, + stroke: stroke, + strokeWidth: 1 + }) + }); + + addMarker(id, { + element: sequenceflowEnd, + ref: { x: 11, y: 10 }, + scale: 0.5 + }); + } + + if (type === 'messageflow-start') { + var messageflowStart = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('circle', { + cx: 6, + cy: 6, + r: 3.5, + ...shapeStyle({ + fill, + stroke: stroke, + strokeWidth: 1, + + // fix for safari / chrome / firefox bug not correctly + // resetting stroke dash array + strokeDasharray: [ 10000, 1 ] + }) + }); + + addMarker(id, { + element: messageflowStart, + ref: { x: 6, y: 6 } + }); + } + + if (type === 'messageflow-end') { + var messageflowEnd = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z', + ...shapeStyle({ + fill, + stroke: stroke, + strokeWidth: 1, + + // fix for safari / chrome / firefox bug not correctly + // resetting stroke dash array + strokeDasharray: [ 10000, 1 ] + }) + }); + + addMarker(id, { + element: messageflowEnd, + ref: { x: 8.5, y: 5 } + }); + } + + if (type === 'association-start') { + var associationStart = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'M 11 5 L 1 10 L 11 15', + ...lineStyle({ + fill: 'none', + stroke, + strokeWidth: 1.5, + + // fix for safari / chrome / firefox bug not correctly + // resetting stroke dash array + strokeDasharray: [ 10000, 1 ] + }) + }); + + addMarker(id, { + element: associationStart, + ref: { x: 1, y: 10 }, + scale: 0.5 + }); + } + + if (type === 'association-end') { + var associationEnd = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'M 1 5 L 11 10 L 1 15', + ...lineStyle({ + fill: 'none', + stroke, + strokeWidth: 1.5, + + // fix for safari / chrome / firefox bug not correctly + // resetting stroke dash array + strokeDasharray: [ 10000, 1 ] + }) + }); + + addMarker(id, { + element: associationEnd, + ref: { x: 11, y: 10 }, + scale: 0.5 + }); + } + + if (type === 'conditional-flow-marker') { + var conditionalFlowMarker = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z', + ...shapeStyle({ + fill, + stroke: stroke + }) + }); + + addMarker(id, { + element: conditionalFlowMarker, + ref: { x: -1, y: 10 }, + scale: 0.5 + }); + } + + if (type === 'conditional-default-flow-marker') { + var defaultFlowMarker = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + d: 'M 6 4 L 10 16', + ...shapeStyle({ + stroke: stroke + }) + }); + + addMarker(id, { + element: defaultFlowMarker, + ref: { x: 0, y: 10 }, + scale: 0.5 + }); + } + } + + function drawCircle(parentGfx, width, height, offset, attrs = {}) { + + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isObject)(offset)) { + attrs = offset; + offset = 0; + } + + offset = offset || 0; + + attrs = shapeStyle(attrs); + + var cx = width / 2, + cy = height / 2; + + var circle = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('circle', { + cx: cx, + cy: cy, + r: Math.round((width + height) / 4 - offset), + ...attrs + }); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, circle); + + return circle; + } + + function drawRect(parentGfx, width, height, r, offset, attrs) { + + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isObject)(offset)) { + attrs = offset; + offset = 0; + } + + offset = offset || 0; + + attrs = shapeStyle(attrs); + + var rect = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('rect', { + x: offset, + y: offset, + width: width - offset * 2, + height: height - offset * 2, + rx: r, + ry: r, + ...attrs + }); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, rect); + + return rect; + } + + function drawDiamond(parentGfx, width, height, attrs) { + + var x_2 = width / 2; + var y_2 = height / 2; + + var points = [ + { x: x_2, y: 0 }, + { x: width, y: y_2 }, + { x: x_2, y: height }, + { x: 0, y: y_2 } + ]; + + var pointsString = points.map(function(point) { + return point.x + ',' + point.y; + }).join(' '); + + attrs = shapeStyle(attrs); + + var polygon = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('polygon', { + ...attrs, + points: pointsString + }); - if (typeof options.validate !== 'function') { - valuesToValidate = diff(element, node, values, elements(element, node), editable); - } + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, polygon); - var self = this; + return polygon; + } - forEach(valuesToValidate, function(value) { - var validationError, - idx = values.indexOf(value); + /** + * @param {SVGElement} parentGfx + * @param {Point[]} waypoints + * @param {any} attrs + * @param {number} [radius] + * + * @return {SVGElement} + */ + function drawLine(parentGfx, waypoints, attrs, radius) { + attrs = lineStyle(attrs); - if (typeof options.validate === 'function') { - validationError = options.validate(element, value, node, idx); - } + var line = (0,diagram_js_lib_util_RenderUtil__WEBPACK_IMPORTED_MODULE_6__.createLine)(waypoints, attrs, radius); - if (!validationError) { - var cmd = updateElement(element, value, node, idx); + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, line); - if (cmd) { - commands.push(cmd); - } - } else { - // cache invalid value in an object by index as key - self.__invalidValues = self.__invalidValues || {}; - self.__invalidValues[idx] = value; + return line; + } - // execute a command, which does not do anything - commands.push(cmdHelper.updateProperties(element, {})); - } - }); + /** + * @param {SVGElement} parentGfx + * @param {Point[]} waypoints + * @param {any} attrs + * + * @return {SVGElement} + */ + function drawConnectionSegments(parentGfx, waypoints, attrs) { + return drawLine(parentGfx, waypoints, attrs, 5); + } + + function drawPath(parentGfx, d, attrs) { + attrs = lineStyle(attrs); + + var path = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.create)('path', { + ...attrs, + d + }); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, path); + + return path; + } + + function drawMarker(type, parentGfx, path, attrs) { + return drawPath(parentGfx, path, (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.assign)({ 'data-marker': type }, attrs)); + } + + function renderer(type) { + return handlers[type]; + } + + function as(type) { + return function(parentGfx, element, attrs) { + return renderer(type)(parentGfx, element, attrs); + }; + } + + var eventIconRenderers = { + 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_MESSAGE', { + xScaleFactor: 0.9, + yScaleFactor: 0.9, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.235, + my: 0.315 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill); + + var stroke = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke); + + var messagePath = drawPath(parentGfx, pathData, { + fill, + stroke, + strokeWidth: 1 + }); + + return messagePath; + }, + 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) { + var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 2 + }); + + var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', { + xScaleFactor: 0.75, + yScaleFactor: 0.75, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.5, + my: 0.5 + } + }); + + drawPath(parentGfx, pathData, { + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 2 + }); + + for (var i = 0; i < 12; i++) { + var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', { + xScaleFactor: 0.75, + yScaleFactor: 0.75, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.5, + my: 0.5 + } + }); - return commands; - } - }, - createListEntryTemplate: function(value, index, selectBox) { - return createInputRowTemplate(modelProperties, canRemove); - }, + var width = element.width / 2, + height = element.height / 2; - addElement: function(element, node, event, scopeNode) { - var template = domify(createInputRowTemplate(modelProperties, canRemove)); + drawPath(parentGfx, linePathData, { + strokeWidth: 1, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')' + }); + } + + return circle; + }, + 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_ESCALATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.5, + my: 0.2 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) { + var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.5, + my: 0.222 + } + }); + + return drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_LINK', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.57, + my: 0.263 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_ERROR', { + xScaleFactor: 1.1, + yScaleFactor: 1.1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.2, + my: 0.722 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', { + xScaleFactor: 1.0, + yScaleFactor: 1.0, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.638, + my: -0.055 + } + }); + + var fill = isThrowing ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) : 'none'; + + var path = drawPath(parentGfx, pathData, { + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__.rotate)(path, 45); + + return path; + }, + 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.22, + my: 0.5 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_SIGNAL', { + xScaleFactor: 0.9, + yScaleFactor: 0.9, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.5, + my: 0.2 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + strokeWidth: 1, + fill, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + }); + }, + 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) { + var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', { + xScaleFactor: 1.1, + yScaleFactor: 1.1, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.222, + my: 0.36 + } + }); + + var fill = isThrowing + ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke) + : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill); + + return drawPath(parentGfx, pathData, { + fill, + strokeWidth: 1 + }); + }, + 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) { + var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', { + xScaleFactor: 1.2, + yScaleFactor: 1.2, + containerWidth: event.width, + containerHeight: event.height, + position: { + mx: 0.458, + my: 0.194 + } + }); + + return drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(event, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(event, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + }, + 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) { + var circle = drawCircle(parentGfx, element.width, element.height, 8, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 4 + }); + + return circle; + } + }; + + function renderEventIcon(element, parentGfx, attrs = {}) { + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element), + isThrowing = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isThrowEvent)(semantic); + + if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) { + if (semantic.get('parallelMultiple')) { + return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + else { + return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:MessageEventDefinition')) { + return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:TimerEventDefinition')) { + return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:ConditionalEventDefinition')) { + return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:SignalEventDefinition')) { + return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:EscalationEventDefinition')) { + return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:LinkEventDefinition')) { + return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:ErrorEventDefinition')) { + return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:CancelEventDefinition')) { + return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:CompensateEventDefinition')) { + return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isTypedEvent)(semantic, 'bpmn:TerminateEventDefinition')) { + return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing); + } + + return null; + } + + var taskMarkerRenderers = { + 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) { + var width = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + + var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: width, + containerHeight: height, + position: { + mx: ((width / 2 - 6) / width), + my: (height - 15) / height + } + }); + + drawMarker('participant-multiplicity', parentGfx, markerPath, { + strokeWidth: 2, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + }, + 'SubProcessMarker': function(parentGfx, element, attrs = {}) { + var markerRect = drawRect(parentGfx, 14, 14, 0, { + strokeWidth: 1, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__.translate)(markerRect, element.width / 2 - 7.5, element.height - 20); + + var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', { + xScaleFactor: 1.5, + yScaleFactor: 1.5, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: (element.width / 2 - 7.5) / element.width, + my: (element.height - 20) / element.height + } + }); + + drawMarker('sub-process', parentGfx, markerPath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + }, + 'ParallelMarker': function(parentGfx, element, attrs) { + var width = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + + var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: width, + containerHeight: height, + position: { + mx: ((width / 2 + attrs.parallel) / width), + my: (height - 20) / height + } + }); + + drawMarker('parallel', parentGfx, markerPath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + }, + 'SequentialMarker': function(parentGfx, element, attrs) { + var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: ((element.width / 2 + attrs.seq) / element.width), + my: (element.height - 19) / element.height + } + }); + + drawMarker('sequential', parentGfx, markerPath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + }, + 'CompensationMarker': function(parentGfx, element, attrs) { + var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: ((element.width / 2 + attrs.compensation) / element.width), + my: (element.height - 13) / element.height + } + }); + + drawMarker('compensation', parentGfx, markerMath, { + strokeWidth: 1, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + }, + 'LoopMarker': function(parentGfx, element, attrs) { + var width = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + + var markerPath = pathMap.getScaledPath('MARKER_LOOP', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: width, + containerHeight: height, + position: { + mx: ((width / 2 + attrs.loop) / width), + my: (height - 7) / height + } + }); + + drawMarker('loop', parentGfx, markerPath, { + strokeWidth: 1.5, + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeMiterlimit: 0.5 + }); + }, + 'AdhocMarker': function(parentGfx, element, attrs) { + var width = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + + var markerPath = pathMap.getScaledPath('MARKER_ADHOC', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: width, + containerHeight: height, + position: { + mx: ((width / 2 + attrs.adhoc) / width), + my: (height - 15) / height + } + }); + + drawMarker('adhoc', parentGfx, markerPath, { + strokeWidth: 1, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + } + }; + + function renderTaskMarker(type, parentGfx, element, attrs) { + taskMarkerRenderers[ type ](parentGfx, element, attrs); + } + + function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) { + attrs = { + fill: attrs.fill, + stroke: attrs.stroke, + width: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs) + }; + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker'); + + if (subprocess) { + attrs = { + ...attrs, + seq: -21, + parallel: -22, + compensation: -42, + loop: -18, + adhoc: 10 + }; + } else { + attrs = { + ...attrs, + seq: -5, + parallel: -6, + compensation: -27, + loop: 0, + adhoc: 10 + }; + } + + (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.forEach)(taskMarkers, function(marker) { + renderTaskMarker(marker, parentGfx, element, attrs); + }); + + if (semantic.get('isForCompensation')) { + renderTaskMarker('CompensationMarker', parentGfx, element, attrs); + } + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(semantic, 'bpmn:AdHocSubProcess')) { + renderTaskMarker('AdhocMarker', parentGfx, element, attrs); + } + + var loopCharacteristics = semantic.get('loopCharacteristics'), + isSequential = loopCharacteristics && loopCharacteristics.get('isSequential'); + + if (loopCharacteristics) { + + if (isSequential === undefined) { + renderTaskMarker('LoopMarker', parentGfx, element, attrs); + } + + if (isSequential === false) { + renderTaskMarker('ParallelMarker', parentGfx, element, attrs); + } + + if (isSequential === true) { + renderTaskMarker('SequentialMarker', parentGfx, element, attrs); + } + } + } + + function renderLabel(parentGfx, label, attrs = {}) { + attrs = (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.assign)({ + size: { + width: 100 + } + }, attrs); + + var text = textRenderer.createText(label || '', attrs); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.classes)(text).add('djs-label'); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.append)(parentGfx, text); + + return text; + } + + function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) { + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + var box = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getBounds)({ + x: element.x, + y: element.y, + width: element.width, + height: element.height + }, attrs); + + return renderLabel(parentGfx, semantic.name, { + align, + box, + padding: 7, + style: { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getLabelColor)(element, defaultLabelColor, defaultStrokeColor, attrs.stroke) + } + }); + } + + function renderExternalLabel(parentGfx, element, attrs = {}) { + var box = { + width: 90, + height: 30, + x: element.width / 2 + element.x, + y: element.height / 2 + element.y + }; + + return renderLabel(parentGfx, (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_9__.getLabel)(element), { + box: box, + fitBox: true, + style: (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.assign)( + {}, + textRenderer.getExternalStyle(), + { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getLabelColor)(element, defaultLabelColor, defaultStrokeColor, attrs.stroke) + } + ) + }); + } + + function renderLaneLabel(parentGfx, text, element, attrs = {}) { + var isHorizontalLane = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isHorizontal)(element); + + var textBox = renderLabel(parentGfx, text, { + box: { + height: 30, + width: isHorizontalLane ? (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs) : (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + }, + align: 'center-middle', + style: { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getLabelColor)(element, defaultLabelColor, defaultStrokeColor, attrs.stroke) + } + }); + + if (isHorizontalLane) { + var top = -1 * (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__.transform)(textBox, 0, -top, 270); + } + } + + function renderActivity(parentGfx, element, attrs = {}) { + var { + width, + height + } = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getBounds)(element, attrs); + + return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, { + ...attrs, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + fillOpacity: DEFAULT_OPACITY, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + } + + function renderAssociation(parentGfx, element, attrs = {}) { + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + var fill = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke); + + if (semantic.get('associationDirection') === 'One' || + semantic.get('associationDirection') === 'Both') { + attrs.markerEnd = marker('association-end', fill, stroke); + } + + if (semantic.get('associationDirection') === 'Both') { + attrs.markerStart = marker('association-start', fill, stroke); + } + + attrs = pickAttrs(attrs, [ + 'markerStart', + 'markerEnd' + ]); + + return drawConnectionSegments(parentGfx, element.waypoints, { + ...attrs, + stroke, + strokeDasharray: '0, 5' + }); + } + + function renderDataObject(parentGfx, element, attrs = {}) { + var fill = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke); + + var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.474, + my: 0.296 + } + }); + + var dataObject = drawPath(parentGfx, pathData, { + fill, + fillOpacity: DEFAULT_OPACITY, + stroke + }); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.isCollection)(semantic)) { + var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.33, + my: (element.height - 18) / element.height + } + }); + + drawPath(parentGfx, collectionPathData, { + strokeWidth: 2, + fill, + stroke + }); + } + + return dataObject; + } + + function renderEvent(parentGfx, element, attrs = {}) { + return drawCircle(parentGfx, element.width, element.height, { + fillOpacity: DEFAULT_OPACITY, + ...attrs, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + } + + function renderGateway(parentGfx, element, attrs = {}) { + return drawDiamond(parentGfx, element.width, element.height, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + fillOpacity: DEFAULT_OPACITY, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + } + + function renderLane(parentGfx, element, attrs = {}) { + var lane = drawRect(parentGfx, (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs), 0, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1.5 + }); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(semantic, 'bpmn:Lane')) { + var text = semantic.get('name'); + + renderLaneLabel(parentGfx, text, element, attrs); + } + + return lane; + } + + function renderSubProcess(parentGfx, element, attrs = {}) { + var activity = renderActivity(parentGfx, element, attrs); + + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isEventSubProcess)(element)) { + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.attr)(activity, { + strokeDasharray: '0, 5.5', + strokeWidth: 2.5 + }); + } + + var expanded = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element); + + renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs); + + if (expanded) { + renderTaskMarkers(parentGfx, element, undefined, attrs); + } else { + renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs); + } + + return activity; + } + + function renderTask(parentGfx, element, attrs = {}) { + var activity = renderActivity(parentGfx, element, attrs); + + renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs); + + renderTaskMarkers(parentGfx, element, undefined, attrs); + + return activity; + } + + var handlers = this.handlers = { + 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) { + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element)) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + } else { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + } + + return renderSubProcess(parentGfx, element, attrs); + }, + 'bpmn:Association': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderAssociation(parentGfx, element, attrs); + }, + 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) { + var { renderIcon = true } = attrs; + + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element), + cancelActivity = semantic.get('cancelActivity'); + + attrs = { + strokeWidth: 1.5, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + fillOpacity: FULL_OPACITY, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }; + + if (!cancelActivity) { + attrs.strokeDasharray = '6'; + } + + var event = renderEvent(parentGfx, element, attrs); + + drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, { + ...attrs, + fill: 'none' + }); + + if (renderIcon) { + renderEventIcon(element, parentGfx, attrs); + } + + return event; + }, + 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', { + abspos: { + x: 8, + y: 8 + } + }); + + var businessPath = drawPath(parentGfx, headerData); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.attr)(businessPath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', { + abspos: { + x: 8, + y: 8 + } + }); + + var businessHeaderPath = drawPath(parentGfx, headerPathData); + + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.attr)(businessHeaderPath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return task; + }, + 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderSubProcess(parentGfx, element, { + strokeWidth: 5, + ...attrs + }); + }, + 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var gateway = renderGateway(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', { + xScaleFactor: 0.5, + yScaleFactor:0.5, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.46, + my: 0.26 + } + }); + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return gateway; + }, + 'bpmn:DataInput': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var arrowPathData = pathMap.getRawPath('DATA_ARROW'); + + var dataObject = renderDataObject(parentGfx, element, attrs); + + drawPath(parentGfx, arrowPathData, { + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return dataObject; + }, + 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderAssociation(parentGfx, element, { + ...attrs, + markerEnd: marker('association-end', (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke)) + }); + }, + 'bpmn:DataObject': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderDataObject(parentGfx, element, attrs); + }, + 'bpmn:DataObjectReference': as('bpmn:DataObject'), + 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var arrowPathData = pathMap.getRawPath('DATA_ARROW'); + + var dataObject = renderDataObject(parentGfx, element, attrs); + + drawPath(parentGfx, arrowPathData, { + strokeWidth: 1, + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + + return dataObject; + }, + 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderAssociation(parentGfx, element, { + ...attrs, + markerEnd: marker('association-end', (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke)) + }); + }, + 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var dataStorePath = pathMap.getScaledPath('DATA_STORE', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0, + my: 0.133 + } + }); + + return drawPath(parentGfx, dataStorePath, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + fillOpacity: DEFAULT_OPACITY, + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 2 + }); + }, + 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) { + var { renderIcon = true } = attrs; + + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var event = renderEvent(parentGfx, element, { + ...attrs, + strokeWidth: 4 + }); + + if (renderIcon) { + renderEventIcon(element, parentGfx, attrs); + } + + return event; + }, + 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + var diamond = renderGateway(parentGfx, element, attrs); + + drawCircle(parentGfx, element.width, element.height, element.height * 0.20, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, 'none', attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + var type = semantic.get('eventGatewayType'), + instantiate = !!semantic.get('instantiate'); + + function drawEvent() { + + var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', { + xScaleFactor: 0.18, + yScaleFactor: 0.18, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.36, + my: 0.44 + } + }); - var container = getContainer(node); - container.appendChild(template); + drawPath(parentGfx, pathData, { + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 2 + }); + } + + if (type === 'Parallel') { + var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', { + xScaleFactor: 0.4, + yScaleFactor: 0.4, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.474, + my: 0.296 + } + }); - this.__action = { - id: 'add-element' - }; + drawPath(parentGfx, pathData, { + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + } else if (type === 'Exclusive') { + if (!instantiate) { + drawCircle(parentGfx, element.width, element.height, element.height * 0.26, { + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + } + + drawEvent(); + } + + + return diamond; + }, + 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var gateway = renderGateway(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', { + xScaleFactor: 0.4, + yScaleFactor: 0.4, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.32, + my: 0.3 + } + }); + + var di = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getDi)(element); + + if (di.get('isMarkerVisible')) { + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + } + + return gateway; + }, + 'bpmn:Gateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderGateway(parentGfx, element, attrs); + }, + 'bpmn:Group': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + + return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, { + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1.5, + strokeDasharray: '10, 6, 0, 6', + fill: 'none', + pointerEvents: 'none', + width: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + height: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs) + }); + }, + 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var gateway = renderGateway(parentGfx, element, attrs); + + drawCircle(parentGfx, element.width, element.height, element.height * 0.24, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 2.5 + }); + + return gateway; + }, + 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) { + var { renderIcon = true } = attrs; + + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var outer = renderEvent(parentGfx, element, { + ...attrs, + strokeWidth: 1.5 + }); + + drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, { + fill: 'none', + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1.5 + }); + + if (renderIcon) { + renderEventIcon(element, parentGfx, attrs); + } + + return outer; + }, + 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'), + 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'), + 'bpmn:Lane': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + + return renderLane(parentGfx, element, { + ...attrs, + fillOpacity: LOW_OPACITY + }); + }, + 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', { + abspos: { + x: 17, + y: 15 + } + }); + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 0.5 + }); + + return task; + }, + 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element), + di = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getDi)(element); + + var fill = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke); + + var path = drawConnectionSegments(parentGfx, element.waypoints, { + markerEnd: marker('messageflow-end', fill, stroke), + markerStart: marker('messageflow-start', fill, stroke), + stroke, + strokeDasharray: '10, 11', + strokeWidth: 1.5 + }); + + if (semantic.get('messageRef')) { + var midPoint = path.getPointAtLength(path.getTotalLength() / 2); + + var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', { + abspos: { + x: midPoint.x, + y: midPoint.y + } + }); - return true; - }, + var messageAttrs = { + strokeWidth: 1 + }; - deleteElement: function(element, node, event, scopeNode) { - var container = getContainer(node); - var rowToDelete = event.delegateTarget.parentNode; - var idx = parseInt(domAttr(rowToDelete, 'data-index'), 10); + if (di.get('messageVisibleKind') === 'initiating') { + messageAttrs.fill = fill; + messageAttrs.stroke = stroke; + } else { + messageAttrs.fill = stroke; + messageAttrs.stroke = fill; + } - container.removeChild(rowToDelete); + var message = drawPath(parentGfx, markerPathData, messageAttrs); - this.__action = { - id: 'delete-element', - idx: idx - }; + var messageRef = semantic.get('messageRef'), + name = messageRef.get('name'); - return true; - }, + var label = renderLabel(parentGfx, name, { + align: 'center-top', + fitBox: true, + style: { + fill: stroke + } + }); - editable: function(element, rowNode, input, prop, value, idx) { - var entryNode = domClosest(rowNode, '[data-entry]'); - return editable(element, entryNode, prop, idx); - }, + var messageBounds = message.getBBox(), + labelBounds = label.getBBox(); + + var translateX = midPoint.x - labelBounds.width / 2, + translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE; + + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__.transform)(label, translateX, translateY, 0); + } + + return path; + }, + 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var diamond = renderGateway(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', { + xScaleFactor: 0.6, + yScaleFactor: 0.6, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.46, + my: 0.2 + } + }); + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return diamond; + }, + 'bpmn:Participant': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + + var participant = renderLane(parentGfx, element, attrs); + + var expandedParticipant = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element); + var horizontalParticipant = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isHorizontal)(element); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element), + name = semantic.get('name'); + + if (expandedParticipant) { + var waypoints = horizontalParticipant ? [ + { + x: 30, + y: 0 + }, + { + x: 30, + y: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs) + } + ] : [ + { + x: 0, + y: 30 + }, + { + x: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + y: 30 + } + ]; - show: function(element, entryNode, node, scopeNode) { - entryNode = getEntryNode(entryNode); - return show(element, entryNode, node, scopeNode); - }, + drawLine(parentGfx, waypoints, { + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: PARTICIPANT_STROKE_WIDTH + }); - showTable: function(element, entryNode, node, scopeNode) { - entryNode = getEntryNode(entryNode); - var elems = elements(element, entryNode); - return elems && elems.length && (!canBeShown || show(element, entryNode, node, scopeNode)); - }, + renderLaneLabel(parentGfx, name, element, attrs); + } else { + var bounds = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getBounds)(element, attrs); - validateListItem: function(element, value, node, idx) { - if (typeof options.validate === 'function') { - return options.validate(element, value, node, idx); - } - } + if (!horizontalParticipant) { + bounds.height = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs); + bounds.width = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + } - }; + var textBox = renderLabel(parentGfx, name, { + box: bounds, + align: 'center-middle', + style: { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getLabelColor)(element, defaultLabelColor, defaultStrokeColor, attrs.stroke) + } + }); - // Update/set the selection on the correct position. - // It's the same code like for an input value in the PropertiesPanel.js. - if (setControlValue) { - factory.setControlValue = function(element, rowNode, input, prop, value, idx) { - var entryNode = getEntryNode(rowNode); + if (!horizontalParticipant) { + var top = -1 * (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs); + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__.transform)(textBox, 0, -top, 270); + } + } - var isReadOnly = domAttr(input, 'readonly'); - var oldValue = input.value; + if (semantic.get('participantMultiplicity')) { + renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs); + } - var selection; + return participant; + }, + 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); - // prevents input fields from having the value 'undefined' - if (value === undefined) { - value = ''; - } + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); - // when the attribute 'readonly' exists, ignore the comparison - // with 'oldValue' and 'value' - if (!!isReadOnly && oldValue === value) { - return; - } + var task = renderTask(parentGfx, element, attrs); - // update selection on undo/redo - if (document.activeElement === input) { - selection = updateSelection(getSelection(input), oldValue, value); - } + var pathData; - setControlValue(element, entryNode, input, prop, value, idx); + if (semantic.get('instantiate')) { + drawCircle(parentGfx, 28, 28, 20 * 0.22, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); - if (selection) { - setSelection(input, selection); - } + pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', { + abspos: { + x: 7.77, + y: 9.52 + } + }); + } else { + pathData = pathMap.getScaledPath('TASK_TYPE_SEND', { + xScaleFactor: 0.9, + yScaleFactor: 0.9, + containerWidth: 21, + containerHeight: 14, + position: { + mx: 0.3, + my: 0.4 + } + }); + } + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return task; + }, + 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', { + abspos: { + x: 15, + y: 20 + } + }); + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return task; + }, + 'bpmn:SendTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: 21, + containerHeight: 14, + position: { + mx: 0.285, + my: 0.357 + } + }); + + drawPath(parentGfx, pathData, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + strokeWidth: 1 + }); + + return task; + }, + 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var fill = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke); + + var connection = drawConnectionSegments(parentGfx, element.waypoints, { + markerEnd: marker('sequenceflow-end', fill, stroke), + stroke + }); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + var { source } = element; + + if (source) { + var sourceSemantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(source); + + // conditional flow marker + if (semantic.get('conditionExpression') && (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(sourceSemantic, 'bpmn:Activity')) { + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.attr)(connection, { + markerStart: marker('conditional-flow-marker', fill, stroke) + }); + } + + // default marker + if (sourceSemantic.get('default') && ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(sourceSemantic, 'bpmn:Gateway') || (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(sourceSemantic, 'bpmn:Activity')) && + sourceSemantic.get('default') === semantic) { + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_3__.attr)(connection, { + markerStart: marker('conditional-default-flow-marker', fill, stroke) + }); + } + } + + return connection; + }, + 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + drawCircle(parentGfx, 10, 10, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: 'none', + transform: 'translate(6, 6)' + }); + + var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', { + abspos: { + x: 12, + y: 18 + } + }); + + drawPath(parentGfx, pathDataService1, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + drawCircle(parentGfx, 10, 10, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: 'none', + transform: 'translate(11, 10)' + }); + + var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', { + abspos: { + x: 17, + y: 22 + } + }); + + drawPath(parentGfx, pathDataService2, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1 + }); + + return task; + }, + 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) { + var { renderIcon = true } = attrs; + + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element); + + if (!semantic.get('isInterrupting')) { + attrs = { + ...attrs, + strokeDasharray: '6' + }; + } + + var event = renderEvent(parentGfx, element, attrs); + + if (renderIcon) { + renderEventIcon(element, parentGfx, attrs); + } + + return event; + }, + 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) { + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element)) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + } else { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + } + + return renderSubProcess(parentGfx, element, attrs); + }, + 'bpmn:Task': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + return renderTask(parentGfx, element, attrs); + }, + 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + + var { + width, + height + } = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getBounds)(element, attrs); + + var textElement = drawRect(parentGfx, width, height, 0, 0, { + fill: 'none', + stroke: 'none' + }); + + var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: width, + containerHeight: height, + position: { + mx: 0.0, + my: 0.0 + } + }); + + drawPath(parentGfx, textPathData, { + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke) + }); + + var semantic = (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.getBusinessObject)(element), + text = semantic.get('text') || ''; + + renderLabel(parentGfx, text, { + align: 'left-top', + box: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getBounds)(element, attrs), + padding: 7, + style: { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getLabelColor)(element, defaultLabelColor, defaultStrokeColor, attrs.stroke) + } + }); + + return textElement; + }, + 'bpmn:Transaction': function(parentGfx, element, attrs = {}) { + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element)) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke', + 'width', + 'height' + ]); + } else { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + } + + var outer = renderSubProcess(parentGfx, element, { + strokeWidth: 1.5, + ...attrs + }); + + var innerAttrs = styles.style([ 'no-fill', 'no-events' ], { + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 1.5 + }); + + var expanded = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_10__.isExpanded)(element); + + if (!expanded) { + attrs = {}; + } + + drawRect( + parentGfx, + (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getWidth)(element, attrs), + (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getHeight)(element, attrs), + TASK_BORDER_RADIUS - INNER_OUTER_DIST, + INNER_OUTER_DIST, + innerAttrs + ); + + return outer; + }, + 'bpmn:UserTask': function(parentGfx, element, attrs = {}) { + attrs = pickAttrs(attrs, [ + 'fill', + 'stroke' + ]); + + var task = renderTask(parentGfx, element, attrs); + + var x = 15; + var y = 12; + + var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', { + abspos: { + x: x, + y: y + } + }); + + drawPath(parentGfx, pathDataUser1, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 0.5 + }); + + var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', { + abspos: { + x: x, + y: y + } + }); + + drawPath(parentGfx, pathDataUser2, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getFillColor)(element, defaultFillColor, attrs.fill), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 0.5 + }); + + var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', { + abspos: { + x: x, + y: y + } + }); + + drawPath(parentGfx, pathDataUser3, { + fill: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + stroke: (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getStrokeColor)(element, defaultStrokeColor, attrs.stroke), + strokeWidth: 0.5 + }); + + return task; + }, + 'label': function(parentGfx, element, attrs = {}) { + return renderExternalLabel(parentGfx, element, attrs); + } + }; + + // extension API, use at your own risk + this._drawPath = drawPath; + + this._renderer = renderer; +} + + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_11__["default"])(BpmnRenderer, diagram_js_lib_draw_BaseRenderer__WEBPACK_IMPORTED_MODULE_1__["default"]); + +BpmnRenderer.$inject = [ + 'config.bpmnRenderer', + 'eventBus', + 'styles', + 'pathMap', + 'canvas', + 'textRenderer' +]; + + +/** + * @param {Element} element + * + * @return {boolean} + */ +BpmnRenderer.prototype.canRender = function(element) { + return (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(element, 'bpmn:BaseElement'); +}; - }; - } +/** + * Draw shape into parentGfx. + * + * @param {SVGElement} parentGfx + * @param {Element} element + * @param {Attrs} [attrs] + * + * @return {SVGElement} mainGfx + */ +BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) { + var { type } = element; - return factory; + var handler = this._renderer(type); - }; + return handler(parentGfx, element, attrs); +}; - },{"../Utils":5,"../helper/CmdHelper":25,"./EntryFieldDescription":15,"lodash/filter":609,"lodash/forEach":613,"lodash/keys":630,"min-dom":647,"selection-update":657}],20:[function(require,module,exports){ - 'use strict'; +/** + * Draw connection into parentGfx. + * + * @param {SVGElement} parentGfx + * @param {Element} element + * @param {Attrs} [attrs] + * + * @return {SVGElement} mainGfx + */ +BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) { + var { type } = element; - var escapeHTML = require('../Utils').escapeHTML; + var handler = this._renderer(type); - var entryFieldDescription = require('./EntryFieldDescription'); + return handler(parentGfx, element, attrs); +}; +/** + * Get shape path. + * + * @param {Element} element + * + * @return {string} path + */ +BpmnRenderer.prototype.getShapePath = function(element) { + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(element, 'bpmn:Event')) { + return (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getCirclePath)(element); + } - var textBox = function(options, defaultParameters) { + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(element, 'bpmn:Activity')) { + return (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getRoundRectPath)(element, TASK_BORDER_RADIUS); + } - var resource = defaultParameters, - label = options.label || resource.id, - canBeShown = !!options.show && typeof options.show === 'function', - description = options.description; + if ((0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_8__.is)(element, 'bpmn:Gateway')) { + return (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getDiamondPath)(element); + } - resource.html = - '' + - '
' + - '
' + - '
'; + return (0,_BpmnRenderUtil__WEBPACK_IMPORTED_MODULE_2__.getRectPath)(element); +}; - // add description below text box entry field - if (description) { - resource.html += entryFieldDescription(description); - } +/** + * Pick attributes if they exist. + * + * @param {Object} attrs + * @param {string[]} keys + * + * @returns {Object} + */ +function pickAttrs(attrs, keys = []) { + return keys.reduce((pickedAttrs, key) => { + if (attrs[ key ]) { + pickedAttrs[ key ] = attrs[ key ]; + } + + return pickedAttrs; + }, {}); +} + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/draw/PathMap.js": +/*!***************************************************!*\ + !*** ../node_modules/bpmn-js/lib/draw/PathMap.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PathMap) +/* harmony export */ }); +/** + * Map containing SVG paths needed by BpmnRenderer + */ +function PathMap() { - if (canBeShown) { - resource.isShown = function() { - return options.show.apply(resource, arguments); - }; - } + /** + * Contains a map of path elements + * + *

Path definition

+ * A parameterized path is defined like this: + *
+   * 'GATEWAY_PARALLEL': {
+   *   d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
+          '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
+   *   height: 17.5,
+   *   width:  17.5,
+   *   heightElements: [2.5, 7.5],
+   *   widthElements: [2.5, 7.5]
+   * }
+   * 
+ *

It's important to specify a correct height and width for the path as the scaling + * is based on the ratio between the specified height and width in this object and the + * height and width that is set as scale target (Note x,y coordinates will be scaled with + * individual ratios).

+ *

The 'heightElements' and 'widthElements' array must contain the values that will be scaled. + * The scaling is based on the computed ratios. + * Coordinates on the y axis should be in the heightElement's array, they will be scaled using + * the computed ratio coefficient. + * In the parameterized path the scaled values can be accessed through the 'e' object in {} brackets. + *

    + *
  • The values for the y axis can be accessed in the path string using {e.y0}, {e.y1}, ....
  • + *
  • The values for the x axis can be accessed in the path string using {e.x0}, {e.x1}, ....
  • + *
+ * The numbers x0, x1 respectively y0, y1, ... map to the corresponding array index. + *

+ */ + this.pathMap = { + 'EVENT_MESSAGE': { + d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}', + height: 36, + width: 36, + heightElements: [ 6, 14 ], + widthElements: [ 10.5, 21 ] + }, + 'EVENT_SIGNAL': { + d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z', + height: 36, + width: 36, + heightElements: [ 18 ], + widthElements: [ 10, 20 ] + }, + 'EVENT_ESCALATION': { + d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z', + height: 36, + width: 36, + heightElements: [ 20, 7 ], + widthElements: [ 8 ] + }, + 'EVENT_CONDITIONAL': { + d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' + + 'M {e.x2},{e.y3} l {e.x0},0 ' + + 'M {e.x2},{e.y4} l {e.x0},0 ' + + 'M {e.x2},{e.y5} l {e.x0},0 ' + + 'M {e.x2},{e.y6} l {e.x0},0 ' + + 'M {e.x2},{e.y7} l {e.x0},0 ' + + 'M {e.x2},{e.y8} l {e.x0},0 ', + height: 36, + width: 36, + heightElements: [ 8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5 ], + widthElements: [ 10.5, 14.5, 12.5 ] + }, + 'EVENT_LINK': { + d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z', + height: 36, + width: 36, + heightElements: [ 4.4375, 6.75, 7.8125 ], + widthElements: [ 9.84375, 13.5 ] + }, + 'EVENT_ERROR': { + d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z', + height: 36, + width: 36, + heightElements: [ 0.023, 8.737, 8.151, 16.564, 10.591, 8.714 ], + widthElements: [ 0.085, 6.672, 6.97, 4.273, 5.337, 6.636 ] + }, + 'EVENT_CANCEL_45': { + d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' + + '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z', + height: 36, + width: 36, + heightElements: [ 4.75, 8.5 ], + widthElements: [ 4.75, 8.5 ] + }, + 'EVENT_COMPENSATION': { + d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z', + height: 36, + width: 36, + heightElements: [ 6.5, 13, 0.4, 6.1 ], + widthElements: [ 9, 9.3, 8.7 ] + }, + 'EVENT_TIMER_WH': { + d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ', + height: 36, + width: 36, + heightElements: [ 10, 2 ], + widthElements: [ 3, 7 ] + }, + 'EVENT_TIMER_LINE': { + d: 'M {mx},{my} ' + + 'm {e.x0},{e.y0} l -{e.x1},{e.y1} ', + height: 36, + width: 36, + heightElements: [ 10, 3 ], + widthElements: [ 0, 0 ] + }, + 'EVENT_MULTIPLE': { + d:'m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z', + height: 36, + width: 36, + heightElements: [ 6.28099, 12.56199 ], + widthElements: [ 3.1405, 9.42149, 12.56198 ] + }, + 'EVENT_PARALLEL_MULTIPLE': { + d:'m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' + + '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z', + height: 36, + width: 36, + heightElements: [ 2.56228, 7.68683 ], + widthElements: [ 2.56228, 7.68683 ] + }, + 'GATEWAY_EXCLUSIVE': { + d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' + + '{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' + + '{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z', + height: 17.5, + width: 17.5, + heightElements: [ 8.5, 6.5312, -6.5312, -8.5 ], + widthElements: [ 6.5, -6.5, 3, -3, 5, -5 ] + }, + 'GATEWAY_PARALLEL': { + d:'m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' + + '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z', + height: 30, + width: 30, + heightElements: [ 5, 12.5 ], + widthElements: [ 5, 12.5 ] + }, + 'GATEWAY_EVENT_BASED': { + d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z', + height: 11, + width: 11, + heightElements: [ -6, 6, 12, -12 ], + widthElements: [ 9, -3, -12 ] + }, + 'GATEWAY_COMPLEX': { + d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' + + '{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' + + '{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' + + '-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z', + height: 17.125, + width: 17.125, + heightElements: [ 4.875, 3.4375, 2.125, 3 ], + widthElements: [ 3.4375, 2.125, 4.875, 3 ] + }, + 'DATA_OBJECT_PATH': { + d:'m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0', + height: 61, + width: 51, + heightElements: [ 10, 50, 60 ], + widthElements: [ 10, 40, 50, 60 ] + }, + 'DATA_OBJECT_COLLECTION_PATH': { + d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10', + height: 10, + width: 10, + heightElements: [], + widthElements: [] + }, + 'DATA_ARROW': { + d:'m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z', + height: 61, + width: 51, + heightElements: [], + widthElements: [] + }, + 'DATA_STORE': { + d:'m {mx},{my} ' + + 'l 0,{e.y2} ' + + 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' + + 'l 0,-{e.y2} ' + + 'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' + + 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' + + 'm -{e.x2},{e.y0}' + + 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' + + 'm -{e.x2},{e.y0}' + + 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0', + height: 61, + width: 61, + heightElements: [ 7, 10, 45 ], + widthElements: [ 2, 58, 60 ] + }, + 'TEXT_ANNOTATION': { + d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0', + height: 30, + width: 10, + heightElements: [ 30 ], + widthElements: [ 10 ] + }, + 'MARKER_SUB_PROCESS': { + d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0', + height: 10, + width: 10, + heightElements: [], + widthElements: [] + }, + 'MARKER_PARALLEL': { + d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10', + height: 10, + width: 10, + heightElements: [], + widthElements: [] + }, + 'MARKER_SEQUENTIAL': { + d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0', + height: 10, + width: 10, + heightElements: [], + widthElements: [] + }, + 'MARKER_COMPENSATION': { + d: 'm {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z', + height: 10, + width: 21, + heightElements: [], + widthElements: [] + }, + 'MARKER_LOOP': { + d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' + + '-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' + + '0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' + + 'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902', + height: 13.9, + width: 13.7, + heightElements: [], + widthElements: [] + }, + 'MARKER_ADHOC': { + d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' + + '3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' + + '1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' + + '-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' + + '-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z', + height: 4, + width: 15, + heightElements: [], + widthElements: [] + }, + 'TASK_TYPE_SEND': { + d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}', + height: 14, + width: 21, + heightElements: [ 6, 14 ], + widthElements: [ 10.5, 21 ] + }, + 'TASK_TYPE_SCRIPT': { + d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' + + 'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' + + 'm -7,-12 l 5,0 ' + + 'm -4.5,3 l 4.5,0 ' + + 'm -3,3 l 5,0' + + 'm -4,3 l 5,0', + height: 15, + width: 12.6, + heightElements: [ 6, 14 ], + widthElements: [ 10.5, 21 ] + }, + 'TASK_TYPE_USER_1': { + d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' + + '-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' + + '0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' + + 'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' + + 'm -8,6 l 0,5.5 m 11,0 l 0,-5' + }, + 'TASK_TYPE_USER_2': { + d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' + + '-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 ' + }, + 'TASK_TYPE_USER_3': { + d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' + + '4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' + + '-4.20799998,3.36699999 -4.20699998,4.34799999 z' + }, + 'TASK_TYPE_MANUAL': { + d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' + + '-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' + + '0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' + + '-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' + + '0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' + + '-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' + + '2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' + + '-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' + + '-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' + + '-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' + + '0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' + + '-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z' + }, + 'TASK_TYPE_INSTANTIATING_SEND': { + d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6' + }, + 'TASK_TYPE_SERVICE': { + d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' + + '0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' + + '-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' + + 'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' + + '-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' + + '-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' + + 'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' + + '-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' + + 'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' + + 'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' + + '0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' + + 'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' + + 'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' + + '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' + + '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z' + }, + 'TASK_TYPE_SERVICE_FILL': { + d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' + + '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' + + '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z' + }, + 'TASK_TYPE_BUSINESS_RULE_HEADER': { + d: 'm {mx},{my} 0,4 20,0 0,-4 z' + }, + 'TASK_TYPE_BUSINESS_RULE_MAIN': { + d: 'm {mx},{my} 0,12 20,0 0,-12 z' + + 'm 0,8 l 20,0 ' + + 'm -13,-4 l 0,8' + }, + 'MESSAGE_FLOW_MARKER': { + d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6' + } + }; + + /** + * Return raw path for the given ID. + * + * @param {string} pathId + * + * @return {string} raw path + */ + this.getRawPath = function getRawPath(pathId) { + return this.pathMap[pathId].d; + }; + + /** + * Scales the path to the given height and width. + *

Use case

+ *

Use case is to scale the content of elements (event, gateways) based + * on the element bounding box's size. + *

+ *

Why not transform

+ *

Scaling a path with transform() will also scale the stroke and IE does not support + * the option 'non-scaling-stroke' to prevent this. + * Also there are use cases where only some parts of a path should be + * scaled.

+ * + * @param {string} pathId The ID of the path. + * @param {Object} param

+ * Example param object scales the path to 60% size of the container (data.width, data.height). + *

+   *   {
+   *     xScaleFactor: 0.6,
+   *     yScaleFactor:0.6,
+   *     containerWidth: data.width,
+   *     containerHeight: data.height,
+   *     position: {
+   *       mx: 0.46,
+   *       my: 0.2,
+   *     }
+   *   }
+   *   
+ *
    + *
  • targetpathwidth = xScaleFactor * containerWidth
  • + *
  • targetpathheight = yScaleFactor * containerHeight
  • + *
  • Position is used to set the starting coordinate of the path. M is computed: + *
      + *
    • position.x * containerWidth
    • + *
    • position.y * containerHeight
    • + *
    + * Center of the container
     position: {
    +   *       mx: 0.5,
    +   *       my: 0.5,
    +   *     }
    + * Upper left corner of the container + *
     position: {
    +   *       mx: 0.0,
    +   *       my: 0.0,
    +   *     }
    + *
  • + *
+ *

+ * + * @return {string} scaled path + */ + this.getScaledPath = function getScaledPath(pathId, param) { + var rawPath = this.pathMap[pathId]; + + // positioning + // compute the start point of the path + var mx, my; + + if (param.abspos) { + mx = param.abspos.x; + my = param.abspos.y; + } else { + mx = param.containerWidth * param.position.mx; + my = param.containerHeight * param.position.my; + } + + var coordinates = {}; // map for the scaled coordinates + if (param.position) { + + // path + var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor; + var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor; + + + // Apply height ratio + for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) { + coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio; + } + + // Apply width ratio + for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) { + coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio; + } + } + + // Apply value to raw path + var path = format( + rawPath.d, { + mx: mx, + my: my, + e: coordinates + } + ); + return path; + }; +} + +// helpers ////////////////////// + +// copied and adjusted from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js +var tokenRegex = /\{([^{}]+)\}/g, + objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties + +function replacer(all, key, obj) { + var res = obj; + key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) { + name = name || quotedName; + if (res) { + if (name in res) { + res = res[name]; + } + typeof res == 'function' && isFunc && (res = res()); + } + }); + res = (res == null || res == obj ? all : res) + ''; + + return res; +} + +function format(str, obj) { + return String(str).replace(tokenRegex, function(all, key) { + return replacer(all, key, obj); + }); +} + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/draw/TextRenderer.js": +/*!********************************************************!*\ + !*** ../node_modules/bpmn-js/lib/draw/TextRenderer.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ TextRenderer) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_util_Text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/util/Text */ "../node_modules/diagram-js/lib/util/Text.js"); + + + + +var DEFAULT_FONT_SIZE = 12; +var LINE_HEIGHT_RATIO = 1.2; + +var MIN_TEXT_ANNOTATION_HEIGHT = 30; + +/** + * @typedef { { + * fontFamily: string; + * fontSize: number; + * fontWeight: string; + * lineHeight: number; + * } } TextRendererStyle + * + * @typedef { { + * defaultStyle?: Partial; + * externalStyle?: Partial; + * } } TextRendererConfig + * + * @typedef { import('diagram-js/lib/util/Text').TextLayoutConfig } TextLayoutConfig + * + * @typedef { import('diagram-js/lib/util/Types').Rect } Rect + */ - resource.cssClasses = ['bpp-textbox']; - return resource; - }; +/** + * Renders text and computes text bounding boxes. + * + * @param {TextRendererConfig} [config] + */ +function TextRenderer(config) { - module.exports = textBox; + var defaultStyle = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({ + fontFamily: 'Arial, sans-serif', + fontSize: DEFAULT_FONT_SIZE, + fontWeight: 'normal', + lineHeight: LINE_HEIGHT_RATIO + }, config && config.defaultStyle || {}); - },{"../Utils":5,"./EntryFieldDescription":15}],21:[function(require,module,exports){ - 'use strict'; + var fontSize = parseInt(defaultStyle.fontSize, 10) - 1; - var escapeHTML = require('../Utils').escapeHTML; + var externalStyle = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({}, defaultStyle, { + fontSize: fontSize + }, config && config.externalStyle || {}); - var domQuery = require('min-dom').query; + var textUtil = new diagram_js_lib_util_Text__WEBPACK_IMPORTED_MODULE_1__["default"]({ + style: defaultStyle + }); - var entryFieldDescription = require('./EntryFieldDescription'); + /** + * Get the new bounds of an externally rendered, + * layouted label. + * + * @param {Rect} bounds + * @param {string} text + * + * @return {Rect} + */ + this.getExternalLabelBounds = function(bounds, text) { + + var layoutedDimensions = textUtil.getDimensions(text, { + box: { + width: 90, + height: 30 + }, + style: externalStyle + }); + + // resize label shape to fit label text + return { + x: Math.round(bounds.x + bounds.width / 2 - layoutedDimensions.width / 2), + y: Math.round(bounds.y), + width: Math.ceil(layoutedDimensions.width), + height: Math.ceil(layoutedDimensions.height) + }; + + }; + + /** + * Get the new bounds of text annotation. + * + * @param {Rect} bounds + * @param {string} text + * + * @return {Rect} + */ + this.getTextAnnotationBounds = function(bounds, text) { + + var layoutedDimensions = textUtil.getDimensions(text, { + box: bounds, + style: defaultStyle, + align: 'left-top', + padding: 5 + }); + + return { + x: bounds.x, + y: bounds.y, + width: bounds.width, + height: Math.max(MIN_TEXT_ANNOTATION_HEIGHT, Math.round(layoutedDimensions.height)) + }; + }; + + /** + * Create a layouted text element. + * + * @param {string} text + * @param {TextLayoutConfig} [options] + * + * @return {SVGElement} rendered text + */ + this.createText = function(text, options) { + return textUtil.createText(text, options || {}); + }; + /** + * Get default text style. + */ + this.getDefaultStyle = function() { + return defaultStyle; + }; - var textField = function(options, defaultParameters) { + /** + * Get the external text style. + */ + this.getExternalStyle = function() { + return externalStyle; + }; - // Default action for the button next to the input-field - var defaultButtonAction = function(element, inputNode) { - var input = domQuery('input[name="' + options.modelProperty + '"]', inputNode); - input.value = ''; +} - return true; - }; +TextRenderer.$inject = [ + 'config.textRenderer' +]; - // default method to determine if the button should be visible - var defaultButtonShow = function(element, inputNode) { - var input = domQuery('input[name="' + options.modelProperty + '"]', inputNode); +/***/ }), - return input.value !== ''; - }; +/***/ "../node_modules/bpmn-js/lib/draw/index.js": +/*!*************************************************!*\ + !*** ../node_modules/bpmn-js/lib/draw/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _BpmnRenderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BpmnRenderer */ "../node_modules/bpmn-js/lib/draw/BpmnRenderer.js"); +/* harmony import */ var _TextRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextRenderer */ "../node_modules/bpmn-js/lib/draw/TextRenderer.js"); +/* harmony import */ var _PathMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PathMap */ "../node_modules/bpmn-js/lib/draw/PathMap.js"); - var resource = defaultParameters, - label = options.label || resource.id, - dataValueLabel = options.dataValueLabel, - buttonLabel = (options.buttonLabel || 'X'), - actionName = (typeof options.buttonAction != 'undefined') ? options.buttonAction.name : 'clear', - actionMethod = (typeof options.buttonAction != 'undefined') ? options.buttonAction.method : defaultButtonAction, - showName = (typeof options.buttonShow != 'undefined') ? options.buttonShow.name : 'canClear', - showMethod = (typeof options.buttonShow != 'undefined') ? options.buttonShow.method : defaultButtonShow, - canBeDisabled = !!options.disabled && typeof options.disabled === 'function', - canBeHidden = !!options.hidden && typeof options.hidden === 'function', - description = options.description; - - resource.html = - '' + - '
' + - '' + - '' + - '
'; - - // add description below text input entry field - if (description) { - resource.html += entryFieldDescription(description); - } - - resource[actionName] = actionMethod; - resource[showName] = showMethod; - - if (canBeDisabled) { - resource.isDisabled = function() { - return options.disabled.apply(resource, arguments); - }; - } - if (canBeHidden) { - resource.isHidden = function() { - return !options.hidden.apply(resource, arguments); - }; - } - resource.cssClasses = ['bpp-textfield']; - return resource; - }; - module.exports = textField; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __init__: [ 'bpmnRenderer' ], + bpmnRenderer: [ 'type', _BpmnRenderer__WEBPACK_IMPORTED_MODULE_0__["default"] ], + textRenderer: [ 'type', _TextRenderer__WEBPACK_IMPORTED_MODULE_1__["default"] ], + pathMap: [ 'type', _PathMap__WEBPACK_IMPORTED_MODULE_2__["default"] ] +}); - },{"../Utils":5,"./EntryFieldDescription":15,"min-dom":647}],22:[function(require,module,exports){ - 'use strict'; - var textField = require('./TextInputEntryFactory'); +/***/ }), - /** - * This function is a wrapper around TextInputEntryFactory. - * It adds functionality to cache an invalid value entered in the - * text input, instead of setting it on the business object. - */ - var validationAwareTextField = function(options, defaultParameters) { +/***/ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsContextPadProvider.js": +/*!**********************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/align-elements/AlignElementsContextPadProvider.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var modelProperty = options.modelProperty; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ AlignElementsContextPadProvider) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _AlignElementsIcons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AlignElementsIcons */ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsIcons.js"); - defaultParameters.get = function(element, node) { - var value = this.__lastInvalidValue; - delete this.__lastInvalidValue; - var properties = {}; - properties[modelProperty] = value !== undefined ? value : options.getProperty(element, node); +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').default} ContextPad + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').ContextPadEntries} ContextPadEntries + * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default} ContextPadProvider + */ - return properties; - }; +var LOW_PRIORITY = 900; - defaultParameters.set = function(element, values, node) { - var validationErrors = validate.apply(this, [ element, values, node ]), - propertyValue = values[modelProperty]; +/** + * A provider for the `Align elements` context pad entry. + * + * @implements {ContextPadProvider} + * + * @param {ContextPad} contextPad + * @param {PopupMenu} popupMenu + * @param {Translate} translate + * @param {Canvas} canvas + */ +function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) { - // make sure we do not update the id - if (validationErrors && validationErrors[modelProperty]) { - this.__lastInvalidValue = propertyValue; + contextPad.registerProvider(LOW_PRIORITY, this); - return options.setProperty(element, {}, node); - } else { - var properties = {}; + this._contextPad = contextPad; + this._popupMenu = popupMenu; + this._translate = translate; + this._canvas = canvas; +} - properties[modelProperty] = propertyValue; +AlignElementsContextPadProvider.$inject = [ + 'contextPad', + 'popupMenu', + 'translate', + 'canvas' +]; - return options.setProperty(element, properties, node); - } - }; +/** + * @param {Element[]} elements + * + * @return {ContextPadEntries} + */ +AlignElementsContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) { + var actions = {}; - var validate = defaultParameters.validate = function(element, values, node) { - var value = values[modelProperty] || this.__lastInvalidValue; + if (this._isAllowed(elements)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)(actions, this._getEntries(elements)); + } - var property = {}; - property[modelProperty] = value; + return actions; +}; - return options.validate(element, property, node); - }; +AlignElementsContextPadProvider.prototype._isAllowed = function(elements) { + return !this._popupMenu.isEmpty(elements, 'align-elements'); +}; - return textField(options, defaultParameters); - }; +AlignElementsContextPadProvider.prototype._getEntries = function() { + var self = this; - module.exports = validationAwareTextField; + return { + 'align-elements': { + group: 'align-elements', + title: self._translate('Align elements'), + html: `
${_AlignElementsIcons__WEBPACK_IMPORTED_MODULE_1__["default"]['align']}
`, + action: { + click: function(event, target) { + var position = self._getMenuPosition(target); - },{"./TextInputEntryFactory":21}],23:[function(require,module,exports){ - 'use strict'; + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)(position, { + cursor: { + x: event.x, + y: event.y + } + }); - var map = require('lodash/map'); + self._popupMenu.open(target, 'align-elements', position); + } + } + } + }; +}; - var extensionElementsHelper = require('./ExtensionElementsHelper'); +AlignElementsContextPadProvider.prototype._getMenuPosition = function(elements) { + var Y_OFFSET = 5; - /** - * Returns true if the attribute 'camunda:asyncBefore' is set - * to true. - * - * @param {ModdleElement} bo - * - * @return {boolean} a boolean value - */ - function isAsyncBefore(bo) { - return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async')); - } + var pad = this._contextPad.getPad(elements).html; - module.exports.isAsyncBefore = isAsyncBefore; + var padRect = pad.getBoundingClientRect(); - /** - * Returns true if the attribute 'camunda:asyncAfter' is set - * to true. - * - * @param {ModdleElement} bo - * - * @return {boolean} a boolean value - */ - function isAsyncAfter(bo) { - return !!bo.get('camunda:asyncAfter'); - } + var pos = { + x: padRect.left, + y: padRect.bottom + Y_OFFSET + }; - module.exports.isAsyncAfter = isAsyncAfter; + return pos; +}; - /** - * Returns true if the attribute 'camunda:exclusive' is set - * to true. - * - * @param {ModdleElement} bo - * - * @return {boolean} a boolean value - */ - function isExclusive(bo) { - return !!bo.get('camunda:exclusive'); - } - module.exports.isExclusive = isExclusive; +/***/ }), - /** - * Get first 'camunda:FailedJobRetryTimeCycle' from the business object. - * - * @param {ModdleElement} bo - * - * @return {Array} a list of 'camunda:FailedJobRetryTimeCycle' - */ - function getFailedJobRetryTimeCycle(bo) { - return (extensionElementsHelper.getExtensionElements(bo, 'camunda:FailedJobRetryTimeCycle') || [])[0]; - } +/***/ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsIcons.js": +/*!*********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/align-elements/AlignElementsIcons.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - module.exports.getFailedJobRetryTimeCycle = getFailedJobRetryTimeCycle; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/** + * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`, + * and then replace respective icons with the optimized data URIs in `./dist`. + */ +var icons = { + align: ` + + + + `, + bottom: ` + + + + `, + center: ` + + + + `, + left: ` + + + + `, + right: ` + + + + `, + top: ` + + + + `, + middle: ` + + + + ` +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (icons); + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsMenuProvider.js": +/*!****************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/align-elements/AlignElementsMenuProvider.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ AlignElementsMenuProvider) +/* harmony export */ }); +/* harmony import */ var _AlignElementsIcons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AlignElementsIcons */ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsIcons.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); + + + + +/** + * @typedef {import('diagram-js/lib/features/align-elements/AlignElements').default} AlignElements + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu + * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuEntries} PopupMenuEntries + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenuProvider').default} PopupMenuProvider + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuTarget} PopupMenuTarget + */ - /** - * Removes all existing 'camunda:FailedJobRetryTimeCycle' from the business object - * - * @param {ModdleElement} bo - * - * @return {Array} a list of 'camunda:FailedJobRetryTimeCycle' - */ - function removeFailedJobRetryTimeCycle(bo, element) { - var retryTimeCycles = extensionElementsHelper.getExtensionElements(bo, 'camunda:FailedJobRetryTimeCycle'); - return map(retryTimeCycles, function(cycle) { - return extensionElementsHelper.removeEntry(bo, element, cycle); - }); - } +var ALIGNMENT_OPTIONS = [ + 'left', + 'center', + 'right', + 'top', + 'middle', + 'bottom' +]; + +/** + * A provider for the `Align elements` popup menu. + * + * @implements {PopupMenuProvider} + * + * @param {PopupMenu} popupMenu + * @param {AlignElements} alignElements + * @param {Translate} translate + * @param {Rules} rules + */ +function AlignElementsMenuProvider(popupMenu, alignElements, translate, rules) { - module.exports.removeFailedJobRetryTimeCycle = removeFailedJobRetryTimeCycle; - },{"./ExtensionElementsHelper":28,"lodash/map":631}],24:[function(require,module,exports){ - 'use strict'; + this._alignElements = alignElements; + this._translate = translate; + this._popupMenu = popupMenu; + this._rules = rules; - var collectionAdd = require('diagram-js/lib/util/Collections').add, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; + popupMenu.registerProvider('align-elements', this); +} - var CategoryHelper = {}; +AlignElementsMenuProvider.$inject = [ + 'popupMenu', + 'alignElements', + 'translate', + 'rules' +]; - module.exports = CategoryHelper; +/** + * @param {PopupMenuTarget} target + * + * @return {PopupMenuEntries} + */ +AlignElementsMenuProvider.prototype.getPopupMenuEntries = function(target) { + var entries = {}; - /** - * Creates a new bpmn:CategoryValue inside a new bpmn:Category - * - * @param {ModdleElement} definitions - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} categoryValue. - */ - CategoryHelper.createCategoryValue = function(definitions, bpmnFactory) { - var categoryValue = bpmnFactory.create('bpmn:CategoryValue'), - category = bpmnFactory.create('bpmn:Category', { - categoryValue: [ categoryValue ] - }); + if (this._isAllowed(target)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)(entries, this._getEntries(target)); + } - // add to correct place - collectionAdd(definitions.get('rootElements'), category); - getBusinessObject(category).$parent = definitions; - getBusinessObject(categoryValue).$parent = category; + return entries; +}; - return categoryValue; +AlignElementsMenuProvider.prototype._isAllowed = function(target) { + return this._rules.allowed('elements.align', { elements: target }); +}; - }; - },{"bpmn-js/lib/util/ModelUtil":240,"diagram-js/lib/util/Collections":418}],25:[function(require,module,exports){ - 'use strict'; +/** + * @param {PopupMenuTarget} target + * + * @return {PopupMenuEntries} + */ +AlignElementsMenuProvider.prototype._getEntries = function(target) { + var alignElements = this._alignElements, + translate = this._translate, + popupMenu = this._popupMenu; - var CmdHelper = {}; - module.exports = CmdHelper; + var entries = {}; - CmdHelper.updateProperties = function(element, properties) { - return { - cmd: 'element.updateProperties', - context: { element: element, properties: properties } - }; - }; + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(ALIGNMENT_OPTIONS, function(alignment) { + entries[ 'align-elements-' + alignment ] = { + group: 'align', + title: translate('Align elements ' + alignment), + className: 'bjs-align-elements-menu-entry', + imageHtml: _AlignElementsIcons__WEBPACK_IMPORTED_MODULE_1__["default"][ alignment ], + action: function() { + alignElements.trigger(target, alignment); + popupMenu.close(); + } + }; + }); - CmdHelper.updateBusinessObject = function(element, businessObject, newProperties) { - return { - cmd: 'properties-panel.update-businessobject', - context: { - element: element, - businessObject: businessObject, - properties: newProperties - } - }; - }; + return entries; +}; - CmdHelper.addElementsTolist = function(element, businessObject, listPropertyName, objectsToAdd) { - return { - cmd: 'properties-panel.update-businessobject-list', - context: { - element: element, - currentObject: businessObject, - propertyName: listPropertyName, - objectsToAdd: objectsToAdd - } - }; - }; - CmdHelper.removeElementsFromList = function(element, businessObject, listPropertyName, referencePropertyName, objectsToRemove) { +/***/ }), - return { - cmd: 'properties-panel.update-businessobject-list', - context: { - element: element, - currentObject: businessObject, - propertyName: listPropertyName, - referencePropertyName: referencePropertyName, - objectsToRemove: objectsToRemove - } - }; - }; +/***/ "../node_modules/bpmn-js/lib/features/align-elements/BpmnAlignElements.js": +/*!********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/align-elements/BpmnAlignElements.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnAlignElements) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/rules/RuleProvider */ "../node_modules/diagram-js/lib/features/rules/RuleProvider.js"); +/* harmony import */ var diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/util/Elements */ "../node_modules/diagram-js/lib/util/Elements.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); - CmdHelper.addAndRemoveElementsFromList = function(element, businessObject, listPropertyName, referencePropertyName, objectsToAdd, objectsToRemove) { - return { - cmd: 'properties-panel.update-businessobject-list', - context: { - element: element, - currentObject: businessObject, - propertyName: listPropertyName, - referencePropertyName: referencePropertyName, - objectsToAdd: objectsToAdd, - objectsToRemove: objectsToRemove - } - }; - }; - CmdHelper.setList = function(element, businessObject, listPropertyName, updatedObjectList) { - return { - cmd: 'properties-panel.update-businessobject-list', - context: { - element: element, - currentObject: businessObject, - propertyName: listPropertyName, - updatedObjectList: updatedObjectList - } - }; - }; - },{}],26:[function(require,module,exports){ - 'use strict'; - var ElementHelper = {}; - module.exports = ElementHelper; - /** - * Creates a new element and set the parent to it - * - * @method ElementHelper#createElement - * - * @param {String} elementType of the new element - * @param {Object} properties of the new element in key-value pairs - * @param {moddle.object} parent of the new element - * @param {BpmnFactory} factory which creates the new element - * - * @returns {djs.model.Base} element which is created - */ - ElementHelper.createElement = function(elementType, properties, parent, factory) { - var element = factory.create(elementType, properties); - element.$parent = parent; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + */ - return element; - }; +/** + * Rule provider for aligning BPMN elements. + * + * @param {EventBus} eventBus + */ +function BpmnAlignElements(eventBus) { + diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); +} - },{}],27:[function(require,module,exports){ - 'use strict'; +BpmnAlignElements.$inject = [ 'eventBus' ]; - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - is = require('bpmn-js/lib/util/ModelUtil').is, - forEach = require('lodash/forEach'); +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnAlignElements, diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__["default"]); - var EventDefinitionHelper = {}; +BpmnAlignElements.prototype.init = function() { + this.addRule('elements.align', function(context) { + var elements = context.elements; - module.exports = EventDefinitionHelper; + // filter out elements which cannot be aligned + var filteredElements = (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.filter)(elements, function(element) { + return !(element.waypoints || element.host || element.labelTarget); + }); - EventDefinitionHelper.getEventDefinition = function(element, eventType) { + // filter out elements which are children of any of the selected elements + filteredElements = (0,diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_3__.getParents)(filteredElements); - var bo = getBusinessObject(element), - eventDefinition = null; + if (filteredElements.length < 2) { + return false; + } - if (bo.eventDefinitions) { - forEach(bo.eventDefinitions, function(event) { - if (is(event, eventType)) { - eventDefinition = event; - } - }); - } + return filteredElements; + }); +}; - return eventDefinition; - }; - EventDefinitionHelper.getTimerEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:TimerEventDefinition'); - }; +/***/ }), - EventDefinitionHelper.getMessageEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:MessageEventDefinition'); - }; +/***/ "../node_modules/bpmn-js/lib/features/align-elements/index.js": +/*!********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/align-elements/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - EventDefinitionHelper.getSignalEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:SignalEventDefinition'); - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_align_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/align-elements */ "../node_modules/diagram-js/lib/features/align-elements/index.js"); +/* harmony import */ var diagram_js_lib_features_context_pad__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/features/context-pad */ "../node_modules/diagram-js/lib/features/context-pad/index.js"); +/* harmony import */ var diagram_js_lib_features_popup_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/features/popup-menu */ "../node_modules/diagram-js/lib/features/popup-menu/index.js"); +/* harmony import */ var _AlignElementsContextPadProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AlignElementsContextPadProvider */ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsContextPadProvider.js"); +/* harmony import */ var _AlignElementsMenuProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AlignElementsMenuProvider */ "../node_modules/bpmn-js/lib/features/align-elements/AlignElementsMenuProvider.js"); +/* harmony import */ var _BpmnAlignElements__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BpmnAlignElements */ "../node_modules/bpmn-js/lib/features/align-elements/BpmnAlignElements.js"); - EventDefinitionHelper.getErrorEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:ErrorEventDefinition'); - }; - EventDefinitionHelper.getEscalationEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:EscalationEventDefinition'); - }; - EventDefinitionHelper.getCompensateEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:CompensateEventDefinition'); - }; - EventDefinitionHelper.getLinkEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:LinkEventDefinition'); - }; - EventDefinitionHelper.getConditionalEventDefinition = function(element) { - return this.getEventDefinition(element, 'bpmn:ConditionalEventDefinition'); - }; - },{"bpmn-js/lib/util/ModelUtil":240,"lodash/forEach":613}],28:[function(require,module,exports){ - 'use strict'; - var cmdHelper = require('./CmdHelper'), - elementHelper = require('./ElementHelper'); - var is = require('bpmn-js/lib/util/ModelUtil').is; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_align_elements__WEBPACK_IMPORTED_MODULE_0__["default"], + diagram_js_lib_features_context_pad__WEBPACK_IMPORTED_MODULE_1__["default"], + diagram_js_lib_features_popup_menu__WEBPACK_IMPORTED_MODULE_2__["default"] + ], + __init__: [ + 'alignElementsContextPadProvider', + 'alignElementsMenuProvider', + 'bpmnAlignElements' + ], + alignElementsContextPadProvider: [ 'type', _AlignElementsContextPadProvider__WEBPACK_IMPORTED_MODULE_3__["default"] ], + alignElementsMenuProvider: [ 'type', _AlignElementsMenuProvider__WEBPACK_IMPORTED_MODULE_4__["default"] ], + bpmnAlignElements: [ 'type', _BpmnAlignElements__WEBPACK_IMPORTED_MODULE_5__["default"] ] +}); - var ExtensionElementsHelper = {}; - var getExtensionElements = function(bo) { - return bo.get('extensionElements'); - }; +/***/ }), - ExtensionElementsHelper.getExtensionElements = function(bo, type) { - var extensionElements = getExtensionElements(bo); - if (typeof extensionElements !== 'undefined') { - var extensionValues = extensionElements.get('values'); - if (typeof extensionValues !== 'undefined') { - var elements = extensionValues.filter(function(value) { - return is(value, type); - }); - if (elements.length) { - return elements; - } - } - } - }; +/***/ "../node_modules/bpmn-js/lib/features/append-preview/AppendPreview.js": +/*!****************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/append-preview/AppendPreview.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - ExtensionElementsHelper.addEntry = function(bo, element, entry, bpmnFactory) { - var extensionElements = bo.get('extensionElements'); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ AppendPreview) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); - // if there is no extensionElements list, create one - if (!extensionElements) { - // TODO: Ask Daniel which operation costs more - extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [entry] }, bo, bpmnFactory); - return { extensionElements : extensionElements }; - } else { - // add new failedJobRetryExtensionElement to existing extensionElements list - return cmdHelper.addElementsTolist(element, extensionElements, 'values', [entry]); - } - }; - ExtensionElementsHelper.removeEntry = function(bo, element, entry) { - var extensionElements = bo.get('extensionElements'); +const round = Math.round; - if (!extensionElements) { +/** + * @typedef {import('diagram-js/lib/features/complex-preview/ComplexPreview').default} ComplexPreview + * @typedef {import('diagram-js/lib/layout/ConnectionDocking').default} ConnectionDocking + * @typedef {import('../modeling/ElementFactory').default} ElementFactory + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/layout/ManhattanLayout').default} ManhattanLayout + * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules + * + * @typedef {import('../../model/Types').Shape} Shape + */ - // return an empty command when there is no extensionElements list - return {}; - } +/** + * A preview for appending. + * + * @param {ComplexPreview} complexPreview + * @param {ConnectionDocking} connectionDocking + * @param {ElementFactory} elementFactory + * @param {EventBus} eventBus + * @param {ManhattanLayout} layouter + * @param {Rules} rules + */ +function AppendPreview(complexPreview, connectionDocking, elementFactory, eventBus, layouter, rules) { + this._complexPreview = complexPreview; + this._connectionDocking = connectionDocking; + this._elementFactory = elementFactory; + this._eventBus = eventBus; + this._layouter = layouter; + this._rules = rules; +} + +/** + * Create a preview of appending a shape of the given type to the given source. + * + * @param {Shape} source + * @param {string} type + * @param {Partial} options + */ +AppendPreview.prototype.create = function(source, type, options) { + const complexPreview = this._complexPreview, + connectionDocking = this._connectionDocking, + elementFactory = this._elementFactory, + eventBus = this._eventBus, + layouter = this._layouter, + rules = this._rules; + + const shape = elementFactory.createShape((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({ type }, options)); + + const position = eventBus.fire('autoPlace', { + source, + shape + }); + + if (!position) { + return; + } + + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)(shape, { + x: position.x - round(shape.width / 2), + y: position.y - round(shape.height / 2) + }); + + const connectionCreateAllowed = rules.allowed('connection.create', { + source, + target: shape, + hints: { + targetParent: source.parent + } + }); + + let connection = null; + + if (connectionCreateAllowed) { + connection = elementFactory.createConnection(connectionCreateAllowed); + + connection.waypoints = layouter.layoutConnection(connection, { + source, + target: shape + }); + + connection.waypoints = connectionDocking.getCroppedWaypoints(connection, source, shape); + } + + complexPreview.create({ + created: [ + shape, + connection + ].filter((element) => !(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isNil)(element)) + }); +}; + +AppendPreview.prototype.cleanUp = function() { + this._complexPreview.cleanUp(); +}; + +AppendPreview.$inject = [ + 'complexPreview', + 'connectionDocking', + 'elementFactory', + 'eventBus', + 'layouter', + 'rules' +]; + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/append-preview/index.js": +/*!********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/append-preview/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _auto_place__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../auto-place */ "../node_modules/bpmn-js/lib/features/auto-place/index.js"); +/* harmony import */ var diagram_js_lib_features_complex_preview__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/features/complex-preview */ "../node_modules/diagram-js/lib/features/complex-preview/index.js"); +/* harmony import */ var _modeling__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../modeling */ "../node_modules/bpmn-js/lib/features/modeling/index.js"); +/* harmony import */ var _AppendPreview__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AppendPreview */ "../node_modules/bpmn-js/lib/features/append-preview/AppendPreview.js"); + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + _auto_place__WEBPACK_IMPORTED_MODULE_0__["default"], + diagram_js_lib_features_complex_preview__WEBPACK_IMPORTED_MODULE_1__["default"], + _modeling__WEBPACK_IMPORTED_MODULE_2__["default"] + ], + __init__: [ 'appendPreview' ], + appendPreview: [ 'type', _AppendPreview__WEBPACK_IMPORTED_MODULE_3__["default"] ] +}); + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlace.js": +/*!************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlace.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - return cmdHelper.removeElementsFromList(element, extensionElements, 'values', 'extensionElements', [entry]); - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ AutoPlace) +/* harmony export */ }); +/* harmony import */ var _BpmnAutoPlaceUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BpmnAutoPlaceUtil */ "../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlaceUtil.js"); + + +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + */ - module.exports = ExtensionElementsHelper; +/** + * BPMN auto-place behavior. + * + * @param {EventBus} eventBus + */ +function AutoPlace(eventBus) { + eventBus.on('autoPlace', function(context) { + var shape = context.shape, + source = context.source; - },{"./CmdHelper":25,"./ElementHelper":26,"bpmn-js/lib/util/ModelUtil":240}],29:[function(require,module,exports){ - 'use strict'; + return (0,_BpmnAutoPlaceUtil__WEBPACK_IMPORTED_MODULE_0__.getNewShapePosition)(source, shape); + }); +} - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - getExtensionElements = require('./ExtensionElementsHelper').getExtensionElements; +AutoPlace.$inject = [ 'eventBus' ]; - var FormHelper = {}; +/***/ }), - module.exports = FormHelper; +/***/ "../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlaceUtil.js": +/*!****************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlaceUtil.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - /** - * Return form data from business object or undefined if none exist - * - * @param {djs.model.Base} element - * - * @return {ModdleElement|undefined} formData - */ - FormHelper.getFormData = function(element) { - var bo = getBusinessObject(element); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getDataElementPosition: () => (/* binding */ getDataElementPosition), +/* harmony export */ getFlowNodePosition: () => (/* binding */ getFlowNodePosition), +/* harmony export */ getNewShapePosition: () => (/* binding */ getNewShapePosition), +/* harmony export */ getTextAnnotationPosition: () => (/* binding */ getTextAnnotationPosition) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/layout/LayoutUtil */ "../node_modules/diagram-js/lib/layout/LayoutUtil.js"); +/* harmony import */ var diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/features/auto-place/AutoPlaceUtil */ "../node_modules/diagram-js/lib/features/auto-place/AutoPlaceUtil.js"); +/* harmony import */ var diagram_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/util/ModelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); - var formData = getExtensionElements(bo, 'camunda:FormData'); - if (typeof formData !== 'undefined') { - return formData[0]; - } - }; - /** - * Return all form fields existing in the business object, and - * an empty array if none exist. - * - * @param {djs.model.Base} element - * - * @return {Array} a list of form field objects - */ - FormHelper.getFormFields = function(element) { - var formData = this.getFormData(element); - if (typeof formData === 'undefined') { - return []; - } - return formData.fields || []; - }; - /** - * Get a form field from the business object at given index - * - * @param {djs.model.Base} element - * @param {number} idx - * - * @return {ModdleElement} the form field - */ - FormHelper.getFormField = function(element, idx) { - var formFields = this.getFormFields(element); +/** + * @typedef {import('../../model/Types').Shape} Shape + * + * @typedef {import('diagram-js/lib/util/Types').Point} Point + * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL + */ - return formFields[idx]; - }; +/** + * Get the position for given new target relative to the source it will be + * connected to. + * + * @param {Shape} source + * @param {Shape} element + * + * @return {Point} + */ +function getNewShapePosition(source, element) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + return getTextAnnotationPosition(source, element); + } - /** - * Get all constraints for a specific form field from the business object - * - * @param {ModdleElement} formField - * - * @return {Array} a list of constraint objects - */ - FormHelper.getConstraints = function(formField) { - if (formField && formField.validation && formField.validation.constraints) { - return formField.validation.constraints; - } - return []; - }; + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) { + return getDataElementPosition(source, element); + } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:FlowNode')) { + return getFlowNodePosition(source, element); + } +} - /** - * Get all camunda:value objects for a specific form field from the business object - * - * @param {ModdleElement} formField - * - * @return {Array} a list of camunda:value objects - */ - FormHelper.getEnumValues = function(formField) { - if (formField && formField.values) { - return formField.values; - } - return []; - }; +/** + * Get the position for given new flow node. Try placing the flow node right of + * the source. + * + * @param {Shape} source + * @param {Shape} element + * + * @return {Point} + */ +function getFlowNodePosition(source, element) { + + var sourceTrbl = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.asTRBL)(source); + var sourceMid = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.getMid)(source); + + var horizontalDistance = (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.getConnectedDistance)(source, { + filter: function(connection) { + return (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(connection, 'bpmn:SequenceFlow'); + } + }); + + var margin = 30, + minDistance = 80, + orientation = 'left'; + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(source, 'bpmn:BoundaryEvent')) { + orientation = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.getOrientation)(source, source.host, -25); + + if (orientation.indexOf('top') !== -1) { + margin *= -1; + } + } + + var position = { + x: sourceTrbl.right + horizontalDistance + element.width / 2, + y: sourceMid.y + getVerticalDistance(orientation, minDistance) + }; + + var nextPositionDirection = { + y: { + margin: margin, + minDistance: minDistance + } + }; + + return (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.findFreePosition)(source, element, position, (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.generateGetNextPosition)(nextPositionDirection)); +} + +/** + * @param {DirectionTRBL} orientation + * @param {number} minDistance + * + * @return {number} + */ +function getVerticalDistance(orientation, minDistance) { + if (orientation.includes('top')) { + return -1 * minDistance; + } else if (orientation.includes('bottom')) { + return minDistance; + } else { + return 0; + } +} + + +/** + * Get the position for given text annotation. Try placing the text annotation + * top-right of the source. + * + * @param {Shape} source + * @param {Shape} element + * + * @return {Point} + */ +function getTextAnnotationPosition(source, element) { + var sourceTrbl = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.asTRBL)(source); - },{"./ExtensionElementsHelper":28,"bpmn-js/lib/util/ModelUtil":240}],30:[function(require,module,exports){ - 'use strict'; + var position = { + x: sourceTrbl.right + element.width / 2, + y: sourceTrbl.top - 50 - element.height / 2 + }; - var ModelUtil = require('bpmn-js/lib/util/ModelUtil'), - is = ModelUtil.is, - getBusinessObject = ModelUtil.getBusinessObject; + if ((0,diagram_js_lib_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__.isConnection)(source)) { + position = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.getMid)(source); + position.x += 100; + position.y -= 50; + } - var eventDefinitionHelper = require('./EventDefinitionHelper'); - var extensionsElementHelper = require('./ExtensionElementsHelper'); + var nextPositionDirection = { + y: { + margin: -30, + minDistance: 20 + } + }; - var ImplementationTypeHelper = {}; + return (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.findFreePosition)(source, element, position, (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.generateGetNextPosition)(nextPositionDirection)); +} - module.exports = ImplementationTypeHelper; - /** - * Returns 'true' if the given element is 'camunda:ServiceTaskLike' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isServiceTaskLike = function(element) { - return is(element, 'camunda:ServiceTaskLike'); - }; +/** + * Get the position for given new data element. Try placing the data element + * bottom-right of the source. + * + * @param {Shape} source + * @param {Shape} element + * + * @return {Point} + */ +function getDataElementPosition(source, element) { - /** - * Returns 'true' if the given element is 'camunda:DmnCapable' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isDmnCapable = function(element) { - return is(element, 'camunda:DmnCapable'); - }; + var sourceTrbl = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.asTRBL)(source); - /** - * Returns 'true' if the given element is 'camunda:ExternalCapable' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isExternalCapable = function(element) { - return is(element, 'camunda:ExternalCapable'); - }; + var position = { + x: sourceTrbl.right - 10 + element.width / 2, + y: sourceTrbl.bottom + 40 + element.width / 2 + }; - /** - * Returns 'true' if the given element is 'camunda:TaskListener' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isTaskListener = function(element) { - return is(element, 'camunda:TaskListener'); - }; + var nextPositionDirection = { + x: { + margin: 30, + minDistance: 30 + } + }; - /** - * Returns 'true' if the given element is 'camunda:ExecutionListener' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isExecutionListener = function(element) { - return is(element, 'camunda:ExecutionListener'); - }; + return (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.findFreePosition)(source, element, position, (0,diagram_js_lib_features_auto_place_AutoPlaceUtil__WEBPACK_IMPORTED_MODULE_2__.generateGetNextPosition)(nextPositionDirection)); +} - /** - * Returns 'true' if the given element is 'camunda:ExecutionListener' or - * 'camunda:TaskListener' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isListener = function(element) { - return this.isTaskListener(element) || this.isExecutionListener(element); - }; +/***/ }), - /** - * Returns 'true' if the given element is 'bpmn:SequenceFlow' - * - * @param {djs.model.Base} element - * - * @return {boolean} a boolean value - */ - ImplementationTypeHelper.isSequenceFlow = function(element) { - return is(element, 'bpmn:SequenceFlow'); - }; +/***/ "../node_modules/bpmn-js/lib/features/auto-place/index.js": +/*!****************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-place/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - /** - * Get a 'camunda:ServiceTaskLike' business object. - * - * If the given element is not a 'camunda:ServiceTaskLike', then 'false' - * is returned. - * - * @param {djs.model.Base} element - * - * @return {ModdleElement} the 'camunda:ServiceTaskLike' business object - */ - ImplementationTypeHelper.getServiceTaskLikeBusinessObject = function(element) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_auto_place__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/auto-place */ "../node_modules/diagram-js/lib/features/auto-place/index.js"); +/* harmony import */ var _BpmnAutoPlace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BpmnAutoPlace */ "../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlace.js"); - if (is(element, 'bpmn:IntermediateThrowEvent') || is(element, 'bpmn:EndEvent')) { - // change business object to 'messageEventDefinition' when - // the element is a message intermediate throw event or message end event - // because the camunda extensions (e.g. camunda:class) are in the message - // event definition tag and not in the intermediate throw event or end event tag - var messageEventDefinition = eventDefinitionHelper.getMessageEventDefinition(element); - if (messageEventDefinition) { - element = messageEventDefinition; - } - } - return this.isServiceTaskLike(element) && getBusinessObject(element); - }; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ diagram_js_lib_features_auto_place__WEBPACK_IMPORTED_MODULE_0__["default"] ], + __init__: [ 'bpmnAutoPlace' ], + bpmnAutoPlace: [ 'type', _BpmnAutoPlace__WEBPACK_IMPORTED_MODULE_1__["default"] ] +}); - /** - * Returns the implementation type of the given element. - * - * Possible implementation types are: - * - dmn - * - connector - * - external - * - class - * - expression - * - delegateExpression - * - script - * - or undefined, when no matching implementation type is found - * - * @param {djs.model.Base} element - * - * @return {String} the implementation type - */ - ImplementationTypeHelper.getImplementationType = function(element) { +/***/ }), - var bo = this.getServiceTaskLikeBusinessObject(element); +/***/ "../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResize.js": +/*!**************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResize.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - if (!bo) { - if (this.isListener(element)) { - bo = element; - } else { - return; - } - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnAutoResize) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_auto_resize_AutoResize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/auto-resize/AutoResize */ "../node_modules/diagram-js/lib/features/auto-resize/AutoResize.js"); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - if (this.isDmnCapable(bo)) { - var decisionRef = bo.get('camunda:decisionRef'); - if (typeof decisionRef !== 'undefined') { - return 'dmn'; - } - } - if (this.isServiceTaskLike(bo)) { - var connectors = extensionsElementHelper.getExtensionElements(bo, 'camunda:Connector'); - if (typeof connectors !== 'undefined') { - return 'connector'; - } - } - if (this.isExternalCapable(bo)) { - var type = bo.get('camunda:type'); - if (type === 'external') { - return 'external'; - } - } - var cls = bo.get('camunda:class'); - if (typeof cls !== 'undefined') { - return 'class'; - } - var expression = bo.get('camunda:expression'); - if (typeof expression !== 'undefined') { - return 'expression'; - } - var delegateExpression = bo.get('camunda:delegateExpression'); - if (typeof delegateExpression !== 'undefined') { - return 'delegateExpression'; - } +/** + * @typedef {import('didi').Injector} Injector + * + * @typedef {import('../../model/Types').Shape} Shape + * + * @typedef {import('diagram-js/lib/util/Types').Rect} Rect + */ - if (this.isListener(bo)) { - var script = bo.get('script'); - if (typeof script !== 'undefined') { - return 'script'; - } - } +/** + * BPMN-specific resize behavior. + * + * @param {Injector} injector + */ +function BpmnAutoResize(injector) { - }; + injector.invoke(diagram_js_lib_features_auto_resize_AutoResize__WEBPACK_IMPORTED_MODULE_0__["default"], this); +} - },{"./EventDefinitionHelper":27,"./ExtensionElementsHelper":28,"bpmn-js/lib/util/ModelUtil":240}],31:[function(require,module,exports){ - 'use strict'; +BpmnAutoResize.$inject = [ + 'injector' +]; - var ModelUtil = require('bpmn-js/lib/util/ModelUtil'), - is = ModelUtil.is, - getBusinessObject = ModelUtil.getBusinessObject; +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnAutoResize, diagram_js_lib_features_auto_resize_AutoResize__WEBPACK_IMPORTED_MODULE_0__["default"]); - var extensionElementsHelper = require('./ExtensionElementsHelper'), - implementationTypeHelper = require('./ImplementationTypeHelper'); +/** + * Perform BPMN-specific resizing of participants. + * + * @param {Shape} target + * @param {Rect} newBounds + * @param {Object} [hints] + * @param {string} [hints.autoResize] + */ +BpmnAutoResize.prototype.resize = function(target, newBounds, hints) { - var InputOutputHelper = {}; + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Participant')) { + this._modeling.resizeLane(target, newBounds, null, hints); + } else { + this._modeling.resizeShape(target, newBounds, null, hints); + } +}; - module.exports = InputOutputHelper; +/***/ }), - function getElements(bo, type, prop) { - var elems = extensionElementsHelper.getExtensionElements(bo, type) || []; - return !prop ? elems : (elems[0] || {})[prop] || []; - } +/***/ "../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResizeProvider.js": +/*!**********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResizeProvider.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - function getParameters(element, prop, insideConnector) { - var inputOutput = InputOutputHelper.getInputOutput(element, insideConnector); - return (inputOutput && inputOutput.get(prop)) || []; - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnAutoResizeProvider) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_features_auto_resize_AutoResizeProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/auto-resize/AutoResizeProvider */ "../node_modules/diagram-js/lib/features/auto-resize/AutoResizeProvider.js"); - /** - * Get a inputOutput from the business object - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * - * @return {ModdleElement} the inputOutput object - */ - InputOutputHelper.getInputOutput = function(element, insideConnector) { - if (!insideConnector) { - var bo = getBusinessObject(element); - return (getElements(bo, 'camunda:InputOutput') || [])[0]; - } - var connector = this.getConnector(element); - return connector && connector.get('inputOutput'); - }; - /** - * Get a connector from the business object - * - * @param {djs.model.Base} element - * - * @return {ModdleElement} the connector object - */ - InputOutputHelper.getConnector = function(element) { - var bo = implementationTypeHelper.getServiceTaskLikeBusinessObject(element); - return bo && (getElements(bo, 'camunda:Connector') || [])[0]; - }; - /** - * Return all input parameters existing in the business object, and - * an empty array if none exist. - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * - * @return {Array} a list of input parameter objects - */ - InputOutputHelper.getInputParameters = function(element, insideConnector) { - return getParameters.apply(this, [ element, 'inputParameters', insideConnector ]); - }; - /** - * Return all output parameters existing in the business object, and - * an empty array if none exist. - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * - * @return {Array} a list of output parameter objects - */ - InputOutputHelper.getOutputParameters = function(element, insideConnector) { - return getParameters.apply(this, [ element, 'outputParameters', insideConnector ]); - }; - /** - * Get a input parameter from the business object at given index - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * @param {number} idx - * - * @return {ModdleElement} input parameter - */ - InputOutputHelper.getInputParameter = function(element, insideConnector, idx) { - return this.getInputParameters(element, insideConnector)[idx]; - }; - /** - * Get a output parameter from the business object at given index - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * @param {number} idx - * - * @return {ModdleElement} output parameter - */ - InputOutputHelper.getOutputParameter = function(element, insideConnector, idx) { - return this.getOutputParameters(element, insideConnector)[idx]; - }; - /** - * Returns 'true' if the given element supports inputOutput - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * - * @return {boolean} a boolean value - */ - InputOutputHelper.isInputOutputSupported = function(element, insideConnector) { - if (insideConnector) { - return true; - } - var bo = getBusinessObject(element); - return ( - is(bo, 'bpmn:FlowNode') && !( - is(bo, 'bpmn:StartEvent') || - is(bo, 'bpmn:Gateway') || - is(bo, 'bpmn:BoundaryEvent') || - ( - is(bo, 'bpmn:SubProcess') && bo.get('triggeredByEvent') - ) - ) - ); - }; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('../modeling/Modeling').default} Modeling + * + * @typedef {import('../../model/Types').Shape} Shape + */ - /** - * Returns 'true' if the given element supports output parameters - * - * @param {djs.model.Base} element - * @param {boolean} insideConnector - * - * @return {boolean} a boolean value - */ - InputOutputHelper.areOutputParametersSupported = function(element, insideConnector) { - var bo = getBusinessObject(element); - return insideConnector || (!is(bo, 'bpmn:EndEvent') && !bo.loopCharacteristics); - }; +/** + * BPMN-specific provider for automatic resizung. + * + * @param {EventBus} eventBus + * @param {Modeling} modeling + */ +function BpmnAutoResizeProvider(eventBus, modeling) { + diagram_js_lib_features_auto_resize_AutoResizeProvider__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); - },{"./ExtensionElementsHelper":28,"./ImplementationTypeHelper":30,"bpmn-js/lib/util/ModelUtil":240}],32:[function(require,module,exports){ - 'use strict'; + this._modeling = modeling; +} - var is = require('bpmn-js/lib/util/ModelUtil').is, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - cmdHelper = require('./CmdHelper'); +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnAutoResizeProvider, diagram_js_lib_features_auto_resize_AutoResizeProvider__WEBPACK_IMPORTED_MODULE_0__["default"]); +BpmnAutoResizeProvider.$inject = [ + 'eventBus', + 'modeling' +]; - var ParticipantHelper = {}; - module.exports = ParticipantHelper; +/** + * BPMN-specific check whether given elements can be resized. + * + * @param {Shape[]} elements + * @param {Shape} target + * + * @return {boolean} + */ +BpmnAutoResizeProvider.prototype.canResize = function(elements, target) { - ParticipantHelper.modifyProcessBusinessObject = function(element, property, values) { - if (!is(element, 'bpmn:Participant')) { - return {}; - } + // do not resize plane elements: + // root elements, collapsed sub-processes + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target.di, 'bpmndi:BPMNPlane')) { + return false; + } - var bo = getBusinessObject(element).get('processRef'), - properties = {}; + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Participant') && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Lane') && !((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:SubProcess'))) { + return false; + } - properties[property] = values[property]; + var canResize = true; - return cmdHelper.updateBusinessObject(element, bo, properties); - }; + (0,min_dash__WEBPACK_IMPORTED_MODULE_3__.forEach)(elements, function(element) { - ParticipantHelper.getProcessBusinessObject = function(element, propertyName) { - if (!is(element, 'bpmn:Participant')) { - return {}; - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:Lane') || (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_4__.isLabel)(element)) { + canResize = false; + return; + } + }); - var bo = getBusinessObject(element).get('processRef'), - properties = {}; + return canResize; +}; - properties[propertyName] = bo.get(propertyName); - return properties; - }; - },{"./CmdHelper":25,"bpmn-js/lib/util/ModelUtil":240}],33:[function(require,module,exports){ - module.exports = { - __depends__: [ - require('./cmd'), - require('diagram-js/lib/i18n/translate').default - ], - __init__: [ 'propertiesPanel' ], - propertiesPanel: [ 'type', require('./PropertiesPanel') ] - }; +/***/ }), - },{"./PropertiesPanel":4,"./cmd":11,"diagram-js/lib/i18n/translate":401}],34:[function(require,module,exports){ - 'use strict'; +/***/ "../node_modules/bpmn-js/lib/features/auto-resize/index.js": +/*!*****************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/auto-resize/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var entryFactory = require('../../../factory/EntryFactory'), - cmdHelper = require('../../../helper/CmdHelper'); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _BpmnAutoResize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BpmnAutoResize */ "../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResize.js"); +/* harmony import */ var _BpmnAutoResizeProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BpmnAutoResizeProvider */ "../node_modules/bpmn-js/lib/features/auto-resize/BpmnAutoResizeProvider.js"); - var ModelUtil = require('bpmn-js/lib/util/ModelUtil'), - is = ModelUtil.is, - getBusinessObject = ModelUtil.getBusinessObject; - module.exports = function(group, element, bpmnFactory, translate) { - var getValue = function(businessObject) { - return function(element) { - var documentations = businessObject && businessObject.get('documentation'), - text = (documentations && documentations.length > 0) ? documentations[0].text : ''; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __init__: [ + 'bpmnAutoResize', + 'bpmnAutoResizeProvider' + ], + bpmnAutoResize: [ 'type', _BpmnAutoResize__WEBPACK_IMPORTED_MODULE_0__["default"] ], + bpmnAutoResizeProvider: [ 'type', _BpmnAutoResizeProvider__WEBPACK_IMPORTED_MODULE_1__["default"] ] +}); - return { documentation: text }; - }; - }; - var setValue = function(businessObject) { - return function(element, values) { - var newObjectList = []; +/***/ }), - if (typeof values.documentation !== 'undefined' && values.documentation !== '') { - newObjectList.push(bpmnFactory.create('bpmn:Documentation', { - text: values.documentation - })); - } +/***/ "../node_modules/bpmn-js/lib/features/context-pad/ContextPadProvider.js": +/*!******************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/context-pad/ContextPadProvider.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - return cmdHelper.setList(element, businessObject, 'documentation', newObjectList); - }; - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ ContextPadProvider) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var _modeling_util_LaneUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../modeling/util/LaneUtil */ "../node_modules/bpmn-js/lib/features/modeling/util/LaneUtil.js"); +/* harmony import */ var diagram_js_lib_util_Mouse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/util/Mouse */ "../node_modules/diagram-js/lib/util/Mouse.js"); - // Element Documentation - var elementDocuEntry = entryFactory.textBox({ - id: 'documentation', - label: translate('Element Documentation'), - modelProperty: 'documentation' - }); - elementDocuEntry.set = setValue(getBusinessObject(element)); - elementDocuEntry.get = getValue(getBusinessObject(element)); - group.entries.push(elementDocuEntry); - var processRef; - // Process Documentation when having a Collaboration Diagram - if (is(element, 'bpmn:Participant')) { - processRef = getBusinessObject(element).processRef; - // do not show for collapsed Pools/Participants - if (processRef) { - var processDocuEntry = entryFactory.textBox({ - id: 'process-documentation', - label: translate('Process Documentation'), - modelProperty: 'documentation' - }); - processDocuEntry.set = setValue(processRef); - processDocuEntry.get = getValue(processRef); - group.entries.push(processDocuEntry); - } - } +/** + * @typedef {import('didi').Injector} Injector + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').default} ContextPad + * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('../modeling/ElementFactory').default} ElementFactory + * @typedef {import('diagram-js/lib/features/connect/Connect').default} Connect + * @typedef {import('diagram-js/lib/features/create/Create').default} Create + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu + * @typedef {import('diagram-js/lib/features/canvas/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').ModdleElement} ModdleElement + * + * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default} BaseContextPadProvider + * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').ContextPadEntries} ContextPadEntries + * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').ContextPadEntry} ContextPadEntry + * + * @typedef { { autoPlace?: boolean; } } ContextPadConfig + */ - }; +/** + * BPMN-specific context pad provider. + * + * @implements {BaseContextPadProvider} + * + * @param {ContextPadConfig} config + * @param {Injector} injector + * @param {EventBus} eventBus + * @param {ContextPad} contextPad + * @param {Modeling} modeling + * @param {ElementFactory} elementFactory + * @param {Connect} connect + * @param {Create} create + * @param {PopupMenu} popupMenu + * @param {Canvas} canvas + * @param {Rules} rules + * @param {Translate} translate + */ +function ContextPadProvider( + config, injector, eventBus, + contextPad, modeling, elementFactory, + connect, create, popupMenu, + canvas, rules, translate, appendPreview) { + + config = config || {}; + + contextPad.registerProvider(this); + + this._contextPad = contextPad; + + this._modeling = modeling; + + this._elementFactory = elementFactory; + this._connect = connect; + this._create = create; + this._popupMenu = popupMenu; + this._canvas = canvas; + this._rules = rules; + this._translate = translate; + this._eventBus = eventBus; + this._appendPreview = appendPreview; + + if (config.autoPlace !== false) { + this._autoPlace = injector.get('autoPlace', false); + } + + eventBus.on('create.end', 250, function(event) { + var context = event.context, + shape = context.shape; + + if (!(0,diagram_js_lib_util_Mouse__WEBPACK_IMPORTED_MODULE_0__.hasPrimaryModifier)(event) || !contextPad.isOpen(shape)) { + return; + } + + var entries = contextPad.getEntries(shape); + + if (entries.replace) { + entries.replace.action.click(event, shape); + } + }); +} + +ContextPadProvider.$inject = [ + 'config.contextPad', + 'injector', + 'eventBus', + 'contextPad', + 'modeling', + 'elementFactory', + 'connect', + 'create', + 'popupMenu', + 'canvas', + 'rules', + 'translate', + 'appendPreview' +]; + +/** + * @param {Element[]} elements + * + * @return {ContextPadEntries} + */ +ContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) { + var modeling = this._modeling; + + var actions = {}; + + if (this._isDeleteAllowed(elements)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'delete': { + group: 'edit', + className: 'bpmn-icon-trash', + title: this._translate('Delete'), + action: { + click: function(event, elements) { + modeling.removeElements(elements.slice()); + } + } + } + }); + } + + return actions; +}; + +/** + * @param {Element[]} elements + * + * @return {boolean} + */ +ContextPadProvider.prototype._isDeleteAllowed = function(elements) { + + var baseAllowed = this._rules.allowed('elements.delete', { + elements: elements + }); - },{"../../../factory/EntryFactory":14,"../../../helper/CmdHelper":25,"bpmn-js/lib/util/ModelUtil":240}],35:[function(require,module,exports){ - 'use strict'; + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_1__.isArray)(baseAllowed)) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.every)(baseAllowed, function(element) { + return includes(baseAllowed, element); + }); + } - var is = require('bpmn-js/lib/util/ModelUtil').is, - isAny = require('bpmn-js/lib/features/modeling/util/ModelingUtil').isAny, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - eventDefinitionHelper = require('../../../helper/EventDefinitionHelper'); + return baseAllowed; +}; - var forEach = require('lodash/forEach'); +/** + * @param {Element} element + * + * @return {ContextPadEntries} + */ +ContextPadProvider.prototype.getContextPadEntries = function(element) { + var contextPad = this._contextPad, + modeling = this._modeling, + elementFactory = this._elementFactory, + connect = this._connect, + create = this._create, + popupMenu = this._popupMenu, + rules = this._rules, + autoPlace = this._autoPlace, + translate = this._translate, + appendPreview = this._appendPreview; - var message = require('./implementation/MessageEventDefinition'), - signal = require('./implementation/SignalEventDefinition'), - error = require('./implementation/ErrorEventDefinition'), - escalation = require('./implementation/EscalationEventDefinition'), - timer = require('./implementation/TimerEventDefinition'), - compensation = require('./implementation/CompensateEventDefinition'), - condition = require('./implementation/ConditionalEventDefinition'); + var actions = {}; + if (element.type === 'label') { + return actions; + } - module.exports = function(group, element, bpmnFactory, elementRegistry, translate) { - var events = [ - 'bpmn:StartEvent', - 'bpmn:EndEvent', - 'bpmn:IntermediateThrowEvent', - 'bpmn:BoundaryEvent', - 'bpmn:IntermediateCatchEvent' - ]; + var businessObject = element.businessObject; - // Message and Signal Event Definition - forEach(events, function(event) { - if (is(element, event)) { + function startConnect(event, element) { + connect.start(event, element); + } - var messageEventDefinition = eventDefinitionHelper.getMessageEventDefinition(element), - signalEventDefinition = eventDefinitionHelper.getSignalEventDefinition(element); + function removeElement(e, element) { + modeling.removeElements([ element ]); + } - if (messageEventDefinition) { - message(group, element, bpmnFactory, messageEventDefinition, translate); - } + function getReplaceMenuPosition(element) { - if (signalEventDefinition) { - signal(group, element, bpmnFactory, signalEventDefinition, translate); - } + var Y_OFFSET = 5; - } - }); + var pad = contextPad.getPad(element).html; - // Special Case: Receive Task - if (is(element, 'bpmn:ReceiveTask')) { - message(group, element, bpmnFactory, getBusinessObject(element), translate); - } + var padRect = pad.getBoundingClientRect(); - // Error Event Definition - var errorEvents = [ - 'bpmn:StartEvent', - 'bpmn:BoundaryEvent', - 'bpmn:EndEvent' - ]; + var pos = { + x: padRect.left, + y: padRect.bottom + Y_OFFSET + }; - forEach(errorEvents, function(event) { - if (is(element, event)) { + return pos; + } - var errorEventDefinition = eventDefinitionHelper.getErrorEventDefinition(element); + /** + * Create an append action. + * + * @param {string} type + * @param {string} className + * @param {string} title + * @param {Object} [options] + * + * @return {ContextPadEntry} + */ + function appendAction(type, className, title, options) { - if (errorEventDefinition) { + function appendStart(event, element) { - error(group, element, bpmnFactory, errorEventDefinition, translate); - } - } - }); + var shape = elementFactory.createShape((0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)({ type: type }, options)); - // Escalation Event Definition - var escalationEvents = [ - 'bpmn:StartEvent', - 'bpmn:BoundaryEvent', - 'bpmn:IntermediateThrowEvent', - 'bpmn:EndEvent' - ]; + create.start(event, shape, { + source: element + }); - forEach(escalationEvents, function(event) { - if (is(element, event)) { + appendPreview.cleanUp(); + } - var showEscalationCodeVariable = is(element, 'bpmn:StartEvent') || is(element, 'bpmn:BoundaryEvent'); + var append = autoPlace ? function(_, element) { + var shape = elementFactory.createShape((0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)({ type: type }, options)); - // get business object - var escalationEventDefinition = eventDefinitionHelper.getEscalationEventDefinition(element); + autoPlace.append(element, shape); - if (escalationEventDefinition) { - escalation(group, element, bpmnFactory, escalationEventDefinition, showEscalationCodeVariable, - translate); - } - } + appendPreview.cleanUp(); + } : appendStart; - }); + var previewAppend = autoPlace ? function(_, element) { - // Timer Event Definition - var timerEvents = [ - 'bpmn:StartEvent', - 'bpmn:BoundaryEvent', - 'bpmn:IntermediateCatchEvent' - ]; + // mouseover + appendPreview.create(element, type, options); - forEach(timerEvents, function(event) { - if (is(element, event)) { + return () => { - // get business object - var timerEventDefinition = eventDefinitionHelper.getTimerEventDefinition(element); + // mouseout + appendPreview.cleanUp(); + }; + } : null; - if (timerEventDefinition) { - timer(group, element, bpmnFactory, timerEventDefinition, translate); - } - } - }); + return { + group: 'model', + className: className, + title: title, + action: { + dragstart: appendStart, + click: append, + hover: previewAppend + } + }; + } - // Compensate Event Definition - var compensationEvents = [ - 'bpmn:EndEvent', - 'bpmn:IntermediateThrowEvent' - ]; + function splitLaneHandler(count) { - forEach(compensationEvents, function(event) { - if (is(element, event)) { + return function(_, element) { - // get business object - var compensateEventDefinition = eventDefinitionHelper.getCompensateEventDefinition(element); + // actual split + modeling.splitLane(element, count); - if (compensateEventDefinition) { - compensation(group, element, bpmnFactory, compensateEventDefinition, elementRegistry, translate); - } - } - }); + // refresh context pad after split to + // get rid of split icons + contextPad.open(element, true); + }; + } - // Conditional Event Definition - var conditionalEvents = [ - 'bpmn:StartEvent', - 'bpmn:BoundaryEvent', - 'bpmn:IntermediateThrowEvent', - 'bpmn:IntermediateCatchEvent' - ]; + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.isAny)(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isExpanded)(element)) { - if (isAny(element, conditionalEvents)) { + var childLanes = (0,_modeling_util_LaneUtil__WEBPACK_IMPORTED_MODULE_4__.getChildLanes)(element); - // get business object - var conditionalEventDefinition = eventDefinitionHelper.getConditionalEventDefinition(element); + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'lane-insert-above': { + group: 'lane-insert-above', + className: 'bpmn-icon-lane-insert-above', + title: translate('Add lane above'), + action: { + click: function(event, element) { + modeling.addLane(element, 'top'); + } + } + } + }); - if (conditionalEventDefinition) { - condition(group, element, bpmnFactory, conditionalEventDefinition, elementRegistry, translate); - } + if (childLanes.length < 2) { + + if (element.height >= 120) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'lane-divide-two': { + group: 'lane-divide', + className: 'bpmn-icon-lane-divide-two', + title: translate('Divide into two lanes'), + action: { + click: splitLaneHandler(2) } + } + }); + } + + if (element.height >= 180) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'lane-divide-three': { + group: 'lane-divide', + className: 'bpmn-icon-lane-divide-three', + title: translate('Divide into three lanes'), + action: { + click: splitLaneHandler(3) + } + } + }); + } + } + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'lane-insert-below': { + group: 'lane-insert-below', + className: 'bpmn-icon-lane-insert-below', + title: translate('Add lane below'), + action: { + click: function(event, element) { + modeling.addLane(element, 'bottom'); + } + } + } + }); + + } + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:FlowNode')) { + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:EventBasedGateway')) { + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.receive-task': appendAction( + 'bpmn:ReceiveTask', + 'bpmn-icon-receive-task', + translate('Append receive task') + ), + 'append.message-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-message', + translate('Append message intermediate catch event'), + { eventDefinitionType: 'bpmn:MessageEventDefinition' } + ), + 'append.timer-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-timer', + translate('Append timer intermediate catch event'), + { eventDefinitionType: 'bpmn:TimerEventDefinition' } + ), + 'append.condition-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-condition', + translate('Append conditional intermediate catch event'), + { eventDefinitionType: 'bpmn:ConditionalEventDefinition' } + ), + 'append.signal-intermediate-event': appendAction( + 'bpmn:IntermediateCatchEvent', + 'bpmn-icon-intermediate-event-catch-signal', + translate('Append signal intermediate catch event'), + { eventDefinitionType: 'bpmn:SignalEventDefinition' } + ) + }); + } else + + if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) { + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.compensation-activity': + appendAction( + 'bpmn:Task', + 'bpmn-icon-task', + translate('Append compensation activity'), + { + isForCompensation: true + } + ) + }); + } else + + if (!(0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:EndEvent') && + !businessObject.isForCompensation && + !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') && + !(0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isEventSubProcess)(businessObject)) { + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.end-event': appendAction( + 'bpmn:EndEvent', + 'bpmn-icon-end-event-none', + translate('Append end event') + ), + 'append.gateway': appendAction( + 'bpmn:ExclusiveGateway', + 'bpmn-icon-gateway-none', + translate('Append gateway') + ), + 'append.append-task': appendAction( + 'bpmn:Task', + 'bpmn-icon-task', + translate('Append task') + ), + 'append.intermediate-event': appendAction( + 'bpmn:IntermediateThrowEvent', + 'bpmn-icon-intermediate-event-none', + translate('Append intermediate/boundary event') + ) + }); + } + } + + if (!popupMenu.isEmpty(element, 'bpmn-replace')) { + + // Replace menu entry + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'replace': { + group: 'edit', + className: 'bpmn-icon-screw-wrench', + title: translate('Change element'), + action: { + click: function(event, element) { + + var position = (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(getReplaceMenuPosition(element), { + cursor: { x: event.x, y: event.y } + }); + + popupMenu.open(element, 'bpmn-replace', position, { + title: translate('Change element'), + width: 300, + search: true + }); + } + } + } + }); + } + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:SequenceFlow')) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.text-annotation': appendAction( + 'bpmn:TextAnnotation', + 'bpmn-icon-text-annotation', + translate('Add text annotation') + ) + }); + } + + if ( + (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.isAny)(businessObject, [ + 'bpmn:FlowNode', + 'bpmn:InteractionNode', + 'bpmn:DataObjectReference', + 'bpmn:DataStoreReference', + ]) + ) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.text-annotation': appendAction( + 'bpmn:TextAnnotation', + 'bpmn-icon-text-annotation', + translate('Add text annotation') + ), + + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate('Connect to other element'), + action: { + click: startConnect, + dragstart: startConnect, + }, + }, + }); + } + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:TextAnnotation')) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate('Connect using association'), + action: { + click: startConnect, + dragstart: startConnect, + }, + }, + }); + } + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.isAny)(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'connect': { + group: 'connect', + className: 'bpmn-icon-connection-multi', + title: translate('Connect using data input association'), + action: { + click: startConnect, + dragstart: startConnect + } + } + }); + } + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:Group')) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'append.text-annotation': appendAction( + 'bpmn:TextAnnotation', + 'bpmn-icon-text-annotation', + translate('Add text annotation') + ) + }); + } + + // delete element entry, only show if allowed by rules + var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] }); + + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_1__.isArray)(deleteAllowed)) { + + // was the element returned as a deletion candidate? + deleteAllowed = deleteAllowed[0] === element; + } + + if (deleteAllowed) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(actions, { + 'delete': { + group: 'edit', + className: 'bpmn-icon-trash', + title: translate('Delete'), + action: { + click: removeElement + } + } + }); + } + + return actions; +}; + + +// helpers ///////// + +/** + * @param {ModdleElement} businessObject + * @param {string} type + * @param {string} eventDefinitionType + * + * @return {boolean} + */ +function isEventType(businessObject, type, eventDefinitionType) { - }; + var isType = businessObject.$instanceOf(type); + var isDefinition = false; - },{"../../../helper/EventDefinitionHelper":27,"./implementation/CompensateEventDefinition":41,"./implementation/ConditionalEventDefinition":42,"./implementation/ErrorEventDefinition":44,"./implementation/EscalationEventDefinition":45,"./implementation/MessageEventDefinition":47,"./implementation/SignalEventDefinition":49,"./implementation/TimerEventDefinition":50,"bpmn-js/lib/features/modeling/util/ModelingUtil":211,"bpmn-js/lib/util/ModelUtil":240,"lodash/forEach":613}],36:[function(require,module,exports){ - 'use strict'; + var definitions = businessObject.eventDefinitions || []; + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.forEach)(definitions, function(def) { + if (def.$type === eventDefinitionType) { + isDefinition = true; + } + }); - var is = require('bpmn-js/lib/util/ModelUtil').is, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; + return isType && isDefinition; +} - var entryFactory = require('../../../factory/EntryFactory'); +function includes(array, item) { + return array.indexOf(item) !== -1; +} - var participantHelper = require('../../../helper/ParticipantHelper'); +/***/ }), - module.exports = function(group, element, translate) { +/***/ "../node_modules/bpmn-js/lib/features/context-pad/index.js": +/*!*****************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/context-pad/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var bo = getBusinessObject(element); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _append_preview__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../append-preview */ "../node_modules/bpmn-js/lib/features/append-preview/index.js"); +/* harmony import */ var diagram_js_direct_editing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js-direct-editing */ "../node_modules/diagram-js-direct-editing/lib/index.js"); +/* harmony import */ var diagram_js_lib_features_context_pad__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/features/context-pad */ "../node_modules/diagram-js/lib/features/context-pad/index.js"); +/* harmony import */ var diagram_js_lib_features_selection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/features/selection */ "../node_modules/diagram-js/lib/features/selection/index.js"); +/* harmony import */ var diagram_js_lib_features_connect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/features/connect */ "../node_modules/diagram-js/lib/features/connect/index.js"); +/* harmony import */ var diagram_js_lib_features_create__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! diagram-js/lib/features/create */ "../node_modules/diagram-js/lib/features/create/index.js"); +/* harmony import */ var _popup_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../popup-menu */ "../node_modules/bpmn-js/lib/features/popup-menu/index.js"); +/* harmony import */ var _ContextPadProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ContextPadProvider */ "../node_modules/bpmn-js/lib/features/context-pad/ContextPadProvider.js"); - if (!bo) { - return; - } - if (is(element, 'bpmn:Process') || (is(element, 'bpmn:Participant') && bo.get('processRef'))) { - var executableEntry = entryFactory.checkbox({ - id: 'process-is-executable', - label: translate('Executable'), - modelProperty: 'isExecutable' - }); - // in participants we have to change the default behavior of set and get - if (is(element, 'bpmn:Participant')) { - executableEntry.get = function(element) { - return participantHelper.getProcessBusinessObject(element, 'isExecutable'); - }; - executableEntry.set = function(element, values) { - return participantHelper.modifyProcessBusinessObject(element, 'isExecutable', values); - }; - } - group.entries.push(executableEntry); - } - }; - },{"../../../factory/EntryFactory":14,"../../../helper/ParticipantHelper":32,"bpmn-js/lib/util/ModelUtil":240}],37:[function(require,module,exports){ - 'use strict'; - var entryFactory = require('../../../factory/EntryFactory'), - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - utils = require('../../../Utils'), - cmdHelper = require('../../../helper/CmdHelper'); - module.exports = function(group, element, translate, options) { +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + _append_preview__WEBPACK_IMPORTED_MODULE_1__["default"], + diagram_js_direct_editing__WEBPACK_IMPORTED_MODULE_0__["default"], + diagram_js_lib_features_context_pad__WEBPACK_IMPORTED_MODULE_2__["default"], + diagram_js_lib_features_selection__WEBPACK_IMPORTED_MODULE_3__["default"], + diagram_js_lib_features_connect__WEBPACK_IMPORTED_MODULE_4__["default"], + diagram_js_lib_features_create__WEBPACK_IMPORTED_MODULE_5__["default"], + _popup_menu__WEBPACK_IMPORTED_MODULE_6__["default"] + ], + __init__: [ 'contextPadProvider' ], + contextPadProvider: [ 'type', _ContextPadProvider__WEBPACK_IMPORTED_MODULE_7__["default"] ] +}); - var description = options && options.description; +/***/ }), - // Id - group.entries.push(entryFactory.validationAwareTextField({ - id: 'id', - label: translate('Id'), - description: description && translate(description), - modelProperty: 'id', - getProperty: function(element) { - return getBusinessObject(element).id; - }, - setProperty: function(element, properties) { +/***/ "../node_modules/bpmn-js/lib/features/copy-paste/BpmnCopyPaste.js": +/*!************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/copy-paste/BpmnCopyPaste.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - element = element.labelTarget || element; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnCopyPaste) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); - return cmdHelper.updateProperties(element, properties); - }, - validate: function(element, values) { - var idValue = values.id; - var bo = getBusinessObject(element); - var idError = utils.isIdValid(bo, idValue, translate); - return idError ? { id: idError } : {}; - } - })); - }; - },{"../../../Utils":5,"../../../factory/EntryFactory":14,"../../../helper/CmdHelper":25,"bpmn-js/lib/util/ModelUtil":240}],38:[function(require,module,exports){ - 'use strict'; +/** + * @typedef {import('../modeling/BpmnFactory').default} BpmnFactory + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('./ModdleCopy').default} ModdleCopy + */ - var is = require('bpmn-js/lib/util/ModelUtil').is, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - entryFactory = require('../../../factory/EntryFactory'), - cmdHelper = require('../../../helper/CmdHelper'); +function copyProperties(source, target, properties) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isArray)(properties)) { + properties = [ properties ]; + } - var forEach = require('lodash/forEach'); + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(properties, function(property) { + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(source[property])) { + target[property] = source[property]; + } + }); +} - function getLinkEventDefinition(element) { +var LOW_PRIORITY = 750; - var bo = getBusinessObject(element); +/** + * BPMN-specific copy & paste. + * + * @param {BpmnFactory} bpmnFactory + * @param {EventBus} eventBus + * @param {ModdleCopy} moddleCopy + */ +function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) { - var linkEventDefinition = null; - if (bo.eventDefinitions) { - forEach(bo.eventDefinitions, function(eventDefinition) { - if (is(eventDefinition, 'bpmn:LinkEventDefinition')) { - linkEventDefinition = eventDefinition; - } - }); - } + function copy(bo, clone) { + var targetBo = bpmnFactory.create(bo.$type); - return linkEventDefinition; - } + return moddleCopy.copyElement(bo, targetBo, null, clone); + } - module.exports = function(group, element, translate) { - var linkEvents = [ 'bpmn:IntermediateThrowEvent', 'bpmn:IntermediateCatchEvent' ]; + eventBus.on('copyPaste.copyElement', LOW_PRIORITY, function(context) { + var descriptor = context.descriptor, + element = context.element, + businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(element); - forEach(linkEvents, function(event) { - if (is(element, event)) { + // do not copy business object + di for labels; + // will be pulled from the referenced label target + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_2__.isLabel)(element)) { + return descriptor; + } - var linkEventDefinition = getLinkEventDefinition(element); + var businessObjectCopy = descriptor.businessObject = copy(businessObject, true); + var diCopy = descriptor.di = copy((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getDi)(element), true); + diCopy.bpmnElement = businessObjectCopy; - if (linkEventDefinition) { - var entry = entryFactory.textField({ - id: 'link-event', - label: translate('Link Name'), - modelProperty: 'link-name' - }); + copyProperties(businessObjectCopy, descriptor, 'name'); + copyProperties(diCopy, descriptor, 'isExpanded'); - entry.get = function() { - return { 'link-name': linkEventDefinition.get('name') }; - }; + // default sequence flow + if (businessObject.default) { + descriptor.default = businessObject.default.id; + } + }); - entry.set = function(element, values) { - var newProperties = { - name: values['link-name'] - }; - return cmdHelper.updateBusinessObject(element, linkEventDefinition, newProperties); - }; + var referencesKey = '-bpmn-js-refs'; - group.entries.push(entry); - } - } - }); - }; + function getReferences(cache) { + return (cache[referencesKey] = cache[referencesKey] || {}); + } + function setReferences(cache, references) { + cache[referencesKey] = references; + } - },{"../../../factory/EntryFactory":14,"../../../helper/CmdHelper":25,"bpmn-js/lib/util/ModelUtil":240,"lodash/forEach":613}],39:[function(require,module,exports){ - 'use strict'; + function resolveReferences(descriptor, cache, references) { + var businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(descriptor); - var nameEntryFactory = require('./implementation/Name'), - createCategoryValue = require('../../../helper/CategoryHelper').createCategoryValue, - is = require('bpmn-js/lib/util/ModelUtil').is, - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; + // default sequence flows + if (descriptor.default) { - module.exports = function(group, element, bpmnFactory, canvas, translate) { + // relationship cannot be resolved immediately + references[ descriptor.default ] = { + element: businessObject, + property: 'default' + }; + } - function initializeCategory(semantic) { - var rootElement = canvas.getRootElement(), - definitions = getBusinessObject(rootElement).$parent, - categoryValue = createCategoryValue(definitions, bpmnFactory); + // boundary events + if (descriptor.host) { - semantic.categoryValueRef = categoryValue; + // relationship can be resolved immediately + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(descriptor).attachedToRef = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(cache[ descriptor.host ]); + } - } + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.omit)(references, (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.reduce)(references, function(array, reference, key) { + var element = reference.element, + property = reference.property; - function setGroupName(element, values) { - var bo = getBusinessObject(element), - categoryValueRef = bo.categoryValueRef; + if (key === descriptor.id) { + element.set(property, businessObject); - if (!categoryValueRef) { - initializeCategory(bo); - } + array.push(descriptor.id); + } - // needs direct call to update categoryValue properly - return { - cmd: 'element.updateLabel', - context: { - element: element, - newLabel: values.categoryValue - } - }; - } + return array; + }, [])); + } - function getGroupName(element) { - var bo = getBusinessObject(element), - value = (bo.categoryValueRef || {}).value; + eventBus.on('copyPaste.pasteElement', function(context) { + var cache = context.cache, + descriptor = context.descriptor, + businessObject = descriptor.businessObject, + di = descriptor.di; - return { categoryValue: value }; - } + // wire existing di + businessObject for external label + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_2__.isLabel)(descriptor)) { + descriptor.businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(cache[ descriptor.labelTarget ]); + descriptor.di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getDi)(cache[ descriptor.labelTarget ]); + + return; + } + + businessObject = descriptor.businessObject = copy(businessObject); + + di = descriptor.di = copy(di); + di.bpmnElement = businessObject; + + copyProperties(descriptor, businessObject, [ + 'isExpanded', + 'name' + ]); + + descriptor.type = businessObject.$type; + }); + + // copy + paste processRef with participant + + eventBus.on('copyPaste.copyElement', LOW_PRIORITY, function(context) { + var descriptor = context.descriptor, + element = context.element; + + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.is)(element, 'bpmn:Participant')) { + return; + } + + var participantBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(element); + + if (participantBo.processRef) { + descriptor.processRef = copy(participantBo.processRef, true); + } + }); + + eventBus.on('copyPaste.pasteElement', function(context) { + var descriptor = context.descriptor, + processRef = descriptor.processRef; + + if (processRef) { + descriptor.processRef = copy(processRef); + } + }); + + // resolve references - if (!is(element, 'bpmn:Collaboration')) { + eventBus.on('copyPaste.pasteElement', LOW_PRIORITY, function(context) { + var cache = context.cache, + descriptor = context.descriptor; + + // resolve references e.g. default sequence flow + setReferences( + cache, + resolveReferences(descriptor, cache, getReferences(cache)) + ); + }); - var options; - if (is(element, 'bpmn:TextAnnotation')) { - options = { modelProperty: 'text', label: translate('Text') }; - } else if (is(element, 'bpmn:Group')) { - options = { - modelProperty: 'categoryValue', - label: translate('Category Value'), - get: getGroupName, - set: setGroupName - }; - } +} + + +BpmnCopyPaste.$inject = [ + 'bpmnFactory', + 'eventBus', + 'moddleCopy' +]; + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/copy-paste/ModdleCopy.js": +/*!*********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/copy-paste/ModdleCopy.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ ModdleCopy), +/* harmony export */ getPropertyNames: () => (/* binding */ getPropertyNames) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); + + +var DISALLOWED_PROPERTIES = [ + 'artifacts', + 'dataInputAssociations', + 'dataOutputAssociations', + 'default', + 'flowElements', + 'lanes', + 'incoming', + 'outgoing', + 'categoryValue' +]; + +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('../modeling/BpmnFactory').default} BpmnFactory + * @typedef {import('../../model/Types').Moddle} Moddle + * + * @typedef {import('../../model/Types').ModdleElement} ModdleElement + */ - // name - group.entries = group.entries.concat(nameEntryFactory(element, options, translate)); +/** + * Utility for copying model properties from source element to target element. + * + * @param {EventBus} eventBus + * @param {BpmnFactory} bpmnFactory + * @param {Moddle} moddle + */ +function ModdleCopy(eventBus, bpmnFactory, moddle) { + this._bpmnFactory = bpmnFactory; + this._eventBus = eventBus; + this._moddle = moddle; + + // copy extension elements last + eventBus.on('moddleCopy.canCopyProperties', function(context) { + var propertyNames = context.propertyNames; + + if (!propertyNames || !propertyNames.length) { + return; + } + + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.sortBy)(propertyNames, function(propertyName) { + return propertyName === 'extensionElements'; + }); + }); + + // default check whether property can be copied + eventBus.on('moddleCopy.canCopyProperty', function(context) { + var parent = context.parent, + parentDescriptor = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isObject)(parent) && parent.$descriptor, + propertyName = context.propertyName; + + if (propertyName && DISALLOWED_PROPERTIES.indexOf(propertyName) !== -1) { + + // disallow copying property + return false; + } + + if (propertyName && + parentDescriptor && + !(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.find)(parentDescriptor.properties, (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.matchPattern)({ name: propertyName }))) { + + // disallow copying property + return false; + } + }); + + // do NOT allow to copy empty extension elements + eventBus.on('moddleCopy.canSetCopiedProperty', function(context) { + var property = context.property; + + if (is(property, 'bpmn:ExtensionElements') && (!property.values || !property.values.length)) { + + // disallow setting copied property + return false; + } + }); +} + +ModdleCopy.$inject = [ + 'eventBus', + 'bpmnFactory', + 'moddle' +]; + +/** + * Copy model properties of source element to target element. + * + * @param {ModdleElement} sourceElement + * @param {ModdleElement} targetElement + * @param {string[]} [propertyNames] + * @param {boolean} [clone=false] + * + * @return {ModdleElement} + */ +ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, propertyNames, clone = false) { + var self = this; - } + if (propertyNames && !(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isArray)(propertyNames)) { + propertyNames = [ propertyNames ]; + } - }; + propertyNames = propertyNames || getPropertyNames(sourceElement.$descriptor); - },{"../../../helper/CategoryHelper":24,"./implementation/Name":48,"bpmn-js/lib/util/ModelUtil":240}],40:[function(require,module,exports){ - 'use strict'; + var canCopyProperties = this._eventBus.fire('moddleCopy.canCopyProperties', { + propertyNames: propertyNames, + sourceElement: sourceElement, + targetElement: targetElement, + clone: clone + }); - var is = require('bpmn-js/lib/util/ModelUtil').is, - entryFactory = require('../../../factory/EntryFactory'), - participantHelper = require('../../../helper/ParticipantHelper'), - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - nameEntryFactory = require('./implementation/Name'), - utils = require('../../../Utils'); + if (canCopyProperties === false) { + return targetElement; + } - module.exports = function(group, element, translate, options) { - var businessObject = getBusinessObject(element); + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isArray)(canCopyProperties)) { + propertyNames = canCopyProperties; + } - var processIdDescription = options && options.processIdDescription; + // copy properties + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(propertyNames, function(propertyName) { + var sourceProperty; - if (is(element, 'bpmn:Process') || (is(element, 'bpmn:Participant') && businessObject.get('processRef'))) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.has)(sourceElement, propertyName)) { + sourceProperty = sourceElement.get(propertyName); + } - /** - * processId - */ - if (is(element, 'bpmn:Participant')) { - var idEntry = entryFactory.validationAwareTextField({ - id: 'process-id', - label: translate('Process Id'), - description: processIdDescription && translate(processIdDescription), - modelProperty: 'processId' - }); + var copiedProperty = self.copyProperty(sourceProperty, targetElement, propertyName, clone); - // in participants we have to change the default behavior of set and get - idEntry.get = function(element) { - var properties = participantHelper.getProcessBusinessObject(element, 'id'); - return { processId: properties.id }; - }; + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isDefined)(copiedProperty)) { + return; + } - idEntry.set = function(element, values) { - return participantHelper.modifyProcessBusinessObject(element, 'id', { id: values.processId }); - }; + var canSetProperty = self._eventBus.fire('moddleCopy.canSetCopiedProperty', { + parent: targetElement, + property: copiedProperty, + propertyName: propertyName + }); - idEntry.validate = function(element, values) { - var idValue = values.processId; + if (canSetProperty === false) { + return; + } - var bo = getBusinessObject(element); + // TODO(nikku): unclaim old IDs if ID property is copied over + // this._moddle.getPropertyDescriptor(parent, propertyName) + targetElement.set(propertyName, copiedProperty); + }); - var processIdError = utils.isIdValid(bo.processRef, idValue, translate); + return targetElement; +}; - return processIdError ? { processId: processIdError } : {}; - }; +/** + * Copy model property. + * + * @param {any} property + * @param {ModdleElement} parent + * @param {string} propertyName + * @param {boolean} [clone=false] + * + * @return {any} + */ +ModdleCopy.prototype.copyProperty = function(property, parent, propertyName, clone = false) { + var self = this; - group.entries.push(idEntry); + // allow others to copy property + var copiedProperty = this._eventBus.fire('moddleCopy.canCopyProperty', { + parent: parent, + property: property, + propertyName: propertyName, + clone: clone + }); + // return if copying is NOT allowed + if (copiedProperty === false) { + return; + } + + if (copiedProperty) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isObject)(copiedProperty) && copiedProperty.$type && !copiedProperty.$parent) { + copiedProperty.$parent = parent; + } + + return copiedProperty; + } - /** - * process name - */ - var processNameEntry = nameEntryFactory(element, { - id: 'process-name', - label: translate('Process Name') - })[0]; + var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName); - // in participants we have to change the default behavior of set and get - processNameEntry.get = function(element) { - return participantHelper.getProcessBusinessObject(element, 'name'); - }; + // do NOT copy references + if (propertyDescriptor.isReference) { + return; + } - processNameEntry.set = function(element, values) { - return participantHelper.modifyProcessBusinessObject(element, 'name', values); - }; + // copy id + if (propertyDescriptor.isId) { + return property && this._copyId(property, parent, clone); + } - group.entries.push(processNameEntry); - } - } - }; + // copy arrays + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isArray)(property)) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.reduce)(property, function(childProperties, childProperty) { - },{"../../../Utils":5,"../../../factory/EntryFactory":14,"../../../helper/ParticipantHelper":32,"./implementation/Name":48,"bpmn-js/lib/util/ModelUtil":240}],41:[function(require,module,exports){ - 'use strict'; + // recursion + copiedProperty = self.copyProperty(childProperty, parent, propertyName, clone); - var entryFactory = require('../../../../factory/EntryFactory'); + // copying might NOT be allowed + if (copiedProperty) { + return childProperties.concat(copiedProperty); + } - var cmdHelper = require('../../../../helper/CmdHelper'), - eventDefinitionHelper = require('../../../../helper/EventDefinitionHelper'), - utils = require('../../../../Utils'); + return childProperties; + }, []); + } - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - is = require('bpmn-js/lib/util/ModelUtil').is; + // copy model elements + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isObject)(property) && property.$type) { + if (this._moddle.getElementDescriptor(property).isGeneric) { + return; + } - var forEach = require('lodash/forEach'), - find = require('lodash/find'), - filter = require('lodash/filter'); + copiedProperty = self._bpmnFactory.create(property.$type); + copiedProperty.$parent = parent; - function getContainedActivities(element) { - return getFlowElements(element, 'bpmn:Activity'); - } + // recursion + copiedProperty = self.copyElement(property, copiedProperty, null, clone); - function getContainedBoundaryEvents(element) { - return getFlowElements(element, 'bpmn:BoundaryEvent'); - } + return copiedProperty; + } - function getFlowElements(element, type) { - return utils.filterElementsByType(element.flowElements, type); - } + // copy primitive properties + return property; +}; - function isCompensationEventAttachedToActivity(activity, boundaryEvents) { - var activityId = activity.id; - var boundaryEvent = find(boundaryEvents, function(boundaryEvent) { - var compensateEventDefinition = eventDefinitionHelper.getCompensateEventDefinition(boundaryEvent); - var attachedToRef = boundaryEvent.attachedToRef; - return compensateEventDefinition && attachedToRef && attachedToRef.id === activityId; - }); - return !!boundaryEvent; - } +ModdleCopy.prototype._copyId = function(id, element, clone = false) { + if (clone) { + return id; + } -// subprocess: only when it is not triggeredByEvent -// activity: only when it attach a compensation boundary event -// callActivity: no limitation - function canActivityBeCompensated(activity, boundaryEvents) { - return (is(activity, 'bpmn:SubProcess') && !activity.triggeredByEvent) || - is(activity, 'bpmn:CallActivity') || - isCompensationEventAttachedToActivity(activity, boundaryEvents); - } + // disallow if already taken + if (this._moddle.ids.assigned(id)) { + return; + } else { - function getActivitiesForCompensation(element) { - var boundaryEvents = getContainedBoundaryEvents(element); - return filter(getContainedActivities(element), function(activity) { - return canActivityBeCompensated(activity, boundaryEvents); - }); - } + this._moddle.ids.claim(id, element); + return id; + } +}; - function getActivitiesForActivityRef(element) { - var bo = getBusinessObject(element); - var parent = bo.$parent; +// helpers ////////// - var activitiesForActivityRef = getActivitiesForCompensation(parent); +function getPropertyNames(descriptor, keepDefaultProperties) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.reduce)(descriptor.properties, function(properties, property) { - // if throwing compensation event is in an event sub process: - // get also all activities outside of the event sub process - if (is(parent, 'bpmn:SubProcess') && parent.triggeredByEvent) { - parent = parent.$parent; - if (parent) { - activitiesForActivityRef = activitiesForActivityRef.concat(getActivitiesForCompensation(parent)); - } + if (keepDefaultProperties && property.default) { + return properties; + } - } + return properties.concat(property.name); + }, []); +} - return activitiesForActivityRef; - } +function is(element, type) { + return element && (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isFunction)(element.$instanceOf) && element.$instanceOf(type); +} - function createActivityRefOptions(element) { - var options = [ { value: '' } ]; +/***/ }), - var activities = getActivitiesForActivityRef(element); - forEach(activities, function(activity) { - var activityId = activity.id; - var name = (activity.name ? (activity.name + ' ') : '') + '(id=' + activityId + ')'; - options.push({ value: activityId, name: name }); - }); +/***/ "../node_modules/bpmn-js/lib/features/copy-paste/index.js": +/*!****************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/copy-paste/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - return options; - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_copy_paste__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/copy-paste */ "../node_modules/diagram-js/lib/features/copy-paste/index.js"); +/* harmony import */ var _BpmnCopyPaste__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BpmnCopyPaste */ "../node_modules/bpmn-js/lib/features/copy-paste/BpmnCopyPaste.js"); +/* harmony import */ var _ModdleCopy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ModdleCopy */ "../node_modules/bpmn-js/lib/features/copy-paste/ModdleCopy.js"); - module.exports = function(group, element, bpmnFactory, compensateEventDefinition, elementRegistry, translate) { - group.entries.push(entryFactory.checkbox({ - id: 'wait-for-completion', - label: translate('Wait for Completion'), - modelProperty: 'waitForCompletion', - get: function(element, node) { - return { - waitForCompletion: compensateEventDefinition.waitForCompletion - }; - }, - set: function(element, values) { - values.waitForCompletion = values.waitForCompletion || false; - return cmdHelper.updateBusinessObject(element, compensateEventDefinition, values); - } - })); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_copy_paste__WEBPACK_IMPORTED_MODULE_0__["default"] + ], + __init__: [ 'bpmnCopyPaste', 'moddleCopy' ], + bpmnCopyPaste: [ 'type', _BpmnCopyPaste__WEBPACK_IMPORTED_MODULE_1__["default"] ], + moddleCopy: [ 'type', _ModdleCopy__WEBPACK_IMPORTED_MODULE_2__["default"] ] +}); - group.entries.push(entryFactory.selectBox({ - id: 'activity-ref', - label: translate('Activity Ref'), - selectOptions: createActivityRefOptions(element), - modelProperty: 'activityRef', - - get: function(element, node) { - var activityRef = compensateEventDefinition.activityRef; - activityRef = activityRef && activityRef.id; - return { - activityRef: activityRef || '' - }; - }, - set: function(element, values) { - var activityRef = values.activityRef || undefined; - activityRef = activityRef && getBusinessObject(elementRegistry.get(activityRef)); - return cmdHelper.updateBusinessObject(element, compensateEventDefinition, { - activityRef: activityRef - }); - } - })); +/***/ }), - }; +/***/ "../node_modules/bpmn-js/lib/features/di-ordering/BpmnDiOrdering.js": +/*!**************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/di-ordering/BpmnDiOrdering.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - },{"../../../../Utils":5,"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25,"../../../../helper/EventDefinitionHelper":27,"bpmn-js/lib/util/ModelUtil":240,"lodash/filter":609,"lodash/find":610,"lodash/forEach":613}],42:[function(require,module,exports){ - 'use strict'; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnDiOrdering) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/util/Elements */ "../node_modules/diagram-js/lib/util/Elements.js"); - var entryFactory = require('../../../../factory/EntryFactory'), - cmdHelper = require('../../../../helper/CmdHelper'); - var is = require('bpmn-js/lib/util/ModelUtil').is, - isEventSubProcess = require('bpmn-js/lib/util/DiUtil').isEventSubProcess; - module.exports = function(group, element, bpmnFactory, conditionalEventDefinition, elementRegistry, translate) { - var getValue = function(modelProperty) { - return function(element) { - var modelPropertyValue = conditionalEventDefinition.get('camunda:' + modelProperty); - var value = {}; - value[modelProperty] = modelPropertyValue; - return value; - }; - }; - var setValue = function(modelProperty) { - return function(element, values) { - var props = {}; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + */ - props['camunda:' + modelProperty] = values[modelProperty] || undefined; +var HIGH_PRIORITY = 2000; - return cmdHelper.updateBusinessObject(element, conditionalEventDefinition, props); - }; - }; +/** + * @param {EventBus} eventBus + * @param {Canvas} canvas + */ +function BpmnDiOrdering(eventBus, canvas) { - group.entries.push(entryFactory.textField({ - id: 'variableName', - label: translate('Variable Name'), - modelProperty : 'variableName', + eventBus.on('saveXML.start', HIGH_PRIORITY, orderDi); - get: getValue('variableName'), - set: setValue('variableName') - })); + function orderDi() { + var rootElements = canvas.getRootElements(); - var isConditionalStartEvent = - is(element, 'bpmn:StartEvent') && !isEventSubProcess(element.parent); + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(rootElements, function(root) { + var rootDi = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getDi)(root), + elements, + diElements; - if (!isConditionalStartEvent) { - group.entries.push(entryFactory.textField({ - id: 'variableEvent', - label: translate('Variable Event'), - description: translate('Specify more than one variable change event as a comma separated list.'), - modelProperty : 'variableEvent', + elements = (0,diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_2__.selfAndAllChildren)([ root ], false); - get: getValue('variableEvent'), - set: setValue('variableEvent') - })); - } - }; + // only bpmndi:Shape and bpmndi:Edge can be direct children of bpmndi:Plane + elements = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.filter)(elements, function(element) { + return element !== root && !element.labelTarget; + }); - },{"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25,"bpmn-js/lib/util/DiUtil":238,"bpmn-js/lib/util/ModelUtil":240}],43:[function(require,module,exports){ - 'use strict'; + diElements = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.map)(elements, _util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getDi); - var entryFactory = require('../../../../factory/EntryFactory'); + rootDi.set('planeElement', diElements); + }); + } +} - var cmdHelper = require('../../../../helper/CmdHelper'); +BpmnDiOrdering.$inject = [ 'eventBus', 'canvas' ]; - /** - * Create an entry to modify a property of an element which - * is referenced by a event definition. - * - * @param {djs.model.Base} element - * @param {ModdleElement} definition - * @param {BpmnFactory} bpmnFactory - * @param {Object} options - * @param {string} options.id the id of the entry - * @param {string} options.label the label of the entry - * @param {string} options.referenceProperty the name of referencing property - * @param {string} options.modelProperty the name of property to modify - * @param {string} options.shouldValidate a flag indicate whether to validate or not - * - * @return {Array} return an array containing the entries - */ - module.exports = function(element, definition, bpmnFactory, options) { - - var id = options.id || 'element-property'; - var label = options.label; - var referenceProperty = options.referenceProperty; - var modelProperty = options.modelProperty || 'name'; - var shouldValidate = options.shouldValidate || false; - - var entry = entryFactory.textField({ - id: id, - label: label, - modelProperty: modelProperty, - - get: function(element, node) { - var reference = definition.get(referenceProperty); - var props = {}; - props[modelProperty] = reference && reference.get(modelProperty); - return props; - }, - set: function(element, values, node) { - var reference = definition.get(referenceProperty); - var props = {}; - props[modelProperty] = values[modelProperty] || undefined; - return cmdHelper.updateBusinessObject(element, reference, props); - }, +/***/ }), - hidden: function(element, node) { - return !definition.get(referenceProperty); - } - }); +/***/ "../node_modules/bpmn-js/lib/features/di-ordering/index.js": +/*!*****************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/di-ordering/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - if (shouldValidate) { - entry.validate = function(element, values, node) { - var reference = definition.get(referenceProperty); - if (reference && !values[modelProperty]) { - var validationErrors = {}; - validationErrors[modelProperty] = 'Must provide a value'; - return validationErrors; - } - }; - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _di_ordering_BpmnDiOrdering__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../di-ordering/BpmnDiOrdering */ "../node_modules/bpmn-js/lib/features/di-ordering/BpmnDiOrdering.js"); - return [ entry ]; - }; - },{"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25}],44:[function(require,module,exports){ - 'use strict'; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __init__: [ + 'bpmnDiOrdering' + ], + bpmnDiOrdering: [ 'type', _di_ordering_BpmnDiOrdering__WEBPACK_IMPORTED_MODULE_0__["default"] ] +}); - var eventDefinitionReference = require('./EventDefinitionReference'), - elementReferenceProperty = require('./ElementReferenceProperty'); +/***/ }), +/***/ "../node_modules/bpmn-js/lib/features/distribute-elements/BpmnDistributeElements.js": +/*!******************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/distribute-elements/BpmnDistributeElements.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - module.exports = function(group, element, bpmnFactory, errorEventDefinition, translate) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnDistributeElements) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/rules/RuleProvider */ "../node_modules/diagram-js/lib/features/rules/RuleProvider.js"); +/* harmony import */ var diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/util/Elements */ "../node_modules/diagram-js/lib/util/Elements.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - group.entries = group.entries.concat(eventDefinitionReference(element, errorEventDefinition, bpmnFactory, { - label: translate('Error'), - elementName: 'error', - elementType: 'bpmn:Error', - referenceProperty: 'errorRef', - newElementIdPrefix: 'Error_' - })); - group.entries = group.entries.concat(elementReferenceProperty(element, errorEventDefinition, bpmnFactory, { - id: 'error-element-name', - label: translate('Error Name'), - referenceProperty: 'errorRef', - modelProperty: 'name', - shouldValidate: true - })); - group.entries = group.entries.concat(elementReferenceProperty(element, errorEventDefinition, bpmnFactory, { - id: 'error-element-code', - label: translate('Error Code'), - referenceProperty: 'errorRef', - modelProperty: 'errorCode' - })); - }; - },{"./ElementReferenceProperty":43,"./EventDefinitionReference":46}],45:[function(require,module,exports){ - 'use strict'; - var entryFactory = require('../../../../factory/EntryFactory'), - cmdHelper = require('../../../../helper/CmdHelper'); +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + */ - var eventDefinitionReference = require('./EventDefinitionReference'), - elementReferenceProperty = require('./ElementReferenceProperty'); +/** + * Registers element exclude filters for elements that currently do not support + * distribution. + * + * @param {EventBus} eventBus + */ +function BpmnDistributeElements(eventBus) { + diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); +} + +BpmnDistributeElements.$inject = [ 'eventBus' ]; + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnDistributeElements, diagram_js_lib_features_rules_RuleProvider__WEBPACK_IMPORTED_MODULE_0__["default"]); + +BpmnDistributeElements.prototype.init = function() { + this.addRule('elements.distribute', function(context) { + var elements = context.elements; + + elements = (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.filter)(elements, function(element) { + var cannotDistribute = (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_3__.isAny)(element, [ + 'bpmn:Association', + 'bpmn:BoundaryEvent', + 'bpmn:DataInputAssociation', + 'bpmn:DataOutputAssociation', + 'bpmn:Lane', + 'bpmn:MessageFlow', + 'bpmn:SequenceFlow', + 'bpmn:TextAnnotation' + ]); + + return !(element.labelTarget || cannotDistribute); + }); + + // filter out elements which are children of any of the selected elements + elements = (0,diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_4__.getParents)(elements); + + if (elements.length < 3) { + return false; + } + + return elements; + }); +}; + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsIcons.js": +/*!*******************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsIcons.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/** + * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`, + * and then replace respective icons with the optimized data URIs in `./dist`. + */ +var icons = { + horizontal: ` + + + + `, + vertical: ` + + + + ` +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (icons); + + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsMenuProvider.js": +/*!**************************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsMenuProvider.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ DistributeElementsMenuProvider) +/* harmony export */ }); +/* harmony import */ var _DistributeElementsIcons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DistributeElementsIcons */ "../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsIcons.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); + + + + +/** + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu + * @typedef {import('./BpmnDistributeElements').default} DistributeElements + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules + * + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenuProvider').PopupMenuEntries} PopupMenuEntries + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenuProvider').default} PopupMenuProvider + * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuTarget} PopupMenuTarget + */ +var LOW_PRIORITY = 900; - module.exports = function(group, element, bpmnFactory, escalationEventDefinition, showEscalationCodeVariable, translate) { +/** + * A provider for the distribute elements popup menu. + * + * @implements {PopupMenuProvider} + * + * @param {PopupMenu} popupMenu + * @param {DistributeElements} distributeElements + * @param {Translate} translate + * @param {Rules} rules + */ +function DistributeElementsMenuProvider( + popupMenu, distributeElements, translate, rules) { + this._distributeElements = distributeElements; + this._translate = translate; + this._popupMenu = popupMenu; + this._rules = rules; + + popupMenu.registerProvider('align-elements', LOW_PRIORITY, this); +} + +DistributeElementsMenuProvider.$inject = [ + 'popupMenu', + 'distributeElements', + 'translate', + 'rules' +]; + +/** + * @param {PopupMenuTarget} target + * + * @return {PopupMenuEntries} + */ +DistributeElementsMenuProvider.prototype.getPopupMenuEntries = function(target) { + var entries = {}; + + if (this._isAllowed(target)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)(entries, this._getEntries(target)); + } - group.entries = group.entries.concat(eventDefinitionReference(element, escalationEventDefinition, bpmnFactory, { - label: translate('Escalation'), - elementName: 'escalation', - elementType: 'bpmn:Escalation', - referenceProperty: 'escalationRef', - newElementIdPrefix: 'Escalation_' - })); + return entries; +}; +DistributeElementsMenuProvider.prototype._isAllowed = function(elements) { + return this._rules.allowed('elements.distribute', { elements: elements }); +}; - group.entries = group.entries.concat(elementReferenceProperty(element, escalationEventDefinition, bpmnFactory, { - id: 'escalation-element-name', - label: translate('Escalation Name'), - referenceProperty: 'escalationRef', - modelProperty: 'name', - shouldValidate: true - })); +DistributeElementsMenuProvider.prototype._getEntries = function(elements) { + var distributeElements = this._distributeElements, + translate = this._translate, + popupMenu = this._popupMenu; + var entries = { + 'distribute-elements-horizontal': { + group: 'distribute', + title: translate('Distribute elements horizontally'), + className: 'bjs-align-elements-menu-entry', + imageHtml: _DistributeElementsIcons__WEBPACK_IMPORTED_MODULE_1__["default"]['horizontal'], + action: function(event, entry) { + distributeElements.trigger(elements, 'horizontal'); + popupMenu.close(); + } + }, + 'distribute-elements-vertical': { + group: 'distribute', + title: translate('Distribute elements vertically'), + imageHtml: _DistributeElementsIcons__WEBPACK_IMPORTED_MODULE_1__["default"]['vertical'], + action: function(event, entry) { + distributeElements.trigger(elements, 'vertical'); + popupMenu.close(); + } + }, + }; - group.entries = group.entries.concat(elementReferenceProperty(element, escalationEventDefinition, bpmnFactory, { - id: 'escalation-element-code', - label: translate('Escalation Code'), - referenceProperty: 'escalationRef', - modelProperty: 'escalationCode' - })); + return entries; +}; - if (showEscalationCodeVariable) { - group.entries.push(entryFactory.textField({ - id : 'escalationCodeVariable', - label : translate('Escalation Code Variable'), - modelProperty : 'escalationCodeVariable', +/***/ }), - get: function(element) { - var codeVariable = escalationEventDefinition.get('camunda:escalationCodeVariable'); - return { - escalationCodeVariable: codeVariable - }; - }, +/***/ "../node_modules/bpmn-js/lib/features/distribute-elements/index.js": +/*!*************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/distribute-elements/index.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - set: function(element, values) { - return cmdHelper.updateBusinessObject(element, escalationEventDefinition, { - 'camunda:escalationCodeVariable': values.escalationCodeVariable || undefined - }); - } - })); - } - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_distribute_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/features/distribute-elements */ "../node_modules/diagram-js/lib/features/distribute-elements/index.js"); +/* harmony import */ var diagram_js_lib_features_popup_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/popup-menu */ "../node_modules/diagram-js/lib/features/popup-menu/index.js"); +/* harmony import */ var _BpmnDistributeElements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BpmnDistributeElements */ "../node_modules/bpmn-js/lib/features/distribute-elements/BpmnDistributeElements.js"); +/* harmony import */ var _DistributeElementsMenuProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DistributeElementsMenuProvider */ "../node_modules/bpmn-js/lib/features/distribute-elements/DistributeElementsMenuProvider.js"); - },{"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25,"./ElementReferenceProperty":43,"./EventDefinitionReference":46}],46:[function(require,module,exports){ - 'use strict'; - var cmdHelper = require('../../../../helper/CmdHelper'); - var domQuery = require('min-dom').query, - domify = require('min-dom').domify, - domAttr = require('min-dom').attr; - var forEach = require('lodash/forEach'), - find = require('lodash/find'); - var elementHelper = require('../../../../helper/ElementHelper'); - var utils = require('../../../../Utils'), - escapeHTML = utils.escapeHTML; - var selector = 'select[name=selectedElement]'; - /** - * Get select box containing all elements. - * - * @param {DOMElement} node - * - * @return {DOMElement} the select box - */ - function getSelectBox(node) { - return domQuery(selector, node.parentElement); - } +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_popup_menu__WEBPACK_IMPORTED_MODULE_0__["default"], + diagram_js_lib_features_distribute_elements__WEBPACK_IMPORTED_MODULE_1__["default"] + ], + __init__: [ + 'bpmnDistributeElements', + 'distributeElementsMenuProvider' + ], + bpmnDistributeElements: [ 'type', _BpmnDistributeElements__WEBPACK_IMPORTED_MODULE_2__["default"] ], + distributeElementsMenuProvider: [ 'type', _DistributeElementsMenuProvider__WEBPACK_IMPORTED_MODULE_3__["default"] ] +}); - /** - * Find element by given id. - * - * @param {ModdleElement} eventDefinition - * - * @return {ModdleElement} an element - */ - function findElementById(eventDefinition, type, id) { - var elements = utils.findRootElementsByType(eventDefinition, type); - return find(elements, function(element) { - return element.id === id; - }); - } - /** - * Create an entry to modify the reference to an element from an - * event definition. - * - * @param {djs.model.Base} element - * @param {ModdleElement} definition - * @param {BpmnFactory} bpmnFactory - * @param {Object} options - * @param {string} options.label the label of the entry - * @param {string} options.description the description of the entry - * @param {string} options.elementName the name of the element - * @param {string} options.elementType the type of the element - * @param {string} options.referenceProperty the name of referencing property - * @param {string} options.newElementIdPrefix the prefix of a new created element - * - * @return {Array} return an array containing the entries - */ - module.exports = function(element, definition, bpmnFactory, options) { - - var elementName = options.elementName || '', - elementType = options.elementType, - referenceProperty = options.referenceProperty; - - var newElementIdPrefix = options.newElementIdPrefix || 'elem_'; - - var label = options.label || '', - description = options.description || ''; - - var entries = []; - - entries.push({ - - id: 'event-definitions-' + elementName, - description: description, - html: '
' + - '' + - '
' + - '' + - '' + - '
' + - '
', - - get: function(element, entryNode) { - utils.updateOptionsDropDown(selector, definition, elementType, entryNode); - var reference = definition.get(referenceProperty); - return { - selectedElement: (reference && reference.id) || '' - }; - }, +/***/ }), - set: function(element, values) { - var selection = values.selectedElement; +/***/ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownBreadcrumbs.js": +/*!******************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/drilldown/DrilldownBreadcrumbs.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var props = {}; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ DrilldownBreadcrumbs) +/* harmony export */ }); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_util_EscapeUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! diagram-js/lib/util/EscapeUtil */ "../node_modules/diagram-js/lib/util/EscapeUtil.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/DrilldownUtil */ "../node_modules/bpmn-js/lib/util/DrilldownUtil.js"); - if (!selection || typeof selection === 'undefined') { - // remove reference to element - props[referenceProperty] = undefined; - return cmdHelper.updateBusinessObject(element, definition, props); - } - var commands = []; - var selectedElement = findElementById(definition, elementType, selection); - if (!selectedElement) { - var root = utils.getRoot(definition); - // create a new element - selectedElement = elementHelper.createElement(elementType, { name: selection }, root, bpmnFactory); - commands.push(cmdHelper.addAndRemoveElementsFromList(element, root, 'rootElements', null, [ selectedElement ])); - } - // update reference to element - props[referenceProperty] = selectedElement; - commands.push(cmdHelper.updateBusinessObject(element, definition, props)); - return commands; - }, - addElement: function(element, inputNode) { - // note: this generated id will be used as name - // of the element and not as id - var id = utils.nextId(newElementIdPrefix); +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Shape} Shape + */ - var optionTemplate = domify(''); +var OPEN_CLASS = 'bjs-breadcrumbs-shown'; - // add new option - var selectBox = getSelectBox(inputNode); - selectBox.insertBefore(optionTemplate, selectBox.firstChild); - // select new element in the select box - forEach(selectBox, function(option) { - if (option.value === id) { - domAttr(option, 'selected', 'selected'); - } else { - domAttr(option, 'selected', null); - } - }); +/** + * Adds overlays that allow switching planes on collapsed subprocesses. + * + * @param {EventBus} eventBus + * @param {ElementRegistry} elementRegistry + * @param {Canvas} canvas + */ +function DrilldownBreadcrumbs(eventBus, elementRegistry, canvas) { + var breadcrumbs = (0,min_dom__WEBPACK_IMPORTED_MODULE_0__.domify)('
    '); + var container = canvas.getContainer(); + var containerClasses = (0,min_dom__WEBPACK_IMPORTED_MODULE_0__.classes)(container); + container.appendChild(breadcrumbs); - return true; - } + var businessObjectParents = []; - }); + // update breadcrumbs if name or ID of the primary shape changes + eventBus.on('element.changed', function(event) { + var shape = event.element, + businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(shape); - return entries; + var isPresent = (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.find)(businessObjectParents, function(element) { + return element === businessObject; + }); - }; + if (!isPresent) { + return; + } - },{"../../../../Utils":5,"../../../../helper/CmdHelper":25,"../../../../helper/ElementHelper":26,"lodash/find":610,"lodash/forEach":613,"min-dom":647}],47:[function(require,module,exports){ - 'use strict'; + updateBreadcrumbs(); + }); - var eventDefinitionReference = require('./EventDefinitionReference'), - elementReferenceProperty = require('./ElementReferenceProperty'); + /** + * Updates the displayed breadcrumbs. If no element is provided, only the + * labels are updated. + * + * @param {Element} [element] + */ + function updateBreadcrumbs(element) { + if (element) { + businessObjectParents = getBusinessObjectParentChain(element); + } + var path = businessObjectParents.map(function(parent) { + var title = (0,diagram_js_lib_util_EscapeUtil__WEBPACK_IMPORTED_MODULE_3__.escapeHTML)(parent.name || parent.id); + var link = (0,min_dom__WEBPACK_IMPORTED_MODULE_0__.domify)('
  • ' + title + '
  • '); - module.exports = function(group, element, bpmnFactory, messageEventDefinition, translate) { + var parentPlane = canvas.findRoot((0,_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_4__.getPlaneIdFromShape)(parent)) || canvas.findRoot(parent.id); - group.entries = group.entries.concat(eventDefinitionReference(element, messageEventDefinition, bpmnFactory, { - label: translate('Message'), - elementName: 'message', - elementType: 'bpmn:Message', - referenceProperty: 'messageRef', - newElementIdPrefix: 'Message_' - })); + // when the root is a collaboration, the process does not have a corresponding + // element in the elementRegisty. Instead, we search for the corresponding participant + if (!parentPlane && (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.is)(parent, 'bpmn:Process')) { + var participant = elementRegistry.find(function(element) { + var businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(element); + return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent; + }); - group.entries = group.entries.concat(elementReferenceProperty(element, messageEventDefinition, bpmnFactory, { - id: 'message-element-name', - label: translate('Message Name'), - referenceProperty: 'messageRef', - modelProperty: 'name', - shouldValidate: true - })); + parentPlane = canvas.findRoot(participant.id); + } - }; + link.addEventListener('click', function() { + canvas.setRootElement(parentPlane); + }); - },{"./ElementReferenceProperty":43,"./EventDefinitionReference":46}],48:[function(require,module,exports){ - 'use strict'; + return link; + }); - var entryFactory = require('../../../../factory/EntryFactory'); + breadcrumbs.innerHTML = ''; - /** - * Create an entry to modify the name of an an element. - * - * @param {djs.model.Base} element - * @param {Object} options - * @param {string} options.id the id of the entry - * @param {string} options.label the label of the entry - * - * @return {Array} return an array containing - * the entry to modify the name - */ - module.exports = function(element, options, translate) { - - options = options || {}; - var id = options.id || 'name', - label = options.label || translate('Name'), - modelProperty = options.modelProperty || 'name'; - - var nameEntry = entryFactory.textBox({ - id: id, - label: label, - modelProperty: modelProperty, - get: options.get, - set: options.set - }); + // show breadcrumbs and expose state to .djs-container + var visible = path.length > 1; - return [ nameEntry ]; + containerClasses.toggle(OPEN_CLASS, visible); - }; + path.forEach(function(element) { + breadcrumbs.appendChild(element); + }); + } - },{"../../../../factory/EntryFactory":14}],49:[function(require,module,exports){ - 'use strict'; + eventBus.on('root.set', function(event) { + updateBreadcrumbs(event.element); + }); - var eventDefinitionReference = require('./EventDefinitionReference'), - elementReferenceProperty = require('./ElementReferenceProperty'); +} +DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'canvas' ]; - module.exports = function(group, element, bpmnFactory, signalEventDefinition, translate) { - group.entries = group.entries.concat(eventDefinitionReference(element, signalEventDefinition, bpmnFactory, { - label: translate('Signal'), - elementName: 'signal', - elementType: 'bpmn:Signal', - referenceProperty: 'signalRef', - newElementIdPrefix: 'Signal_' - })); +// helpers ////////// +/** + * Returns the parents for the element using the business object chain, + * starting with the root element. + * + * @param {Shape} child + * + * @return {Shape} + */ +function getBusinessObjectParentChain(child) { + var businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.getBusinessObject)(child); - group.entries = group.entries.concat(elementReferenceProperty(element, signalEventDefinition, bpmnFactory, { - id: 'signal-element-name', - label: translate('Signal Name'), - referenceProperty: 'signalRef', - modelProperty: 'name', - shouldValidate: true - })); + var parents = []; - }; + for (var element = businessObject; element; element = element.$parent) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.is)(element, 'bpmn:SubProcess') || (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_1__.is)(element, 'bpmn:Process')) { + parents.push(element); + } + } - },{"./ElementReferenceProperty":43,"./EventDefinitionReference":46}],50:[function(require,module,exports){ - 'use strict'; + return parents.reverse(); +} - var elementHelper = require('../../../../helper/ElementHelper'), - cmdHelper = require('../../../../helper/CmdHelper'); +/***/ }), - var entryFactory = require('../../../../factory/EntryFactory'); +/***/ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownCentering.js": +/*!****************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/drilldown/DrilldownCentering.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - /** - * Get the timer definition type for a given timer event definition. - * - * @param {ModdleElement} timer - * - * @return {string|undefined} the timer definition type - */ - function getTimerDefinitionType(timer) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ DrilldownCentering) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - if (!timer) { - return; - } - var timeDate = timer.get('timeDate'); - if (typeof timeDate !== 'undefined') { - return 'timeDate'; - } +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + */ - var timeCycle = timer.get('timeCycle'); - if (typeof timeCycle !== 'undefined') { - return 'timeCycle'; - } +/** + * Move collapsed subprocesses into view when drilling down. + * + * Zoom and scroll are saved in a session. + * + * @param {EventBus} eventBus + * @param {Canvas} canvas + */ +function DrilldownCentering(eventBus, canvas) { - var timeDuration = timer.get('timeDuration'); - if (typeof timeDuration !== 'undefined') { - return 'timeDuration'; - } - } + var currentRoot = null; + var positionMap = new Map(); - /** - * Get the actual timer event definition based on option, whether it's a getter - * to fetch the timer event definition or the exact event definition itself - * - * @param {ModdleElement|Function} timerOrFunction - * @param {Shape} element - * @param {HTMLElement} node - * - * @return ModdleElement - */ - function getTimerDefinition(timerOrFunction, element, node) { - if (typeof timerOrFunction === 'function') { - return timerOrFunction(element, node); - } + eventBus.on('root.set', function(event) { + var newRoot = event.element; + var currentViewbox = canvas.viewbox(); + var storedViewbox = positionMap.get(newRoot); - return timerOrFunction; - } + positionMap.set(currentRoot, { + x: currentViewbox.x, + y: currentViewbox.y, + zoom: currentViewbox.scale + }); - /** - * Creates 'bpmn:FormalExpression' element. - * - * @param {ModdleElement} parent - * @param {string} body - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} a formal expression - */ - function createFormalExpression(parent, body, bpmnFactory) { - body = body || undefined; - return elementHelper.createElement('bpmn:FormalExpression', { body: body }, parent, bpmnFactory); - } + currentRoot = newRoot; - function TimerEventDefinition(group, element, bpmnFactory, timerEventDefinition, translate, options) { + // current root was replaced with a collaboration, we don't update the viewbox + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(newRoot, 'bpmn:Collaboration') && !storedViewbox) { + return; + } - var selectOptions = [ - { value: 'timeDate', name: translate('Date') }, - { value: 'timeDuration', name: translate('Duration') }, - { value: 'timeCycle', name: translate('Cycle') } - ]; + storedViewbox = storedViewbox || { x: 0, y: 0, zoom: 1 }; - var prefix = options && options.idPrefix, - createTimerEventDefinition = options && options.createTimerEventDefinition; + var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale, + dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale; + if (dx !== 0 || dy !== 0) { + canvas.scroll({ + dx: dx, + dy: dy + }); + } - group.entries.push(entryFactory.selectBox({ - id: prefix + 'timer-event-definition-type', - label: translate('Timer Definition Type'), - selectOptions: selectOptions, - emptyParameter: true, - modelProperty: 'timerDefinitionType', + if (storedViewbox.zoom !== currentViewbox.scale) { + canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 }); + } + }); - get: function(element, node) { - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node); + eventBus.on('diagram.clear', function() { + positionMap.clear(); + currentRoot = null; + }); - return { - timerDefinitionType: getTimerDefinitionType(timerDefinition) || '' - }; - }, +} - set: function(element, values, node) { - var props = { - timeDuration: undefined, - timeDate: undefined, - timeCycle: undefined - }; +DrilldownCentering.$inject = [ 'eventBus', 'canvas' ]; - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node), - newType = values.timerDefinitionType; +/** + * ES5 Map implementation. Works. + */ +function Map() { - if (!timerDefinition && typeof createTimerEventDefinition === 'function') { - timerDefinition = createTimerEventDefinition(element, node); - } + this._entries = []; - if (values.timerDefinitionType) { - var oldType = getTimerDefinitionType(timerDefinition); + this.set = function(key, value) { - var value; - if (oldType) { - var definition = timerDefinition.get(oldType); - value = definition.get('body'); - } + var found = false; - props[newType] = createFormalExpression(timerDefinition, value, bpmnFactory); - } + for (var k in this._entries) { + if (this._entries[k][0] === key) { + this._entries[k][1] = value; - return cmdHelper.updateBusinessObject(element, timerDefinition, props); - }, + found = true; - hidden: function(element, node) { - return getTimerDefinition(timerEventDefinition, element, node) === undefined; - } + break; + } + } - })); + if (!found) { + this._entries.push([ key, value ]); + } + }; + this.get = function(key) { - group.entries.push(entryFactory.textField({ - id: prefix + 'timer-event-definition', - label: translate('Timer Definition'), - modelProperty: 'timerDefinition', + for (var k in this._entries) { + if (this._entries[k][0] === key) { + return this._entries[k][1]; + } + } - get: function(element, node) { - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node), - type = getTimerDefinitionType(timerDefinition), - definition = type && timerDefinition.get(type), - value = definition && definition.get('body'); + return null; + }; - return { - timerDefinition: value - }; - }, + this.clear = function() { + this._entries.length = 0; + }; - set: function(element, values, node) { - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node), - type = getTimerDefinitionType(timerDefinition), - definition = type && timerDefinition.get(type); + this.remove = function(key) { - if (definition) { - return cmdHelper.updateBusinessObject(element, definition, { - body: values.timerDefinition || undefined - }); - } - }, + var idx = -1; - validate: function(element, node) { - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node), - type = getTimerDefinitionType(timerDefinition), - definition = type && timerDefinition.get(type); - - if (definition) { - var value = definition.get('body'); - if (!value) { - return { - timerDefinition: translate('Must provide a value') - }; - } - } - }, + for (var k in this._entries) { + if (this._entries[k][0] === key) { + idx = k; - hidden: function(element, node) { - var timerDefinition = getTimerDefinition(timerEventDefinition, element, node); + break; + } + } - return !getTimerDefinitionType(timerDefinition); - } + if (idx !== -1) { + this._entries.splice(idx, 1); + } + }; +} - })); +/***/ }), - } +/***/ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownOverlayBehavior.js": +/*!**********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/drilldown/DrilldownOverlayBehavior.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - module.exports = TimerEventDefinition; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ DrilldownOverlayBehavior) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/command/CommandInterceptor */ "../node_modules/diagram-js/lib/command/CommandInterceptor.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! min-dom */ "../node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var _util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/DrilldownUtil */ "../node_modules/bpmn-js/lib/util/DrilldownUtil.js"); - },{"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25,"../../../../helper/ElementHelper":26}],51:[function(require,module,exports){ - 'use strict'; - var inherits = require('inherits'); - var PropertiesActivator = require('../../PropertiesActivator'); - var asyncCapableHelper = require('../../helper/AsyncCapableHelper'), - ImplementationTypeHelper = require('../../helper/ImplementationTypeHelper'); - var is = require('bpmn-js/lib/util/ModelUtil').is; -// bpmn properties - var processProps = require('../bpmn/parts/ProcessProps'), - eventProps = require('../bpmn/parts/EventProps'), - linkProps = require('../bpmn/parts/LinkProps'), - documentationProps = require('../bpmn/parts/DocumentationProps'), - idProps = require('../bpmn/parts/IdProps'), - nameProps = require('../bpmn/parts/NameProps'), - executableProps = require('../bpmn/parts/ExecutableProps'); -// camunda properties - var serviceTaskDelegateProps = require('./parts/ServiceTaskDelegateProps'), - userTaskProps = require('./parts/UserTaskProps'), - asynchronousContinuationProps = require('./parts/AsynchronousContinuationProps'), - callActivityProps = require('./parts/CallActivityProps'), - multiInstanceProps = require('./parts/MultiInstanceLoopProps'), - conditionalProps = require('./parts/ConditionalProps'), - scriptProps = require('./parts/ScriptTaskProps'), - errorProps = require('./parts/ErrorEventProps'), - formProps = require('./parts/FormProps'), - startEventInitiator = require('./parts/StartEventInitiator'), - variableMapping = require('./parts/VariableMappingProps'), - versionTag = require('./parts/VersionTagProps'); +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/overlays/Overlays').default} Overlays + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Parent} Parent + * @typedef {import('../../model/Types').Shape} Shape + */ - var listenerProps = require('./parts/ListenerProps'), - listenerDetails = require('./parts/ListenerDetailProps'), - listenerFields = require('./parts/ListenerFieldInjectionProps'); +var LOW_PRIORITY = 250; +var ARROW_DOWN_SVG = ''; - var elementTemplateChooserProps = require('./element-templates/parts/ChooserProps'), - elementTemplateCustomProps = require('./element-templates/parts/CustomProps'); +var EMPTY_MARKER = 'bjs-drilldown-empty'; -// Input/Output - var inputOutput = require('./parts/InputOutputProps'), - inputOutputParameter = require('./parts/InputOutputParameterProps'); +/** + * @param {Canvas} canvas + * @param {EventBus} eventBus + * @param {ElementRegistry} elementRegistry + * @param {Overlays} overlays + */ +function DrilldownOverlayBehavior( + canvas, eventBus, elementRegistry, overlays +) { + diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); + + this._canvas = canvas; + this._eventBus = eventBus; + this._elementRegistry = elementRegistry; + this._overlays = overlays; + + var self = this; + + this.executed('shape.toggleCollapse', LOW_PRIORITY, function(context) { + var shape = context.shape; + + // Add overlay to the collapsed shape + if (self._canDrillDown(shape)) { + self._addOverlay(shape); + } else { + self._removeOverlay(shape); + } + }, true); + + + this.reverted('shape.toggleCollapse', LOW_PRIORITY, function(context) { + var shape = context.shape; + + // Add overlay to the collapsed shape + if (self._canDrillDown(shape)) { + self._addOverlay(shape); + } else { + self._removeOverlay(shape); + } + }, true); + + + this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY, + function(context) { + var oldParent = context.oldParent, + newParent = context.newParent || context.parent, + shape = context.shape; + + // Add overlay to the collapsed shape + if (self._canDrillDown(shape)) { + self._addOverlay(shape); + } + + self._updateDrilldownOverlay(oldParent); + self._updateDrilldownOverlay(newParent); + self._updateDrilldownOverlay(shape); + }, true); + + + this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY, + function(context) { + var oldParent = context.oldParent, + newParent = context.newParent || context.parent, + shape = context.shape; + + // Add overlay to the collapsed shape + if (self._canDrillDown(shape)) { + self._addOverlay(shape); + } + + self._updateDrilldownOverlay(oldParent); + self._updateDrilldownOverlay(newParent); + self._updateDrilldownOverlay(shape); + }, true); + + + eventBus.on('import.render.complete', function() { + elementRegistry.filter(function(e) { + return self._canDrillDown(e); + }).map(function(el) { + self._addOverlay(el); + }); + }); + +} + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(DrilldownOverlayBehavior, diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"]); + +/** + * @param {Shape} shape + */ +DrilldownOverlayBehavior.prototype._updateDrilldownOverlay = function(shape) { + var canvas = this._canvas; -// Connector - var connectorDetails = require('./parts/ConnectorDetailProps'), - connectorInputOutput = require('./parts/ConnectorInputOutputProps'), - connectorInputOutputParameter = require('./parts/ConnectorInputOutputParameterProps'); + if (!shape) { + return; + } -// properties - var properties = require('./parts/PropertiesProps'); + var root = canvas.findRoot(shape); -// job configuration - var jobConfiguration = require('./parts/JobConfigurationProps'); + if (root) { + this._updateOverlayVisibility(root); + } +}; -// history time to live - var historyTimeToLive = require('./parts/HistoryTimeToLiveProps'); +/** + * @param {Element} element + * + * @return {boolean} + */ +DrilldownOverlayBehavior.prototype._canDrillDown = function(element) { + var canvas = this._canvas; -// candidate starter groups/users - var candidateStarter = require('./parts/CandidateStarterProps'); + return (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:SubProcess') && canvas.findRoot((0,_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_3__.getPlaneIdFromShape)(element)); +}; -// tasklist - var tasklist = require('./parts/TasklistProps'); +/** + * Update the visibility of the drilldown overlay. If the plane has no elements, + * the drilldown will only be shown when the element is selected. + * + * @param {Parent} element The collapsed root or shape. + */ +DrilldownOverlayBehavior.prototype._updateOverlayVisibility = function(element) { + var overlays = this._overlays; -// external task configuration - var externalTaskConfiguration = require('./parts/ExternalTaskConfigurationProps'); + var businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(element); -// field injection - var fieldInjections = require('./parts/FieldInjectionProps'); + var overlay = overlays.get({ element: businessObject.id, type: 'drilldown' })[0]; - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - eventDefinitionHelper = require('../../helper/EventDefinitionHelper'), - implementationTypeHelper = require('../../helper/ImplementationTypeHelper'); + if (!overlay) { + return; + } -// helpers //////////////////////////////////////// + var hasFlowElements = businessObject + && businessObject.get('flowElements') + && businessObject.get('flowElements').length; - var isExternalTaskPriorityEnabled = function(element) { - var businessObject = getBusinessObject(element); + (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.classes)(overlay.html).toggle(EMPTY_MARKER, !hasFlowElements); +}; - // show only if element is a process, a participant ... - if (is(element, 'bpmn:Process') || is(element, 'bpmn:Participant') && businessObject.get('processRef')) { - return true; - } +/** + * Add a drilldown button to the given element assuming the plane has the same + * ID as the element. + * + * @param {Shape} element The collapsed shape. + */ +DrilldownOverlayBehavior.prototype._addOverlay = function(element) { + var canvas = this._canvas, + overlays = this._overlays; - var externalBo = ImplementationTypeHelper.getServiceTaskLikeBusinessObject(element), - isExternalTask = ImplementationTypeHelper.getImplementationType(externalBo) === 'external'; + var existingOverlays = overlays.get({ element: element, type: 'drilldown' }); - // ... or an external task with selected external implementation type - return !!ImplementationTypeHelper.isExternalCapable(externalBo) && isExternalTask; - }; + if (existingOverlays.length) { + this._removeOverlay(element); + } - var isJobConfigEnabled = function(element) { - var businessObject = getBusinessObject(element); + var button = (0,min_dom__WEBPACK_IMPORTED_MODULE_4__.domify)(''); - if (is(element, 'bpmn:Process') || is(element, 'bpmn:Participant') && businessObject.get('processRef')) { - return true; - } + button.addEventListener('click', function() { + canvas.setRootElement(canvas.findRoot((0,_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_3__.getPlaneIdFromShape)(element))); + }); - // async behavior - var bo = getBusinessObject(element); - if (asyncCapableHelper.isAsyncBefore(bo) || asyncCapableHelper.isAsyncAfter(bo)) { - return true; - } + overlays.add(element, 'drilldown', { + position: { + bottom: -7, + right: -8 + }, + html: button + }); - // timer definition - if (is(element, 'bpmn:Event')) { - return !!eventDefinitionHelper.getTimerEventDefinition(element); - } + this._updateOverlayVisibility(element); +}; - return false; - }; +DrilldownOverlayBehavior.prototype._removeOverlay = function(element) { + var overlays = this._overlays; - var getInputOutputParameterLabel = function(param, translate) { + overlays.remove({ + element: element, + type: 'drilldown' + }); +}; - if (is(param, 'camunda:InputParameter')) { - return translate('Input Parameter'); - } +DrilldownOverlayBehavior.$inject = [ + 'canvas', + 'eventBus', + 'elementRegistry', + 'overlays' +]; - if (is(param, 'camunda:OutputParameter')) { - return translate('Output Parameter'); - } +/***/ }), - return ''; - }; +/***/ "../node_modules/bpmn-js/lib/features/drilldown/SubprocessCompatibility.js": +/*!*********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/drilldown/SubprocessCompatibility.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var getListenerLabel = function(param, translate) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ SubprocessCompatibility) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/layout/LayoutUtil */ "../node_modules/diagram-js/lib/layout/LayoutUtil.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - if (is(param, 'camunda:ExecutionListener')) { - return translate('Execution Listener'); - } - if (is(param, 'camunda:TaskListener')) { - return translate('Task Listener'); - } - return ''; - }; - var PROCESS_KEY_HINT = 'This maps to the process definition key.'; - var TASK_KEY_HINT = 'This maps to the task definition key.'; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('../../model/Types').Moddle} Moddle + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Shape} Shape + * + * @typedef {import('diagram-js/lib/core/Canvas').CanvasPlane} CanvasPlane + * + * @typedef {import('diagram-js/lib/util/Types').Rect} Rect + */ - function createGeneralTabGroups( - element, canvas, bpmnFactory, - elementRegistry, elementTemplates, translate) { +var DEFAULT_POSITION = { + x: 180, + y: 160 +}; - // refer to target element for external labels - element = element.labelTarget || element; +/** + * Hook into `import.render.start` and create new planes for diagrams with + * collapsed subprocesses and all DI elements on the same plane. + * + * @param {EventBus} eventBus + * @param {Moddle} moddle + */ +function SubprocessCompatibility(eventBus, moddle) { + this._eventBus = eventBus; + this._moddle = moddle; - var generalGroup = { - id: 'general', - label: translate('General'), - entries: [] - }; + var self = this; - var idOptions; - var processOptions; + eventBus.on('import.render.start', 1500, function(e, context) { + self._handleImport(context.definitions); + }); +} - if (is(element, 'bpmn:Process')) { - idOptions = { description: PROCESS_KEY_HINT }; - } +/** + * @param {ModdleElement} definitions + */ +SubprocessCompatibility.prototype._handleImport = function(definitions) { + if (!definitions.diagrams) { + return; + } - if (is(element, 'bpmn:UserTask')) { - idOptions = { description: TASK_KEY_HINT }; - } + var self = this; + this._definitions = definitions; + this._processToDiagramMap = {}; - if (is(element, 'bpmn:Participant')) { - processOptions = { processIdDescription: PROCESS_KEY_HINT }; - } + definitions.diagrams.forEach(function(diagram) { + if (!diagram.plane || !diagram.plane.bpmnElement) { + return; + } - idProps(generalGroup, element, translate, idOptions); - nameProps(generalGroup, element, bpmnFactory, canvas, translate); - processProps(generalGroup, element, translate, processOptions); - versionTag(generalGroup, element, translate); - executableProps(generalGroup, element, translate); - elementTemplateChooserProps(generalGroup, element, elementTemplates, translate); + self._processToDiagramMap[diagram.plane.bpmnElement.id] = diagram; + }); - var customFieldsGroups = elementTemplateCustomProps(element, elementTemplates, bpmnFactory, translate); + var newDiagrams = []; + definitions.diagrams.forEach(function(diagram) { + var createdDiagrams = self._createNewDiagrams(diagram.plane); + Array.prototype.push.apply(newDiagrams, createdDiagrams); + }); - var detailsGroup = { - id: 'details', - label: translate('Details'), - entries: [] - }; - serviceTaskDelegateProps(detailsGroup, element, bpmnFactory, translate); - userTaskProps(detailsGroup, element, translate); - scriptProps(detailsGroup, element, bpmnFactory, translate); - linkProps(detailsGroup, element, translate); - callActivityProps(detailsGroup, element, bpmnFactory, translate); - eventProps(detailsGroup, element, bpmnFactory, elementRegistry, translate); - errorProps(detailsGroup, element, bpmnFactory, translate); - conditionalProps(detailsGroup, element, bpmnFactory, translate); - startEventInitiator(detailsGroup, element, translate); // this must be the last element of the details group! - - var multiInstanceGroup = { - id: 'multiInstance', - label: translate('Multi Instance'), - entries: [] - }; - multiInstanceProps(multiInstanceGroup, element, bpmnFactory, translate); + newDiagrams.forEach(function(diagram) { + self._movePlaneElementsToOrigin(diagram.plane); + }); +}; - var asyncGroup = { - id : 'async', - label: translate('Asynchronous Continuations'), - entries : [] - }; - asynchronousContinuationProps(asyncGroup, element, bpmnFactory, translate); - var jobConfigurationGroup = { - id : 'jobConfiguration', - label : translate('Job Configuration'), - entries : [], - enabled: isJobConfigEnabled - }; - jobConfiguration(jobConfigurationGroup, element, bpmnFactory, translate); +/** + * Moves all DI elements from collapsed subprocesses to a new plane. + * + * @param {CanvasPlane} plane + * + * @return {ModdleElement[]} new diagrams created for the collapsed subprocesses + */ +SubprocessCompatibility.prototype._createNewDiagrams = function(plane) { + var self = this; - var externalTaskGroup = { - id : 'externalTaskConfiguration', - label : translate('External Task Configuration'), - entries : [], - enabled: isExternalTaskPriorityEnabled - }; - externalTaskConfiguration(externalTaskGroup, element, bpmnFactory, translate); + var collapsedElements = []; + var elementsToMove = []; + plane.get('planeElement').forEach(function(diElement) { + var businessObject = diElement.bpmnElement; - var candidateStarterGroup = { - id: 'candidateStarterConfiguration', - label: translate('Candidate Starter Configuration'), - entries: [] - }; - candidateStarter(candidateStarterGroup, element, bpmnFactory, translate); + if (!businessObject) { + return; + } - var historyTimeToLiveGroup = { - id: 'historyConfiguration', - label: translate('History Configuration'), - entries: [] - }; - historyTimeToLive(historyTimeToLiveGroup, element, bpmnFactory, translate); + var parent = businessObject.$parent; - var tasklistGroup = { - id: 'tasklist', - label: translate('Tasklist Configuration'), - entries: [] - }; - tasklist(tasklistGroup, element, bpmnFactory, translate); + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(businessObject, 'bpmn:SubProcess') && !diElement.isExpanded) { + collapsedElements.push(businessObject); + } - var documentationGroup = { - id: 'documentation', - label: translate('Documentation'), - entries: [] - }; - documentationProps(documentationGroup, element, bpmnFactory, translate); + if (shouldMoveToPlane(businessObject, plane)) { - var groups = []; - groups.push(generalGroup); - customFieldsGroups.forEach(function(group) { - groups.push(group); - }); - groups.push(detailsGroup); - groups.push(externalTaskGroup); - groups.push(multiInstanceGroup); - groups.push(asyncGroup); - groups.push(jobConfigurationGroup); - groups.push(candidateStarterGroup); - groups.push(historyTimeToLiveGroup); - groups.push(tasklistGroup); - groups.push(documentationGroup); - - return groups; - } - - function createVariablesTabGroups(element, bpmnFactory, elementRegistry, translate) { - var variablesGroup = { - id : 'variables', - label : translate('Variables'), - entries: [] - }; - variableMapping(variablesGroup, element, bpmnFactory, translate); + // don't change the array while we iterate over it + elementsToMove.push({ diElement: diElement, parent: parent }); + } + }); - return [ - variablesGroup - ]; - } + var newDiagrams = []; - function createFormsTabGroups(element, bpmnFactory, elementRegistry, translate) { - var formGroup = { - id : 'forms', - label : translate('Forms'), - entries: [] - }; - formProps(formGroup, element, bpmnFactory, translate); + // create new planes for all collapsed subprocesses, even when they are empty + collapsedElements.forEach(function(element) { + if (!self._processToDiagramMap[ element.id ]) { + var diagram = self._createDiagram(element); - return [ - formGroup - ]; - } + self._processToDiagramMap[element.id] = diagram; - function createListenersTabGroups(element, bpmnFactory, elementRegistry, translate) { + newDiagrams.push(diagram); + } + }); - var listenersGroup = { - id : 'listeners', - label: translate('Listeners'), - entries: [] - }; + elementsToMove.forEach(function(element) { + var diElement = element.diElement; + var parent = element.parent; - var options = listenerProps(listenersGroup, element, bpmnFactory, translate); + // parent is expanded, get nearest collapsed parent + while (parent && collapsedElements.indexOf(parent) === -1) { + parent = parent.$parent; + } - var listenerDetailsGroup = { - id: 'listener-details', - entries: [], - enabled: function(element, node) { - return options.getSelectedListener(element, node); - }, - label: function(element, node) { - var param = options.getSelectedListener(element, node); - return getListenerLabel(param, translate); - } - }; + // false positive, all parents are expanded + if (!parent) { + return; + } - listenerDetails(listenerDetailsGroup, element, bpmnFactory, options, translate); + var diagram = self._processToDiagramMap[ parent.id ]; - var listenerFieldsGroup = { - id: 'listener-fields', - label: translate('Field Injection'), - entries: [], - enabled: function(element, node) { - return options.getSelectedListener(element, node); - } - }; + self._moveToDiPlane(diElement, diagram.plane); + }); - listenerFields(listenerFieldsGroup, element, bpmnFactory, options, translate); + return newDiagrams; +}; - return [ - listenersGroup, - listenerDetailsGroup, - listenerFieldsGroup - ]; - } +/** + * @param {CanvasPlane} plane + */ +SubprocessCompatibility.prototype._movePlaneElementsToOrigin = function(plane) { + var elements = plane.get('planeElement'); + + // get bounding box of all elements + var planeBounds = getPlaneBounds(plane); + + var offset = { + x: planeBounds.x - DEFAULT_POSITION.x, + y: planeBounds.y - DEFAULT_POSITION.y + }; + + elements.forEach(function(diElement) { + if (diElement.waypoint) { + diElement.waypoint.forEach(function(waypoint) { + waypoint.x = waypoint.x - offset.x; + waypoint.y = waypoint.y - offset.y; + }); + } else if (diElement.bounds) { + diElement.bounds.x = diElement.bounds.x - offset.x; + diElement.bounds.y = diElement.bounds.y - offset.y; + } + }); +}; + +/** + * @param {ModdleElement} diElement + * @param {CanvasPlane} newPlane + */ +SubprocessCompatibility.prototype._moveToDiPlane = function(diElement, newPlane) { + var containingDiagram = findRootDiagram(diElement); - function createInputOutputTabGroups(element, bpmnFactory, elementRegistry, translate) { + // remove DI from old Plane and add it to the new one + var parentPlaneElement = containingDiagram.plane.get('planeElement'); - var inputOutputGroup = { - id: 'input-output', - label: translate('Parameters'), - entries: [] - }; + parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1); - var options = inputOutput(inputOutputGroup, element, bpmnFactory, translate); + newPlane.get('planeElement').push(diElement); +}; - var inputOutputParameterGroup = { - id: 'input-output-parameter', - entries: [], - enabled: function(element, node) { - return options.getSelectedParameter(element, node); - }, - label: function(element, node) { - var param = options.getSelectedParameter(element, node); - return getInputOutputParameterLabel(param, translate); - } - }; +/** + * @param {ModdleElement} businessObject + * + * @return {ModdleElement} + */ +SubprocessCompatibility.prototype._createDiagram = function(businessObject) { + var plane = this._moddle.create('bpmndi:BPMNPlane', { + bpmnElement: businessObject + }); - inputOutputParameter(inputOutputParameterGroup, element, bpmnFactory, options, translate); + var diagram = this._moddle.create('bpmndi:BPMNDiagram', { + plane: plane + }); - return [ - inputOutputGroup, - inputOutputParameterGroup - ]; - } + plane.$parent = diagram; - function createConnectorTabGroups(element, bpmnFactory, elementRegistry, translate) { - var connectorDetailsGroup = { - id: 'connector-details', - label: translate('Details'), - entries: [] - }; + plane.bpmnElement = businessObject; - connectorDetails(connectorDetailsGroup, element, bpmnFactory, translate); + diagram.$parent = this._definitions; - var connectorInputOutputGroup = { - id: 'connector-input-output', - label: translate('Input/Output'), - entries: [] - }; + this._definitions.diagrams.push(diagram); - var options = connectorInputOutput(connectorInputOutputGroup, element, bpmnFactory, translate); + return diagram; +}; - var connectorInputOutputParameterGroup = { - id: 'connector-input-output-parameter', - entries: [], - enabled: function(element, node) { - return options.getSelectedParameter(element, node); - }, - label: function(element, node) { - var param = options.getSelectedParameter(element, node); - return getInputOutputParameterLabel(param, translate); - } - }; +SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ]; - connectorInputOutputParameter(connectorInputOutputParameterGroup, element, bpmnFactory, options, translate); - return [ - connectorDetailsGroup, - connectorInputOutputGroup, - connectorInputOutputParameterGroup - ]; - } +// helpers ////////// - function createFieldInjectionsTabGroups(element, bpmnFactory, elementRegistry, translate) { +function findRootDiagram(element) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmndi:BPMNDiagram')) { + return element; + } else { + return findRootDiagram(element.$parent); + } +} - var fieldGroup = { - id: 'field-injections-properties', - label: translate('Field Injections'), - entries: [] - }; +/** + * @param {CanvasPlane} plane + * + * @return {Rect} + */ +function getPlaneBounds(plane) { + var planeTrbl = { + top: Infinity, + right: -Infinity, + bottom: -Infinity, + left: Infinity + }; + + plane.planeElement.forEach(function(element) { + if (!element.bounds) { + return; + } + + var trbl = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.asTRBL)(element.bounds); + + planeTrbl.top = Math.min(trbl.top, planeTrbl.top); + planeTrbl.left = Math.min(trbl.left, planeTrbl.left); + }); + + return (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_1__.asBounds)(planeTrbl); +} + +/** + * @param {ModdleElement} businessObject + * @param {CanvasPlane} plane + * + * @return {boolean} + */ +function shouldMoveToPlane(businessObject, plane) { + var parent = businessObject.$parent; - fieldInjections(fieldGroup, element, bpmnFactory, translate); + // don't move elements that are already on the plane + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) { + return false; + } - return [ - fieldGroup - ]; - } + // dataAssociations are children of the subprocess but rendered on process level + // cf. https://github.com/bpmn-io/bpmn-js/issues/1619 + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(businessObject, [ 'bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation' ])) { + return false; + } - function createExtensionElementsGroups(element, bpmnFactory, elementRegistry, translate) { + return true; +} - var propertiesGroup = { - id : 'extensionElements-properties', - label: translate('Properties'), - entries: [] - }; - properties(propertiesGroup, element, bpmnFactory, translate); - return [ - propertiesGroup - ]; - } +/***/ }), -// Camunda Properties Provider ///////////////////////////////////// +/***/ "../node_modules/bpmn-js/lib/features/drilldown/index.js": +/*!***************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/drilldown/index.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_overlays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/overlays */ "../node_modules/diagram-js/lib/features/overlays/index.js"); +/* harmony import */ var diagram_js_lib_features_change_support__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/features/change-support */ "../node_modules/diagram-js/lib/features/change-support/index.js"); +/* harmony import */ var diagram_js_lib_features_root_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/features/root-elements */ "../node_modules/diagram-js/lib/features/root-elements/index.js"); +/* harmony import */ var _DrilldownBreadcrumbs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DrilldownBreadcrumbs */ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownBreadcrumbs.js"); +/* harmony import */ var _DrilldownCentering__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DrilldownCentering */ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownCentering.js"); +/* harmony import */ var _SubprocessCompatibility__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SubprocessCompatibility */ "../node_modules/bpmn-js/lib/features/drilldown/SubprocessCompatibility.js"); +/* harmony import */ var _DrilldownOverlayBehavior__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DrilldownOverlayBehavior */ "../node_modules/bpmn-js/lib/features/drilldown/DrilldownOverlayBehavior.js"); - /** - * A properties provider for Camunda related properties. - * - * @param {EventBus} eventBus - * @param {Canvas} canvas - * @param {BpmnFactory} bpmnFactory - * @param {ElementRegistry} elementRegistry - * @param {ElementTemplates} elementTemplates - * @param {Translate} translate - */ - function CamundaPropertiesProvider( - eventBus, canvas, bpmnFactory, - elementRegistry, elementTemplates, translate) { - PropertiesActivator.call(this, eventBus); - this.getTabs = function(element) { - var generalTab = { - id: 'general', - label: translate('General'), - groups: createGeneralTabGroups( - element, canvas, bpmnFactory, - elementRegistry, elementTemplates, translate) - }; - var variablesTab = { - id: 'variables', - label: translate('Variables'), - groups: createVariablesTabGroups(element, bpmnFactory, elementRegistry, translate) - }; - var formsTab = { - id: 'forms', - label: translate('Forms'), - groups: createFormsTabGroups(element, bpmnFactory, elementRegistry, translate) - }; - var listenersTab = { - id: 'listeners', - label: translate('Listeners'), - groups: createListenersTabGroups(element, bpmnFactory, elementRegistry, translate), - enabled: function(element) { - return !eventDefinitionHelper.getLinkEventDefinition(element) - || (!is(element, 'bpmn:IntermediateThrowEvent') - && eventDefinitionHelper.getLinkEventDefinition(element)); - } - }; - var inputOutputTab = { - id: 'input-output', - label: translate('Input/Output'), - groups: createInputOutputTabGroups(element, bpmnFactory, elementRegistry, translate) - }; - var connectorTab = { - id: 'connector', - label: translate('Connector'), - groups: createConnectorTabGroups(element, bpmnFactory, elementRegistry, translate), - enabled: function(element) { - var bo = implementationTypeHelper.getServiceTaskLikeBusinessObject(element); - return bo && implementationTypeHelper.getImplementationType(bo) === 'connector'; - } - }; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ diagram_js_lib_features_overlays__WEBPACK_IMPORTED_MODULE_0__["default"], diagram_js_lib_features_change_support__WEBPACK_IMPORTED_MODULE_1__["default"], diagram_js_lib_features_root_elements__WEBPACK_IMPORTED_MODULE_2__["default"] ], + __init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility' ], + drilldownBreadcrumbs: [ 'type', _DrilldownBreadcrumbs__WEBPACK_IMPORTED_MODULE_3__["default"] ], + drilldownCentering: [ 'type', _DrilldownCentering__WEBPACK_IMPORTED_MODULE_4__["default"] ], + drilldownOverlayBehavior: [ 'type', _DrilldownOverlayBehavior__WEBPACK_IMPORTED_MODULE_5__["default"] ], + subprocessCompatibility: [ 'type', _SubprocessCompatibility__WEBPACK_IMPORTED_MODULE_6__["default"] ] +}); - var fieldInjectionsTab = { - id: 'field-injections', - label: translate('Field Injections'), - groups: createFieldInjectionsTabGroups(element, bpmnFactory, elementRegistry, translate) - }; +/***/ }), - var extensionsTab = { - id: 'extensionElements', - label: translate('Extensions'), - groups: createExtensionElementsGroups(element, bpmnFactory, elementRegistry, translate) - }; +/***/ "../node_modules/bpmn-js/lib/features/editor-actions/BpmnEditorActions.js": +/*!********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/editor-actions/BpmnEditorActions.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - return [ - generalTab, - variablesTab, - connectorTab, - formsTab, - listenersTab, - inputOutputTab, - fieldInjectionsTab, - extensionsTab - ]; - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnEditorActions) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_features_editor_actions_EditorActions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/editor-actions/EditorActions */ "../node_modules/diagram-js/lib/features/editor-actions/EditorActions.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/util/Elements */ "../node_modules/diagram-js/lib/util/Elements.js"); - } - CamundaPropertiesProvider.$inject = [ - 'eventBus', - 'canvas', - 'bpmnFactory', - 'elementRegistry', - 'elementTemplates', - 'translate' - ]; - inherits(CamundaPropertiesProvider, PropertiesActivator); - module.exports = CamundaPropertiesProvider; - },{"../../PropertiesActivator":3,"../../helper/AsyncCapableHelper":23,"../../helper/EventDefinitionHelper":27,"../../helper/ImplementationTypeHelper":30,"../bpmn/parts/DocumentationProps":34,"../bpmn/parts/EventProps":35,"../bpmn/parts/ExecutableProps":36,"../bpmn/parts/IdProps":37,"../bpmn/parts/LinkProps":38,"../bpmn/parts/NameProps":39,"../bpmn/parts/ProcessProps":40,"./element-templates/parts/ChooserProps":61,"./element-templates/parts/CustomProps":62,"./parts/AsynchronousContinuationProps":64,"./parts/CallActivityProps":65,"./parts/CandidateStarterProps":66,"./parts/ConditionalProps":67,"./parts/ConnectorDetailProps":68,"./parts/ConnectorInputOutputParameterProps":69,"./parts/ConnectorInputOutputProps":70,"./parts/ErrorEventProps":71,"./parts/ExternalTaskConfigurationProps":72,"./parts/FieldInjectionProps":73,"./parts/FormProps":74,"./parts/HistoryTimeToLiveProps":75,"./parts/InputOutputParameterProps":76,"./parts/InputOutputProps":77,"./parts/JobConfigurationProps":78,"./parts/ListenerDetailProps":79,"./parts/ListenerFieldInjectionProps":80,"./parts/ListenerProps":81,"./parts/MultiInstanceLoopProps":82,"./parts/PropertiesProps":83,"./parts/ScriptTaskProps":84,"./parts/ServiceTaskDelegateProps":85,"./parts/StartEventInitiator":86,"./parts/TasklistProps":87,"./parts/UserTaskProps":88,"./parts/VariableMappingProps":89,"./parts/VersionTagProps":90,"bpmn-js/lib/util/ModelUtil":240,"inherits":438}],52:[function(require,module,exports){ - 'use strict'; - var assign = require('lodash/assign'); - /** - * Create an input parameter representing the given - * binding and value. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createInputParameter(binding, value, bpmnFactory) { - var scriptFormat = binding.scriptFormat, - parameterValue, - parameterDefinition; - - if (scriptFormat) { - parameterDefinition = bpmnFactory.create('camunda:Script', { - scriptFormat: scriptFormat, - value: value - }); - } else { - parameterValue = value; - } - return bpmnFactory.create('camunda:InputParameter', { - name: binding.name, - value: parameterValue, - definition: parameterDefinition - }); - } - module.exports.createInputParameter = createInputParameter; +/** + * @typedef {import('didi').Injector} Injector + */ - /** - * Create an output parameter representing the given - * binding and value. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createOutputParameter(binding, value, bpmnFactory) { - var scriptFormat = binding.scriptFormat, - parameterValue, - parameterDefinition; - - if (scriptFormat) { - parameterDefinition = bpmnFactory.create('camunda:Script', { - scriptFormat: scriptFormat, - value: binding.source - }); - } else { - parameterValue = binding.source; - } +/** + * Registers and executes BPMN specific editor actions. + * + * @param {Injector} injector + */ +function BpmnEditorActions(injector) { + injector.invoke(diagram_js_lib_features_editor_actions_EditorActions__WEBPACK_IMPORTED_MODULE_0__["default"], this); +} - return bpmnFactory.create('camunda:OutputParameter', { - name: value, - value: parameterValue, - definition: parameterDefinition - }); - } +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnEditorActions, diagram_js_lib_features_editor_actions_EditorActions__WEBPACK_IMPORTED_MODULE_0__["default"]); - module.exports.createOutputParameter = createOutputParameter; +BpmnEditorActions.$inject = [ + 'injector' +]; +/** + * Register default actions. + * + * @param {Injector} injector + */ +BpmnEditorActions.prototype._registerDefaultActions = function(injector) { + + // (0) invoke super method + + diagram_js_lib_features_editor_actions_EditorActions__WEBPACK_IMPORTED_MODULE_0__["default"].prototype._registerDefaultActions.call(this, injector); + + // (1) retrieve optional components to integrate with + + var canvas = injector.get('canvas', false); + var elementRegistry = injector.get('elementRegistry', false); + var selection = injector.get('selection', false); + var spaceTool = injector.get('spaceTool', false); + var lassoTool = injector.get('lassoTool', false); + var handTool = injector.get('handTool', false); + var globalConnect = injector.get('globalConnect', false); + var distributeElements = injector.get('distributeElements', false); + var alignElements = injector.get('alignElements', false); + var directEditing = injector.get('directEditing', false); + var searchPad = injector.get('searchPad', false); + var modeling = injector.get('modeling', false); + var contextPad = injector.get('contextPad', false); + + // (2) check components and register actions + + if (canvas && elementRegistry && selection) { + this._registerAction('selectElements', function() { + + // select all elements except for the invisible + // root element + var rootElement = canvas.getRootElement(); + + var elements = elementRegistry.filter(function(element) { + return element !== rootElement; + }); + + selection.select(elements); + + return elements; + }); + } + + if (spaceTool) { + this._registerAction('spaceTool', function() { + spaceTool.toggle(); + }); + } + + if (lassoTool) { + this._registerAction('lassoTool', function() { + lassoTool.toggle(); + }); + } + + if (handTool) { + this._registerAction('handTool', function() { + handTool.toggle(); + }); + } + + if (globalConnect) { + this._registerAction('globalConnectTool', function() { + globalConnect.toggle(); + }); + } + + if (selection && distributeElements) { + this._registerAction('distributeElements', function(opts) { + var currentSelection = selection.get(), + type = opts.type; + + if (currentSelection.length) { + distributeElements.trigger(currentSelection, type); + } + }); + } + + if (selection && alignElements) { + this._registerAction('alignElements', function(opts) { + var currentSelection = selection.get(), + aligneableElements = [], + type = opts.type; + + if (currentSelection.length) { + aligneableElements = (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.filter)(currentSelection, function(element) { + return !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__.is)(element, 'bpmn:Lane'); + }); - /** - * Create camunda property from the given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaProperty(binding, value, bpmnFactory) { - return bpmnFactory.create('camunda:Property', { - name: binding.name, - value: value || '' - }); - } + alignElements.trigger(aligneableElements, type); + } + }); + } + + if (selection && modeling) { + this._registerAction('setColor', function(opts) { + var currentSelection = selection.get(); + + if (currentSelection.length) { + modeling.setColor(currentSelection, opts); + } + }); + } + + if (selection && directEditing) { + this._registerAction('directEditing', function() { + var currentSelection = selection.get(); + + if (currentSelection.length) { + directEditing.activate(currentSelection[0]); + } + }); + } + + if (searchPad) { + this._registerAction('find', function() { + searchPad.toggle(); + }); + } + + if (canvas && modeling) { + this._registerAction('moveToOrigin', function() { + var rootElement = canvas.getRootElement(), + boundingBox, + elements; + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__.is)(rootElement, 'bpmn:Collaboration')) { + elements = elementRegistry.filter(function(element) { + return (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__.is)(element.parent, 'bpmn:Collaboration'); + }); + } else { + elements = elementRegistry.filter(function(element) { + return element !== rootElement && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_3__.is)(element.parent, 'bpmn:SubProcess'); + }); + } - module.exports.createCamundaProperty = createCamundaProperty; + boundingBox = (0,diagram_js_lib_util_Elements__WEBPACK_IMPORTED_MODULE_4__.getBBox)(elements); + modeling.moveElements( + elements, + { x: -boundingBox.x, y: -boundingBox.y }, + rootElement + ); + }); + } - /** - * Create camunda:in element from given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaIn(binding, value, bpmnFactory) { + if (selection && contextPad) { + this._registerAction('replaceElement', function(event) { + contextPad.triggerEntry('replace', 'click', event); + }); + } - var properties = createCamundaInOutAttrs(binding, value); +}; - return bpmnFactory.create('camunda:In', properties); - } - module.exports.createCamundaIn = createCamundaIn; +/***/ }), +/***/ "../node_modules/bpmn-js/lib/features/editor-actions/index.js": +/*!********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/editor-actions/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - /** - * Create camunda:in with businessKey element from given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaInWithBusinessKey(binding, value, bpmnFactory) { - return bpmnFactory.create('camunda:In', { - businessKey: value - }); - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_editor_actions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/editor-actions */ "../node_modules/diagram-js/lib/features/editor-actions/index.js"); +/* harmony import */ var _BpmnEditorActions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BpmnEditorActions */ "../node_modules/bpmn-js/lib/features/editor-actions/BpmnEditorActions.js"); - module.exports.createCamundaInWithBusinessKey = createCamundaInWithBusinessKey; - /** - * Create camunda:out element from given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaOut(binding, value, bpmnFactory) { - var properties = createCamundaInOutAttrs(binding, value); - return bpmnFactory.create('camunda:Out', properties); - } +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_editor_actions__WEBPACK_IMPORTED_MODULE_0__["default"] + ], + editorActions: [ 'type', _BpmnEditorActions__WEBPACK_IMPORTED_MODULE_1__["default"] ] +}); - module.exports.createCamundaOut = createCamundaOut; +/***/ }), - /** - * Create camunda:executionListener element containing an inline script from given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaExecutionListenerScript(binding, value, bpmnFactory) { - var scriptFormat = binding.scriptFormat, - parameterValue, - parameterDefinition; - - if (scriptFormat) { - parameterDefinition = bpmnFactory.create('camunda:Script', { - scriptFormat: scriptFormat, - value: value - }); - } else { - parameterValue = value; - } +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/BpmnGridSnapping.js": +/*!******************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/BpmnGridSnapping.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - return bpmnFactory.create('camunda:ExecutionListener', { - event: binding.event, - value: parameterValue, - script: parameterDefinition - }); - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnGridSnapping) +/* harmony export */ }); +/* harmony import */ var _modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - module.exports.createCamundaExecutionListenerScript = createCamundaExecutionListenerScript; - /** - * Create camunda:field element containing string or expression from given binding. - * - * @param {PropertyBinding} binding - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {ModdleElement} - */ - function createCamundaFieldInjection(binding, value, bpmnFactory) { - var DEFAULT_PROPS = { - 'string': undefined, - 'expression': undefined, - 'name': undefined - }; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + */ - var props = assign({}, DEFAULT_PROPS); +/** + * @param {EventBus} eventBus + */ +function BpmnGridSnapping(eventBus) { + eventBus.on([ + 'create.init', + 'shape.move.init' + ], function(event) { + var context = event.context, + shape = event.shape; + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(shape, [ + 'bpmn:Participant', + 'bpmn:SubProcess', + 'bpmn:TextAnnotation' + ])) { + if (!context.gridSnappingContext) { + context.gridSnappingContext = {}; + } + + context.gridSnappingContext.snapLocation = 'top-left'; + } + }); +} + +BpmnGridSnapping.$inject = [ 'eventBus' ]; + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js": +/*!****************************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ GridSnappingAutoPlaceBehavior) +/* harmony export */ }); +/* harmony import */ var _auto_place_BpmnAutoPlaceUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../auto-place/BpmnAutoPlaceUtil */ "../node_modules/bpmn-js/lib/features/auto-place/BpmnAutoPlaceUtil.js"); +/* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/layout/LayoutUtil */ "../node_modules/diagram-js/lib/layout/LayoutUtil.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); + + + + + +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping + * + * @typedef {import('diagram-js/lib/util/Types').Axis} Axis + */ - if (!binding.expression) { - props.string = value; - } else { - props.expression = value; - } - props.name = binding.name; +var HIGH_PRIORITY = 2000; - return bpmnFactory.create('camunda:Field', props); - } - module.exports.createCamundaFieldInjection = createCamundaFieldInjection; +/** + * @param {EventBus} eventBus + * @param {GridSnapping} gridSnapping + */ +function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) { + eventBus.on('autoPlace', HIGH_PRIORITY, function(context) { + var source = context.source, + sourceMid = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_0__.getMid)(source), + shape = context.shape; + var position = (0,_auto_place_BpmnAutoPlaceUtil__WEBPACK_IMPORTED_MODULE_1__.getNewShapePosition)(source, shape); -// helpers //////////////////////////// + [ 'x', 'y' ].forEach(function(axis) { + var options = {}; - /** - * Create properties for camunda:in and camunda:out types. - */ - function createCamundaInOutAttrs(binding, value) { + // do not snap if x/y equal + if (position[ axis ] === sourceMid[ axis ]) { + return; + } - var properties = {}; + if (position[ axis ] > sourceMid[ axis ]) { + options.min = position[ axis ]; + } else { + options.max = position[ axis ]; + } - // camunda:in source(Expression) target - if (binding.target) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(shape, 'bpmn:TextAnnotation')) { - properties.target = binding.target; + if (isHorizontal(axis)) { + options.offset = -shape.width / 2; + } else { + options.offset = -shape.height / 2; + } - if (binding.expression) { - properties.sourceExpression = value; - } else { - properties.source = value; - } - } else + } - // camunda:(in|out) variables local - if (binding.variables) { - properties.variables = 'all'; + position[ axis ] = gridSnapping.snapValue(position[ axis ], options); - if (binding.variables === 'local') { - properties.local = true; - } - } + }); - // camunda:out source(Expression) target - else { - properties.target = value; + // must be returned to be considered by auto place + return position; + }); +} - [ 'source', 'sourceExpression' ].forEach(function(k) { - if (binding[k]) { - properties[k] = binding[k]; - } - }); - } +GridSnappingAutoPlaceBehavior.$inject = [ + 'eventBus', + 'gridSnapping' +]; - return properties; - } +// helpers ////////// - },{"lodash/assign":604}],53:[function(require,module,exports){ - 'use strict'; +/** + * @param {Axis} axis + * + * @return {boolean} + */ +function isHorizontal(axis) { + return axis === 'x'; +} - var inherits = require('inherits'); +/***/ }), - var getTemplate = require('./Helper').getTemplate; +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js": +/*!***********************************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js ***! + \***********************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var PropertiesActivator = require('../../../PropertiesActivator'); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ GridSnappingLayoutConnectionBehavior) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/command/CommandInterceptor */ "../node_modules/diagram-js/lib/command/CommandInterceptor.js"); +/* harmony import */ var diagram_js_lib_util_Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/util/Geometry */ "../node_modules/diagram-js/lib/util/Geometry.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); - var HIGHER_PRIORITY = 1100; - /** - * Applies template visibility settings. - * - * Controlled using `entriesVisible` on template config object: - * - * ```json - * "entriesVisible": { - * "_all": true|false, - * "entryName": true|false, - * ... - * } - * ``` - * - * @param {EventBus} eventBus - * @param {ElementTemplates} elementTemplates - */ - function CustomElementsPropertiesActivator(eventBus, elementTemplates) { - PropertiesActivator.call(this, eventBus, HIGHER_PRIORITY); - this.isEntryVisible = function(entry, element) { - var template = getTemplate(element, elementTemplates); - if (template && !isEntryVisible(entry, template)) { - return false; - } - }; - this.isPropertyEditable = function(entry, propertyName, element) { - var template = getTemplate(element, elementTemplates); - if (template && !isEntryEditable(entry, template)) { - return false; - } - }; - } +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping + * @typedef {import('../../modeling/Modeling').default} Modeling + * + * @typedef {import('diagram-js/lib/util/Types').Point} Point + */ - CustomElementsPropertiesActivator.$inject = [ 'eventBus', 'elementTemplates' ]; +var HIGH_PRIORITY = 3000; - inherits(CustomElementsPropertiesActivator, PropertiesActivator); - module.exports = CustomElementsPropertiesActivator; +/** + * Snaps connections with Manhattan layout. + * + * @param {EventBus} eventBus + * @param {GridSnapping} gridSnapping + * @param {Modeling} modeling + */ +function GridSnappingLayoutConnectionBehavior(eventBus, gridSnapping, modeling) { + diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); + this._gridSnapping = gridSnapping; + var self = this; -// helpers //////////////////////////////////// + this.postExecuted([ + 'connection.create', + 'connection.layout' + ], HIGH_PRIORITY, function(event) { + var context = event.context, + connection = context.connection, + hints = context.hints || {}, + waypoints = connection.waypoints; + if (hints.connectionStart || hints.connectionEnd || hints.createElementsBehavior === false) { + return; + } - var CUSTOM_PROPERTIES_PATTERN = /^custom-/; + if (!hasMiddleSegments(waypoints)) { + return; + } - var DEFAULT_ENTRIES_VISIBLE = { - _all: false, - id: true, - name: true - }; + modeling.updateWaypoints(connection, self.snapMiddleSegments(waypoints)); + }); +} - function isCustomEntry(entry) { - return CUSTOM_PROPERTIES_PATTERN.test(entry.id); - } +GridSnappingLayoutConnectionBehavior.$inject = [ + 'eventBus', + 'gridSnapping', + 'modeling' +]; - function isEntryVisible(entry, template) { +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(GridSnappingLayoutConnectionBehavior, diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"]); - var entryId = entry.id; +/** + * Snap middle segments of a given connection. + * + * @param {Point[]} waypoints + * + * @return {Point[]} + */ +GridSnappingLayoutConnectionBehavior.prototype.snapMiddleSegments = function(waypoints) { + var gridSnapping = this._gridSnapping, + snapped; - if (entryId === 'elementTemplate-chooser' || isCustomEntry(entry)) { - return true; - } + waypoints = waypoints.slice(); - var entriesVisible = template.entriesVisible || DEFAULT_ENTRIES_VISIBLE; + for (var i = 1; i < waypoints.length - 2; i++) { - if (typeof entriesVisible === 'boolean') { - return entriesVisible; - } + snapped = snapSegment(gridSnapping, waypoints[i], waypoints[i + 1]); - var defaultVisible = entriesVisible._all || false, - entryVisible = entriesVisible[entryId]; + waypoints[i] = snapped[0]; + waypoints[i + 1] = snapped[1]; + } - // d = true, e = false => false - // d = false, e = true => true - // d = false, e = false - return ( - (defaultVisible === true && entryVisible !== false) || - (defaultVisible === false && entryVisible === true) - ); - } + return waypoints; +}; - function isEntryEditable(entry, template) { - var property; +// helpers ////////// - if (isCustomEntry(entry)) { - property = getProperty(template, entry); +/** + * Check whether a connection has a middle segments. + * + * @param {Point[]} waypoints + * + * @return {boolean} + */ +function hasMiddleSegments(waypoints) { + return waypoints.length > 3; +} - return property && property.editable !== false; - } +/** + * Check whether an alignment is horizontal. + * + * @param {string} aligned + * + * @return {boolean} + */ +function horizontallyAligned(aligned) { + return aligned === 'h'; +} - return true; - } +/** + * Check whether an alignment is vertical. + * + * @param {string} aligned + * + * @return {boolean} + */ +function verticallyAligned(aligned) { + return aligned === 'v'; +} - function getProperty(template, entry) { +/** + * Get middle segments from a given connection. + * + * @param {Point[]} waypoints + * + * @return {Point[]} + */ +function snapSegment(gridSnapping, segmentStart, segmentEnd) { - var index; - var idx = entry.id.replace('custom-' + template.id + '-', ''); - if (idx.indexOf('-') !== -1) { - var indexes = idx.split('-'); - if (indexes.length == 2) { - var scopeName = indexes[0].replace(/_/g, ':'); - index = parseInt(indexes[1], 10); - if (scopeName && !isNaN(index)) { - return template.scopes[scopeName].properties[index]; - } - } - } else { - index = parseInt(idx, 10); - if (!isNaN(index)) { - return template.properties[index]; - } - } + var aligned = (0,diagram_js_lib_util_Geometry__WEBPACK_IMPORTED_MODULE_2__.pointsAligned)(segmentStart, segmentEnd); - throw new Error('cannot extract property index for entry <' + entry.id + '>'); - } + var snapped = {}; - },{"../../../PropertiesActivator":3,"./Helper":56,"inherits":438}],54:[function(require,module,exports){ - 'use strict'; + if (horizontallyAligned(aligned)) { - var values = require('lodash/values'); + // snap horizontally + snapped.y = gridSnapping.snapValue(segmentStart.y); + } - /** - * The guy knowing all configured element templates. - * - * This registry won't validate. Use the {@link Validator} - * to verify a template is valid prior to adding it to - * this registry. - */ - function ElementTemplates() { + if (verticallyAligned(aligned)) { - this._templates = {}; + // snap vertically + snapped.x = gridSnapping.snapValue(segmentStart.x); + } - /** - * Sets the known element templates. - * - * @param {Array} descriptors - * - * @return {ElementTemplates} - */ - this.set = function(descriptors) { + if ('x' in snapped || 'y' in snapped) { + segmentStart = (0,min_dash__WEBPACK_IMPORTED_MODULE_3__.assign)({}, segmentStart, snapped); + segmentEnd = (0,min_dash__WEBPACK_IMPORTED_MODULE_3__.assign)({}, segmentEnd, snapped); + } - var templates = this._templates = {}; + return [ segmentStart, segmentEnd ]; +} - descriptors.forEach(function(descriptor) { - templates[descriptor.id] = descriptor; - }); +/***/ }), - return this; - }; +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js": +/*!******************************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js ***! + \******************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - /** - * Get template descriptor with given id. - * - * @param {String} id - * - * @return {TemplateDescriptor} - */ - this.get = function(id) { - return this._templates[id]; - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ GridSnappingParticipantBehavior) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - /** - * Return all known template descriptors. - * - * @return {Array} - */ - this.getAll = function() { - return values(this._templates); - }; - } +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping + */ - module.exports = ElementTemplates; - },{"lodash/values":643}],55:[function(require,module,exports){ - 'use strict'; +var HIGHER_PRIORITY = 1750; - var Validator = require('./Validator'); +/** + * @param {Canvas} canvas + * @param {EventBus} eventBus + * @param {GridSnapping} gridSnapping + */ +function GridSnappingParticipantBehavior(canvas, eventBus, gridSnapping) { + eventBus.on([ + 'create.start', + 'shape.move.start' + ], HIGHER_PRIORITY, function(event) { + var context = event.context, + shape = context.shape, + rootElement = canvas.getRootElement(); + + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(shape, 'bpmn:Participant') || + !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(rootElement, 'bpmn:Process') || + !rootElement.children.length) { + return; + } + + var createConstraints = context.createConstraints; + + if (!createConstraints) { + return; + } + + shape.width = gridSnapping.snapValue(shape.width, { min: shape.width }); + shape.height = gridSnapping.snapValue(shape.height, { min: shape.height }); + }); +} + +GridSnappingParticipantBehavior.$inject = [ + 'canvas', + 'eventBus', + 'gridSnapping' +]; + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/index.js": +/*!****************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/behavior/index.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _GridSnappingAutoPlaceBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GridSnappingAutoPlaceBehavior */ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js"); +/* harmony import */ var _GridSnappingParticipantBehavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GridSnappingParticipantBehavior */ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js"); +/* harmony import */ var _GridSnappingLayoutConnectionBehavior__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GridSnappingLayoutConnectionBehavior */ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js"); + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __init__: [ + 'gridSnappingAutoPlaceBehavior', + 'gridSnappingParticipantBehavior', + 'gridSnappingLayoutConnectionBehavior', + ], + gridSnappingAutoPlaceBehavior: [ 'type', _GridSnappingAutoPlaceBehavior__WEBPACK_IMPORTED_MODULE_0__["default"] ], + gridSnappingParticipantBehavior: [ 'type', _GridSnappingParticipantBehavior__WEBPACK_IMPORTED_MODULE_1__["default"] ], + gridSnappingLayoutConnectionBehavior: [ 'type', _GridSnappingLayoutConnectionBehavior__WEBPACK_IMPORTED_MODULE_2__["default"] ] +}); + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/grid-snapping/index.js": +/*!*******************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/grid-snapping/index.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _BpmnGridSnapping__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BpmnGridSnapping */ "../node_modules/bpmn-js/lib/features/grid-snapping/BpmnGridSnapping.js"); +/* harmony import */ var diagram_js_lib_features_grid_snapping__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/grid-snapping */ "../node_modules/diagram-js/lib/features/grid-snapping/index.js"); +/* harmony import */ var _behavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./behavior */ "../node_modules/bpmn-js/lib/features/grid-snapping/behavior/index.js"); + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_grid_snapping__WEBPACK_IMPORTED_MODULE_0__["default"], + _behavior__WEBPACK_IMPORTED_MODULE_1__["default"] + ], + __init__: [ 'bpmnGridSnapping' ], + bpmnGridSnapping: [ 'type', _BpmnGridSnapping__WEBPACK_IMPORTED_MODULE_2__["default"] ] +}); + +/***/ }), + +/***/ "../node_modules/bpmn-js/lib/features/interaction-events/BpmnInteractionEvents.js": +/*!****************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/interaction-events/BpmnInteractionEvents.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnInteractionEvents) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); - /** - * The guy responsible for template loading. - * - * Provide the actual templates via the `config.elementTemplates`. - * - * That configuration can either be an array of template - * descriptors or a node style callback to retrieve - * the templates asynchronously. - * - * @param {Array|Function} loadTemplates - * @param {EventBus} eventBus - * @param {ElementTemplates} elementTemplates - */ - function ElementTemplatesLoader(loadTemplates, eventBus, elementTemplates) { - this._loadTemplates = loadTemplates; - this._eventBus = eventBus; - this._elementTemplates = elementTemplates; - var self = this; - eventBus.on('diagram.init', function() { - self.reload(); - }); - } - module.exports = ElementTemplatesLoader; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/interaction-events/InteractionEvents').default} InteractionEvents + * + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Shape} Shape + */ - ElementTemplatesLoader.$inject = [ - 'config.elementTemplates', - 'eventBus', - 'elementTemplates' - ]; +var LABEL_WIDTH = 30, + LABEL_HEIGHT = 30; - ElementTemplatesLoader.prototype.reload = function() { +/** + * BPMN-specific hit zones and interaction fixes. + * + * @param {EventBus} eventBus + * @param {InteractionEvents} interactionEvents + */ +function BpmnInteractionEvents(eventBus, interactionEvents) { + + this._interactionEvents = interactionEvents; + + var self = this; + + eventBus.on([ + 'interactionEvents.createHit', + 'interactionEvents.updateHit' + ], function(context) { + var element = context.element, + gfx = context.gfx; + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Lane')) { + return self._createParticipantHit(element, gfx); + } else + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Participant')) { + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_1__.isExpanded)(element)) { + return self._createParticipantHit(element, gfx); + } else { + return self._createDefaultHit(element, gfx); + } + } else + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:SubProcess')) { + if ((0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_1__.isExpanded)(element)) { + return self._createSubProcessHit(element, gfx); + } else { + return self._createDefaultHit(element, gfx); + } + } + }); + +} + +BpmnInteractionEvents.$inject = [ + 'eventBus', + 'interactionEvents' +]; + +/** + * @param {Element} element + * @param {SVGElement} gfx + * + * @return {boolean} + */ +BpmnInteractionEvents.prototype._createDefaultHit = function(element, gfx) { + this._interactionEvents.removeHits(gfx); - var self = this; + this._interactionEvents.createDefaultHit(element, gfx); - var loadTemplates = this._loadTemplates; + // indicate that we created a hit + return true; +}; - // no templates specified - if (typeof loadTemplates === 'undefined') { - return; - } +/** + * @param {Shape} element + * @param {SVGElement} gfx + * + * @return {boolean} + */ +BpmnInteractionEvents.prototype._createParticipantHit = function(element, gfx) { + + // remove existing hits + this._interactionEvents.removeHits(gfx); + + // add body hit + this._interactionEvents.createBoxHit(gfx, 'no-move', { + width: element.width, + height: element.height + }); + + // add outline hit + this._interactionEvents.createBoxHit(gfx, 'click-stroke', { + width: element.width, + height: element.height + }); + + // add label hit + this._interactionEvents.createBoxHit(gfx, 'all', { + width: LABEL_WIDTH, + height: element.height + }); + + // indicate that we created a hit + return true; +}; + +/** + * @param {Shape} element + * @param {SVGElement} gfx + * + * @return {boolean} + */ +BpmnInteractionEvents.prototype._createSubProcessHit = function(element, gfx) { - // template loader function specified - if (typeof loadTemplates === 'function') { + // remove existing hits + this._interactionEvents.removeHits(gfx); - return loadTemplates(function(err, templates) { + // add body hit + this._interactionEvents.createBoxHit(gfx, 'no-move', { + width: element.width, + height: element.height + }); - if (err) { - return self.templateErrors([ err ]); - } + // add outline hit + this._interactionEvents.createBoxHit(gfx, 'click-stroke', { + width: element.width, + height: element.height + }); - self.setTemplates(templates); - }); - } + // add label hit + this._interactionEvents.createBoxHit(gfx, 'all', { + width: element.width, + height: LABEL_HEIGHT + }); - // templates array specified - if (loadTemplates.length) { - return this.setTemplates(loadTemplates); - } + // indicate that we created a hit + return true; +}; - }; +/***/ }), - ElementTemplatesLoader.prototype.setTemplates = function(templates) { +/***/ "../node_modules/bpmn-js/lib/features/interaction-events/index.js": +/*!************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/interaction-events/index.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var elementTemplates = this._elementTemplates; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _BpmnInteractionEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BpmnInteractionEvents */ "../node_modules/bpmn-js/lib/features/interaction-events/BpmnInteractionEvents.js"); - var validator = new Validator().addAll(templates); - var errors = validator.getErrors(), - validTemplates = validator.getValidTemplates(); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __init__: [ 'bpmnInteractionEvents' ], + bpmnInteractionEvents: [ 'type', _BpmnInteractionEvents__WEBPACK_IMPORTED_MODULE_0__["default"] ] +}); - elementTemplates.set(validTemplates); +/***/ }), - if (errors.length) { - this.templateErrors(errors); - } +/***/ "../node_modules/bpmn-js/lib/features/keyboard/BpmnKeyboardBindings.js": +/*!*****************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/keyboard/BpmnKeyboardBindings.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - this.templatesChanged(); - }; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnKeyboardBindings) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_features_keyboard_KeyboardBindings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/keyboard/KeyboardBindings */ "../node_modules/diagram-js/lib/features/keyboard/KeyboardBindings.js"); - ElementTemplatesLoader.prototype.templatesChanged = function() { - this._eventBus.fire('elementTemplates.changed'); - }; - ElementTemplatesLoader.prototype.templateErrors = function(errors) { - this._eventBus.fire('elementTemplates.errors', { - errors: errors - }); - }; - },{"./Validator":57}],56:[function(require,module,exports){ - 'use strict'; - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; - var is = require('bpmn-js/lib/util/ModelUtil').is, - isAny = require('bpmn-js/lib/features/modeling/util/ModelingUtil').isAny; +/** + * @typedef {import('didi').Injector} Injector + * @typedef {import('diagram-js/lib/features/editor-actions/EditorActions').default} EditorActions + * @typedef {import('diagram-js/lib/features/keyboard/Keyboard').default} Keyboard + */ - var find = require('lodash/find'); +/** + * BPMN 2.0 specific keyboard bindings. + * + * @param {Injector} injector + */ +function BpmnKeyboardBindings(injector) { + injector.invoke(diagram_js_lib_features_keyboard_KeyboardBindings__WEBPACK_IMPORTED_MODULE_0__["default"], this); +} +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(BpmnKeyboardBindings, diagram_js_lib_features_keyboard_KeyboardBindings__WEBPACK_IMPORTED_MODULE_0__["default"]); - var TEMPLATE_ATTR = 'camunda:modelerTemplate'; +BpmnKeyboardBindings.$inject = [ + 'injector' +]; - /** - * The BPMN 2.0 extension attribute name under - * which the element template is stored. - * - * @type {String} - */ - module.exports.TEMPLATE_ATTR = TEMPLATE_ATTR; +/** + * Register available keyboard bindings. + * + * @param {Keyboard} keyboard + * @param {EditorActions} editorActions + */ +BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActions) { - /** - * Get template id for a given diagram element. - * - * @param {djs.model.Base} element - * - * @return {String} - */ - function getTemplateId(element) { + // inherit default bindings + diagram_js_lib_features_keyboard_KeyboardBindings__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.registerBindings.call(this, keyboard, editorActions); - var bo = getBusinessObject(element); + /** + * Add keyboard binding if respective editor action + * is registered. + * + * @param {string} action name + * @param {Function} fn that implements the key binding + */ + function addListener(action, fn) { - if (bo) { - return bo.get(TEMPLATE_ATTR); - } - } + if (editorActions.isRegistered(action)) { + keyboard.addListener(fn); + } + } - module.exports.getTemplateId = getTemplateId; + // select all elements + // CTRL + A + addListener('selectElements', function(context) { + var event = context.keyEvent; - /** - * Get template of a given element. - * - * @param {Element} element - * @param {ElementTemplates} elementTemplates - * - * @return {TemplateDefinition} - */ - function getTemplate(element, elementTemplates) { - var id = getTemplateId(element); + if (keyboard.isKey([ 'a', 'A' ], event) && keyboard.isCmd(event)) { + editorActions.trigger('selectElements'); - return id && elementTemplates.get(id); - } + return true; + } + }); - module.exports.getTemplate = getTemplate; + // search labels + // CTRL + F + addListener('find', function(context) { - /** - * Get default template for a given element. - * - * @param {Element} element - * @param {ElementTemplates} elementTemplates - * - * @return {TemplateDefinition} - */ - function getDefaultTemplate(element, elementTemplates) { + var event = context.keyEvent; - // return first default template, if any exists - return ( - elementTemplates.getAll().filter(function(t) { - return isAny(element, t.appliesTo) && t.isDefault; - }) - )[0]; - } + if (keyboard.isKey([ 'f', 'F' ], event) && keyboard.isCmd(event)) { + editorActions.trigger('find'); - module.exports.getDefaultTemplate = getDefaultTemplate; + return true; + } + }); + // activate space tool + // S + addListener('spaceTool', function(context) { - /** - * Find extension with given type in - * BPMN element, diagram element or ExtensionElement. - * - * @param {ModdleElement|djs.model.Base} element - * @param {String} type - * - * @return {ModdleElement} the extension - */ - function findExtension(element, type) { - var bo = getBusinessObject(element); + var event = context.keyEvent; - var extensionElements; + if (keyboard.hasModifier(event)) { + return; + } - if (is(bo, 'bpmn:ExtensionElements')) { - extensionElements = bo; - } else { - extensionElements = bo.extensionElements; - } + if (keyboard.isKey([ 's', 'S' ], event)) { + editorActions.trigger('spaceTool'); - if (!extensionElements) { - return null; - } + return true; + } + }); - return find(extensionElements.get('values'), function(e) { - return is(e, type); - }); - } + // activate lasso tool + // L + addListener('lassoTool', function(context) { - module.exports.findExtension = findExtension; + var event = context.keyEvent; + if (keyboard.hasModifier(event)) { + return; + } - function findExtensions(element, types) { - var extensionElements = getExtensionElements(element); + if (keyboard.isKey([ 'l', 'L' ], event)) { + editorActions.trigger('lassoTool'); - if (!extensionElements) { - return []; - } + return true; + } + }); - return extensionElements.get('values').filter(function(e) { - return isAny(e, types); - }); - } + // activate hand tool + // H + addListener('handTool', function(context) { - module.exports.findExtensions = findExtensions; + var event = context.keyEvent; + if (keyboard.hasModifier(event)) { + return; + } - function findCamundaInOut(element, binding) { + if (keyboard.isKey([ 'h', 'H' ], event)) { + editorActions.trigger('handTool'); - var extensionElements = getExtensionElements(element); + return true; + } + }); - if (!extensionElements) { - return; - } + // activate global connect tool + // C + addListener('globalConnectTool', function(context) { - var matcher; + var event = context.keyEvent; - if (binding.type === 'camunda:in') { - matcher = function(e) { - return is(e, 'camunda:In') && isInOut(e, binding); - }; - } else - if (binding.type === 'camunda:out') { - matcher = function(e) { - return is(e, 'camunda:Out') && isInOut(e, binding); - }; - } else - if (binding.type === 'camunda:in:businessKey') { - matcher = function(e) { - return is(e, 'camunda:In') && 'businessKey' in e; - }; - } + if (keyboard.hasModifier(event)) { + return; + } - return find(extensionElements.get('values'), matcher); - } + if (keyboard.isKey([ 'c', 'C' ], event)) { + editorActions.trigger('globalConnectTool'); - module.exports.findCamundaInOut = findCamundaInOut; + return true; + } + }); - function findCamundaProperty(camundaProperties, binding) { - return find(camundaProperties.get('values'), function(p) { - return p.name === binding.name; - }); - } + // activate direct editing + // E + addListener('directEditing', function(context) { - module.exports.findCamundaProperty = findCamundaProperty; + var event = context.keyEvent; + if (keyboard.hasModifier(event)) { + return; + } - function findInputParameter(inputOutput, binding) { - var parameters = inputOutput.get('inputParameters'); + if (keyboard.isKey([ 'e', 'E' ], event)) { + editorActions.trigger('directEditing'); - return find(parameters, function(p) { - return p.name === binding.name; - }); - } + return true; + } + }); - module.exports.findInputParameter = findInputParameter; + // activate replace element + // R + addListener('replaceElement', function(context) { + var event = context.keyEvent; - function findOutputParameter(inputOutput, binding) { - var parameters = inputOutput.get('outputParameters'); + if (keyboard.hasModifier(event)) { + return; + } - return find(parameters, function(p) { - var value = p.value; + if (keyboard.isKey([ 'r', 'R' ], event)) { + editorActions.trigger('replaceElement', event); - if (!binding.scriptFormat) { - return value === binding.source; - } + return true; + } + }); - var definition = p.definition; +}; - if (!definition || binding.scriptFormat !== definition.scriptFormat) { - return false; - } +/***/ }), - return definition.value === binding.source; - }); - } +/***/ "../node_modules/bpmn-js/lib/features/keyboard/index.js": +/*!**************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/keyboard/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - module.exports.findOutputParameter = findOutputParameter; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_keyboard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/keyboard */ "../node_modules/diagram-js/lib/features/keyboard/index.js"); +/* harmony import */ var _BpmnKeyboardBindings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BpmnKeyboardBindings */ "../node_modules/bpmn-js/lib/features/keyboard/BpmnKeyboardBindings.js"); -// helpers ///////////////////////////////// - function getExtensionElements(element) { - var bo = getBusinessObject(element); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_keyboard__WEBPACK_IMPORTED_MODULE_0__["default"] + ], + __init__: [ 'keyboardBindings' ], + keyboardBindings: [ 'type', _BpmnKeyboardBindings__WEBPACK_IMPORTED_MODULE_1__["default"] ] +}); - if (is(bo, 'bpmn:ExtensionElements')) { - return bo; - } else { - return bo.extensionElements; - } - } +/***/ }), - function isInOut(element, binding) { +/***/ "../node_modules/bpmn-js/lib/features/label-editing/LabelEditingPreview.js": +/*!*********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/label-editing/LabelEditingPreview.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - if (binding.type === 'camunda:in') { - // find based on target attribute - if (binding.target) { - return element.target === binding.target; - } - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ LabelEditingPreview) +/* harmony export */ }); +/* harmony import */ var tiny_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tiny-svg */ "../node_modules/tiny-svg/dist/index.esm.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/util/SvgTransformUtil */ "../node_modules/diagram-js/lib/util/SvgTransformUtil.js"); - if (binding.type === 'camunda:out') { - // find based on source / sourceExpression - if (binding.source) { - return element.source === binding.source; - } - if (binding.sourceExpression) { - return element.sourceExpression === binding.sourceExpression; - } - } - // find based variables / local combination - if (binding.variables) { - return element.variables === 'all' && ( - binding.variables !== 'local' || element.local - ); - } - } - },{"bpmn-js/lib/features/modeling/util/ModelingUtil":211,"bpmn-js/lib/util/ModelUtil":240,"lodash/find":610}],57:[function(require,module,exports){ - 'use strict'; - var isArray = require('lodash/isArray'); - var isObject = require('lodash/isObject'); - var DROPDOWN_TYPE = 'Dropdown'; +/** + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('../../draw/PathMap').default} PathMap + */ - var VALID_TYPES = [ 'String', 'Text', 'Boolean', 'Hidden', DROPDOWN_TYPE ]; +var MARKER_HIDDEN = 'djs-element-hidden', + MARKER_LABEL_HIDDEN = 'djs-label-hidden'; - var PROPERTY_TYPE = 'property', - CAMUNDA_PROPERTY_TYPE = 'camunda:property', - CAMUNDA_INPUT_PARAMETER_TYPE = 'camunda:inputParameter', - CAMUNDA_OUTPUT_PARAMETER_TYPE = 'camunda:outputParameter', - CAMUNDA_IN_TYPE = 'camunda:in', - CAMUNDA_OUT_TYPE = 'camunda:out', - CAMUNDA_IN_BUSINESS_KEY_TYPE = 'camunda:in:businessKey', - CAMUNDA_EXECUTION_LISTENER = 'camunda:executionListener', - CAMUNDA_FIELD = 'camunda:field'; +/** + * @param {EventBus} eventBus + * @param {Canvas} canvas + * @param {PathMap} pathMap + */ +function LabelEditingPreview(eventBus, canvas, pathMap) { - var VALID_BINDING_TYPES = [ - PROPERTY_TYPE, - CAMUNDA_PROPERTY_TYPE, - CAMUNDA_INPUT_PARAMETER_TYPE, - CAMUNDA_OUTPUT_PARAMETER_TYPE, - CAMUNDA_IN_TYPE, - CAMUNDA_OUT_TYPE, - CAMUNDA_IN_BUSINESS_KEY_TYPE, - CAMUNDA_EXECUTION_LISTENER, - CAMUNDA_FIELD - ]; + var self = this; + var defaultLayer = canvas.getDefaultLayer(); - /** - * A element template validator. - */ - function Validator() { + var element, absoluteElementBBox, gfx; - this._templatesById = {}; + eventBus.on('directEditing.activate', function(context) { + var activeProvider = context.active; - this._validTemplates = []; - this._errors = []; + element = activeProvider.element.label || activeProvider.element; + // text annotation + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + absoluteElementBBox = canvas.getAbsoluteBBox(element); - /** - * Adds the templates. - * - * @param {Array} templates - * - * @return {Validator} self - */ - this.addAll = function(templates) { + gfx = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.create)('g'); - if (!isArray(templates)) { - this._logError('templates must be []'); - } else { - templates.forEach(this.add, this); - } + var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: element.height, + position: { + mx: 0.0, + my: 0.0 + } + }); - return this; - }; + var path = self.path = (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.create)('path'); - /** - * Add the given element template, if it is valid. - * - * @param {TemplateDescriptor} template - * - * @return {Validator} self - */ - this.add = function(template) { + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.attr)(path, { + d: textPathData, + strokeWidth: 2, + stroke: getStrokeColor(element) + }); - var err = this._validateTemplate(template); + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.append)(gfx, path); - if (!err) { - this._templatesById[template.id] = template; + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.append)(defaultLayer, gfx); - this._validTemplates.push(template); - } + (0,diagram_js_lib_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_2__.translate)(gfx, element.x, element.y); + } - return this; - }; + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation') || + element.labelTarget) { + canvas.addMarker(element, MARKER_HIDDEN); + } else if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Task') || + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:CallActivity') || + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:SubProcess') || + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Participant')) { + canvas.addMarker(element, MARKER_LABEL_HIDDEN); + } + }); - /** - * Validate given template and return error (if any). - * - * @param {TemplateDescriptor} template - * - * @return {Error} validation error, if any - */ - this._validateTemplate = function(template) { - - var err, - id = template.id, - appliesTo = template.appliesTo, - properties = template.properties, - scopes = template.scopes; - - if (!id) { - return this._logError('missing template id'); - } + eventBus.on('directEditing.resize', function(context) { - if (id in this._templatesById) { - return this._logError('template id <' + id + '> already used'); - } + // text annotation + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + var height = context.height, + dy = context.dy; - if (!isArray(appliesTo)) { - err = this._logError('missing appliesTo=[]', template); - } + var newElementHeight = Math.max(element.height / absoluteElementBBox.height * (height + dy), 0); - if (!isArray(properties)) { - err = this._logError('missing properties=[]', template); - } else { - if (!this._validateProperties(properties)) { - err = new Error('invalid properties'); - } - } + var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', { + xScaleFactor: 1, + yScaleFactor: 1, + containerWidth: element.width, + containerHeight: newElementHeight, + position: { + mx: 0.0, + my: 0.0 + } + }); - if (scopes) { - err = this._validateScopes(template, scopes); - } + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.attr)(self.path, { + d: textPathData + }); + } + }); - return err; - }; + eventBus.on([ 'directEditing.complete', 'directEditing.cancel' ], function(context) { + var activeProvider = context.active; - this._validateScopes = function(template, scopes) { + if (activeProvider) { + canvas.removeMarker(activeProvider.element.label || activeProvider.element, MARKER_HIDDEN); + canvas.removeMarker(element, MARKER_LABEL_HIDDEN); + } - var err, - scope, - scopeName; + element = undefined; + absoluteElementBBox = undefined; - if (!isObject(scopes) || isArray(scopes)) { - return this._logError('invalid scopes, should be scopes={}', template); - } + if (gfx) { + (0,tiny_svg__WEBPACK_IMPORTED_MODULE_1__.remove)(gfx); - for (scopeName in scopes) { - scope = scopes[scopeName]; + gfx = undefined; + } + }); +} - if (!isObject(scope) || isArray(scope)) { - err = this._logError('invalid scope, should be scope={}', template); - } +LabelEditingPreview.$inject = [ + 'eventBus', + 'canvas', + 'pathMap' +]; - if (!isArray(scope.properties)) { - err = this._logError( - 'missing properties=[] in scope <' + scopeName + '>', template - ); - } else { - if (!this._validateProperties(scope.properties)) { - err = new Error('invalid properties in scope <' + scopeName + '>'); - } - } - } - return err; - }; +// helpers ////////// - /** - * Validate properties and return false if any is invalid. - * - * @param {Array} properties - * - * @return {Boolean} true if all properties are valid - */ - this._validateProperties = function(properties) { - var validProperties = properties.filter(this._validateProperty, this); - - return properties.length === validProperties.length; - }; +function getStrokeColor(element, defaultColor) { + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.getDi)(element); - /** - * Validate property and return false, if there was - * a validation error. - * - * @param {PropertyDescriptor} property - * - * @return {Boolean} true if property is valid - */ - this._validateProperty = function(property) { + return di.get('stroke') || defaultColor || 'black'; +} - var type = property.type, - binding = property.binding; +/***/ }), - var err; +/***/ "../node_modules/bpmn-js/lib/features/label-editing/LabelEditingProvider.js": +/*!**********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/label-editing/LabelEditingProvider.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var bindingType = binding.type; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ LabelEditingProvider) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var _modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); - if (VALID_TYPES.indexOf(type) === -1) { - err = this._logError( - 'invalid property type <' + type + '>; ' + - 'must be any of { ' + VALID_TYPES.join(', ') + ' }' - ); - } - if (type === DROPDOWN_TYPE && bindingType !== CAMUNDA_EXECUTION_LISTENER) { - if (!isArray(property.choices)) { - err = this._logError( - 'must provide choices=[] with ' + DROPDOWN_TYPE + ' type' - ); - } else - - if (!property.choices.every(isDropdownChoiceValid)) { - err = this._logError( - '{ name, value } must be specified for ' + - DROPDOWN_TYPE + ' choices' - ); - } - } - if (!binding) { - return this._logError('property missing binding'); - } - if (VALID_BINDING_TYPES.indexOf(bindingType) === -1) { - err = this._logError( - 'invalid property.binding type <' + bindingType + '>; ' + - 'must be any of { ' + VALID_BINDING_TYPES.join(', ') + ' }' - ); - } - if (bindingType === PROPERTY_TYPE || - bindingType === CAMUNDA_PROPERTY_TYPE || - bindingType === CAMUNDA_INPUT_PARAMETER_TYPE || - bindingType === CAMUNDA_FIELD) { - if (!binding.name) { - err = this._logError( - 'property.binding <' + bindingType + '> requires name' - ); - } - } - if (bindingType === CAMUNDA_OUTPUT_PARAMETER_TYPE) { - if (!binding.source) { - err = this._logError( - 'property.binding <' + bindingType + '> requires source' - ); - } - } - if (bindingType === CAMUNDA_IN_TYPE) { - if (!binding.variables && !binding.target) { - err = this._logError( - 'property.binding <' + bindingType + '> requires ' + - 'variables or target' - ); - } - } - if (bindingType === CAMUNDA_OUT_TYPE) { - if (!binding.variables && !binding.source && !binding.sourceExpression) { - err = this._logError( - 'property.binding <' + bindingType + '> requires ' + - 'variables, sourceExpression or source' - ); - } - } - if (bindingType === CAMUNDA_EXECUTION_LISTENER) { +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('../modeling/BpmnFactory').default} BpmnFactory + * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas + * @typedef {import('diagram-js-direct-editing/lib/DirectEditing').default} DirectEditing + * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('diagram-js/lib/features/resize/ResizeHandles').default} ResizeHandles + * @typedef {import('../../draw/TextRenderer').default} TextRenderer + * + * @typedef {import('../../model/Types').Element} Element + * + * @typedef { { + * bounds: { + * x: number; + * y: number; + * width: number; + * height: number; + * minWidth?: number; + * minHeight?: number; + * }; + * style: Object; + * } } DirectEditingContext + */ - if (type !== 'Hidden') { - err = this._logError( - 'invalid property type <' + type + '> for ' + CAMUNDA_EXECUTION_LISTENER + '; ' + - 'must be ' - ); - } - } +var HIGH_PRIORITY = 2000; - return !err; - }; +/** + * @param {EventBus} eventBus + * @param {BpmnFactory} bpmnFactory + * @param {Canvas} canvas + * @param {DirectEditing} directEditing + * @param {Modeling} modeling + * @param {ResizeHandles} resizeHandles + * @param {TextRenderer} textRenderer + */ +function LabelEditingProvider( + eventBus, bpmnFactory, canvas, directEditing, + modeling, resizeHandles, textRenderer) { + + this._bpmnFactory = bpmnFactory; + this._canvas = canvas; + this._modeling = modeling; + this._textRenderer = textRenderer; + + directEditing.registerProvider(this); + + // listen to dblclick on non-root elements + eventBus.on('element.dblclick', function(event) { + activateDirectEdit(event.element, true); + }); + + // complete on followup canvas operation + eventBus.on([ + 'autoPlace.start', + 'canvas.viewbox.changing', + 'drag.init', + 'element.mousedown', + 'popupMenu.open', + 'root.set', + 'selection.changed' + ], function() { + if (directEditing.isActive()) { + directEditing.complete(); + } + }); + + eventBus.on([ + 'shape.remove', + 'connection.remove' + ], HIGH_PRIORITY, function(event) { + + if (directEditing.isActive(event.element)) { + directEditing.cancel(); + } + }); + + // cancel on command stack changes + eventBus.on([ 'commandStack.changed' ], function(e) { + if (directEditing.isActive()) { + directEditing.cancel(); + } + }); + + + eventBus.on('directEditing.activate', function(event) { + resizeHandles.removeResizers(); + }); + + eventBus.on('create.end', 500, function(event) { + + var context = event.context, + element = context.shape, + canExecute = event.context.canExecute, + isTouch = event.isTouch; + + // TODO(nikku): we need to find a way to support the + // direct editing on mobile devices; right now this will + // break for desworkflowediting on mobile devices + // as it breaks the user interaction workflow + + // TODO(nikku): we should temporarily focus the edited element + // here and release the focused viewport after the direct edit + // operation is finished + if (isTouch) { + return; + } + + if (!canExecute) { + return; + } + + if (context.hints && context.hints.createElementsBehavior === false) { + return; + } + + activateDirectEdit(element); + }); + + eventBus.on('autoPlace.end', 500, function(event) { + activateDirectEdit(event.shape); + }); + + + function activateDirectEdit(element, force) { + if (force || + (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ 'bpmn:Task', 'bpmn:TextAnnotation', 'bpmn:Participant' ]) || + isCollapsedSubProcess(element)) { + + directEditing.activate(element); + } + } + +} + +LabelEditingProvider.$inject = [ + 'eventBus', + 'bpmnFactory', + 'canvas', + 'directEditing', + 'modeling', + 'resizeHandles', + 'textRenderer' +]; + + +/** + * Activate direct editing for activities and text annotations. + * + * @param {Element} element + * + * @return { { + * text: string; + * options?: { + * autoResize?: boolean; + * centerVertically?: boolean; + * resizable?: boolean; + * } + * } & DirectEditingContext } + */ +LabelEditingProvider.prototype.activate = function(element) { + + // text + var text = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.getLabel)(element); + + if (text === undefined) { + return; + } + + var context = { + text: text + }; + + // bounds + var bounds = this.getEditingBBox(element); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(context, bounds); + + var options = {}; + + // tasks + if ( + (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ + 'bpmn:Task', + 'bpmn:Participant', + 'bpmn:Lane', + 'bpmn:CallActivity' + ]) || + isCollapsedSubProcess(element) + ) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(options, { + centerVertically: true + }); + } + + // external labels + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.isLabelExternal)(element)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(options, { + autoResize: true + }); + } + + // text annotations + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(options, { + resizable: true, + autoResize: true + }); + } + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(context, { + options: options + }); + + return context; +}; + + +/** + * Get the editing bounding box based on the element's size and position. + * + * @param {Element} element + * + * @return {DirectEditingContext} + */ +LabelEditingProvider.prototype.getEditingBBox = function(element) { + var canvas = this._canvas; + + var target = element.label || element; + + var bbox = canvas.getAbsoluteBBox(target); + + var mid = { + x: bbox.x + bbox.width / 2, + y: bbox.y + bbox.height / 2 + }; + + // default position + var bounds = { x: bbox.x, y: bbox.y }; + + var zoom = canvas.zoom(); + + var defaultStyle = this._textRenderer.getDefaultStyle(), + externalStyle = this._textRenderer.getExternalStyle(); + + // take zoom into account + var externalFontSize = externalStyle.fontSize * zoom, + externalLineHeight = externalStyle.lineHeight, + defaultFontSize = defaultStyle.fontSize * zoom, + defaultLineHeight = defaultStyle.lineHeight; + + var style = { + fontFamily: this._textRenderer.getDefaultStyle().fontFamily, + fontWeight: this._textRenderer.getDefaultStyle().fontWeight + }; + + // adjust for expanded pools AND lanes + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Lane') || isExpandedPool(element)) { + var isHorizontalLane = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isHorizontal)(element); + + var laneBounds = isHorizontalLane ? { + width: bbox.height, + height: 30 * zoom, + x: bbox.x - bbox.height / 2 + (15 * zoom), + y: mid.y - (30 * zoom) / 2 + } : { + width: bbox.width, + height: 30 * zoom + }; + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, laneBounds); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: defaultFontSize + 'px', + lineHeight: defaultLineHeight, + paddingTop: (7 * zoom) + 'px', + paddingBottom: (7 * zoom) + 'px', + paddingLeft: (5 * zoom) + 'px', + paddingRight: (5 * zoom) + 'px', + transform: isHorizontalLane ? 'rotate(-90deg)' : null + }); + } + + + // internal labels for collapsed participants + if (isCollapsedPool(element)) { + var isHorizontalPool = (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isHorizontal)(element); + + var poolBounds = isHorizontalPool ? { + width: bbox.width, + height: bbox.height + } : { + width: bbox.height, + height: bbox.width, + x: mid.x - bbox.height / 2, + y: mid.y - bbox.width / 2 + }; + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, poolBounds); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: defaultFontSize + 'px', + lineHeight: defaultLineHeight, + paddingTop: (7 * zoom) + 'px', + paddingBottom: (7 * zoom) + 'px', + paddingLeft: (5 * zoom) + 'px', + paddingRight: (5 * zoom) + 'px', + transform: isHorizontalPool ? null : 'rotate(-90deg)' + }); + } + + + // internal labels for tasks and collapsed call activities + // and sub processes + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ 'bpmn:Task', 'bpmn:CallActivity' ]) || + isCollapsedSubProcess(element)) { + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, { + width: bbox.width, + height: bbox.height + }); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: defaultFontSize + 'px', + lineHeight: defaultLineHeight, + paddingTop: (7 * zoom) + 'px', + paddingBottom: (7 * zoom) + 'px', + paddingLeft: (5 * zoom) + 'px', + paddingRight: (5 * zoom) + 'px' + }); + } + + + // internal labels for expanded sub processes + if (isExpandedSubProcess(element)) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, { + width: bbox.width, + x: bbox.x + }); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: defaultFontSize + 'px', + lineHeight: defaultLineHeight, + paddingTop: (7 * zoom) + 'px', + paddingBottom: (7 * zoom) + 'px', + paddingLeft: (5 * zoom) + 'px', + paddingRight: (5 * zoom) + 'px' + }); + } + + var width = 90 * zoom, + paddingTop = 7 * zoom, + paddingBottom = 4 * zoom; + + // external labels for events, data elements, gateways, groups and connections + if (target.labelTarget) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, { + width: width, + height: bbox.height + paddingTop + paddingBottom, + x: mid.x - width / 2, + y: bbox.y - paddingTop + }); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: externalFontSize + 'px', + lineHeight: externalLineHeight, + paddingTop: paddingTop + 'px', + paddingBottom: paddingBottom + 'px' + }); + } + + // external label not yet created + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.isLabelExternal)(target) + && !(0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.hasExternalLabel)(target) + && !(0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_4__.isLabel)(target)) { + + var externalLabelMid = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.getExternalLabelMid)(element); + + var absoluteBBox = canvas.getAbsoluteBBox({ + x: externalLabelMid.x, + y: externalLabelMid.y, + width: 0, + height: 0 + }); + + var height = externalFontSize + paddingTop + paddingBottom; + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, { + width: width, + height: height, + x: absoluteBBox.x - width / 2, + y: absoluteBBox.y - height / 2 + }); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + fontSize: externalFontSize + 'px', + lineHeight: externalLineHeight, + paddingTop: paddingTop + 'px', + paddingBottom: paddingBottom + 'px' + }); + } + + // text annotations + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(bounds, { + width: bbox.width, + height: bbox.height, + minWidth: 30 * zoom, + minHeight: 10 * zoom + }); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_2__.assign)(style, { + textAlign: 'left', + paddingTop: (5 * zoom) + 'px', + paddingBottom: (7 * zoom) + 'px', + paddingLeft: (7 * zoom) + 'px', + paddingRight: (5 * zoom) + 'px', + fontSize: defaultFontSize + 'px', + lineHeight: defaultLineHeight + }); + } + + return { bounds: bounds, style: style }; +}; + + +LabelEditingProvider.prototype.update = function( + element, newLabel, + activeContextText, bounds) { + + var newBounds, + bbox; + + if ((0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:TextAnnotation')) { + + bbox = this._canvas.getAbsoluteBBox(element); + + newBounds = { + x: element.x, + y: element.y, + width: element.width / bbox.width * bounds.width, + height: element.height / bbox.height * bounds.height + }; + } + + if (isEmptyText(newLabel)) { + newLabel = null; + } + + this._modeling.updateLabel(element, newLabel, newBounds); +}; + + + +// helpers ////////// + +function isCollapsedSubProcess(element) { + return (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:SubProcess') && !(0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isExpanded)(element); +} + +function isExpandedSubProcess(element) { + return (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:SubProcess') && (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isExpanded)(element); +} + +function isCollapsedPool(element) { + return (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Participant') && !(0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isExpanded)(element); +} +function isExpandedPool(element) { + return (0,_modeling_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Participant') && (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_3__.isExpanded)(element); +} - this._logError = function(err, template) { +function isEmptyText(label) { + return !label || !label.trim(); +} - if (typeof err === 'string') { - if (template) { - err = 'template(id: ' + template.id + ') ' + err; - } +/***/ }), - err = new Error(err); - } +/***/ "../node_modules/bpmn-js/lib/features/label-editing/cmd/UpdateLabelHandler.js": +/*!************************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/label-editing/cmd/UpdateLabelHandler.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - this._errors.push(err); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ UpdateLabelHandler) +/* harmony export */ }); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../util/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../util/LabelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - return err; - }; - this.getErrors = function() { - return this._errors; - }; - this.getValidTemplates = function() { - return this._validTemplates; - }; - } - module.exports = Validator; -// helpers /////////////////////////////////// +var NULL_DIMENSIONS = { + width: 0, + height: 0 +}; - function isDropdownChoiceValid(c) { - return 'name' in c && 'value' in c; - } +/** + * @typedef {import('../../modeling/Modeling').default} Modeling + * @typedef {import('../../../draw/TextRenderer').default} TextRenderer + * @typedef {import('../../modeling/BpmnFactory').default} BpmnFactory + * + * @typedef {import('../../../model/Types').Element} Element + */ - },{"lodash/isArray":618,"lodash/isObject":625}],58:[function(require,module,exports){ - 'use strict'; +/** + * A handler that updates the text of a BPMN element. + * + * @param {Modeling} modeling + * @param {TextRenderer} textRenderer + * @param {BpmnFactory} bpmnFactory + */ +function UpdateLabelHandler(modeling, textRenderer, bpmnFactory) { - var findExtension = require('../Helper').findExtension, - findExtensions = require('../Helper').findExtensions; + /** + * Set the label and return the changed elements. + * + * Element parameter can be label itself or connection (i.e. sequence flow). + * + * @param {Element} element + * @param {string} text + */ + function setText(element, text) { - var createCamundaProperty = require('../CreateHelper').createCamundaProperty, - createInputParameter = require('../CreateHelper').createInputParameter, - createOutputParameter = require('../CreateHelper').createOutputParameter, - createCamundaIn = require('../CreateHelper').createCamundaIn, - createCamundaOut = require('../CreateHelper').createCamundaOut, - createCamundaInWithBusinessKey = require('../CreateHelper').createCamundaInWithBusinessKey, - createCamundaExecutionListenerScript = require('../CreateHelper').createCamundaExecutionListenerScript, - createCamundaFieldInjection = require('../CreateHelper').createCamundaFieldInjection; + // external label if present + var label = element.label || element; - var forEach = require('lodash/forEach'); + var labelTarget = element.labelTarget || element; - var CAMUNDA_SERVICE_TASK_LIKE = [ - 'camunda:class', - 'camunda:delegateExpression', - 'camunda:expression' - ]; + (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.setLabel)(label, text, labelTarget !== label); - /** - * A handler that changes the modeling template of a BPMN element. - */ - function ChangeElementTemplateHandler(modeling, commandStack, bpmnFactory) { + return [ label, labelTarget ]; + } - function getOrCreateExtensionElements(element) { + function preExecute(ctx) { + var element = ctx.element, + businessObject = element.businessObject, + newLabel = ctx.newLabel; - var bo = element.businessObject; + if (!(0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.isLabel)(element) + && (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.isLabelExternal)(element) + && !(0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.hasExternalLabel)(element) + && !isEmptyText(newLabel)) { + + // create label + var paddingTop = 7; - var extensionElements = bo.extensionElements; + var labelCenter = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.getExternalLabelMid)(element); - // add extension elements - if (!extensionElements) { - extensionElements = bpmnFactory.create('bpmn:ExtensionElements', { - values: [] - }); + labelCenter = { + x: labelCenter.x, + y: labelCenter.y + paddingTop + }; - modeling.updateProperties(element, { - extensionElements: extensionElements - }); - } + modeling.createLabel(element, labelCenter, { + id: businessObject.id + '_label', + businessObject: businessObject, + di: element.di + }); + } + } - return extensionElements; - } + function execute(ctx) { + ctx.oldLabel = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.getLabel)(ctx.element); + return setText(ctx.element, ctx.newLabel); + } - function updateModelerTemplate(element, newTemplate) { - modeling.updateProperties(element, { - 'camunda:modelerTemplate': newTemplate && newTemplate.id - }); - } + function revert(ctx) { + return setText(ctx.element, ctx.oldLabel); + } - function updateIoMappings(element, newTemplate, context) { + function postExecute(ctx) { + var element = ctx.element, + label = element.label || element, + newLabel = ctx.newLabel, + newBounds = ctx.newBounds, + hints = ctx.hints || {}; - var newMappings = createInputOutputMappings(newTemplate, bpmnFactory), - oldMappings; + // ignore internal labels for elements except text annotations + if (!(0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.isLabel)(label) && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(label, 'bpmn:TextAnnotation')) { + return; + } - if (!newMappings) { - return; - } + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_1__.isLabel)(label) && isEmptyText(newLabel)) { - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: { inputOutput: newMappings } - }); - } else { - context = getOrCreateExtensionElements(element); - oldMappings = findExtension(element, 'camunda:InputOutput'); - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: context, - propertyName: 'values', - objectsToAdd: [ newMappings ], - objectsToRemove: oldMappings ? [ oldMappings ] : [] - }); - } - } + if (hints.removeShape !== false) { + modeling.removeShape(label, { unsetLabel: false }); + } - function updateCamundaField(element, newTemplate, context) { + return; + } - var newMappings = createCamundaFieldInjections(newTemplate, bpmnFactory), - oldMappings; + var text = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_0__.getLabel)(element); - if (!newMappings) { - return; - } - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: { field: newMappings } - }); - } else { - context = getOrCreateExtensionElements(element); - oldMappings = findExtensions(element, ['camunda:Field']); - - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: context, - propertyName: 'values', - objectsToAdd: newMappings, - objectsToRemove: oldMappings ? oldMappings : [] - }); - } - } + // resize element based on label _or_ pre-defined bounds + if (typeof newBounds === 'undefined') { + newBounds = textRenderer.getExternalLabelBounds(label, text); + } + // setting newBounds to false or _null_ will + // disable the postExecute resize operation + if (newBounds) { + modeling.resizeShape(label, newBounds, NULL_DIMENSIONS); + } + } - function updateCamundaProperties(element, newTemplate, context) { + // API - var newProperties = createCamundaProperties(newTemplate, bpmnFactory), - oldProperties; + this.preExecute = preExecute; + this.execute = execute; + this.revert = revert; + this.postExecute = postExecute; +} - if (!newProperties) { - return; - } +UpdateLabelHandler.$inject = [ + 'modeling', + 'textRenderer', + 'bpmnFactory' +]; - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: { properties: newProperties } - }); - } else { - context = getOrCreateExtensionElements(element); - oldProperties = findExtension(element, 'camunda:Properties'); - - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: context, - propertyName: 'values', - objectsToAdd: [ newProperties ], - objectsToRemove: oldProperties ? [ oldProperties ] : [] - }); - } - } - function updateProperties(element, newTemplate, context) { +// helpers ////////// - var newProperties = createBpmnPropertyUpdates(newTemplate, bpmnFactory); +function isEmptyText(label) { + return !label || !label.trim(); +} - var newPropertiesCount = Object.keys(newProperties).length; +/***/ }), - if (!newPropertiesCount) { - return; - } +/***/ "../node_modules/bpmn-js/lib/features/label-editing/index.js": +/*!*******************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/label-editing/index.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: newProperties - }); - } else { - modeling.updateProperties(element, newProperties); - } - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_change_support__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/features/change-support */ "../node_modules/diagram-js/lib/features/change-support/index.js"); +/* harmony import */ var diagram_js_lib_features_resize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! diagram-js/lib/features/resize */ "../node_modules/diagram-js/lib/features/resize/index.js"); +/* harmony import */ var diagram_js_direct_editing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js-direct-editing */ "../node_modules/diagram-js-direct-editing/lib/index.js"); +/* harmony import */ var _LabelEditingProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LabelEditingProvider */ "../node_modules/bpmn-js/lib/features/label-editing/LabelEditingProvider.js"); +/* harmony import */ var _LabelEditingPreview__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./LabelEditingPreview */ "../node_modules/bpmn-js/lib/features/label-editing/LabelEditingPreview.js"); - function updateInOut(element, newTemplate, context) { - var newInOut = createCamundaInOut(newTemplate, bpmnFactory), - oldInOut; - if (!newInOut) { - return; - } - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: { inout: newInOut } - }); - } else { - context = getOrCreateExtensionElements(element); - oldInOut = findExtensions(context, [ 'camunda:In', 'camunda:Out' ]); - - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: context, - propertyName: 'values', - objectsToAdd: newInOut, - objectsToRemove: oldInOut - }); - } - } - function updateExecutionListener(element, newTemplate, context) { - var newExecutionListeners = createCamundaExecutionListeners(newTemplate, bpmnFactory), - oldExecutionsListeners; - if (!newExecutionListeners.length) { - return; - } - if (context) { - commandStack.execute('properties-panel.update-businessobject', { - element: element, - businessObject: context, - properties: { executionListener: newExecutionListeners } - }); - } else { - context = getOrCreateExtensionElements(element); - oldExecutionsListeners = findExtensions(context, [ 'camunda:ExecutionListener' ]); - - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: context, - propertyName: 'values', - objectsToAdd: newExecutionListeners, - objectsToRemove: oldExecutionsListeners - }); - } - } +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_change_support__WEBPACK_IMPORTED_MODULE_1__["default"], + diagram_js_lib_features_resize__WEBPACK_IMPORTED_MODULE_2__["default"], + diagram_js_direct_editing__WEBPACK_IMPORTED_MODULE_0__["default"] + ], + __init__: [ + 'labelEditingProvider', + 'labelEditingPreview' + ], + labelEditingProvider: [ 'type', _LabelEditingProvider__WEBPACK_IMPORTED_MODULE_3__["default"] ], + labelEditingPreview: [ 'type', _LabelEditingPreview__WEBPACK_IMPORTED_MODULE_4__["default"] ] +}); - /** - * Update / recreate a scoped element. - * - * @param {djs.model.Base} element the diagram parent element - * @param {String} scopeName name of the scope, i.e. camunda:Connector - * @param {Object} scopeDefinition - */ - function updateScopeElements(element, scopeName, scopeDefinition) { - var scopeElement = bpmnFactory.create(scopeName); +/***/ }), - // update camunda:inputOutput - updateIoMappings(element, scopeDefinition, scopeElement); +/***/ "../node_modules/bpmn-js/lib/features/modeling-feedback/ModelingFeedback.js": +/*!**********************************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling-feedback/ModelingFeedback.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - // update camunda:field - updateCamundaField(element, scopeDefinition, scopeElement); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ ModelingFeedback) +/* harmony export */ }); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - // update camunda:properties - updateCamundaProperties(element, scopeDefinition, scopeElement); - // update other properties (bpmn:condition, camunda:async, ...) - updateProperties(element, scopeDefinition, scopeElement); +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('diagram-js/lib/features/tooltips/Tooltips').default} Tooltips + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + */ - // update camunda:in and camunda:out - updateInOut(element, scopeDefinition, scopeElement); +var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants'; - // update camunda:executionListener - updateExecutionListener(element, scopeDefinition, scopeElement); +/** + * @param {EventBus} eventBus + * @param {Tooltips} tooltips + * @param {Translate} translate + */ +function ModelingFeedback(eventBus, tooltips, translate) { - var extensionElements = getOrCreateExtensionElements(element); - var oldScope = findExtension(extensionElements, scopeName); + function showError(position, message, timeout) { + tooltips.add({ + position: { + x: position.x + 5, + y: position.y + 5 + }, + type: 'error', + timeout: timeout || 2000, + html: '
    ' + message + '
    ' + }); + } - commandStack.execute('properties-panel.update-businessobject-list', { - element: element, - currentObject: extensionElements, - propertyName: 'values', - objectsToAdd: [ scopeElement ], - objectsToRemove: oldScope ? [ oldScope ] : [] - }); - } + eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) { + var context = event.context, + shape = context.shape, + target = context.target; - /** - * Compose an element template change action, updating all - * necessary underlying properties. - * - * @param {Object} context - * @param {Object} context.element - * @param {Object} context.oldTemplate - * @param {Object} context.newTemplate - */ - this.preExecute = function(context) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(target, 'bpmn:Collaboration') && (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_0__.is)(shape, 'bpmn:FlowNode')) { + showError(event, translate(COLLAB_ERR_MSG)); + } + }); - var element = context.element, - newTemplate = context.newTemplate; +} - // update camunda:modelerTemplate attribute - updateModelerTemplate(element, newTemplate); +ModelingFeedback.$inject = [ + 'eventBus', + 'tooltips', + 'translate' +]; - if (newTemplate) { - // update camunda:inputOutput - updateIoMappings(element, newTemplate); +/***/ }), - // update camunda:field - updateCamundaField(element, newTemplate); +/***/ "../node_modules/bpmn-js/lib/features/modeling-feedback/index.js": +/*!***********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling-feedback/index.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - // update camunda:properties - updateCamundaProperties(element, newTemplate); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var diagram_js_lib_features_tooltips__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/features/tooltips */ "../node_modules/diagram-js/lib/features/tooltips/index.js"); +/* harmony import */ var _ModelingFeedback__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ModelingFeedback */ "../node_modules/bpmn-js/lib/features/modeling-feedback/ModelingFeedback.js"); - // update other properties (bpmn:condition, camunda:async, ...) - updateProperties(element, newTemplate); - // update camunda:in and camunda:out - updateInOut(element, newTemplate); - // update camunda:executionListener - updateExecutionListener(element, newTemplate); - // loop on scopes properties - forEach(newTemplate.scopes, function(scopeDefinition, scopeName) { - updateScopeElements(element, scopeName, scopeDefinition); - }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __depends__: [ + diagram_js_lib_features_tooltips__WEBPACK_IMPORTED_MODULE_0__["default"] + ], + __init__: [ + 'modelingFeedback' + ], + modelingFeedback: [ 'type', _ModelingFeedback__WEBPACK_IMPORTED_MODULE_1__["default"] ] +}); - } - }; - } +/***/ }), - ChangeElementTemplateHandler.$inject = [ 'modeling', 'commandStack', 'bpmnFactory' ]; +/***/ "../node_modules/bpmn-js/lib/features/modeling/BpmnFactory.js": +/*!********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling/BpmnFactory.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - module.exports = ChangeElementTemplateHandler; +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnFactory) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var _util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); -// helpers ///////////////////////////// - function createBpmnPropertyUpdates(template, bpmnFactory) { - var propertyUpdates = {}; - template.properties.forEach(function(p) { +/** + * @typedef {import('../../model/Types').Moddle} Moddle + * @typedef {import('../../model/Types').ModdleElement} ModdleElement + * + * @typedef {import('diagram-js/lib/util/Types').Point} Point + */ - var binding = p.binding, - bindingTarget = binding.name, - propertyValue; +/** + * A factory for BPMN elements. + * + * @param {Moddle} moddle + */ +function BpmnFactory(moddle) { + this._model = moddle; +} - if (binding.type === 'property') { +BpmnFactory.$inject = [ 'moddle' ]; - if (bindingTarget === 'conditionExpression') { - propertyValue = bpmnFactory.create('bpmn:FormalExpression', { - body: p.value, - language: binding.scriptFormat - }); - } else { - propertyValue = p.value; - } +/** + * @param {ModdleElement} element + * + * @return {boolean} + */ +BpmnFactory.prototype._needsId = function(element) { + return (0,_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ + 'bpmn:RootElement', + 'bpmn:FlowElement', + 'bpmn:MessageFlow', + 'bpmn:DataAssociation', + 'bpmn:Artifact', + 'bpmn:Participant', + 'bpmn:Lane', + 'bpmn:LaneSet', + 'bpmn:Process', + 'bpmn:Collaboration', + 'bpmndi:BPMNShape', + 'bpmndi:BPMNEdge', + 'bpmndi:BPMNDiagram', + 'bpmndi:BPMNPlane', + 'bpmn:Property', + 'bpmn:CategoryValue' + ]); +}; + +/** + * @param {ModdleElement} element + */ +BpmnFactory.prototype._ensureId = function(element) { + if (element.id) { + this._model.ids.claim(element.id, element); + return; + } + + // generate semantic ids for elements + // bpmn:SequenceFlow -> SequenceFlow_ID + var prefix; + + if ((0,_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Activity')) { + prefix = 'Activity'; + } else if ((0,_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Event')) { + prefix = 'Event'; + } else if ((0,_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.is)(element, 'bpmn:Gateway')) { + prefix = 'Gateway'; + } else if ((0,_util_ModelingUtil__WEBPACK_IMPORTED_MODULE_0__.isAny)(element, [ 'bpmn:SequenceFlow', 'bpmn:MessageFlow' ])) { + prefix = 'Flow'; + } else { + prefix = (element.$type || '').replace(/^[^:]*:/g, ''); + } + + prefix += '_'; + + if (!element.id && this._needsId(element)) { + element.id = this._model.ids.nextPrefixed(prefix, element); + } +}; + +/** + * Create BPMN element. + * + * @param {string} type + * @param {Object} [attrs] + * + * @return {ModdleElement} + */ +BpmnFactory.prototype.create = function(type, attrs) { + var element = this._model.create(type, attrs || {}); - // assigning camunda:async to true|false - // assigning bpmn:conditionExpression to { $type: 'bpmn:FormalExpression', ... } - propertyUpdates[bindingTarget] = propertyValue; - - // make sure we unset other "implementation types" - // when applying a camunda:class template onto a preconfigured - // camunda:delegateExpression element - if (CAMUNDA_SERVICE_TASK_LIKE.indexOf(bindingTarget) !== -1) { - CAMUNDA_SERVICE_TASK_LIKE.forEach(function(prop) { - if (prop !== bindingTarget) { - propertyUpdates[prop] = undefined; - } - }); - } - } - }); + this._ensureId(element); - return propertyUpdates; - } + return element; +}; - function createCamundaFieldInjections(template, bpmnFactory) { - var injections = []; +/** + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiLabel = function() { + return this.create('bpmndi:BPMNLabel', { + bounds: this.createDiBounds() + }); +}; + +/** + * @param {ModdleElement} semantic + * @param {Object} [attrs] + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiShape = function(semantic, attrs) { + return this.create('bpmndi:BPMNShape', (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)({ + bpmnElement: semantic, + bounds: this.createDiBounds() + }, attrs)); +}; + +/** + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiBounds = function(bounds) { + return this.create('dc:Bounds', bounds); +}; - template.properties.forEach(function(p) { - var binding = p.binding, - bindingType = binding.type; - if (bindingType === 'camunda:field') { - injections.push(createCamundaFieldInjection( - binding, p.value, bpmnFactory - )); - } - }); +/** + * @param {Point[]} waypoints + * + * @return {ModdleElement[]} + */ +BpmnFactory.prototype.createDiWaypoints = function(waypoints) { + var self = this; - if (injections.length) { - return injections; - } - } + return (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.map)(waypoints, function(pos) { + return self.createDiWaypoint(pos); + }); +}; - function createCamundaProperties(template, bpmnFactory) { +/** + * @param {Point} point + * + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiWaypoint = function(point) { + return this.create('dc:Point', (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.pick)(point, [ 'x', 'y' ])); +}; - var properties = []; +/** + * @param {ModdleElement} semantic + * @param {Object} [attrs] + * + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiEdge = function(semantic, attrs) { + return this.create('bpmndi:BPMNEdge', (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)({ + bpmnElement: semantic, + waypoint: this.createDiWaypoints([]) + }, attrs)); +}; + +/** + * @param {ModdleElement} semantic + * @param {Object} [attrs] + * + * @return {ModdleElement} + */ +BpmnFactory.prototype.createDiPlane = function(semantic, attrs) { + return this.create('bpmndi:BPMNPlane', (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)({ + bpmnElement: semantic + }, attrs)); +}; - template.properties.forEach(function(p) { - var binding = p.binding, - bindingType = binding.type; - if (bindingType === 'camunda:property') { - properties.push(createCamundaProperty( - binding, p.value, bpmnFactory - )); - } - }); +/***/ }), - if (properties.length) { - return bpmnFactory.create('camunda:Properties', { - values: properties - }); - } - } +/***/ "../node_modules/bpmn-js/lib/features/modeling/BpmnLayouter.js": +/*!*********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling/BpmnLayouter.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - function createInputOutputMappings(template, bpmnFactory) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnLayouter) +/* harmony export */ }); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var diagram_js_lib_layout_BaseLayouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! diagram-js/lib/layout/BaseLayouter */ "../node_modules/diagram-js/lib/layout/BaseLayouter.js"); +/* harmony import */ var diagram_js_lib_layout_ManhattanLayout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! diagram-js/lib/layout/ManhattanLayout */ "../node_modules/diagram-js/lib/layout/ManhattanLayout.js"); +/* harmony import */ var diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! diagram-js/lib/layout/LayoutUtil */ "../node_modules/diagram-js/lib/layout/LayoutUtil.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/ModelUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); - var inputParameters = [], - outputParameters = []; - template.properties.forEach(function(p) { - var binding = p.binding, - bindingType = binding.type; - if (bindingType === 'camunda:inputParameter') { - inputParameters.push(createInputParameter( - binding, p.value, bpmnFactory - )); - } - if (bindingType === 'camunda:outputParameter') { - outputParameters.push(createOutputParameter( - binding, p.value, bpmnFactory - )); - } - }); - // do we need to create new ioMappings (?) - if (outputParameters.length || inputParameters.length) { - return bpmnFactory.create('camunda:InputOutput', { - inputParameters: inputParameters, - outputParameters: outputParameters - }); - } - } - function createCamundaInOut(template, bpmnFactory) { - var inOuts = []; - template.properties.forEach(function(p) { - var binding = p.binding, - bindingType = binding.type; - if (bindingType === 'camunda:in') { - inOuts.push(createCamundaIn( - binding, p.value, bpmnFactory - )); - } else - if (bindingType === 'camunda:out') { - inOuts.push(createCamundaOut( - binding, p.value, bpmnFactory - )); - } else - if (bindingType === 'camunda:in:businessKey') { - inOuts.push(createCamundaInWithBusinessKey( - binding, p.value, bpmnFactory - )); - } - }); - return inOuts; - } - function createCamundaExecutionListeners(template, bpmnFactory) { - var executionListener = []; - template.properties.forEach(function(p) { - var binding = p.binding, - bindingType = binding.type; +/** + * @typedef {import('diagram-js/lib/util/Types').Point} Point + * + * @typedef {import('../../model/Types').Connection} Connection + * @typedef {import('../../model/Types').Element} Element + * + * @typedef {import('diagram-js/lib/layout/BaseLayouter').LayoutConnectionHints} LayoutConnectionHints + * + * @typedef { { + * source?: Element; + * target?: Element; + * waypoints?: Point[]; + * connectionStart?: Point; + * connectionEnd?: Point; + * } & LayoutConnectionHints } BpmnLayoutConnectionHints + */ - if (bindingType === 'camunda:executionListener') { - executionListener.push(createCamundaExecutionListenerScript( - binding, p.value, bpmnFactory - )); - } - }); +var ATTACH_ORIENTATION_PADDING = -10, + BOUNDARY_TO_HOST_THRESHOLD = 40; + +var oppositeOrientationMapping = { + 'top': 'bottom', + 'top-right': 'bottom-left', + 'top-left': 'bottom-right', + 'right': 'left', + 'bottom': 'top', + 'bottom-right': 'top-left', + 'bottom-left': 'top-right', + 'left': 'right' +}; + +var orientationDirectionMapping = { + top: 't', + right: 'r', + bottom: 'b', + left: 'l' +}; + +function BpmnLayouter() {} + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_0__["default"])(BpmnLayouter, diagram_js_lib_layout_BaseLayouter__WEBPACK_IMPORTED_MODULE_1__["default"]); + +/** + * Returns waypoints of laid out connection. + * + * @param {Connection} connection + * @param {BpmnLayoutConnectionHints} [hints] + * + * @return {Point[]} + */ +BpmnLayouter.prototype.layoutConnection = function(connection, hints) { + if (!hints) { + hints = {}; + } + + var source = hints.source || connection.source, + target = hints.target || connection.target, + waypoints = hints.waypoints || connection.waypoints, + connectionStart = hints.connectionStart, + connectionEnd = hints.connectionEnd; + + var manhattanOptions, + updatedWaypoints; + + if (!connectionStart) { + connectionStart = getConnectionDocking(waypoints && waypoints[ 0 ], source); + } + + if (!connectionEnd) { + connectionEnd = getConnectionDocking(waypoints && waypoints[ waypoints.length - 1 ], target); + } + + // TODO(nikku): support vertical modeling + // and invert preferredLayouts accordingly + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(connection, 'bpmn:Association') || + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(connection, 'bpmn:DataAssociation')) { + + if (waypoints && !isCompensationAssociation(source, target)) { + return [].concat([ connectionStart ], waypoints.slice(1, -1), [ connectionEnd ]); + } + } + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(connection, 'bpmn:MessageFlow')) { + manhattanOptions = getMessageFlowManhattanOptions(source, target); + } else if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(connection, 'bpmn:SequenceFlow') || isCompensationAssociation(source, target)) { + + // layout all connection between flow elements h:h, except for + // (1) outgoing of boundary events -> layout based on attach orientation and target orientation + // (2) incoming/outgoing of gateways -> v:h for outgoing, h:v for incoming + // (3) loops + if (source === target) { + manhattanOptions = { + preferredLayouts: getLoopPreferredLayout(source, connection) + }; + } else if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(source, 'bpmn:BoundaryEvent')) { + manhattanOptions = { + preferredLayouts: getBoundaryEventPreferredLayouts(source, target, connectionEnd) + }; + } else if (isExpandedSubProcess(source) || isExpandedSubProcess(target)) { + manhattanOptions = getSubProcessManhattanOptions(source); + } else if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(source, 'bpmn:Gateway')) { + manhattanOptions = { + preferredLayouts: [ 'v:h' ] + }; + } else if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Gateway')) { + manhattanOptions = { + preferredLayouts: [ 'h:v' ] + }; + } else { + manhattanOptions = { + preferredLayouts: [ 'h:h' ] + }; + } + } + + if (manhattanOptions) { + manhattanOptions = (0,min_dash__WEBPACK_IMPORTED_MODULE_3__.assign)(manhattanOptions, hints); + + updatedWaypoints = (0,diagram_js_lib_layout_ManhattanLayout__WEBPACK_IMPORTED_MODULE_4__.withoutRedundantPoints)((0,diagram_js_lib_layout_ManhattanLayout__WEBPACK_IMPORTED_MODULE_4__.repairConnection)( + source, + target, + connectionStart, + connectionEnd, + waypoints, + manhattanOptions + )); + } + + return updatedWaypoints || [ connectionStart, connectionEnd ]; +}; + + +// helpers ////////// + +function getAttachOrientation(attachedElement) { + var hostElement = attachedElement.host; + + return (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getOrientation)((0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getMid)(attachedElement), hostElement, ATTACH_ORIENTATION_PADDING); +} + +function getMessageFlowManhattanOptions(source, target) { + return { + preferredLayouts: [ 'straight', 'v:v' ], + preserveDocking: getMessageFlowPreserveDocking(source, target) + }; +} + +function getMessageFlowPreserveDocking(source, target) { + + // (1) docking element connected to participant has precedence + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Participant')) { + return 'source'; + } + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(source, 'bpmn:Participant')) { + return 'target'; + } + + // (2) docking element connected to expanded sub-process has precedence + if (isExpandedSubProcess(target)) { + return 'source'; + } + + if (isExpandedSubProcess(source)) { + return 'target'; + } + + // (3) docking event has precedence + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Event')) { + return 'target'; + } + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(source, 'bpmn:Event')) { + return 'source'; + } + + return null; +} + +function getSubProcessManhattanOptions(source) { + return { + preferredLayouts: [ 'straight', 'h:h' ], + preserveDocking: getSubProcessPreserveDocking(source) + }; +} + +function getSubProcessPreserveDocking(source) { + return isExpandedSubProcess(source) ? 'target' : 'source'; +} + +function getConnectionDocking(point, shape) { + return point ? (point.original || point) : (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getMid)(shape); +} + +function isCompensationAssociation(source, target) { + return (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(target, 'bpmn:Activity') && + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(source, 'bpmn:BoundaryEvent') && + target.businessObject.isForCompensation; +} + +function isExpandedSubProcess(element) { + return (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:SubProcess') && (0,_util_DiUtil__WEBPACK_IMPORTED_MODULE_6__.isExpanded)(element); +} + +function isSame(a, b) { + return a === b; +} - return executionListener; - } +function isAnyOrientation(orientation, orientations) { + return orientations.indexOf(orientation) !== -1; +} - },{"../CreateHelper":52,"../Helper":56,"lodash/forEach":613}],59:[function(require,module,exports){ - 'use strict'; +function getHorizontalOrientation(orientation) { + var matches = /right|left/.exec(orientation); - var ChangeElementTemplateHandler = require('./ChangeElementTemplateHandler'); + return matches && matches[0]; +} - var getTemplate = require('../Helper').getTemplate, - getDefaultTemplate = require('../Helper').getDefaultTemplate; +function getVerticalOrientation(orientation) { + var matches = /top|bottom/.exec(orientation); - function registerHandlers(commandStack, elementTemplates, eventBus, elementRegistry) { - commandStack.registerHandler( - 'propertiesPanel.camunda.changeTemplate', - ChangeElementTemplateHandler - ); + return matches && matches[0]; +} - // apply default element templates on shape creation - eventBus.on([ 'commandStack.shape.create.postExecuted' ], function(context) { - applyDefaultTemplate(context.context.shape, elementTemplates, commandStack); - }); +function isOppositeOrientation(a, b) { + return oppositeOrientationMapping[a] === b; +} - // apply default element templates on connection creation - eventBus.on([ 'commandStack.connection.create.postExecuted' ], function(context) { - applyDefaultTemplate(context.context.connection, elementTemplates, commandStack); - }); - } +function isOppositeHorizontalOrientation(a, b) { + var horizontalOrientation = getHorizontalOrientation(a); - registerHandlers.$inject = [ 'commandStack', 'elementTemplates', 'eventBus', 'elementRegistry' ]; + var oppositeHorizontalOrientation = oppositeOrientationMapping[horizontalOrientation]; + return b.indexOf(oppositeHorizontalOrientation) !== -1; +} - module.exports = { - __init__: [ registerHandlers ] - }; +function isOppositeVerticalOrientation(a, b) { + var verticalOrientation = getVerticalOrientation(a); + var oppositeVerticalOrientation = oppositeOrientationMapping[verticalOrientation]; + + return b.indexOf(oppositeVerticalOrientation) !== -1; +} + +function isHorizontalOrientation(orientation) { + return orientation === 'right' || orientation === 'left'; +} + +function getLoopPreferredLayout(source, connection) { + var waypoints = connection.waypoints; + + var orientation = waypoints && waypoints.length && (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getOrientation)(waypoints[0], source); - function applyDefaultTemplate(element, elementTemplates, commandStack) { + if (orientation === 'top') { + return [ 't:r' ]; + } else if (orientation === 'right') { + return [ 'r:b' ]; + } else if (orientation === 'left') { + return [ 'l:t' ]; + } - if (!getTemplate(element, elementTemplates) - && getDefaultTemplate(element, elementTemplates)) { + return [ 'b:l' ]; +} + +function getBoundaryEventPreferredLayouts(source, target, end) { + var sourceMid = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getMid)(source), + targetMid = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getMid)(target), + attachOrientation = getAttachOrientation(source), + sourceLayout, + targetLayout; - var command = 'propertiesPanel.camunda.changeTemplate'; - var commandContext = { - element: element, - newTemplate: getDefaultTemplate(element, elementTemplates) - }; + var isLoop = isSame(source.host, target); - commandStack.execute(command, commandContext); - } - } + var attachedToSide = isAnyOrientation(attachOrientation, [ 'top', 'right', 'bottom', 'left' ]); - },{"../Helper":56,"./ChangeElementTemplateHandler":58}],60:[function(require,module,exports){ - module.exports = { - __depends__: [ - require('./cmd'), - require('diagram-js/lib/i18n/translate').default - ], - __init__: [ - 'customElementsPropertiesActivator', - 'elementTemplatesLoader' - ], - customElementsPropertiesActivator: [ 'type', require('./CustomElementsPropertiesActivator') ], - elementTemplates: [ 'type', require('./ElementTemplates') ], - elementTemplatesLoader: [ 'type', require('./ElementTemplatesLoader') ] - }; + var targetOrientation = (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getOrientation)(targetMid, sourceMid, { + x: source.width / 2 + target.width / 2, + y: source.height / 2 + target.height / 2 + }); + + if (isLoop) { + return getBoundaryEventLoopLayout(attachOrientation, attachedToSide, source, target, end); + } + + // source layout + sourceLayout = getBoundaryEventSourceLayout(attachOrientation, targetOrientation, attachedToSide); - },{"./CustomElementsPropertiesActivator":53,"./ElementTemplates":54,"./ElementTemplatesLoader":55,"./cmd":59,"diagram-js/lib/i18n/translate":401}],61:[function(require,module,exports){ - 'use strict'; + // target layout + targetLayout = getBoundaryEventTargetLayout(attachOrientation, targetOrientation, attachedToSide); - var entryFactory = require('../../../../factory/EntryFactory'), - is = require('bpmn-js/lib/util/ModelUtil').is, - getTemplate = require('../Helper').getTemplate, - getTemplateId = require('../Helper').getTemplateId; + return [ sourceLayout + ':' + targetLayout ]; +} + +function getBoundaryEventLoopLayout(attachOrientation, attachedToSide, source, target, end) { + var orientation = attachedToSide ? attachOrientation : getVerticalOrientation(attachOrientation), + sourceLayout = orientationDirectionMapping[ orientation ], + targetLayout; + + if (attachedToSide) { + if (isHorizontalOrientation(attachOrientation)) { + targetLayout = shouldConnectToSameSide('y', source, target, end) ? 'h' : 'b'; + } else { + targetLayout = shouldConnectToSameSide('x', source, target, end) ? 'v' : 'l'; + } + } else { + targetLayout = 'v'; + } - var find = require('lodash/find'); + return [ sourceLayout + ':' + targetLayout ]; +} + +function shouldConnectToSameSide(axis, source, target, end) { + var threshold = BOUNDARY_TO_HOST_THRESHOLD; + + return !( + areCloseOnAxis(axis, end, target, threshold) || + areCloseOnAxis(axis, end, { + x: target.x + target.width, + y: target.y + target.height + }, threshold) || + areCloseOnAxis(axis, end, (0,diagram_js_lib_layout_LayoutUtil__WEBPACK_IMPORTED_MODULE_5__.getMid)(source), threshold) + ); +} + +function areCloseOnAxis(axis, a, b, threshold) { + return Math.abs(a[ axis ] - b[ axis ]) < threshold; +} - var TEMPLATE_ATTR = require('../Helper').TEMPLATE_ATTR; +function getBoundaryEventSourceLayout(attachOrientation, targetOrientation, attachedToSide) { - function isAny(element, types) { - return types.reduce(function(result, type) { - return result || is(element, type); - }, false); - } + // attached to either top, right, bottom or left side + if (attachedToSide) { + return orientationDirectionMapping[ attachOrientation ]; + } + // attached to either top-right, top-left, bottom-right or bottom-left corner - module.exports = function(group, element, elementTemplates, translate) { + // same vertical or opposite horizontal orientation + if (isSame( + getVerticalOrientation(attachOrientation), getVerticalOrientation(targetOrientation) + ) || isOppositeOrientation( + getHorizontalOrientation(attachOrientation), getHorizontalOrientation(targetOrientation) + )) { + return orientationDirectionMapping[ getVerticalOrientation(attachOrientation) ]; + } - var options = getTemplateOptions(element, elementTemplates, translate); + // fallback + return orientationDirectionMapping[ getHorizontalOrientation(attachOrientation) ]; +} - if (options.length === 1 && !options[0].isDefault) { - return; - } +function getBoundaryEventTargetLayout(attachOrientation, targetOrientation, attachedToSide) { - // select element template (via dropdown) - group.entries.push(entryFactory.selectBox({ - id: 'elementTemplate-chooser', - label: translate('Element Template'), - modelProperty: 'camunda:modelerTemplate', - selectOptions: options, - set: function(element, properties) { - return applyTemplate(element, properties[TEMPLATE_ATTR], elementTemplates); - }, - disabled: function() { - var template = getTemplate(element, elementTemplates); + // attached to either top, right, bottom or left side + if (attachedToSide) { + if (isHorizontalOrientation(attachOrientation)) { - return template && isDefaultTemplate(template); - } - })); + // orientation is right or left - }; + // opposite horizontal orientation or same orientation + if ( + isOppositeHorizontalOrientation(attachOrientation, targetOrientation) || + isSame(attachOrientation, targetOrientation) + ) { + return 'h'; + } + // fallback + return 'v'; + } else { -// helpers ////////////////////////////////////// + // orientation is top or bottom - function applyTemplate(element, newTemplateId, elementTemplates) { + // opposite vertical orientation or same orientation + if ( + isOppositeVerticalOrientation(attachOrientation, targetOrientation) || + isSame(attachOrientation, targetOrientation) + ) { + return 'v'; + } - // cleanup - // clear input output mappings - // undo changes to properties defined in template + // fallback + return 'h'; + } + } - // re-establish - // set input output mappings - // apply changes to properties as defined in new template + // attached to either top-right, top-left, bottom-right or bottom-left corner - var oldTemplate = getTemplate(element, elementTemplates), - newTemplate = elementTemplates.get(newTemplateId); + // orientation is right, left + // or same vertical orientation but also right or left + if (isHorizontalOrientation(targetOrientation) || + (isSame(getVerticalOrientation(attachOrientation), getVerticalOrientation(targetOrientation)) && + getHorizontalOrientation(targetOrientation))) { + return 'h'; + } else { + return 'v'; + } +} - if (oldTemplate === newTemplate) { - return; - } - return { - cmd: 'propertiesPanel.camunda.changeTemplate', - context: { - element: element, - oldTemplate: oldTemplate, - newTemplate: newTemplate - } - }; - } +/***/ }), - function getTemplateOptions(element, elementTemplates, translate) { +/***/ "../node_modules/bpmn-js/lib/features/modeling/BpmnUpdater.js": +/*!********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling/BpmnUpdater.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - var currentTemplateId = getTemplateId(element); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ BpmnUpdater) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! diagram-js/lib/util/Collections */ "../node_modules/diagram-js/lib/util/Collections.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/diagram-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/DrilldownUtil */ "../node_modules/bpmn-js/lib/util/DrilldownUtil.js"); +/* harmony import */ var diagram_js_lib_util_PositionUtil__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! diagram-js/lib/util/PositionUtil */ "../node_modules/diagram-js/lib/util/PositionUtil.js"); +/* harmony import */ var diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/command/CommandInterceptor */ "../node_modules/diagram-js/lib/command/CommandInterceptor.js"); - var emptyOption = { - name: '', - value: '' - }; - var allOptions = elementTemplates.getAll().reduce(function(templates, t) { - if (!isAny(element, t.appliesTo)) { - return templates; - } - return templates.concat({ - name: translate(t.name), - value: t.id, - isDefault: t.isDefault - }); - }, [ emptyOption ]); - var defaultOption = find(allOptions, function(option) { - return isDefaultTemplate(option); - }); - var currentOption = find(allOptions, function(option) { - return option.value === currentTemplateId; - }); - if (currentTemplateId && !currentOption) { - currentOption = unknownTemplate(currentTemplateId, translate); - allOptions.push(currentOption); - } - if (!defaultOption) { - // return all options, including empty - // and optionally unknownTemplate option - return allOptions; - } - // special limited handling for - // default options - var options = []; - // current template not set - if (!currentTemplateId) { - options.push({ - name: '', - value: '' - }); - } - // current template not default - if (currentOption && currentOption !== defaultOption) { - options.push(currentOption); - } - options.push(defaultOption); - // [ (empty), (current), defaultOption ] - return options; - } - function unknownTemplate(templateId, translate) { - return { - name: translate('[unknown template: {templateId}]', { templateId: templateId }), - value: templateId - }; - } - function isDefaultTemplate(elementTemplate) { - return elementTemplate.isDefault; - } - },{"../../../../factory/EntryFactory":14,"../Helper":56,"bpmn-js/lib/util/ModelUtil":240,"lodash/find":610}],62:[function(require,module,exports){ - 'use strict'; - - var assign = require('lodash/assign'); - - var entryFactory = require('../../../../factory/EntryFactory'), - getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - getTemplate = require('../Helper').getTemplate, - cmdHelper = require('../../../../helper/CmdHelper'), - elementHelper = require('../../../../helper/ElementHelper'); - - var findExtension = require('../Helper').findExtension, - findExtensions = require('../Helper').findExtensions, - findInputParameter = require('../Helper').findInputParameter, - findOutputParameter = require('../Helper').findOutputParameter, - findCamundaProperty = require('../Helper').findCamundaProperty, - findCamundaInOut = require('../Helper').findCamundaInOut; - - var createCamundaProperty = require('../CreateHelper').createCamundaProperty, - createInputParameter = require('../CreateHelper').createInputParameter, - createOutputParameter = require('../CreateHelper').createOutputParameter, - createCamundaIn = require('../CreateHelper').createCamundaIn, - createCamundaOut = require('../CreateHelper').createCamundaOut, - createCamundaInWithBusinessKey = require('../CreateHelper').createCamundaInWithBusinessKey, - createCamundaFieldInjection = require('../CreateHelper').createCamundaFieldInjection; - - var CAMUNDA_PROPERTY_TYPE = 'camunda:property', - CAMUNDA_INPUT_PARAMETER_TYPE = 'camunda:inputParameter', - CAMUNDA_OUTPUT_PARAMETER_TYPE = 'camunda:outputParameter', - CAMUNDA_IN_TYPE = 'camunda:in', - CAMUNDA_OUT_TYPE = 'camunda:out', - CAMUNDA_IN_BUSINESS_KEY_TYPE = 'camunda:in:businessKey', - CAMUNDA_EXECUTION_LISTENER_TYPE = 'camunda:executionListener', - CAMUNDA_FIELD = 'camunda:field'; - - var BASIC_MODDLE_TYPES = [ - 'Boolean', - 'Integer', - 'String' - ]; +/** + * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus + * @typedef {import('./BpmnFactory').default} BpmnFactory + * @typedef {import('diagram-js/lib/layout/CroppingConnectionDocking').default} CroppingConnectionDocking + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * + * @typedef {import('../../model/Types').Connection} Connection + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types').Parent} Parent + * @typedef {import('../../model/Types').ModdleElement} ModdleElement + */ - var EXTENSION_BINDING_TYPES = [ - CAMUNDA_PROPERTY_TYPE, - CAMUNDA_INPUT_PARAMETER_TYPE, - CAMUNDA_OUTPUT_PARAMETER_TYPE, - CAMUNDA_IN_TYPE, - CAMUNDA_OUT_TYPE, - CAMUNDA_IN_BUSINESS_KEY_TYPE, - CAMUNDA_FIELD - ]; +/** + * A handler responsible for updating the underlying BPMN 2.0 XML & DI + * once changes on the diagram happen. + * + * @param {EventBus} eventBus + * @param {BpmnFactory} bpmnFactory + * @param {CroppingConnectionDocking} connectionDocking + * @param {Translate} translate + */ +function BpmnUpdater( + eventBus, + bpmnFactory, + connectionDocking, + translate +) { - var IO_BINDING_TYPES = [ - CAMUNDA_INPUT_PARAMETER_TYPE, - CAMUNDA_OUTPUT_PARAMETER_TYPE - ]; + diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"].call(this, eventBus); - var IN_OUT_BINDING_TYPES = [ - CAMUNDA_IN_TYPE, - CAMUNDA_OUT_TYPE, - CAMUNDA_IN_BUSINESS_KEY_TYPE - ]; + this._bpmnFactory = bpmnFactory; + this._translate = translate; - /** - * Injects custom properties into the given group. - * - * @param {djs.model.Base} element - * @param {ElementTemplates} elementTemplates - * @param {BpmnFactory} bpmnFactory - * @param {Function} translate - */ - module.exports = function(element, elementTemplates, bpmnFactory, translate) { + var self = this; - var template = getTemplate(element, elementTemplates); - if (!template) { - return []; - } - var renderCustomField = function(id, p, idx) { - var propertyType = p.type; + // connection cropping ////////////////////// - var entryOptions = { - id: id, - description: p.description, - label: p.label ? translate(p.label) : p.label, - modelProperty: id, - get: propertyGetter(id, p), - set: propertySetter(id, p, bpmnFactory), - validate: propertyValidator(id, p, translate) - }; + // crop connection ends during create/update + function cropConnection(e) { + var context = e.context, + hints = context.hints || {}, + connection; - var entry; + if (!context.cropped && hints.createElementsBehavior !== false) { + connection = context.connection; + connection.waypoints = connectionDocking.getCroppedWaypoints(connection); + context.cropped = true; + } + } - if (propertyType === 'Boolean') { - entry = entryFactory.checkbox(entryOptions); - } + this.executed([ + 'connection.layout', + 'connection.create' + ], cropConnection); - if (propertyType === 'String') { - entry = entryFactory.textField(entryOptions); - } + this.reverted([ 'connection.layout' ], function(e) { + delete e.context.cropped; + }); - if (propertyType === 'Text') { - entry = entryFactory.textBox(entryOptions); - } - if (propertyType === 'Dropdown') { - entryOptions.selectOptions = p.choices; - entry = entryFactory.selectBox(entryOptions); - } + // BPMN + DI update ////////////////////// - return entry; - }; - var groups = []; - var id, entry; + // update parent + function updateParent(e) { + var context = e.context; - var customFieldsGroup = { - id: 'customField', - label: translate('Custom Fields'), - entries: [] - }; - template.properties.forEach(function(p, idx) { + self.updateParent(context.shape || context.connection, context.oldParent); + } - id = 'custom-' + template.id + '-' + idx; + function reverseUpdateParent(e) { + var context = e.context; - entry = renderCustomField(id, p, idx); - if (entry) { - customFieldsGroup.entries.push(entry); - } - }); - if (customFieldsGroup.entries.length > 0) { - groups.push(customFieldsGroup); - } + var element = context.shape || context.connection, - if (template.scopes) { - for (var scopeName in template.scopes) { + // oldParent is the (old) new parent, because we are undoing + oldParent = context.parent || context.newParent; - var scope = template.scopes[scopeName]; - var idScopeName = scopeName.replace(/:/g, '_'); + self.updateParent(element, oldParent); + } - var customScopeFieldsGroup = { - id: 'customField-' + idScopeName, - label: translate('Custom Fields for scope: ') + scopeName, - entries: [] - }; + this.executed([ + 'shape.move', + 'shape.create', + 'shape.delete', + 'connection.create', + 'connection.move', + 'connection.delete' + ], ifBpmn(updateParent)); - scope.properties.forEach(function(p, idx) { + this.reverted([ + 'shape.move', + 'shape.create', + 'shape.delete', + 'connection.create', + 'connection.move', + 'connection.delete' + ], ifBpmn(reverseUpdateParent)); - var propertyId = 'custom-' + template.id + '-' + idScopeName + '-' + idx; + /* + * ## Updating Parent + * + * When morphing a Process into a Collaboration or vice-versa, + * make sure that both the *semantic* and *di* parent of each element + * is updated. + * + */ + function updateRoot(event) { + var context = event.context, + oldRoot = context.oldRoot, + children = oldRoot.children; + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.forEach)(children, function(child) { + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(child, 'bpmn:BaseElement')) { + self.updateParent(child); + } + }); + } + + this.executed([ 'canvas.updateRoot' ], updateRoot); + this.reverted([ 'canvas.updateRoot' ], updateRoot); + + + // update bounds + function updateBounds(e) { + var shape = e.context.shape; + + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(shape, 'bpmn:BaseElement')) { + return; + } + + self.updateBounds(shape); + } + + this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], ifBpmn(function(event) { + + // exclude labels because they're handled separately during shape.changed + if (event.context.shape.type === 'label') { + return; + } + + updateBounds(event); + })); + + this.reverted([ 'shape.move', 'shape.create', 'shape.resize' ], ifBpmn(function(event) { + + // exclude labels because they're handled separately during shape.changed + if (event.context.shape.type === 'label') { + return; + } + + updateBounds(event); + })); + + // Handle labels separately. This is necessary, because the label bounds have to be updated + // every time its shape changes, not only on move, create and resize. + eventBus.on('shape.changed', function(event) { + if (event.element.type === 'label') { + updateBounds({ context: { shape: event.element } }); + } + }); + + // attach / detach connection + function updateConnection(e) { + self.updateConnection(e.context); + } + + this.executed([ + 'connection.create', + 'connection.move', + 'connection.delete', + 'connection.reconnect' + ], ifBpmn(updateConnection)); + + this.reverted([ + 'connection.create', + 'connection.move', + 'connection.delete', + 'connection.reconnect' + ], ifBpmn(updateConnection)); + + + // update waypoints + function updateConnectionWaypoints(e) { + self.updateConnectionWaypoints(e.context.connection); + } + + this.executed([ + 'connection.layout', + 'connection.move', + 'connection.updateWaypoints', + ], ifBpmn(updateConnectionWaypoints)); + + this.reverted([ + 'connection.layout', + 'connection.move', + 'connection.updateWaypoints', + ], ifBpmn(updateConnectionWaypoints)); + + // update conditional/default flows + this.executed('connection.reconnect', ifBpmn(function(event) { + var context = event.context, + connection = context.connection, + oldSource = context.oldSource, + newSource = context.newSource, + connectionBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(connection), + oldSourceBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(oldSource), + newSourceBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(newSource); + + // remove condition from connection on reconnect to new source + // if new source can NOT have condional sequence flow + if (connectionBo.conditionExpression && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.isAny)(newSourceBo, [ + 'bpmn:Activity', + 'bpmn:ExclusiveGateway', + 'bpmn:InclusiveGateway' + ])) { + context.oldConditionExpression = connectionBo.conditionExpression; + + delete connectionBo.conditionExpression; + } + + // remove default from old source flow on reconnect to new source + // if source changed + if (oldSource !== newSource && oldSourceBo.default === connectionBo) { + context.oldDefault = oldSourceBo.default; + + delete oldSourceBo.default; + } + })); + + this.reverted('connection.reconnect', ifBpmn(function(event) { + var context = event.context, + connection = context.connection, + oldSource = context.oldSource, + newSource = context.newSource, + connectionBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(connection), + oldSourceBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(oldSource), + newSourceBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(newSource); + + // add condition to connection on revert reconnect to new source + if (context.oldConditionExpression) { + connectionBo.conditionExpression = context.oldConditionExpression; + } + + // add default to old source on revert reconnect to new source + if (context.oldDefault) { + oldSourceBo.default = context.oldDefault; + + delete newSourceBo.default; + } + })); + + // update attachments + function updateAttachment(e) { + self.updateAttachment(e.context); + } + + this.executed([ 'element.updateAttachment' ], ifBpmn(updateAttachment)); + this.reverted([ 'element.updateAttachment' ], ifBpmn(updateAttachment)); + + + // update BPMNLabel + this.executed('element.updateLabel', ifBpmn(updateBPMNLabel)); + this.reverted('element.updateLabel', ifBpmn(updateBPMNLabel)); + + function updateBPMNLabel(event) { + const { element } = event.context, + label = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_3__.getLabel)(element); + const di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(element), + diLabel = di && di.get('label'); + + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_3__.isLabelExternal)(element) || (0,_util_DrilldownUtil__WEBPACK_IMPORTED_MODULE_4__.isPlane)(element)) { + return; + } + + if (label && !diLabel) { + di.set('label', bpmnFactory.create('bpmndi:BPMNLabel')); + } else if (!label && diLabel) { + di.set('label', undefined); + } + } +} + +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_5__["default"])(BpmnUpdater, diagram_js_lib_command_CommandInterceptor__WEBPACK_IMPORTED_MODULE_0__["default"]); + +BpmnUpdater.$inject = [ + 'eventBus', + 'bpmnFactory', + 'connectionDocking', + 'translate' +]; + + +// implementation ////////////////////// + +/** + * @param { { + * shape: Shape; + * host: Shape; + * } } context + */ +BpmnUpdater.prototype.updateAttachment = function(context) { - var scopedProperty = propertyWithScope(p, scopeName); + var shape = context.shape, + businessObject = shape.businessObject, + host = shape.host; - entry = renderCustomField(propertyId, scopedProperty, idx); - if (entry) { - customScopeFieldsGroup.entries.push(entry); - } - }); + businessObject.attachedToRef = host && host.businessObject; +}; - if (customScopeFieldsGroup.entries.length > 0) { - groups.push(customScopeFieldsGroup); - } - } - } +/** + * @param {Element} element + * @param {Parent} oldParent + */ +BpmnUpdater.prototype.updateParent = function(element, oldParent) { + + // do not update BPMN 2.0 label parent + if ((0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_6__.isLabel)(element)) { + return; + } + + // data stores in collaborations are handled separately by DataStoreBehavior + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:DataStoreReference') && + element.parent && + (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element.parent, 'bpmn:Collaboration')) { + return; + } + + var parentShape = element.parent; + + var businessObject = element.businessObject, + di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(element), + parentBusinessObject = parentShape && parentShape.businessObject, + parentDi = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(parentShape); + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:FlowNode')) { + this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject); + } + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:DataOutputAssociation')) { + if (element.source) { + parentBusinessObject = element.source.businessObject; + } else { + parentBusinessObject = null; + } + } + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:DataInputAssociation')) { + if (element.target) { + parentBusinessObject = element.target.businessObject; + } else { + parentBusinessObject = null; + } + } + + this.updateSemanticParent(businessObject, parentBusinessObject); + + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:DataObjectReference') && businessObject.dataObjectRef) { + this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject); + } + + this.updateDiParent(di, parentDi); +}; + +/** + * @param {Shape} shape + */ +BpmnUpdater.prototype.updateBounds = function(shape) { + + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(shape), + embeddedLabelBounds = getEmbeddedLabelBounds(shape); + + // update embedded label bounds if possible + if (embeddedLabelBounds) { + var embeddedLabelBoundsDelta = (0,diagram_js_lib_util_PositionUtil__WEBPACK_IMPORTED_MODULE_7__.delta)(embeddedLabelBounds, di.get('bounds')); + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(embeddedLabelBounds, { + x: shape.x + embeddedLabelBoundsDelta.x, + y: shape.y + embeddedLabelBoundsDelta.y + }); + } + + var target = (0,_util_LabelUtil__WEBPACK_IMPORTED_MODULE_6__.isLabel)(shape) ? this._getLabel(di) : di; + + var bounds = target.bounds; + + if (!bounds) { + bounds = this._bpmnFactory.createDiBounds(); + target.set('bounds', bounds); + } + + (0,min_dash__WEBPACK_IMPORTED_MODULE_1__.assign)(bounds, { + x: shape.x, + y: shape.y, + width: shape.width, + height: shape.height + }); +}; + +/** + * @param {ModdleElement} businessObject + * @param {ModdleElement} newContainment + * @param {ModdleElement} oldContainment + */ +BpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainment, oldContainment) { - return groups; - }; + if (oldContainment === newContainment) { + return; + } + var oldRefs, newRefs; -// getters, setters and validators /////////////// + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is) (oldContainment, 'bpmn:Lane')) { + oldRefs = oldContainment.get('flowNodeRef'); + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(oldRefs, businessObject); + } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newContainment, 'bpmn:Lane')) { + newRefs = newContainment.get('flowNodeRef'); + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.add)(newRefs, businessObject); + } +}; - /** - * Return a getter that retrieves the given property. - * - * @param {String} name - * @param {PropertyDescriptor} property - * - * @return {Function} - */ - function propertyGetter(name, property) { +/** + * @param {Connection} connection + * @param {Element} newSource + * @param {Element} newTarget + */ +BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) { + var connectionDi = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(connection), + newSourceDi = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(newSource), + newTargetDi = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(newTarget); - /* getter */ - return function get(element) { - var value = getPropertyValue(element, property); + if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(newSource)) { + connectionDi.sourceElement = newSource && newSourceDi; + } - return objectWithKey(name, value); - }; - } + if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(newTarget)) { + connectionDi.targetElement = newTarget && newTargetDi; + } - /** - * Return a setter that updates the given property. - * - * @param {String} name - * @param {PropertyDescriptor} property - * @param {BpmnFactory} bpmnFactory - * - * @return {Function} - */ - function propertySetter(name, property, bpmnFactory) { +}; - /* setter */ - return function set(element, values) { +/** + * @param {ModdleElement} di + * @param {ModdleElement} parentDi + */ +BpmnUpdater.prototype.updateDiParent = function(di, parentDi) { - var value = values[name]; + if (parentDi && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(parentDi, 'bpmndi:BPMNPlane')) { + parentDi = parentDi.$parent; + } - return setPropertyValue(element, property, value, bpmnFactory); - }; - } + if (di.$parent === parentDi) { + return; + } - /** - * Return a validator that ensures the property is ok. - * - * @param {String} name - * @param {PropertyDescriptor} property - * @param {Function} translate - * - * @return {Function} - */ - function propertyValidator(name, property, translate) { + var planeElements = (parentDi || di.$parent).get('planeElement'); - /* validator */ - return function validate(element, values) { - var value = values[name]; + if (parentDi) { + planeElements.push(di); + di.$parent = parentDi; + } else { + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(planeElements, di); + di.$parent = null; + } +}; - var error = validateValue(value, property, translate); +/** + * @param {ModdleElement} element + * + * @return {ModdleElement} + */ +function getDefinitions(element) { + while (element && !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:Definitions')) { + element = element.$parent; + } - if (error) { - return objectWithKey(name, error); - } - }; - } + return element; +} +/** + * @param {ModdleElement} container + * + * @return {ModdleElement} + */ +BpmnUpdater.prototype.getLaneSet = function(container) { -// get, set and validate helpers /////////////////// + var laneSet, laneSets; - /** - * Return the value of the specified property descriptor, - * on the passed diagram element. - * - * @param {djs.model.Base} element - * @param {PropertyDescriptor} property - * - * @return {Any} - */ - function getPropertyValue(element, property) { + // bpmn:Lane + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(container, 'bpmn:Lane')) { + laneSet = container.childLaneSet; - var bo = getBusinessObject(element); + if (!laneSet) { + laneSet = this._bpmnFactory.create('bpmn:LaneSet'); + container.childLaneSet = laneSet; + laneSet.$parent = container; + } - var binding = property.binding, - scope = property.scope; + return laneSet; + } - var bindingType = binding.type, - bindingName = binding.name; + // bpmn:Participant + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(container, 'bpmn:Participant')) { + container = container.processRef; + } - var propertyValue = property.value || ''; + // bpmn:FlowElementsContainer + laneSets = container.get('laneSets'); + laneSet = laneSets[0]; - if (scope) { - bo = findExtension(bo, scope.name); - if (!bo) { - return propertyValue; - } - } + if (!laneSet) { + laneSet = this._bpmnFactory.create('bpmn:LaneSet'); + laneSet.$parent = container; + laneSets.push(laneSet); + } - // property - if (bindingType === 'property') { + return laneSet; +}; - var value = bo.get(bindingName); +/** + * @param {ModdleElement} businessObject + * @param {ModdleElement} newParent + * @param {ModdleElement} visualParent + */ +BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent, visualParent) { - if (bindingName === 'conditionExpression') { - if (value) { - return value.body; - } else { - // return defined default - return propertyValue; - } - } else { - // return value; default to defined default - return typeof value !== 'undefined' ? value : propertyValue; - } - } + var containment, + translate = this._translate; - var camundaProperties, - camundaProperty; + if (businessObject.$parent === newParent) { + return; + } - if (bindingType === CAMUNDA_PROPERTY_TYPE) { - if (scope) { - camundaProperties = bo.get('properties'); - } else { - camundaProperties = findExtension(bo, 'camunda:Properties'); - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataInput') || (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataOutput')) { - if (camundaProperties) { - camundaProperty = findCamundaProperty(camundaProperties, binding); + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Participant') && 'processRef' in newParent) { + newParent = newParent.processRef; + } - if (camundaProperty) { - return camundaProperty.value; - } - } + // already in correct ioSpecification + if ('ioSpecification' in newParent && newParent.ioSpecification === businessObject.$parent) { + return; + } + } - return propertyValue; - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:Lane')) { - var inputOutput, - ioParameter; + if (newParent) { + newParent = this.getLaneSet(newParent); + } - if (IO_BINDING_TYPES.indexOf(bindingType) !== -1) { + containment = 'lanes'; + } else - if (scope) { - inputOutput = bo.get('inputOutput'); - } else { - inputOutput = findExtension(bo, 'camunda:InputOutput'); - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:FlowElement')) { - if (!inputOutput) { - // ioParameter cannot exist yet, return property value - return propertyValue; - } - } + if (newParent) { - // camunda input parameter - if (bindingType === CAMUNDA_INPUT_PARAMETER_TYPE) { - ioParameter = findInputParameter(inputOutput, binding); + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Participant')) { + newParent = newParent.processRef; + } else - if (ioParameter) { - if (binding.scriptFormat) { - if (ioParameter.definition) { - return ioParameter.definition.value; - } - } else { - return ioParameter.value || ''; - } - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Lane')) { + do { - return propertyValue; - } + // unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer) + newParent = newParent.$parent.$parent; + } while ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Lane')); - // camunda output parameter - if (binding.type === CAMUNDA_OUTPUT_PARAMETER_TYPE) { - ioParameter = findOutputParameter(inputOutput, binding); + } + } - if (ioParameter) { - return ioParameter.name; - } + containment = 'flowElements'; - return propertyValue; - } + } else + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:Artifact')) { - var ioElement; + while (newParent && + !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Process') && + !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:SubProcess') && + !(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Collaboration')) { - if (IN_OUT_BINDING_TYPES.indexOf(bindingType) != -1) { - ioElement = findCamundaInOut(bo, binding); + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(newParent, 'bpmn:Participant')) { + newParent = newParent.processRef; + break; + } else { + newParent = newParent.$parent; + } + } - if (ioElement) { - if (bindingType === CAMUNDA_IN_BUSINESS_KEY_TYPE) { - return ioElement.businessKey; - } else - if (bindingType === CAMUNDA_OUT_TYPE) { - return ioElement.target; - } else - if (bindingType === CAMUNDA_IN_TYPE) { - return ioElement[binding.expression ? 'sourceExpression' : 'source']; - } - } + containment = 'artifacts'; + } else - return propertyValue; - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:MessageFlow')) { + containment = 'messageFlows'; - if (bindingType === CAMUNDA_EXECUTION_LISTENER_TYPE) { - var executionListener; - if (scope) { - executionListener = bo.get('executionListener'); - } else { - executionListener = findExtension(bo, 'camunda:ExecutionListener'); - } + } else - return executionListener.script.value; - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:Participant')) { + containment = 'participants'; - var fieldInjection; - if (CAMUNDA_FIELD === bindingType) { - var fieldInjections = findExtensions(bo, [ 'camunda:Field' ]); - fieldInjections.forEach(function(item) { - if (item.name === binding.name) { - fieldInjection = item; - } - }); - if (fieldInjection) { - return fieldInjection.string || fieldInjection.expression; - } else { - return ''; - } - } + // make sure the participants process is properly attached / detached + // from the XML document - throw unknownPropertyBinding(property); - } + var process = businessObject.processRef, + definitions; - module.exports.getPropertyValue = getPropertyValue; + if (process) { + definitions = getDefinitions(businessObject.$parent || newParent); + if (businessObject.$parent) { + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(definitions.get('rootElements'), process); + process.$parent = null; + } - /** - * Return an update operation that changes the diagram - * element's custom property to the given value. - * - * The response of this method will be processed via - * {@link PropertiesPanel#applyChanges}. - * - * @param {djs.model.Base} element - * @param {PropertyDescriptor} property - * @param {String} value - * @param {BpmnFactory} bpmnFactory - * - * @return {Object|Array} results to be processed - */ - function setPropertyValue(element, property, value, bpmnFactory) { - var bo = getBusinessObject(element); + if (newParent) { + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.add)(definitions.get('rootElements'), process); + process.$parent = definitions; + } + } + } else - var binding = property.binding, - scope = property.scope; + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataOutputAssociation')) { + containment = 'dataOutputAssociations'; + } else - var bindingType = binding.type, - bindingName = binding.name; + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataInputAssociation')) { + containment = 'dataInputAssociations'; + } - var propertyValue; + if (!containment) { + throw new Error(translate( + 'no parent for {element} in {parent}', + { + element: businessObject.id, + parent: newParent.id + } + )); + } - var updates = []; + var children; - var extensionElements; + if (businessObject.$parent) { - if (EXTENSION_BINDING_TYPES.indexOf(bindingType) !== -1) { - extensionElements = bo.get('extensionElements'); + // remove from old parent + children = businessObject.$parent.get(containment); + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(children, businessObject); + } - // create extension elements, if they do not exist (yet) - if (!extensionElements) { - extensionElements = elementHelper.createElement('bpmn:ExtensionElements', null, element, bpmnFactory); + if (!newParent) { + businessObject.$parent = null; + } else { - updates.push(cmdHelper.updateBusinessObject( - element, bo, objectWithKey('extensionElements', extensionElements) - )); - } - } + // add to new parent + children = newParent.get(containment); + children.push(businessObject); + businessObject.$parent = newParent; + } - if (scope) { - bo = findExtension(bo, scope.name); - if (!bo) { - bo = elementHelper.createElement(scope.name, null, element, bpmnFactory); + if (visualParent) { + var diChildren = visualParent.get(containment); - updates.push(cmdHelper.addElementsTolist( - bo, extensionElements, 'values', [ bo ] - )); - } - } + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(children, businessObject); - // property - if (bindingType === 'property') { + if (newParent) { - if (bindingName === 'conditionExpression') { + if (!diChildren) { + diChildren = []; + newParent.set(containment, diChildren); + } - propertyValue = elementHelper.createElement('bpmn:FormalExpression', { - body: value, - language: binding.scriptFormat - }, bo, bpmnFactory); - } else { + diChildren.push(businessObject); + } + } +}; - var moddlePropertyDescriptor = bo.$descriptor.propertiesByName[bindingName]; +/** + * @param {Connection} connection + */ +BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) { + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(connection); + + di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints)); +}; + +/** + * @param { { + * connection: Connection; + * parent: Parent; + * newParent: Parent; + * } } context + */ +BpmnUpdater.prototype.updateConnection = function(context) { + var connection = context.connection, + businessObject = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(connection), + newSource = connection.source, + newSourceBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(newSource), + newTarget = connection.target, + newTargetBo = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getBusinessObject)(connection.target), + visualParent; - var moddleType = moddlePropertyDescriptor.type; + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataAssociation')) { - // make sure we only update String, Integer, Real and - // Boolean properties (do not accidentally override complex objects...) - if (BASIC_MODDLE_TYPES.indexOf(moddleType) === -1) { - throw new Error('cannot set moddle type <' + moddleType + '>'); - } + var inverseSet = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:SequenceFlow'); - if (moddleType === 'Boolean') { - propertyValue = !!value; - } else - if (moddleType === 'Integer') { - propertyValue = parseInt(value, 10); + if (businessObject.sourceRef !== newSourceBo) { + if (inverseSet) { + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject); - if (isNaN(propertyValue)) { - // do not write NaN value - propertyValue = undefined; - } - } else { - propertyValue = value; - } - } + if (newSourceBo && newSourceBo.get('outgoing')) { + newSourceBo.get('outgoing').push(businessObject); + } + } - if (propertyValue !== undefined) { - updates.push(cmdHelper.updateBusinessObject( - element, bo, objectWithKey(bindingName, propertyValue) - )); - } - } + businessObject.sourceRef = newSourceBo; + } - // camunda:property - var camundaProperties, - existingCamundaProperty, - newCamundaProperty; + if (businessObject.targetRef !== newTargetBo) { + if (inverseSet) { + (0,diagram_js_lib_util_Collections__WEBPACK_IMPORTED_MODULE_8__.remove)(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject); - if (bindingType === CAMUNDA_PROPERTY_TYPE) { + if (newTargetBo && newTargetBo.get('incoming')) { + newTargetBo.get('incoming').push(businessObject); + } + } - if (scope) { - camundaProperties = bo.get('properties'); - } else { - camundaProperties = findExtension(extensionElements, 'camunda:Properties'); - } + businessObject.targetRef = newTargetBo; + } + } else - if (!camundaProperties) { - camundaProperties = elementHelper.createElement('camunda:Properties', null, bo, bpmnFactory); + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataInputAssociation')) { - if (scope) { - updates.push(cmdHelper.updateBusinessObject( - element, bo, { properties: camundaProperties } - )); - } - else { - updates.push(cmdHelper.addElementsTolist( - element, extensionElements, 'values', [ camundaProperties ] - )); - } - } + // handle obnoxious isMsome sourceRef + businessObject.get('sourceRef')[0] = newSourceBo; - existingCamundaProperty = findCamundaProperty(camundaProperties, binding); + visualParent = context.parent || context.newParent || newTargetBo; - newCamundaProperty = createCamundaProperty(binding, value, bpmnFactory); + this.updateSemanticParent(businessObject, newTargetBo, visualParent); + } else - updates.push(cmdHelper.addAndRemoveElementsFromList( - element, - camundaProperties, - 'values', - null, - [ newCamundaProperty ], - existingCamundaProperty ? [ existingCamundaProperty ] : [] - )); - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(businessObject, 'bpmn:DataOutputAssociation')) { + visualParent = context.parent || context.newParent || newSourceBo; - // camunda:inputParameter - // camunda:outputParameter - var inputOutput, - existingIoParameter, - newIoParameter; + this.updateSemanticParent(businessObject, newSourceBo, visualParent); - if (IO_BINDING_TYPES.indexOf(bindingType) !== -1) { + // targetRef = new target + businessObject.targetRef = newTargetBo; + } - if (scope) { - inputOutput = bo.get('inputOutput'); - } else { - inputOutput = findExtension(extensionElements, 'camunda:InputOutput'); - } + this.updateConnectionWaypoints(connection); - // create inputOutput element, if it do not exist (yet) - if (!inputOutput) { - inputOutput = elementHelper.createElement('camunda:InputOutput', null, bo, bpmnFactory); + this.updateDiConnection(connection, newSource, newTarget); +}; - if (scope) { - updates.push(cmdHelper.updateBusinessObject( - element, bo, { inputOutput: inputOutput } - )); - } - else { - updates.push(cmdHelper.addElementsTolist( - element, extensionElements, 'values', inputOutput - )); - } - } - } - if (bindingType === CAMUNDA_INPUT_PARAMETER_TYPE) { +// helpers ////////////////////// - existingIoParameter = findInputParameter(inputOutput, binding); +BpmnUpdater.prototype._getLabel = function(di) { + if (!di.label) { + di.label = this._bpmnFactory.createDiLabel(); + } - newIoParameter = createInputParameter(binding, value, bpmnFactory); + return di.label; +}; - updates.push(cmdHelper.addAndRemoveElementsFromList( - element, - inputOutput, - 'inputParameters', - null, - [ newIoParameter ], - existingIoParameter ? [ existingIoParameter ] : [] - )); - } - if (bindingType === CAMUNDA_OUTPUT_PARAMETER_TYPE) { +/** + * Call function if shape or connection is BPMN element. + * + * @param {Function} fn + * + * @return {Function} + */ +function ifBpmn(fn) { - existingIoParameter = findOutputParameter(inputOutput, binding); + return function(event) { - newIoParameter = createOutputParameter(binding, value, bpmnFactory); + var context = event.context, + element = context.shape || context.connection || context.element; - updates.push(cmdHelper.addAndRemoveElementsFromList( - element, - inputOutput, - 'outputParameters', - null, - [ newIoParameter ], - existingIoParameter ? [ existingIoParameter ] : [] - )); - } + if ((0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(element, 'bpmn:BaseElement')) { + fn(event); + } + }; +} +/** + * Return dc:Bounds of bpmndi:BPMNLabel if exists. + * + * @param {Shape} shape + * + * @return {ModdleElement|undefined} + */ +function getEmbeddedLabelBounds(shape) { + if (!(0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.is)(shape, 'bpmn:Activity')) { + return; + } - // camunda:in - // camunda:out - // camunda:in:businessKey - var existingInOut, - newInOut; + var di = (0,_util_ModelUtil__WEBPACK_IMPORTED_MODULE_2__.getDi)(shape); - if (IN_OUT_BINDING_TYPES.indexOf(bindingType) !== -1) { + if (!di) { + return; + } - existingInOut = findCamundaInOut(bo, binding); + var label = di.get('label'); - if (bindingType === CAMUNDA_IN_TYPE) { - newInOut = createCamundaIn(binding, value, bpmnFactory); - } else - if (bindingType === CAMUNDA_OUT_TYPE) { - newInOut = createCamundaOut(binding, value, bpmnFactory); - } else { - newInOut = createCamundaInWithBusinessKey(binding, value, bpmnFactory); - } + if (!label) { + return; + } - updates.push(cmdHelper.addAndRemoveElementsFromList( - element, - extensionElements, - 'values', - null, - [ newInOut ], - existingInOut ? [ existingInOut ] : [] - )); - } - - if (bindingType === CAMUNDA_FIELD) { - var existingFieldInjections = findExtensions(bo, [ 'camunda:Field' ]); - var newFieldInjections = []; - - if (existingFieldInjections.length > 0) { - existingFieldInjections.forEach(function(item) { - if (item.name === binding.name) { - newFieldInjections.push(createCamundaFieldInjection(binding, value, bpmnFactory)); - } else { - newFieldInjections.push(item); - } - }); - } else { - newFieldInjections.push(createCamundaFieldInjection(binding, value, bpmnFactory)); - } + return label.get('bounds'); +} - updates.push(cmdHelper.addAndRemoveElementsFromList( - element, - extensionElements, - 'values', - null, - newFieldInjections, - existingFieldInjections ? existingFieldInjections : [] - )); - } +/***/ }), - if (updates.length) { - return updates; - } +/***/ "../node_modules/bpmn-js/lib/features/modeling/ElementFactory.js": +/*!***********************************************************************!*\ + !*** ../node_modules/bpmn-js/lib/features/modeling/ElementFactory.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - // quick warning for better debugging - console.warn('no update', element, property, value); - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ ElementFactory) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! min-dash */ "../node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var inherits_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! inherits-browser */ "../node_modules/inherits-browser/dist/index.es.js"); +/* harmony import */ var _util_ModelUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modeling/util/ModelingUtil */ "../node_modules/bpmn-js/lib/util/ModelUtil.js"); +/* harmony import */ var _util_DiUtil__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/DiUtil */ "../node_modules/bpmn-js/lib/util/DiUtil.js"); +/* harmony import */ var diagram_js_lib_core_ElementFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! diagram-js/lib/core/ElementFactory */ "../node_modules/diagram-js/lib/core/ElementFactory.js"); +/* harmony import */ var _util_LabelUtil__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/LabelUtil */ "../node_modules/bpmn-js/lib/util/LabelUtil.js"); +/* harmony import */ var _util_CompatibilityUtil__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/CompatibilityUtil */ "../node_modules/bpmn-js/lib/util/CompatibilityUtil.js"); - module.exports.setPropertyValue = setPropertyValue; - /** - * Validate value of a given property. - * - * @param {String} value - * @param {PropertyDescriptor} property - * @param {Function} translate - * - * @return {Object} with validation errors - */ - function validateValue(value, property, translate) { - var constraints = property.constraints || {}; - if (constraints.notEmpty && isEmpty(value)) { - return translate('Must not be empty'); - } - if (constraints.maxLength && value.length > constraints.maxLength) { - return translate('Must have max length {length}', { length: constraints.maxLength }); - } - if (constraints.minLength && value.length < constraints.minLength) { - return translate('Must have min length {length}', { length: constraints.minLength }); - } - var pattern = constraints.pattern, - message; - if (pattern) { - if (typeof pattern !== 'string') { - message = pattern.message; - pattern = pattern.value; - } - if (!matchesPattern(value, pattern)) { - return message || translate('Must match pattern {pattern}', { pattern: pattern }); - } - } - } -// misc helpers /////////////////////////////// - function propertyWithScope(property, scopeName) { - if (!scopeName) { - return property; - } - return assign({}, property, { - scope: { - name: scopeName - } - }); - } - /** - * Return an object with a single key -> value association. - * - * @param {String} key - * @param {Any} value - * - * @return {Object} - */ - function objectWithKey(key, value) { - var obj = {}; - obj[key] = value; +/** + * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate + * + * @typedef {import('diagram-js/lib/util/Types').Dimensions} Dimensions + * + * @typedef {import('./BpmnFactory').default} BpmnFactory + * + * @typedef {import('../../model/Types').BpmnAttributes} BpmnAttributes + * @typedef {import('../../model/Types').Connection} Connection + * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types').Label} Label + * @typedef {import('../../model/Types').Root} Root + * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types').Moddle} Moddle + * @typedef {import('../../model/Types').ModdleElement} ModdleElement + */ - return obj; - } +/** + * A BPMN-specific element factory. + * + * @template {Connection} [T=Connection] + * @template {Label} [U=Label] + * @template {Root} [V=Root] + * @template {Shape} [W=Shape] + * + * @extends {BaseElementFactory} + * + * @param {BpmnFactory} bpmnFactory + * @param {Moddle} moddle + * @param {Translate} translate + */ +function ElementFactory(bpmnFactory, moddle, translate) { + diagram_js_lib_core_ElementFactory__WEBPACK_IMPORTED_MODULE_0__["default"].call(this); - /** - * Does the given string match the specified pattern? - * - * @param {String} str - * @param {String} pattern - * - * @return {Boolean} - */ - function matchesPattern(str, pattern) { - var regexp = new RegExp(pattern); + this._bpmnFactory = bpmnFactory; + this._moddle = moddle; + this._translate = translate; +} - return regexp.test(str); - } +(0,inherits_browser__WEBPACK_IMPORTED_MODULE_1__["default"])(ElementFactory, diagram_js_lib_core_ElementFactory__WEBPACK_IMPORTED_MODULE_0__["default"]); - function isEmpty(str) { - return !str || /^\s*$/.test(str); - } +ElementFactory.$inject = [ + 'bpmnFactory', + 'moddle', + 'translate' +]; - /** - * Create a new {@link Error} indicating an unknown - * property binding. - * - * @param {PropertyDescriptor} property - * - * @return {Error} - */ - function unknownPropertyBinding(property) { - var binding = property.binding; +ElementFactory.prototype._baseCreate = diagram_js_lib_core_ElementFactory__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.create; - return new Error('unknown binding: <' + binding.type + '>'); - } +/** + * Create a root element. + * + * @overlord + * @param {'root'} elementType + * @param {Partial & Partial} [attrs] + * @return {V} + */ - },{"../../../../factory/EntryFactory":14,"../../../../helper/CmdHelper":25,"../../../../helper/ElementHelper":26,"../CreateHelper":52,"../Helper":56,"bpmn-js/lib/util/ModelUtil":240,"lodash/assign":604}],63:[function(require,module,exports){ - module.exports = { - __depends__: [ - require('./element-templates'), - require('diagram-js/lib/i18n/translate').default - ], - __init__: [ 'propertiesProvider' ], - propertiesProvider: [ 'type', require('./CamundaPropertiesProvider') ] - }; +/** + * Create a shape. + * + * @overlord + * @param {'shape'} elementType + * @param {Partial & Partial} [attrs] + * @return {W} + */ - },{"./CamundaPropertiesProvider":51,"./element-templates":60,"diagram-js/lib/i18n/translate":401}],64:[function(require,module,exports){ - 'use strict'; +/** + * Create a connection. + * + * @overlord + * @param {'connection'} elementType + * @param {Partial & Partial} [attrs] + * @return {T} + */ - var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject, - is = require('bpmn-js/lib/util/ModelUtil').is, - asyncContinuation = require('./implementation/AsyncContinuation'); +/** + * Create a label. + * + * @param {'label'} elementType + * @param {Partial