lhcb-ntuple-wizard 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/COPYING +674 -0
  2. package/README.md +25 -0
  3. package/dist/components/App.js +136 -0
  4. package/dist/components/ConfigDict.js +117 -0
  5. package/dist/components/ConfigList.js +115 -0
  6. package/dist/components/ConfigNode.js +345 -0
  7. package/dist/components/ConfigValue.js +99 -0
  8. package/dist/components/Dataset.js +82 -0
  9. package/dist/components/Decay.js +64 -0
  10. package/dist/components/DecayItem.js +122 -0
  11. package/dist/components/DecayTag.js +65 -0
  12. package/dist/components/DecayTree.js +518 -0
  13. package/dist/components/DecaysList.js +121 -0
  14. package/dist/components/DeleteButton.js +69 -0
  15. package/dist/components/DescriptorsSearch.js +394 -0
  16. package/dist/components/EventTypeBadge.js +58 -0
  17. package/dist/components/ItemSearch.js +146 -0
  18. package/dist/components/LinesTable.js +810 -0
  19. package/dist/components/NtupleWizard.js +125 -0
  20. package/dist/components/ParticleTag.js +67 -0
  21. package/dist/components/PolarityBadge.js +48 -0
  22. package/dist/components/SearchItem.js +130 -0
  23. package/dist/components/SelectParticle.js +94 -0
  24. package/dist/components/SelectTag.js +88 -0
  25. package/dist/components/SelectTool.js +80 -0
  26. package/dist/components/SelectVariables.js +133 -0
  27. package/dist/components/StrippingBadge.js +76 -0
  28. package/dist/components/StrippingLine.js +66 -0
  29. package/dist/components/TupleTool.js +59 -0
  30. package/dist/components/VariablesSearch.js +154 -0
  31. package/dist/components/YearBadge.js +48 -0
  32. package/dist/config.json +83 -0
  33. package/dist/contexts/MetadataContext.js +154 -0
  34. package/dist/index.js +18 -0
  35. package/dist/lib/BKPath.js +83 -0
  36. package/dist/lib/DTTConfig.js +213 -0
  37. package/dist/lib/mathjax.js +36 -0
  38. package/dist/lib/utils.js +228 -0
  39. package/dist/style/DecaysList.css +15 -0
  40. package/package.json +65 -0
@@ -0,0 +1,810 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _emailValidator = _interopRequireDefault(require("email-validator"));
9
+ var _jsYaml = _interopRequireDefault(require("js-yaml"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _reactBootstrap = require("react-bootstrap");
13
+ var _reactBootstrapIcons = require("react-bootstrap-icons");
14
+ var _reactRouterDom = require("react-router-dom");
15
+ var _reactSelect = _interopRequireDefault(require("react-select"));
16
+ var _creatable = _interopRequireDefault(require("react-select/creatable"));
17
+ var _config = _interopRequireDefault(require("../config"));
18
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
19
+ var _BKPath = _interopRequireDefault(require("../lib/BKPath"));
20
+ var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
21
+ var _utils = require("../lib/utils");
22
+ var _Dataset = _interopRequireDefault(require("./Dataset"));
23
+ var _Decay = _interopRequireDefault(require("./Decay"));
24
+ var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));
25
+ var _StrippingLine = _interopRequireDefault(require("./StrippingLine"));
26
+ var _jsxRuntime = require("react/jsx-runtime");
27
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
29
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
30
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
31
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
35
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
36
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
40
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
45
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
46
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
47
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
48
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
49
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
50
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
51
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
52
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
53
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
54
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
55
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
56
+ function streamLinesToOption(row) {
57
+ var opts = {};
58
+ var streamArr = [];
59
+ var lineArr = [];
60
+ var groups = [];
61
+ Object.keys(row.decay.lines).forEach(function (streamLine) {
62
+ var _streamLine$split = streamLine.split("/"),
63
+ _streamLine$split2 = _slicedToArray(_streamLine$split, 2),
64
+ stream = _streamLine$split2[0],
65
+ line = _streamLine$split2[1];
66
+ streamArr.push(stream);
67
+ lineArr.push(line);
68
+ });
69
+ var uniqStreamArr = _toConsumableArray(new Set(streamArr));
70
+ uniqStreamArr.forEach(function (uniq) {
71
+ opts[uniq] = [];
72
+ lineArr.forEach(function (element, index) {
73
+ if (streamArr[index] === uniq) {
74
+ var dup = false;
75
+ var opt = {
76
+ value: element,
77
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
78
+ line: element,
79
+ stream: uniq,
80
+ versions: row.decay.lines[uniq + "/" + element]
81
+ }),
82
+ group: uniq
83
+ };
84
+ opts[uniq].forEach(function (obj) {
85
+ if (obj["label"] === element) {
86
+ dup = true;
87
+ }
88
+ });
89
+ if (!dup) {
90
+ opts[uniq].push(opt);
91
+ }
92
+ }
93
+ });
94
+ groups.push({
95
+ label: uniq,
96
+ options: opts[uniq]
97
+ });
98
+ });
99
+ return groups;
100
+ }
101
+ function pathToOption(path) {
102
+ return Object({
103
+ value: path,
104
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dataset.default, {
105
+ path: path
106
+ })
107
+ });
108
+ }
109
+ var LinesTable = /*#__PURE__*/function (_React$Component) {
110
+ _inherits(LinesTable, _React$Component);
111
+ var _super = _createSuper(LinesTable);
112
+ function LinesTable(props) {
113
+ var _this;
114
+ _classCallCheck(this, LinesTable);
115
+ _this = _super.call(this, props);
116
+ _defineProperty(_assertThisInitialized(_this), "state", {
117
+ rows: _this.props.rows.map(function (row) {
118
+ return _objectSpread(_objectSpread({}, row), {}, {
119
+ dtt: row.dtt ? new _DTTConfig.default(row.dtt, []) : false
120
+ });
121
+ }),
122
+ showUploadModal: false,
123
+ modalID: -99,
124
+ productionName: _this.props.name,
125
+ contactEmail: _this.props.email
126
+ });
127
+ _defineProperty(_assertThisInitialized(_this), "handleSubmitRows", function (history) {
128
+ var rows = _toConsumableArray(_this.state.rows);
129
+ rows.forEach(function (row) {
130
+ row.editTree = true;
131
+ });
132
+ _this.props.parentCallbackRows(rows);
133
+ _this.props.parentCallbackInfo(_this.state.productionName, _this.state.contactEmail);
134
+ history.push(_this.propsVar.variablesPath);
135
+ });
136
+ _defineProperty(_assertThisInitialized(_this), "handleSubmitSpecificRow", function (history, idx) {
137
+ var rows = _toConsumableArray(_this.state.rows);
138
+ rows.forEach(function (row) {
139
+ row.editTree = row.id === idx;
140
+ });
141
+ _this.props.parentCallbackRows(rows);
142
+ _this.props.parentCallbackInfo(_this.state.productionName, _this.state.contactEmail);
143
+ history.push(_this.propsVar.variablesPath);
144
+ });
145
+ _defineProperty(_assertThisInitialized(_this), "handleAddRow", function (history) {
146
+ _this.props.parentCallbackInfo(_this.state.productionName, _this.state.contactEmail);
147
+ history.push(_this.propsVar.decaysPath);
148
+ });
149
+ _defineProperty(_assertThisInitialized(_this), "handleRemoveSpecificRow", function (id) {
150
+ return function () {
151
+ var rows = _toConsumableArray(_this.state.rows);
152
+ rows = rows.filter(function (row) {
153
+ return row.id !== id;
154
+ });
155
+ _this.setState({
156
+ rows: rows
157
+ });
158
+ _this.props.parentCallbackRows(rows);
159
+ };
160
+ });
161
+ _defineProperty(_assertThisInitialized(_this), "handleRemoveSpecificRowDTT", function (id) {
162
+ return function () {
163
+ var rows = _toConsumableArray(_this.state.rows);
164
+ var index = _this.state.rows.findIndex(function (item) {
165
+ return item.id === id;
166
+ });
167
+ rows[index].dtt = false;
168
+ _this.setState({
169
+ rows: rows
170
+ });
171
+ _this.props.parentCallbackRows(rows);
172
+ };
173
+ });
174
+ _defineProperty(_assertThisInitialized(_this), "handleCreateDTT", function (id) {
175
+ return function () {
176
+ var rows = _toConsumableArray(_this.state.rows);
177
+ var index = _this.state.rows.findIndex(function (item) {
178
+ return item.id === id;
179
+ });
180
+ rows[index].dtt = _DTTConfig.default.createDTT(rows[index].decay.descriptors.template, rows[index].decay.descriptors.mapped_list.flat(Infinity), [], "", _this.context.metadata.tupleTools);
181
+ _this.setInputs(id, rows[index].lines);
182
+ _this.setState({
183
+ rows: rows
184
+ });
185
+ _this.props.parentCallbackRows(rows);
186
+ };
187
+ });
188
+ _defineProperty(_assertThisInitialized(_this), "setInputs", function (id, lines) {
189
+ var rows = _toConsumableArray(_this.state.rows);
190
+ var index = _this.state.rows.findIndex(function (item) {
191
+ return item.id === id;
192
+ });
193
+ var inputs = lines.map(function (_ref) {
194
+ var stream = _ref.stream,
195
+ line = _ref.line;
196
+ var lineLocation = String(line).replace("Stripping", "");
197
+ return "/Event/".concat(stream, "/Phys/").concat(lineLocation, "/Particles");
198
+ });
199
+ rows[index].dtt.setInputs(inputs);
200
+ _this.setState({
201
+ rows: rows
202
+ });
203
+ _this.props.parentCallbackRows(rows);
204
+ });
205
+ _defineProperty(_assertThisInitialized(_this), "changeSelStrLines", function (id) {
206
+ return function (choices) {
207
+ var rows = _toConsumableArray(_this.state.rows);
208
+ var index = _this.state.rows.findIndex(function (item) {
209
+ return item.id === id;
210
+ }); // All choices have the same value (row.id)
211
+
212
+ rows[index].lines = choices.map(function (choice) {
213
+ return Object({
214
+ stream: choice.group,
215
+ line: choice.value,
216
+ versions: _this.state.rows[index].decay.lines[choice.group + "/" + choice.value]
217
+ });
218
+ });
219
+ _this.setState({
220
+ rows: rows
221
+ });
222
+ _this.pathChoiceHandler(id)(rows[index].paths.map(function (path) {
223
+ return {
224
+ value: path
225
+ };
226
+ }));
227
+ if (rows[index].dtt) {
228
+ _this.setInputs(id, rows[index].lines);
229
+ }
230
+ };
231
+ });
232
+ _defineProperty(_assertThisInitialized(_this), "validatePath", function (choice, lines) {
233
+ var path = new _BKPath.default(choice);
234
+ if (!path.isValid()) {
235
+ return false;
236
+ }
237
+ return lines.every(function (line) {
238
+ var streamName = line.stream.toLowerCase();
239
+ var filename = path.getFilename().split(".")[0].toLowerCase();
240
+ var matchingVersion = line.versions.some(function (version) {
241
+ return path.getStrippingVersion() === version;
242
+ });
243
+ return ["allstreams", streamName].includes(filename) && matchingVersion;
244
+ });
245
+ });
246
+ _defineProperty(_assertThisInitialized(_this), "pathChoiceHandler", function (id) {
247
+ return function (choices) {
248
+ var rows = _toConsumableArray(_this.state.rows);
249
+ var index = _this.state.rows.findIndex(function (item) {
250
+ return item.id === id;
251
+ }); // All choices have the same value (row.id)
252
+ var validPaths = choices.filter(function (choice) {
253
+ return _this.validatePath(choice.value, _this.state.rows[index].lines);
254
+ }).map(function (choice) {
255
+ return choice.value;
256
+ });
257
+ var validPathOptions = rows[index].pathOptions.filter(function (choice) {
258
+ return _this.validatePath(choice, _this.state.rows[index].lines);
259
+ });
260
+ rows[index].paths = validPaths;
261
+ rows[index].pathOptions = validPathOptions;
262
+ _this.setState({
263
+ rows: rows
264
+ });
265
+ _this.props.parentCallbackRows(rows);
266
+ };
267
+ });
268
+ _defineProperty(_assertThisInitialized(_this), "pathCreateHandler", function (id) {
269
+ return function (choice) {
270
+ var rows = _toConsumableArray(_this.state.rows);
271
+ var index = _this.state.rows.findIndex(function (item) {
272
+ return item.id === id;
273
+ }); // All choices have the same value (row.id)
274
+ if (_this.validatePath(choice.value, _this.state.rows[index].lines)) {
275
+ rows[index].paths.push(choice.value);
276
+ rows[index].pathOptions.push(choice.value);
277
+ }
278
+ _this.setState({
279
+ rows: rows
280
+ });
281
+ };
282
+ });
283
+ _defineProperty(_assertThisInitialized(_this), "setRowName", function (id) {
284
+ return function (_ref2) {
285
+ var target = _ref2.target;
286
+ var rows = _toConsumableArray(_this.state.rows);
287
+ var index = _this.state.rows.findIndex(function (item) {
288
+ return item.id === id;
289
+ });
290
+ rows[index].dtt.setName(target.value);
291
+ _this.setState({
292
+ rows: rows
293
+ });
294
+ _this.props.parentCallbackRows(rows);
295
+ };
296
+ });
297
+ _defineProperty(_assertThisInitialized(_this), "setProductionName", function (_ref3) {
298
+ var target = _ref3.target;
299
+ var safeName = target.value.replaceAll(/[^\w]/g, "");
300
+ _this.setState({
301
+ productionName: safeName
302
+ });
303
+ _this.props.parentCallbackInfo(safeName, _this.state.contactEmail);
304
+ });
305
+ _defineProperty(_assertThisInitialized(_this), "setContactEmail", function (_ref4) {
306
+ var target = _ref4.target;
307
+ var emails = target.value.split(/[\s,]+/);
308
+ _this.setState({
309
+ contactEmail: emails
310
+ });
311
+ var validEmails = emails.filter(function (email) {
312
+ return _emailValidator.default.validate(email);
313
+ });
314
+ _this.props.parentCallbackInfo(_this.state.productionName, validEmails);
315
+ });
316
+ _defineProperty(_assertThisInitialized(_this), "clearAll", function () {
317
+ _this.setState({
318
+ productionName: "",
319
+ contactEmail: [],
320
+ rows: []
321
+ });
322
+ _this.props.parentCallbackRows([]);
323
+ _this.props.parentCallbackInfo("", []);
324
+ });
325
+ _defineProperty(_assertThisInitialized(_this), "getBKPaths", function (id) {
326
+ var index = _this.state.rows.findIndex(function (item) {
327
+ return item.id === id;
328
+ });
329
+ var row = _this.state.rows[index];
330
+ var options = row.paths.map(function (path) {
331
+ return pathToOption(path);
332
+ });
333
+ return options;
334
+ });
335
+ _defineProperty(_assertThisInitialized(_this), "defaultBKPaths", function (id) {
336
+ var index = _this.state.rows.findIndex(function (item) {
337
+ return item.id === id;
338
+ });
339
+ var row = _this.state.rows[index];
340
+ var defaultOptions = _this.context.loaded.dataset ? _this.context.metadata.dataset.filter(function (path) {
341
+ return _this.validatePath(path, row.lines);
342
+ }).map(function (path) {
343
+ return pathToOption(path);
344
+ }) : [];
345
+ var options = row.pathOptions.map(function (path) {
346
+ return pathToOption(path);
347
+ });
348
+ return [].concat(defaultOptions, options);
349
+ });
350
+ _defineProperty(_assertThisInitialized(_this), "createInfoYaml", function () {
351
+ var _ref5;
352
+ var rows = _toConsumableArray(_this.state.rows);
353
+ var uniquePaths = new Set((_ref5 = []).concat.apply(_ref5, _toConsumableArray(rows.map(function (row) {
354
+ return row.paths;
355
+ }))));
356
+ var uniquePathList = _toConsumableArray(uniquePaths).sort();
357
+ var info = {
358
+ defaults: {
359
+ application: "DaVinci/v45r8",
360
+ // TODO: get from metadata
361
+ wg: "DPA",
362
+ // TODO: get input from (LHCb) user. keep "DPA" if open data
363
+ automatically_configure: true,
364
+ inform: _this.state.contactEmail,
365
+ output: "DVNtuple.root" // Probably okay to leave this as the default
366
+ }
367
+ };
368
+
369
+ rows.forEach(function (row) {
370
+ row.paths.forEach(function (path, _index) {
371
+ var jobID = uniquePathList.findIndex(function (otherPath) {
372
+ return otherPath === path;
373
+ });
374
+ var key = "job".concat(jobID);
375
+ var dttFile = "".concat(row.dtt.getSafeName(), ".py");
376
+ if (key in info) {
377
+ info[key].options.push(dttFile);
378
+ } else {
379
+ info[key] = {
380
+ input: {
381
+ bk_query: path
382
+ },
383
+ options: [dttFile] // TODO: figure out the actual syntax that AnaProd needs to indicate that this is to be parsed into a DecayTreeTuple
384
+ };
385
+
386
+ if (path.includes("MDST")) {
387
+ var stream = row.lines[0].stream; // XXX: in the validation we enforce that each BK location be compatible with every line, so effectively forcing one stream per row
388
+ info[key].root_in_tes = "/Event/".concat(stream);
389
+ }
390
+ }
391
+ });
392
+ });
393
+ return info;
394
+ });
395
+ _defineProperty(_assertThisInitialized(_this), "uploadConfig", function (e, id) {
396
+ var rows = _toConsumableArray(_this.state.rows);
397
+ var index = _this.state.rows.findIndex(function (item) {
398
+ return item.id === id;
399
+ });
400
+ e.preventDefault();
401
+ var reader = new FileReader();
402
+ reader.onload = /*#__PURE__*/function () {
403
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
404
+ var text, config;
405
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
406
+ while (1) switch (_context.prev = _context.next) {
407
+ case 0:
408
+ text = e.target.result;
409
+ config = _jsYaml.default.load(text);
410
+ if (config.descriptorTemplate === rows[index].decay.descriptors.template) {
411
+ rows[index].dtt = new _DTTConfig.default(config, []);
412
+ _this.setInputs(id, rows[index].lines);
413
+ _this.setState({
414
+ rows: rows,
415
+ showUploadModal: false
416
+ });
417
+ _this.props.parentCallbackRows(rows);
418
+ } else {
419
+ alert("Make sure to upload a previously downloaded configuration file for the same decay.");
420
+ }
421
+ case 3:
422
+ case "end":
423
+ return _context.stop();
424
+ }
425
+ }, _callee);
426
+ }));
427
+ return function (_x2) {
428
+ return _ref6.apply(this, arguments);
429
+ };
430
+ }();
431
+ reader.readAsText(e.target.files[0]);
432
+ });
433
+ _defineProperty(_assertThisInitialized(_this), "handleShowUploadModal", function (id) {
434
+ _this.setState({
435
+ showUploadModal: true,
436
+ modalID: id
437
+ });
438
+ });
439
+ _defineProperty(_assertThisInitialized(_this), "handleCloseUploadModal", function () {
440
+ _this.setState({
441
+ showUploadModal: false
442
+ });
443
+ });
444
+ _defineProperty(_assertThisInitialized(_this), "createPyOpts", function (row) {
445
+ var subdirectory = _this.state.productionName;
446
+ var filename = row.dtt.getSafeName();
447
+ return Array.apply(void 0, _toConsumableArray(_config.default.pyOptsTemplate)).join("\n").replace("{subdirectory}", subdirectory).replace("{filename}", filename);
448
+ });
449
+ _defineProperty(_assertThisInitialized(_this), "downloadAll", function () {
450
+ var allFiles = [].concat(_this.state.rows.map(function (row) {
451
+ return ["".concat(row.dtt.getSafeName(), ".yaml"), _jsYaml.default.dump(row.dtt.config)];
452
+ }), _this.state.rows.map(function (row) {
453
+ return ["".concat(row.dtt.getSafeName(), ".py"), _this.createPyOpts(row)];
454
+ }), [["info.yaml", _jsYaml.default.dump(_this.createInfoYaml())]]);
455
+ return (0, _utils.downloadZip)(allFiles, "".concat(_this.state.productionName, ".zip"));
456
+ });
457
+ _this.propsVar = _this.props;
458
+ return _this;
459
+ }
460
+ _createClass(LinesTable, [{
461
+ key: "render",
462
+ value: function render() {
463
+ var _this2 = this;
464
+ var emptySession = !this.state.productionName && this.state.contactEmail.length === 0 && this.state.rows.length === 0;
465
+ var validEmail = this.state.contactEmail.length > 0 && this.state.contactEmail.every(function (email) {
466
+ return _emailValidator.default.validate(email);
467
+ });
468
+ var nRows = this.state.rows.filter(function (row) {
469
+ return row.dtt;
470
+ }).length;
471
+ var ready = nRows > 0 && nRows === this.state.rows.length;
472
+ var readyPaths = this.state.rows.every(function (row) {
473
+ return row.paths.length > 0;
474
+ });
475
+ var tableContent = this.state.rows.map(function (row) {
476
+ var safeName = row.dtt ? row.dtt.getSafeName() : "";
477
+ var allSafeNames = _this2.state.rows.filter(function (otherRow) {
478
+ return otherRow.dtt;
479
+ }).map(function (otherRow) {
480
+ return otherRow.dtt.getSafeName();
481
+ });
482
+ var hasValidName = allSafeNames.filter(function (name) {
483
+ return name === safeName;
484
+ }).length === 1;
485
+ var urls = row.lines.map(function (strline) {
486
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
487
+ line: strline.line,
488
+ stream: strline.stream,
489
+ versions: strline.versions,
490
+ showlink: true
491
+ }, "".concat(strline.line));
492
+ });
493
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Row, {
494
+ className: "align-items-center",
495
+ style: {
496
+ marginBottom: 10
497
+ },
498
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
499
+ lg: true,
500
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card, {
501
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Header, {
502
+ className: "d-flex justify-content-between align-items-start",
503
+ children: [row.dtt ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
504
+ hasValidation: true,
505
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
506
+ placeholder: "DecayTree",
507
+ value: row.dtt.getName(),
508
+ onChange: _this2.setRowName(row.id),
509
+ isInvalid: !hasValidName
510
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl.Feedback, {
511
+ type: "invalid",
512
+ children: "Must give a unique name"
513
+ })]
514
+ }) : "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
515
+ children: row.dtt ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
516
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
517
+ render: function render(_ref7) {
518
+ var history = _ref7.history;
519
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
520
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
521
+ children: "Configure this DecayTreeTuple"
522
+ }),
523
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
524
+ type: "submit",
525
+ variant: "secondary",
526
+ onClick: function onClick() {
527
+ _this2.handleSubmitSpecificRow(history, row.id);
528
+ },
529
+ disabled: !hasValidName && !_this2.context.loaded.tupleTools,
530
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {})
531
+ })
532
+ });
533
+ }
534
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
535
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
536
+ children: "Download DecayTreeTuple YAML configuration file"
537
+ }),
538
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
539
+ className: "ms-auto",
540
+ type: "button",
541
+ onClick: function onClick() {
542
+ (0, _utils.download)(_jsYaml.default.dump(row.dtt.config), "".concat(row.dtt.getSafeName(), ".yaml"));
543
+ },
544
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {})
545
+ })
546
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
547
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
548
+ children: "Download python options file to load this DecayTreeTuple from YAML"
549
+ }),
550
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
551
+ className: "ms-auto",
552
+ type: "button",
553
+ onClick: function onClick() {
554
+ return (0, _utils.download)(_this2.createPyOpts(row), "".concat(row.dtt.getSafeName(), ".py"));
555
+ },
556
+ disabled: !_this2.state.productionName,
557
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.FileEarmarkCode, {})
558
+ })
559
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
560
+ action: _this2.handleRemoveSpecificRowDTT(row.id)
561
+ })]
562
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
563
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
564
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
565
+ children: "Add a DecayTreeTuple"
566
+ }),
567
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
568
+ type: "submit",
569
+ variant: "success",
570
+ onClick: _this2.handleCreateDTT(row.id),
571
+ disabled: !_this2.context.loaded.tupleTools,
572
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
573
+ })
574
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
575
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
576
+ children: "Upload DecayTreeTuple configuration file"
577
+ }),
578
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
579
+ className: "ms-auto",
580
+ type: "button",
581
+ onClick: function onClick() {
582
+ _this2.handleShowUploadModal(row.id);
583
+ },
584
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Upload, {})
585
+ })
586
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
587
+ show: _this2.state.showUploadModal,
588
+ animation: false,
589
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Header, {
590
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Title, {
591
+ children: " Upload configuration file "
592
+ })
593
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Body, {
594
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Group, {
595
+ controlId: "formFile",
596
+ className: "mb-3",
597
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
598
+ type: "file",
599
+ onChange: function onChange(event) {
600
+ _this2.uploadConfig(event, _this2.state.modalID);
601
+ },
602
+ onClick: function onClick(event) {
603
+ event.target.value = null;
604
+ },
605
+ disabled: !_this2.context.loaded.tupleTools
606
+ })
607
+ })
608
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Footer, {
609
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
610
+ variant: "secondary",
611
+ onClick: _this2.handleCloseUploadModal,
612
+ children: "Close"
613
+ })
614
+ })]
615
+ })]
616
+ })
617
+ })]
618
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Body, {
619
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Decay.default, {
620
+ decay: row.decay,
621
+ display: false
622
+ })
623
+ })]
624
+ })
625
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
626
+ lg: true,
627
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
628
+ isMulti: true,
629
+ options: streamLinesToOption(row),
630
+ defaultValue: row.lines.map(function (lineInfo) {
631
+ return Object({
632
+ value: lineInfo.line,
633
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
634
+ line: lineInfo.line,
635
+ stream: lineInfo.stream,
636
+ versions: lineInfo.versions,
637
+ showlink: false
638
+ }),
639
+ group: lineInfo.stream
640
+ });
641
+ }),
642
+ placeholder: "Stripping line",
643
+ onChange: _this2.changeSelStrLines(row.id)
644
+ })
645
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
646
+ xs: "auto",
647
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
648
+ trigger: "click",
649
+ placement: "right",
650
+ rootClose: true,
651
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
652
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
653
+ children: urls
654
+ })
655
+ }),
656
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
657
+ className: "ms-auto",
658
+ type: "button",
659
+ disabled: urls.length === 0,
660
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.QuestionCircle, {})
661
+ })
662
+ })
663
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
664
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_creatable.default, {
665
+ isMulti: true,
666
+ options: _this2.defaultBKPaths(row.id) /*TODO: use ODP records when ready*/,
667
+ value: _this2.getBKPaths(row.id),
668
+ isDisabled: row.lines.length === 0,
669
+ placeholder: "Bookkeeping path",
670
+ onChange: _this2.pathChoiceHandler(row.id),
671
+ onCreateOption: _this2.pathCreateHandler(row.id),
672
+ closeMenuOnSelect: false
673
+ })
674
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
675
+ xs: "auto",
676
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
677
+ action: _this2.handleRemoveSpecificRow(row.id)
678
+ })
679
+ })]
680
+ }, row.id);
681
+ });
682
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
683
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
684
+ children: "Production configuration"
685
+ }), tableContent, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
686
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
687
+ xs: "auto",
688
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
689
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
690
+ render: function render(_ref8) {
691
+ var history = _ref8.history;
692
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
693
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
694
+ children: "Select decays"
695
+ }),
696
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
697
+ type: "submit",
698
+ variant: "success",
699
+ onClick: function onClick() {
700
+ return _this2.handleAddRow(history);
701
+ },
702
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
703
+ })
704
+ });
705
+ }
706
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
707
+ render: function render(_ref9) {
708
+ var history = _ref9.history;
709
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
710
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
711
+ children: "Configure all DecayTreeTuples"
712
+ }),
713
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
714
+ type: "submit",
715
+ variant: "secondary",
716
+ onClick: function onClick() {
717
+ return _this2.handleSubmitRows(history);
718
+ },
719
+ disabled: !ready,
720
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {}), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
721
+ pill: true,
722
+ bg: "primary",
723
+ children: nRows
724
+ })]
725
+ })
726
+ });
727
+ }
728
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
729
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
730
+ children: "Download Analysis Production configuration file (info.yaml)"
731
+ }),
732
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
733
+ type: "download",
734
+ onClick: function onClick() {
735
+ return (0, _utils.download)(_jsYaml.default.dump(_this2.createInfoYaml()), "info.yaml");
736
+ },
737
+ disabled: !ready || !readyPaths || !validEmail,
738
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {})
739
+ })
740
+ })]
741
+ })
742
+ })
743
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
744
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Col, {
745
+ xs: 4,
746
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
747
+ hasValidation: true,
748
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
749
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
750
+ children: "Name of this production. This will become the subdirectory in AnalysisProductions"
751
+ }),
752
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
753
+ children: "Title"
754
+ })
755
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
756
+ value: this.state.productionName,
757
+ onChange: this.setProductionName,
758
+ isValid: this.state.productionName,
759
+ placeholder: "MyAnalysis"
760
+ })]
761
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
762
+ hasValidation: true,
763
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
764
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
765
+ children: "Email addresses to notify (comma-separated)"
766
+ }),
767
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
768
+ children: "Email"
769
+ })
770
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
771
+ type: "email",
772
+ value: this.state.contactEmail.join(","),
773
+ onChange: this.setContactEmail,
774
+ isValid: validEmail,
775
+ placeholder: "name@example.com"
776
+ })]
777
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
778
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
779
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
780
+ children: "Download all files for this production"
781
+ }),
782
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
783
+ disabled: !ready || !readyPaths || !validEmail || !this.state.productionName,
784
+ onClick: this.downloadAll,
785
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {}), " Done"]
786
+ })
787
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
788
+ action: this.clearAll,
789
+ disabled: emptySession,
790
+ children: "Clear"
791
+ })]
792
+ })]
793
+ })
794
+ })]
795
+ });
796
+ }
797
+ }]);
798
+ return LinesTable;
799
+ }(_react.default.Component);
800
+ _defineProperty(LinesTable, "contextType", _MetadataContext.default);
801
+ LinesTable.propTypes = {
802
+ rows: _propTypes.default.arrayOf(_propTypes.default.object),
803
+ name: _propTypes.default.string,
804
+ email: _propTypes.default.arrayOf(_propTypes.default.string),
805
+ parentCallbackInfo: _propTypes.default.func,
806
+ parentCallbackRows: _propTypes.default.func,
807
+ decaysPath: _propTypes.default.string.isRequired
808
+ };
809
+ var _default = LinesTable;
810
+ exports.default = _default;