bpmn-process-designer
Version:
A process designer base on Vue 2.x and ElementUI
1,855 lines (1,524 loc) • 4.25 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["bpmn-process-designer"] = factory(require("vue"));
else
root["bpmn-process-designer"] = factory(root["Vue"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__8bbf__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
/* (ignored) */
/***/ }),
/***/ "0014":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var is = __webpack_require__("e81d").is;
var events = __webpack_require__("99e7"),
CONSUME_TOKEN_EVENT = events.CONSUME_TOKEN_EVENT,
GENERATE_TOKEN_EVENT = events.GENERATE_TOKEN_EVENT,
UPDATE_ELEMENT_EVENT = events.UPDATE_ELEMENT_EVENT;
function SubProcessHandler(animation, eventBus, log) {
this._animation = animation;
this._eventBus = eventBus;
this._log = log;
}
SubProcessHandler.prototype.consume = function(context) {
var element = context.element,
processInstanceId = context.processInstanceId;
var startEvent = element.children.filter(function(child) {
return is(child, 'bpmn:StartEvent');
})[0];
if (!startEvent) {
this._log.log('Skipping Subprocess', 'info', 'fa-angle-double-right');
// skip subprocess
this._eventBus.fire(GENERATE_TOKEN_EVENT, context);
} else {
this._log.log('Starting Subprocess', 'info', 'fa-sign-in');
// start subprocess with process instance ID as parent process instance ID
this._eventBus.fire(GENERATE_TOKEN_EVENT, {
element: startEvent,
parentProcessInstanceId: processInstanceId
});
}
this._eventBus.fire(UPDATE_ELEMENT_EVENT, {
element: element
});
};
SubProcessHandler.prototype.generate = function(context) {
var self = this;
var element = context.element,
processInstanceId = context.processInstanceId;
var outgoingSequenceFlows = element.outgoing.filter(function(outgoing) {
return is(outgoing, 'bpmn:SequenceFlow');
});
outgoingSequenceFlows.forEach(function(outgoing) {
self._animation.createAnimation(outgoing, processInstanceId, function() {
self._eventBus.fire(CONSUME_TOKEN_EVENT, {
element: outgoing.target,
processInstanceId: processInstanceId
});
});
});
this._eventBus.fire(UPDATE_ELEMENT_EVENT, {
element: element
});
};
SubProcessHandler.$inject = [ 'animation', 'eventBus', 'log' ];
module.exports = SubProcessHandler;
/***/ }),
/***/ "00ee":
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__("b622");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};
test[TO_STRING_TAG] = 'z';
module.exports = String(test) === '[object z]';
/***/ }),
/***/ "0131":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var domify = __webpack_require__("0af7");
var events = __webpack_require__("99e7"),
TOGGLE_MODE_EVENT = events.TOGGLE_MODE_EVENT,
RESET_SIMULATION_EVENT = events.RESET_SIMULATION_EVENT,
GENERATE_TOKEN_EVENT = events.GENERATE_TOKEN_EVENT;
var OFFSET_TOP = -15,
OFFSET_RIGHT = 15;
function ElementNotifications(overlays, eventBus) {
var self = this;
this._overlays = overlays;
eventBus.on(TOGGLE_MODE_EVENT, function(context) {
var simulationModeActive = context.simulationModeActive;
if (!simulationModeActive) {
self.removeElementNotifications();
}
});
eventBus.on([
RESET_SIMULATION_EVENT,
GENERATE_TOKEN_EVENT
], function() {
self.removeElementNotifications();
});
}
ElementNotifications.prototype.addElementNotifications = function(elements, options) {
var self = this;
elements.forEach(function(element) {
self.addElementNotification(element, options);
});
};
ElementNotifications.prototype.addElementNotification = function(element, options) {
var position = {
top: OFFSET_TOP,
right: OFFSET_RIGHT
};
var markup =
'<div class="element-notification ' + (options.type || '') + '">' +
(options.icon ? '<i class="fa ' + options.icon + '"></i>' : '') +
('<span class="text">' + options.text + '</span>' || false) +
'</div>';
var html = domify(markup);
this._overlays.add(element, 'element-notification', {
position: position,
html: html,
show: {
minZoom: 0.5
}
});
};
ElementNotifications.prototype.removeElementNotifications = function(elements) {
var self = this;
if (!elements) {
this._overlays.remove({ type: 'element-notification' });
} else {
elements.forEach(function(element) {
self.removeElementNotification(element);
});
}
};
ElementNotifications.prototype.removeElementNotification = function(element) {
this._overlays.remove({ element: element });
};
ElementNotifications.$inject = [ 'overlays', 'eventBus' ];
module.exports = ElementNotifications;
/***/ }),
/***/ "0366":
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__("1c0b");
// optional / simple context binding
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "0394":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var is = __webpack_require__("e81d").is;
var events = __webpack_require__("99e7"),
CONSUME_TOKEN_EVENT = events.CONSUME_TOKEN_EVENT,
GENERATE_TOKEN_EVENT = events.GENERATE_TOKEN_EVENT;
function IntermediateThrowEventHandler(animation, eventBus) {
this._animation = animation;
this._eventBus = eventBus;
}
IntermediateThrowEventHandler.prototype.consume = function(element) {
this._eventBus.fire(GENERATE_TOKEN_EVENT, {
element: element
});
};
IntermediateThrowEventHandler.prototype.generate = function(element) {
var self = this;
var outgoingSequenceFlows = element.outgoing.filter(function(outgoing) {
return is(outgoing, 'bpmn:SequenceFlow');
});
outgoingSequenceFlows.forEach(function(connection) {
self._animation.createAnimation(connection, function() {
self._eventBus.fire(CONSUME_TOKEN_EVENT, {
element: connection.target
});
});
});
};
IntermediateThrowEventHandler.$inject = [ 'animation', 'eventBus' ];
module.exports = IntermediateThrowEventHandler;
/***/ }),
/***/ "03d6":
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__("9c0e");
var toIObject = __webpack_require__("6ca1");
var arrayIndexOf = __webpack_require__("39ad")(false);
var IE_PROTO = __webpack_require__("5a94")('IE_PROTO');
module.exports = function (object, names) {
var O = toIObject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/***/ "04fb":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var events = __webpack_require__("99e7"),
TOGGLE_MODE_EVENT = events.TOGGLE_MODE_EVENT,
PROCESS_INSTANCE_CREATED_EVENT = events.PROCESS_INSTANCE_CREATED_EVENT,
PROCESS_INSTANCE_FINISHED_EVENT = events.PROCESS_INSTANCE_FINISHED_EVENT,
PROCESS_INSTANCE_SHOWN_EVENT = events.PROCESS_INSTANCE_SHOWN_EVENT,
PROCESS_INSTANCE_HIDDEN_EVENT = events.PROCESS_INSTANCE_HIDDEN_EVENT;
var LOW_PRIORITY = 500;
function ProcessInstanceSettings(animation, eventBus, processInstances, elementRegistry) {
var self = this;
this._animation = animation;
this._eventBus = eventBus;
this._processInstances = processInstances;
this._elementRegistry = elementRegistry;
this._eventBus.on(PROCESS_INSTANCE_CREATED_EVENT, LOW_PRIORITY, function(context) {
var parent = context.parent,
processInstanceId = context.processInstanceId;
var processInstancesWithParent = processInstances.getProcessInstances(parent).filter(function(processInstance) {
return !processInstance.isFinished;
});
if (processInstancesWithParent.length === 1) {
self.showProcessInstance(processInstanceId, parent);
} else if (processInstancesWithParent.length > 1) {
self.hideProcessInstance(processInstanceId);
}
});
this._eventBus.on(PROCESS_INSTANCE_FINISHED_EVENT, LOW_PRIORITY, function(context) {
var parent = context.parent,
processInstanceId = context.processInstanceId;
var processInstancesWithParent = processInstances
.getProcessInstances(parent)
.filter(function(processInstance) {
return processInstanceId !== processInstance.processInstanceId && !processInstance.isFinished;
});
// show remaining process instance
if (processInstancesWithParent.length
&& processInstanceId === parent.shownProcessInstance) {
self.showProcessInstance(processInstancesWithParent[0].processInstanceId, parent);
} else {
delete parent.shownProcessInstance;
}
// outer process is finished
if (!parent.parent) {
elementRegistry.forEach(function(element) {
delete element.shownProcessInstance;
});
}
});
eventBus.on(TOGGLE_MODE_EVENT, function() {
elementRegistry.forEach(function(element) {
delete element.shownProcessInstance;
});
});
}
ProcessInstanceSettings.prototype.showProcessInstance = function(processInstanceId, parent) {
this._animation.showProcessInstanceAnimations(processInstanceId);
parent.shownProcessInstance = processInstanceId;
this._eventBus.fire(PROCESS_INSTANCE_SHOWN_EVENT, {
processInstanceId: processInstanceId
});
};
ProcessInstanceSettings.prototype.hideProcessInstance = function(processInstanceId) {
this._animation.hideProcessInstanceAnimations(processInstanceId);
this._eventBus.fire(PROCESS_INSTANCE_HIDDEN_EVENT, {
processInstanceId: processInstanceId
});
};
ProcessInstanceSettings.prototype.showNext = function(parent) {
var self = this;
var processInstancesWithParent = this._processInstances.getProcessInstances(parent);
var shownProcessInstance = parent.shownProcessInstance;
var indexOfShownProcessInstance = 0;
for (let i = 0; i < processInstancesWithParent.length; i++) {
if (processInstancesWithParent[i].processInstanceId === shownProcessInstance) {
break;
} else {
indexOfShownProcessInstance++;
}
}
processInstancesWithParent.forEach(function(processInstance) {
self.hideProcessInstance(processInstance.processInstanceId);
});
if (indexOfShownProcessInstance === processInstancesWithParent.length - 1) {
// last index
this.showProcessInstance(processInstancesWithParent[0].processInstanceId, parent);
} else {
// not last index
this.showProcessInstance(processInstancesWithParent[indexOfShownProcessInstance + 1].processInstanceId, parent);
}
};
ProcessInstanceSettings.$inject = [ 'animation', 'eventBus', 'processInstances', 'elementRegistry' ];
module.exports = ProcessInstanceSettings;
/***/ }),
/***/ "051b":
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__("1a14");
var createDesc = __webpack_require__("10db");
module.exports = __webpack_require__("0bad") ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/***/ "057f":
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__("fc6a");
var nativeGetOwnPropertyNames = __webpack_require__("241c").f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return nativeGetOwnPropertyNames(it);
} catch (error) {
return windowNames.slice();
}
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]'
? getWindowNames(it)
: nativeGetOwnPropertyNames(toIndexedObject(it));
};
/***/ }),
/***/ "05f5":
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__("7a41");
var document = __webpack_require__("ef08").document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/***/ "06cf":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
var toIndexedObject = __webpack_require__("fc6a");
var toPrimitive = __webpack_require__("c04e");
var has = __webpack_require__("5135");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
/***/ }),
/***/ "072d":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 19.1.2.1 Object.assign(target, source, ...)
var DESCRIPTORS = __webpack_require__("0bad");
var getKeys = __webpack_require__("9876");
var gOPS = __webpack_require__("fed5");
var pIE = __webpack_require__("1917");
var toObject = __webpack_require__("0983");
var IObject = __webpack_require__("9fbb");
var $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__("4b8b")(function () {
var A = {};
var B = {};
// eslint-disable-next-line no-undef
var S = Symbol();
var K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function (k) { B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
var T = toObject(target);
var aLen = arguments.length;
var index = 1;
var getSymbols = gOPS.f;
var isEnum = pIE.f;
while (aLen > index) {
var S = IObject(arguments[index++]);
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
var length = keys.length;
var j = 0;
var key;
while (length > j) {
key = keys[j++];
if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
}
} return T;
} : $assign;
/***/ }),
/***/ "078a":
/***/ (function(module, exports, __webpack_require__) {
var helper = __webpack_require__("96c1");
var xml2js = __webpack_require__("844f");
function validateOptions (userOptions) {
var options = helper.copyOptions(userOptions);
helper.ensureSpacesExists(options);
return options;
}
module.exports = function(xml, userOptions) {
var options, js, json, parentKey;
options = validateOptions(userOptions);
js = xml2js(xml, options);
parentKey = 'compact' in options && options.compact ? '_parent' : 'parent';
// parentKey = ptions.compact ? '_parent' : 'parent'; // consider this
if ('addParent' in options && options.addParent) {
json = JSON.stringify(js, function (k, v) { return k === parentKey? '_' : v; }, options.spaces);
} else {
json = JSON.stringify(js, null, options.spaces);
}
return json.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
};
/***/ }),
/***/ "0809":
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("ddeb");
/***/ }),
/***/ "0960":
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("b19a");
/***/ }),
/***/ "0983":
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__("c901");
module.exports = function (it) {
return Object(defined(it));
};
/***/ }),
/***/ "09c5":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__("45fc");
__webpack_require__("b0c0");
__webpack_require__("ac1f");
__webpack_require__("5319");
var some = __webpack_require__("87f2").some;
var ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
};
function is(element, type) {
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
}
function exists(element) {
return element && element.length;
}
function includesType(collection, type) {
return exists(collection) && some(collection, function (element) {
return is(element, type);
});
}
function anyType(element, types) {
return some(types, function (type) {
return is(element, type);
});
}
function isAllowed(propName, propDescriptor, newElement) {
var name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/activiti:/, "")];
return name === propName && anyType(newElement, types);
}
function ActivitiModdleExtension(eventBus) {
eventBus.on("property.clone", function (context) {
var newElement = context.newElement,
propDescriptor = context.propertyDescriptor;
this.canCloneProperty(newElement, propDescriptor);
}, this);
}
ActivitiModdleExtension.$inject = ["eventBus"];
ActivitiModdleExtension.prototype.canCloneProperty = function (newElement, propDescriptor) {
if (isAllowed("activiti:FailedJobRetryTimeCycle", propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") || includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") || is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics");
}
if (isAllowed("activiti:Connector", propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
}
if (isAllowed("activiti:Field", propDescriptor, newElement)) {
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
}
};
module.exports = ActivitiModdleExtension;
/***/ }),
/***/ "0ae2":
/***/ (function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__("9876");
var gOPS = __webpack_require__("fed5");
var pIE = __webpack_require__("1917");
module.exports = function (it) {
var result = getKeys(it);
var getSymbols = gOPS.f;
if (getSymbols) {
var symbols = getSymbols(it);
var isEnum = pIE.f;
var i = 0;
var key;
while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
} return result;
};
/***/ }),
/***/ "0af7":
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("f95b");
/***/ }),
/***/ "0b99":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $at = __webpack_require__("19fa")(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__("393a")(String, 'String', function (iterated) {
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
var O = this._t;
var index = this._i;
var point;
if (index >= O.length) return { value: undefined, done: true };
point = $at(O, index);
this._i += point.length;
return { value: point, done: false };
});
/***/ }),
/***/ "0bad":
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__("4b8b")(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/***/ "0cfb":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var createElement = __webpack_require__("cc12");
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/***/ "0d3b":
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__("d039");
var wellKnownSymbol = __webpack_require__("b622");
var IS_PURE = __webpack_require__("c430");
var ITERATOR = wellKnownSymbol('iterator');
module.exports = !fails(function () {
var url = new URL('b?a=1&b=2&c=3', 'http://a');
var searchParams = url.searchParams;
var result = '';
url.pathname = 'c%20d';
searchParams.forEach(function (value, key) {
searchParams['delete']('b');
result += key + value;
});
return (IS_PURE && !url.toJSON)
|| !searchParams.sort
|| url.href !== 'http://a/c%20d?a=1&c=3'
|| searchParams.get('c') !== '3'
|| String(new URLSearchParams('?a=1')) !== 'a=1'
|| !searchParams[ITERATOR]
// throws in Edge
|| new URL('https://a@b').username !== 'a'
|| new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
// not punycoded in Edge
|| new URL('http://тест').host !== 'xn--e1aybc'
// not escaped in Chrome 62-
|| new URL('http://a#б').hash !== '#%D0%B1'
// fails in Chrome 66-
|| result !== 'a1c3'
// throws in Safari
|| new URL('http://x', undefined).host !== 'x';
});
/***/ }),
/***/ "0e15":
/***/ (function(module, exports, __webpack_require__) {
/* eslint-disable no-undefined */
var throttle = __webpack_require__("597f");
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {Boolean} [atBegin] Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @return {Function} A new, debounced function.
*/
module.exports = function ( delay, atBegin, callback ) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
};
/***/ }),
/***/ "0ebc":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var domClasses = __webpack_require__("4193");
var elementHelper = __webpack_require__("e81d"),
is = elementHelper.is,
SUPPORTED_ELEMENTS = elementHelper.supportedElements;
var events = __webpack_require__("99e7"),
TOGGLE_MODE_EVENT = events.TOGGLE_MODE_EVENT,
GENERATE_TOKEN_EVENT = events.GENERATE_TOKEN_EVENT;
var IGNORED_ELEMENTS = [
'bpmn:Process',
'bpmn:Collaboration',
'bpmn:Participant',
'bpmn:Lane',
'bpmn:TextAnnotation'
];
function isLabel(element) {
return element.labelTarget;
}
function ElementSupport(eventBus, elementRegistry, canvas, notifications, elementNotifications) {
var self = this;
this._eventBus = eventBus;
this._elementRegistry = elementRegistry;
this._elementNotifications = elementNotifications;
this._notifications = notifications;
this.canvasParent = canvas.getContainer().parentNode;
eventBus.on(GENERATE_TOKEN_EVENT, 20000, function(context) {
var element = context.element;
if (!is(element, 'bpmn:StartEvent')) {
return;
}
if (!self.allElementsSupported()) {
self.showWarnings();
domClasses(self.canvasParent).add('warning');
// cancel event
return true;
}
});
eventBus.on(TOGGLE_MODE_EVENT, function(context) {
var simulationModeActive = context.simulationModeActive;
if (!simulationModeActive) {
domClasses(self.canvasParent).remove('warning');
}
});
}
ElementSupport.prototype.allElementsSupported = function() {
var allElementsSupported = true;
this._elementRegistry.forEach(function(element) {
if (!is(element, IGNORED_ELEMENTS)
&& !is(element, SUPPORTED_ELEMENTS)
&& !isLabel(element)
) {
allElementsSupported = false;
}
});
return allElementsSupported;
};
ElementSupport.prototype.showWarnings = function(elements) {
var self = this;
var warnings = [];
this._elementRegistry.forEach(function(element) {
if (!is(element, IGNORED_ELEMENTS)
&& !is(element, SUPPORTED_ELEMENTS)
&& !isLabel(element)
) {
self.showWarning(element);
if (warnings.indexOf(element.type)) {
self._notifications.showNotification(element.type + ' not supported', 'warning');
warnings.push(element.type);
}
}
});
};
ElementSupport.prototype.showWarning = function(element) {
this._elementNotifications.addElementNotification(element, {
type: 'warning',
icon: 'fa-exclamation-triangle',
text: 'Not supported'
});
};
ElementSupport.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'notifications', 'elementNotifications' ];
module.exports = ElementSupport;
/***/ }),
/***/ "0fab":
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("c7ca");
/***/ }),
/***/ 1:
/***/ (function(module, exports) {
/* (ignored) */
/***/ }),
/***/ "1020":
/***/ (function(module, exports) {
function deepFreeze(obj) {
if (obj instanceof Map) {
obj.clear = obj.delete = obj.set = function () {
throw new Error('map is read-only');
};
} else if (obj instanceof Set) {
obj.add = obj.clear = obj.delete = function () {
throw new Error('set is read-only');
};
}
// Freeze self
Object.freeze(obj);
Object.getOwnPropertyNames(obj).forEach(function (name) {
var prop = obj[name];
// Freeze prop if it is an object
if (typeof prop == 'object' && !Object.isFrozen(prop)) {
deepFreeze(prop);
}
});
return obj;
}
var deepFreezeEs6 = deepFreeze;
var _default = deepFreeze;
deepFreezeEs6.default = _default;
class Response {
/**
* @param {CompiledMode} mode
*/
constructor(mode) {
// eslint-disable-next-line no-undefined
if (mode.data === undefined) mode.data = {};
this.data = mode.data;
}
ignoreMatch() {
this.ignore = true;
}
}
/**
* @param {string} value
* @returns {string}
*/
function escapeHTML(value) {
return value
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
/**
* performs a shallow merge of multiple objects into one
*
* @template T
* @param {T} original
* @param {Record<string,any>[]} objects
* @returns {T} a single new object
*/
function inherit(original, ...objects) {
/** @type Record<string,any> */
const result = Object.create(null);
for (const key in original) {
result[key] = original[key];
}
objects.forEach(function(obj) {
for (const key in obj) {
result[key] = obj[key];
}
});
return /** @type {T} */ (result);
}
/**
* @typedef {object} Renderer
* @property {(text: string) => void} addText
* @property {(node: Node) => void} openNode
* @property {(node: Node) => void} closeNode
* @property {() => string} value
*/
/** @typedef {{kind?: string, sublanguage?: boolean}} Node */
/** @typedef {{walk: (r: Renderer) => void}} Tree */
/** */
const SPAN_CLOSE = '</span>';
/**
* Determines if a node needs to be wrapped in <span>
*
* @param {Node} node */
const emitsWrappingTags = (node) => {
return !!node.kind;
};
/** @type {Renderer} */
class HTMLRenderer {
/**
* Creates a new HTMLRenderer
*
* @param {Tree} parseTree - the parse tree (must support `walk` API)
* @param {{classPrefix: string}} options
*/
constructor(parseTree, options) {
this.buffer = "";
this.classPrefix = options.classPrefix;
parseTree.walk(this);
}
/**
* Adds texts to the output stream
*
* @param {string} text */
addText(text) {
this.buffer += escapeHTML(text);
}
/**
* Adds a node open to the output stream (if needed)
*
* @param {Node} node */
openNode(node) {
if (!emitsWrappingTags(node)) return;
let className = node.kind;
if (!node.sublanguage) {
className = `${this.classPrefix}${className}`;
}
this.span(className);
}
/**
* Adds a node close to the output stream (if needed)
*
* @param {Node} node */
closeNode(node) {
if (!emitsWrappingTags(node)) return;
this.buffer += SPAN_CLOSE;
}
/**
* returns the accumulated buffer
*/
value() {
return this.buffer;
}
// helpers
/**
* Builds a span element
*
* @param {string} className */
span(className) {
this.buffer += `<span class="${className}">`;
}
}
/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} | string} Node */
/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} } DataNode */
/** */
class TokenTree {
constructor() {
/** @type DataNode */
this.rootNode = { children: [] };
this.stack = [this.rootNode];
}
get top() {
return this.stack[this.stack.length - 1];
}
get root() { return this.rootNode; }
/** @param {Node} node */
add(node) {
this.top.children.push(node);
}
/** @param {string} kind */
openNode(kind) {
/** @type Node */
const node = { kind, children: [] };
this.add(node);
this.stack.push(node);
}
closeNode() {
if (this.stack.length > 1) {
return this.stack.pop();
}
// eslint-disable-next-line no-undefined
return undefined;
}
closeAllNodes() {
while (this.closeNode());
}
toJSON() {
return JSON.stringify(this.rootNode, null, 4);
}
/**
* @typedef { import("./html_renderer").Renderer } Renderer
* @param {Renderer} builder
*/
walk(builder) {
// this does not
return this.constructor._walk(builder, this.rootNode);
// this works
// return TokenTree._walk(builder, this.rootNode);
}
/**
* @param {Renderer} builder
* @param {Node} node
*/
static _walk(builder, node) {
if (typeof node === "string") {
builder.addText(node);
} else if (node.children) {
builder.openNode(node);
node.children.forEach((child) => this._walk(builder, child));
builder.closeNode(node);
}
return builder;
}
/**
* @param {Node} node
*/
static _collapse(node) {
if (typeof node === "string") return;
if (!node.children) return;
if (node.children.every(el => typeof el === "string")) {
// node.text = node.children.join("");
// delete node.children;
node.children = [node.children.join("")];
} else {
node.children.forEach((child) => {
TokenTree._collapse(child);
});
}
}
}
/**
Currently this is all private API, but this is the minimal API necessary
that an Emitter must implement to fully support the parser.
Minimal interface:
- addKeyword(text, kind)
- addText(text)
- addSublanguage(emitter, subLanguageName)
- finalize()
- openNode(kind)
- closeNode()
- closeAllNodes()
- toHTML()
*/
/**
* @implements {Emitter}
*/
class TokenTreeEmitter extends TokenTree {
/**
* @param {*} options
*/
constructor(options) {
super();
this.options = options;
}
/**
* @param {string} text
* @param {string} kind
*/
addKeyword(text, kind) {
if (text === "") { return; }
this.openNode(kind);
this.addText(text);
this.closeNode();
}
/**
* @param {string} text
*/
addText(text) {
if (text === "") { return; }
this.add(text);
}
/**
* @param {Emitter & {root: DataNode}} emitter
* @param {string} name
*/
addSublanguage(emitter, name) {
/** @type DataNode */
const node = emitter.root;
node.kind = name;
node.sublanguage = true;
this.add(node);
}
toHTML() {
const renderer = new HTMLRenderer(this, this.options);
return renderer.value();
}
finalize() {
return true;
}
}
/**
* @param {string} value
* @returns {RegExp}
* */
function escape(value) {
return new RegExp(value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm');
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/**
* @param {RegExp} re
* @returns {number}
*/
function countMatchGroups(re) {
return (new RegExp(re.toString() + '|')).exec('').length - 1;
}
/**
* Does lexeme start with a regular expression match at the beginning
* @param {RegExp} re
* @param {string} lexeme
*/
function startsWith(re, lexeme) {
const match = re && re.exec(lexeme);
return match && match.index === 0;
}
// join logically computes regexps.join(separator), but fixes the
// backreferences so they continue to match.
// it also places each individual regular expression into it's own
// match group, keeping track of the sequencing of those match groups
// is currently an exercise for the caller. :-)
/**
* @param {(string | RegExp)[]} regexps
* @param {string} separator
* @returns {string}
*/
function join(regexps, separator = "|") {
// backreferenceRe matches an open parenthesis or backreference. To avoid
// an incorrect parse, it additionally matches the following:
// - [...] elements, where the meaning of parentheses and escapes change
// - other escape sequences, so we do not misparse escape sequences as
// interesting elements
// - non-matching or lookahead parentheses, which do not capture. These
// follow the '(' with a '?'.
const backreferenceRe = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
let numCaptures = 0;
let ret = '';
for (let i = 0; i < regexps.length; i++) {
numCaptures += 1;
const offset = numCaptures;
let re = source(regexps[i]);
if (i > 0) {
ret += separator;
}
ret += "(";
while (re.length > 0) {
const match = backreferenceRe.exec(re);
if (match == null) {
ret += re;
break;
}
ret += re.substring(0, match.index);
re = re.substring(match.index + match[0].length);
if (match[0][0] === '\\' && match[1]) {
// Adjust the backreference.
ret += '\\' + String(Number(match[1]) + offset);
} else {
ret += match[0];
if (match[0] === '(') {
numCaptures++;
}
}
}
ret += ")";
}
return ret;
}
// Common regexps
const IDENT_RE = '[a-zA-Z]\\w*';
const UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*';
const NUMBER_RE = '\\b\\d+(\\.\\d+)?';
const C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float
const BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b...
const RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
/**
* @param { Partial<Mode> & {binary?: string | RegExp} } opts
*/
const SHEBANG = (opts = {}) => {
const beginShebang = /^#![ ]*\//;
if (opts.binary) {
opts.begin = concat(
beginShebang,
/.*\b/,
opts.binary,
/\b.*/);
}
return inherit({
className: 'meta',
begin: beginShebang,
end: /$/,
relevance: 0,
/** @type {ModeCallback} */
"on:begin": (m, resp) => {
if (m.index !== 0) resp.ignoreMatch();
}
}, opts);
};
// Common modes
const BACKSLASH_ESCAPE = {
begin: '\\\\[\\s\\S]', relevance: 0
};
const APOS_STRING_MODE = {
className: 'string',
begin: '\'',
end: '\'',
illegal: '\\n',
contains: [BACKSLASH_ESCAPE]
};
const QUOTE_STRING_MODE = {
className: 'string',
begin: '"',
end: '"',
illegal: '\\n',
contains: [BACKSLASH_ESCAPE]
};
const PHRASAL_WORDS_MODE = {
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
};
/**
* Creates a comment mode
*
* @param {string | RegExp} begin
* @param {string | RegExp} end
* @param {Mode | {}} [modeOptions]
* @returns {Partial<Mode>}
*/
const COMMENT = function(begin, end, modeOptions = {}) {
const mode = inherit(
{
className: 'comment',
begin,
end,
contains: []
},
modeOptions
);
mode.contains.push(PHRASAL_WORDS_MODE);
mode.contains.push({
className: 'doctag',
begin: '(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
relevance: 0
});
return mode;
};
const C_LINE_COMMENT_MODE = COMMENT('//', '$');
const C_BLOCK_COMMENT_MODE = COMMENT('/\\*', '\\*/');
const HASH_COMMENT_MODE = COMMENT('#', '$');
const NUMBER_MODE = {
className: 'number',
begin: NUMBER_RE,
relevance: 0
};
const C_NUMBER_MODE = {
className: 'number',
begin: C_NUMBER_RE,
relevance: 0
};
const BINARY_NUMBER_MODE = {
className: 'number',
begin: BINARY_NUMBER_RE,
relevance: 0
};
const CSS_NUMBER_MODE = {
className: 'number',
begin: NUMBER_RE + '(' +
'%|em|ex|ch|rem' +
'|vw|vh|vmin|vmax' +
'|cm|mm|in|pt|pc|px' +
'|deg|grad|rad|turn' +
'|s|ms' +
'|Hz|kHz' +
'|dpi|dpcm|dppx' +
')?',
relevance: 0
};
const REGEXP_MODE = {
// this outer rule makes sure we actually have a WHOLE regex and not simply
// an expression such as:
//
// 3 / something
//
// (which will then blow up when regex's `illegal` sees the newline)
begin: /(?=\/[^/\n]*\/)/,
contains: [{
className: 'regexp',
begin: /\//,
end: /\/[gimuy]*/,
illegal: /\n/,
contains: [
BACKSLASH_ESCAPE,
{
begin: /\[/,
end: /\]/,
relevance: 0,
contains: [BACKSLASH_ESCAPE]
}
]
}]
};
const TITLE_MODE = {
className: 'title',
begin: IDENT_RE,
relevance: 0
};
const UNDERSCORE_TITLE_MODE = {
className: 'title',
begin: UNDERSCORE_IDENT_RE,
relevance: 0
};
const METHOD_GUARD = {
// excludes method names from keyword processing
begin: '\\.\\s*' + UNDERSCORE_IDENT_RE,
relevance: 0
};
/**
* Adds end same as begin mechanics to a mode
*
* Your mode must include at least a single () match group as that first match
* group is what is used for comparison
* @param {Partial<Mode>} mode
*/
const END_SAME_AS_BEGIN = function(mode) {
return Object.assign(mode,
{
/** @type {ModeCallback} */
'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },
/** @type {ModeCallback} */
'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }
});
};
var MODES = /*#__PURE__*/Object.freeze({
__proto__: null,
IDENT_RE: IDENT_RE,
UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,
NUMBER_RE: NUMBER_RE,
C_NUMBER_RE: C_NUMBER_RE,
BINARY_NUMBER_RE: BINARY_NUMBER_RE,
RE_STARTERS_RE: RE_STARTERS_RE,
SHEBANG: SHEBANG,
BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,
APOS_STRING_MODE: APOS_STRING_MODE,
QUOTE_STRING_MODE: QUOTE_STRING_MODE,
PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,
COMMENT: COMMENT,
C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,
C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,
HASH_COMMENT_MODE: HASH_COMMENT_MODE,
NUMBER_MODE: NUMBER_MODE,
C_NUMBER_MODE: C_NUMBER_MODE,
BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,
CSS_NUMBER_MODE: CSS_NUMBER_MODE,
REGEXP_MODE: REGEXP_MODE,
TITLE_MODE: TITLE_MODE,
UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE,
METHOD_GUARD: METHOD_GUARD,
END_SAME_AS_BEGIN: END_SAME_AS_BEGIN
});
// Grammar extensions / plugins
// See: https://github.com/highlightjs/highlight.js/issues/2833
// Grammar extensions allow "syntactic sugar" to be added to the grammar modes
// without requiring any underlying changes to the compiler internals.
// `compileMatch` being the perfect small example of now allowing a grammar
// author to write `match` when they desire to match a single expression rather
// than being forced to use `begin`. The extension then just moves `match` into
// `begin` when it runs. Ie, no features have been added, but we've just made
// the experience of writing (and reading grammars) a little bit nicer.
// ------
// TODO: We need negative look-behind support to do this properly
/**
* Skip a match if it has a preceding dot
*
* This is used for `beginKeywords` to prevent matching expressions such as
* `bob.keyword.do()`. The mode compiler automatically wires this up as a
* special _internal_ 'on:begin' callback for modes with `beginKeywords`
* @param {RegExpMatchArray} match
* @param {CallbackResponse} response
*/
function skipIfhasPrecedingDot(match, response) {
const before = match.input[match.index - 1];
if (before === ".") {
response.ignoreMatch();
}
}
/**
* `beginKeywords` syntactic sugar
* @type {CompilerExt}
*/
function beginKeywords(mode, parent) {
if (!parent) return;
if (!mode.beginKeywords) return;
// for languages with keywords that include non-word characters checking for
// a word boundary is not sufficient, so instead we check for a word boundary
// or whitespace - this does no harm in any case since our keyword engine
// doesn't allow spaces in keywords anyways and we still check for the boundary
// first
mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\.)(?=\\b|\\s)';
mode.__beforeBegin = skipIfhasPrecedingDot;
mode.keywords = mode.keywords || mode.beginKeywords;
delete mode.beginKeywords;
}
/**
* Allow `illegal` to contain an array of illegal values
* @type {CompilerExt}
*/
function compileIllegal(mode, _parent) {
if (!Array.isArray(mode.illegal)) return;
mode.illegal = either(...mode.illegal);
}
/**
* `match` to match a single expression for readability
* @type {CompilerExt}
*/
function compileMatch(mode, _parent) {
if (!mode.match) return;
if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
mode.begin = mode.match;
delete mode.match;
}
/**
* provides the default 1 relevance to all modes
* @type {CompilerExt}
*/
function compileRelevance(mode, _parent) {
// eslint-disable-next-line no-undefined
if (mode.relevance === undefined) mode.relevance = 1;
}
// keywords that should have no default relevance value
const COMMON_KEYWORDS = [
'of',
'and',
'for',
'in',
'not',
'or',
'if',
'then',
'parent', // common variable name
'list', // common variable name
'value' // common variable name
];
/**
* Given raw keywords from a language definition, compile them.
*
* @param {string | Record<string,string>} rawKeywords
* @param {boolean} caseInsensitive
*/
function compileKeywords(rawKeywords, caseInsensitive) {
/** @type KeywordDict */
const compiledKeywords = {};
if (typeof rawKeywords === 'string') { // string
splitAndCompile('keyword', rawKeywords);
} else {
Object.keys(rawKeywords).forEach(function(className) {
splitAndCompile(className, rawKeywords[className]);
});
}
return compiledKeywords;
// ---
/**
* Compiles an individual list of keywords
*
* Ex: "for if when while|5"
*
* @param {string} className
* @param {string} keywordList
*/
function splitAndCompile(className, keywordList) {
if (caseInsensitive) {
keywordList = keywordList.toLowerCase();
}
keywordList.split(' ').forEach(function(keyword) {
const pair = keyword.split('|');
compiledKeywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];
});
}
}
/**
* Returns the proper score for a given keyword
*
* Also takes into account comment keywords, which will be scored 0 UNLESS
* another score has been manually assigned.
* @param {string} keyword
* @param {string} [providedScore]
*/
function scoreForKeyword(keyword, providedScore) {
// manual scores always win over common keywords
// so you can force a score of 1 if you really insist
if (providedScore) {
return Number(providedScore);
}
return commonKeyword(keyword) ? 0 : 1;
}
/**
* Determines if a given keyword is common or not
*
* @param {stri