@nocobase/plugin-workflow 1.5.0-alpha.5 → 1.5.0-beta.2
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.
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,569 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@formily/react"),require("react"),require("react-i18next"),require("@nocobase/evaluators/client"),require("dayjs"),require("antd"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow",["@nocobase/client","@formily/react","react","react-i18next","@nocobase/evaluators/client","dayjs","antd","react-router-dom","@ant-design/icons","@formily/antd-v5","@formily/shared","@nocobase/utils/client","@formily/core","lodash","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow"]=t(require("@nocobase/client"),require("@formily/react"),require("react"),require("react-i18next"),require("@nocobase/evaluators/client"),require("dayjs"),require("antd"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("@formily/reactive")):e["@nocobase/plugin-workflow"]=t(e["@nocobase/client"],e["@formily/react"],e.react,e["react-i18next"],e["@nocobase/evaluators/client"],e.dayjs,e.antd,e["react-router-dom"],e["@ant-design/icons"],e["@formily/antd-v5"],e["@formily/shared"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e["@formily/reactive"])}(self,function(e,t,n,r,o,i,a,l,c,u,s,f,p,d,m){return function(){var y={801:function(e,t,n){"use strict";var r=n(156),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,n){var r,i={},u=null,s=null;for(r in void 0!==n&&(u=""+n),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:u,ref:s,props:i,_owner:l.current}}t.Fragment=i,t.jsx=u,t.jsxs=u},704:function(e,t,n){"use strict";e.exports=n(801)},482:function(e){"use strict";e.exports=c},632:function(e){"use strict";e.exports=u},563:function(e){"use strict";e.exports=p},505:function(e){"use strict";e.exports=t},229:function(e){"use strict";e.exports=m},875:function(e){"use strict";e.exports=s},772:function(t){"use strict";t.exports=e},47:function(e){"use strict";e.exports=o},584:function(e){"use strict";e.exports=f},721:function(e){"use strict";e.exports=a},760:function(e){"use strict";e.exports=i},467:function(e){"use strict";e.exports=d},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=r},128:function(e){"use strict";e.exports=l},527:function(e){!function(){"use strict";var t={}.hasOwnProperty;function n(){for(var e="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(e=r(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var i in e)t.call(e,i)&&e[i]&&(o=r(o,i));return o}(i)))}return e}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()}},b={};function v(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,v),n.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var n in t)v.o(t,n)&&!v.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var h={};return!function(){"use strict";v.r(h),v.d(h,{JobStatusOptionsMap:function(){return ea},WorkflowVariableJSON:function(){return tg},useWorkflowAnyExecuted:function(){return rD},systemOptions:function(){return ti},useRecordTriggerWorkflowsActionProps:function(){return rP},Trigger:function(){return ng},JobStatusOptions:function(){return ei},ValueBlock:function(){return tP},WorkflowVariableInput:function(){return tb},useWorkflowVariableOptions:function(){return tf},Fieldset:function(){return tX},CollectionBlockInitializer:function(){return M},ExecutionStatusOptions:function(){return en},nodesOptions:function(){return tn},FilterDynamicComponent:function(){return tO},useNodeSavedConfig:function(){return eG},Instruction:function(){return eq},NodeDefaultView:function(){return e5},getWorkflowDetailPath:function(){return D},useWorkflowExecuted:function(){return rA},scopeOptions:function(){return to},traverseSchema:function(){return A},CalculationConfig:function(){return tQ},defaultFieldNames:function(){return tt},WorkflowVariableRawTextArea:function(){return th},useGetAriaLabelOfAddButton:function(){return el},SimpleDesigner:function(){return tE},DetailsBlockProvider:function(){return _},useStyles:function(){return eP},FlowContext:function(){return x},JobButton:function(){return eQ},NodeContext:function(){return e$},useTrigger:function(){return nj},useUpstreamScopes:function(){return eH},Node:function(){return eY},useTriggerWorkflowsActionProps:function(){return rC},BaseTypeSets:function(){return ta},triggerOptions:function(){return tr},RadioWithTooltip:function(){return tx},useGetCollectionFields:function(){return ty},RemoveButton:function(){return eK},default:function(){return ab},EXECUTION_STATUS:function(){return et},useNodeContext:function(){return eU},ExecutionStatusOptionsMap:function(){return er},JOB_STATUS:function(){return eo},ExecutionContextProvider:function(){return aa},getWorkflowExecutionsPath:function(){return T},linkNodes:function(){return P},WorkflowVariableTextArea:function(){return tv},CheckboxGroupWithTooltip:function(){return tS},calculators:function(){return t$},Branch:function(){return na},useFlowContext:function(){return j},renderEngineReference:function(){return tT},FieldsSelect:function(){return q},useAvailableUpstreams:function(){return eJ},getCollectionFieldOptions:function(){return tm}});var e,t,n,r,o,i,a,l=v("156"),c=v.n(l),u=v("505"),s=v("875"),f=v("772"),p=v("584"),d=v("128"),m=v("721");let y=(0,l.createContext)(null),b={didCatch:!1,error:null};class g extends l.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=b}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];null===(t=(n=this.props).onReset)||void 0===t||t.call(n,{args:o,reason:"imperative-api"}),this.setState(b)}}componentDidCatch(e,t){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)){var o,i;null===(o=(i=this.props).onReset)||void 0===o||o.call(i,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(b)}}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state,a=e;if(o){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if((0,l.isValidElement)(r))a=r;else if("function"==typeof t)a=t(e);else if(n)a=(0,l.createElement)(n,e);else throw i}return(0,l.createElement)(y.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},a)}}var O=v("482"),w=v("563"),x=c().createContext({});function j(){return(0,l.useContext)(x)}var S=v("238"),E="workflow";function k(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return f.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},r),n=(n={ns:E},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function C(){return(0,S.useTranslation)(E)}function P(e){var t=new Map;e.forEach(function(e){return t.set(e.id,e)});var n=!0,r=!1,o=void 0;try{for(var i,a=t.values()[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value;l.upstreamId&&(l.upstream=t.get(l.upstreamId)),l.downstreamId&&(l.downstream=t.get(l.downstreamId))}}catch(e){r=!0,o=e}finally{try{!n&&null!=a.return&&a.return()}finally{if(r)throw o}}}function A(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(function(n){A(e.properties[n],t)})}function D(e){return"/admin/workflow/workflows/".concat(e)}function T(e){return"/admin/workflow/executions/".concat(e)}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function F(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function R(e){var t,n,r,o=e.collection,i=e.dataPath,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["collection","dataPath"]),l=(0,f.useSchemaInitializer)().insert,u=(0,f.useSchemaTemplateManager)().getTemplateSchemaByMode,p=(0,f.useCollectionManager_deprecated)().getCollection,d=(0,f.useRecordCollectionDataSourceItems)("FormItem");if("string"==typeof o){var m,y,b=(m=(0,f.parseCollectionName)(o),y=2,function(e){if(Array.isArray(e))return e}(m)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(m,2)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}(m,y)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=b[0];r=p(b[1],v)}else r=o;function h(){var e;return e=function(e){var t,n,c,f;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(p){switch(p.label){case 0:if(!(t=e.item).template)return[3,2];return[4,u(t)];case 1:return c=p.sent(),[3,3];case 2:c=null,p.label=3;case 3:return n=c,A(f={type:"void",name:(0,s.uid)(),title:r.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:o,dataPath:i},"x-component":"CardItem","x-component-props":{title:a.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:n||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}},function(e){e["x-uid"]&&delete e["x-uid"]}),l(f),[2]}})},(h=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){F(i,r,o,a,l,"next",e)}function l(e){F(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return c().createElement(f.SchemaInitializerItem,(t=N({},a),n=(n={onClick:function(e){return h.apply(this,arguments)},items:d},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function M(e){var t,n,r,o=(0,f.useSchemaInitializerItem)(),i=null!==(t=null==e?void 0:e.collection)&&void 0!==t?t:o.collection;if("string"==typeof i){var a=(0,f.parseCollectionName)(i);n=a[0],r=a[1]}else r=i;return c().createElement(f.CollectionProvider_deprecated,{dataSource:n,collection:r},c().createElement(R,N({},o,e)))}var B=v("467");function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){var t,n,r,o,i,a,s,p,d=e.collection,m=e.dataPath,y=e.children,b=(0,u.useField)(),v=(0,l.useRef)(null),h=(0,(0,f.useAssociationNames)().getAssociationAppends)(),g=h.appends,O=h.updateAssociationValues;var x=(t=m,r=(n=j()).execution,o=n.nodes,i=(0,l.useMemo)(function(){return o.reduce(function(e,t){return Object.assign(e,V({},t.id,t.key))},{})},[o]),a=(0,l.useMemo)(function(){var e;return{$context:null==r?void 0:r.context,$jobsMapByNodeKey:(null!==(e=null==r?void 0:r.jobs)&&void 0!==e?e:[]).reduce(function(e,t){return Object.assign(e,V({},i[t.nodeId],t.result))},{})}},[null==r?void 0:r.context,null==r?void 0:r.jobs,i]),(0,l.useMemo)(function(){return(0,B.get)(a,t)},[a,t]));if("string"==typeof d){var S=(0,f.parseCollectionName)(d);s=S[0],p=S[1]}else p=d;var E=(0,l.useMemo)(function(){return(0,w.createForm)({values:x,readPretty:!0})},[x]),k={loading:!1,data:{data:x}},C=(0,f.useAPIClient)().resource(p),P=(0,f.useBlockRequestContext)();return c().createElement(f.CollectionProvider_deprecated,{dataSource:s,collection:p},c().createElement(f.RecordProvider,{record:x,parent:null},c().createElement(f.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:b,service:k,resource:C,__parent:P}},c().createElement(f.FormBlockContext.Provider,{value:{params:{appends:g},form:E,field:b,service:k,updateAssociationValues:O,formBlockRef:v}},y))))}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z(){return!0}var q=(0,u.observer)(function(e){var t,n,r,o,i=e.filter,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["filter"]),l=(0,f.useCompile)(),s=(0,f.useCollectionManager_deprecated)().getCollectionFields,p=(0,u.useForm)().values;var d=(t=(0,f.parseCollectionName)(null==p?void 0:p.collection),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return W(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=d[0],b=s(d[1],y);return c().createElement(m.Select,(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({popupMatchSelectWidth:!1},a),o=(o={options:b.filter(void 0===i?z:i).map(function(e){var t;return{label:l(null===(t=e.uiSchema)||void 0===t?void 0:t.title),value:e.name}})},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r))},{displayName:"FieldsSelect"}),L=v("229");function $(){var e,t,n=(e=["\n margin-bottom: 1.5em;\n padding: 1em;\n background-color: ",";\n\n > *:last-child {\n margin-bottom: 0;\n }\n\n dl {\n display: flex;\n align-items: baseline;\n\n dt {\n color: ",";\n &:after {\n content: ':';\n margin-right: 0.5em;\n }\n }\n }\n\n p {\n color: ",";\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return $=function(){return n},n}var U=(0,f.createStyles)(function(e){var t=e.css,n=e.token;return{container:t($(),n.colorFillAlter,n.colorText,n.colorTextDescription)}});function G(e){var t=e.label,n=e.title,r=e.description,o=U().styles;return c().createElement("div",{className:(0,f.cx)(o.container,e.className)},c().createElement("dl",null,c().createElement("dt",null,t),c().createElement("dd",null,c().createElement(m.Tag,{style:{background:"none"}},n))),r?c().createElement("p",null,r):null)}var J=v("527"),H=v.n(J);function Y(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function K(){var e=Y(["\n border: none;\n .ant-tag {\n width: 100%;\n height: 100%;\n padding: 0;\n margin-right: 0;\n border-radius: 50%;\n text-align: center;\n }\n "]);return K=function(){return e},e}function Q(){var e=Y(["\n border-width: 2px;\n "]);return Q=function(){return e},e}var Z=(0,f.createStyles)(function(e){var t=e.css;return e.token,{statusButtonClass:t(K()),noStatusButtonClass:t(Q())}});function X(e){var t,n,r=e.status,o=e.statusMap,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["status","statusMap"]),a=Z().styles,l=null;if(void 0!==r&&(null==o?void 0:o[r])){var u=o[r],s=u.icon,f=u.color;l=c().createElement(m.Tag,{color:f},s)}return c().createElement(m.Button,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},i),n=(n={shape:"circle",size:"small",className:H()(l?a.statusButtonClass:a.noStatusButtonClass,e.className)},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),l)}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var et={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},en=[{value:et.QUEUEING,label:'{{t("Queueing", { ns: "'.concat(E,'" })}}'),color:"blue",icon:c().createElement(O.HourglassOutlined,null),description:'{{t("Triggered but still waiting in queue to execute.", { ns: "'.concat(E,'" })}}')},{value:et.STARTED,label:'{{t("On going", { ns: "'.concat(E,'" })}}'),color:"gold",icon:c().createElement(O.LoadingOutlined,null),description:'{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "'.concat(E,'" })}}')},{value:et.RESOLVED,label:'{{t("Resolved", { ns: "'.concat(E,'" })}}'),color:"green",icon:c().createElement(O.CheckOutlined,null),description:'{{t("Successfully finished.", { ns: "'.concat(E,'" })}}')},{value:et.FAILED,label:'{{t("Failed", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.ExclamationOutlined,null),description:'{{t("Failed to satisfy node configurations.", { ns: "'.concat(E,'" })}}')},{value:et.ERROR,label:'{{t("Error", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.CloseOutlined,null),description:'{{t("Some node meets error.", { ns: "'.concat(E,'" })}}')},{value:et.ABORTED,label:'{{t("Aborted", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.MinusOutlined,{rotate:90}),description:'{{t("Running of some node was aborted by program flow.", { ns: "'.concat(E,'" })}}')},{value:et.CANCELED,label:'{{t("Canceled", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.MinusOutlined,{rotate:45}),description:'{{t("Manually canceled whole execution when waiting.", { ns: "'.concat(E,'" })}}')},{value:et.REJECTED,label:'{{t("Rejected", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.MinusOutlined,null),description:'{{t("Rejected from a manual node.", { ns: "'.concat(E,'" })}}')},{value:et.RETRY_NEEDED,label:'{{t("Retry needed", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.RedoOutlined,null),description:'{{t("General failed but should do another try.", { ns: "'.concat(E,'" })}}')}],er=en.reduce(function(e,t){return Object.assign(e,ee({},t.value,t))},{}),eo={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},ei=[{value:eo.PENDING,label:'{{t("Pending", { ns: "'.concat(E,'" })}}'),color:"gold",icon:c().createElement(O.ClockCircleOutlined,null)},{value:eo.RESOLVED,label:'{{t("Resolved", { ns: "'.concat(E,'" })}}'),color:"green",icon:c().createElement(O.CheckOutlined,null)},{value:eo.FAILED,label:'{{t("Failed", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.ExclamationOutlined,null)},{value:eo.ERROR,label:'{{t("Error", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.CloseOutlined,null)},{value:eo.ABORTED,label:'{{t("Aborted", { ns: "'.concat(E,'" })}}'),color:"red",icon:c().createElement(O.MinusOutlined,{rotate:90})},{value:eo.CANCELED,label:'{{t("Canceled", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.MinusOutlined,{rotate:45})},{value:eo.REJECTED,label:'{{t("Rejected", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.MinusOutlined,null)},{value:eo.RETRY_NEEDED,label:'{{t("Retry needed", { ns: "'.concat(E,'" })}}'),color:"volcano",icon:c().createElement(O.RedoOutlined,null)}],ea=ei.reduce(function(e,t){return Object.assign(e,ee({},t.value,t))},{}),el=function(e,t){return{getAriaLabel:(0,l.useCallback)(function(n){return["add-button",null==e?void 0:e.type,null==e?void 0:e.title,null!=t?String(t):"",n].filter(Boolean).join("-")},[t,null==e?void 0:e.title,null==e?void 0:e.type])}};function ec(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eu(){var e=ec(["\n flex-grow: 1;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n\n .workflow-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n position: relative;\n padding: 0.5rem 1rem;\n background: ",";\n border-bottom: 1px solid ",";\n\n header {\n display: flex;\n align-items: center;\n }\n\n aside {\n display: flex;\n align-items: center;\n gap: 0.5em;\n }\n\n .workflow-versions {\n label {\n margin-right: 0.5em;\n }\n }\n }\n\n .workflow-canvas-wrapper {\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n }\n\n .workflow-canvas-zoomer {\n display: flex;\n align-items: center;\n position: absolute;\n top: 2em;\n right: 2em;\n height: 10em;\n padding: 1em 0;\n border-radius: 0.5em;\n background: ",";\n }\n\n .workflow-canvas {\n overflow: auto;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 2em;\n\n > .ant-alert {\n margin-bottom: 2em;\n font-size: 85%;\n }\n }\n "]);return eu=function(){return e},e}function es(){var e=ec(["\n .ant-dropdown-menu-item {\n justify-content: flex-end;\n .ant-dropdown-menu-title-content {\n display: flex;\n align-items: baseline;\n justify-content: flex-end;\n text-align: right;\n\n time {\n width: 14em;\n font-size: 80%;\n }\n }\n }\n "]);return es=function(){return e},e}function ef(){var e=ec(["\n max-height: 80vh;\n overflow-y: auto;\n\n .ant-dropdown-menu-item {\n .ant-dropdown-menu-title-content {\n strong {\n font-weight: normal;\n }\n\n > .enabled {\n strong {\n font-weight: bold;\n }\n }\n\n > .unexecuted {\n strong {\n font-style: italic;\n }\n }\n }\n }\n "]);return ef=function(){return e},e}function ep(){var e=ec(["\n .ant-dropdown-menu-item {\n .id {\n flex-grow: 1;\n text-align: right;\n }\n }\n "]);return ep=function(){return e},e}function ed(){var e=ec(["\n display: flex;\n position: relative;\n margin: 2em auto auto auto;\n\n :before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n left: calc(50% - 0.5px);\n width: 1px;\n background-color: ",";\n }\n "]);return ed=function(){return e},e}function em(){var e=ec(["\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n min-width: 20em;\n padding: 0 2em;\n\n .workflow-node-list {\n flex-grow: 1;\n }\n\n .workflow-branch-lines {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n background-color: ",";\n }\n\n :before,\n :after {\n content: '';\n position: absolute;\n height: 1px;\n background-color: ",";\n }\n\n :before {\n top: 0;\n }\n\n :after {\n bottom: 0;\n }\n\n :not(:first-child):not(:last-child) {\n :before,\n :after {\n left: 0;\n width: 100%;\n }\n }\n\n :last-child:not(:first-child) {\n :before,\n :after {\n right: 50%;\n width: 50%;\n }\n }\n\n :first-child:not(:last-child) {\n :before,\n :after {\n left: 50%;\n width: 50%;\n }\n }\n\n .end-sign {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 0;\n height: 6em;\n border-left: 1px dashed ",";\n\n .anticon {\n font-size: 1.5em;\n line-height: 100%;\n }\n }\n "]);return em=function(){return e},e}function ey(){var e=ec(["\n flex-grow: 1;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n "]);return ey=function(){return e},e}function eb(){var e=ec(["\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n "]);return eb=function(){return e},e}function ev(){var e=ec(["\n position: relative;\n width: 20em;\n background: ",";\n padding: 1em;\n box-shadow: ",";\n border-radius: ","px;\n cursor: pointer;\n transition: box-shadow 0.3s ease;\n\n &:hover {\n box-shadow: ",";\n\n .workflow-node-remove-button {\n display: block;\n }\n }\n\n &.configuring {\n box-shadow: ",";\n }\n\n .workflow-node-remove-button {\n display: none;\n position: absolute;\n right: 0;\n top: 0;\n color: ",";\n\n &[disabled] {\n display: none;\n }\n\n &:hover {\n color: ",";\n }\n }\n\n .ant-input {\n font-weight: bold;\n\n &:not(:focus) {\n transition:\n background-color 0.3s ease,\n border-color 0.3s ease;\n border-color: ",";\n background-color: ",";\n\n &:not(:disabled):hover {\n border-color: ",";\n }\n\n &:disabled:hover {\n border-color: ",";\n }\n }\n }\n\n .workflow-node-config-button {\n padding: 0;\n }\n\n &:hover {\n box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);\n\n .workflow-node-remove-button {\n display: block;\n }\n }\n "]);return ev=function(){return e},e}function eh(){var e=ec(["\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n justify-content: center;\n align-items: center;\n color: ",";\n "]);return eh=function(){return e},e}function eg(){var e=ec(["\n display: flex;\n margin-bottom: 0.5em;\n\n .workflow-node-actions {\n position: relative;\n }\n "]);return eg=function(){return e},e}function eO(){var e=ec(["\n flex-grow: 1;\n\n .workflow-node-id {\n color: ",";\n\n &:before {\n content: '#';\n }\n }\n "]);return eO=function(){return e},e}function ew(){var e=ec(["\n display: flex;\n align-items: center;\n font-weight: normal;\n .workflow-node-id {\n color: ",";\n }\n "]);return ew=function(){return e},e}function ex(){var e=ec(["\n display: flex;\n flex-direction: column-reverse;\n align-items: center;\n margin: auto;\n "]);return ex=function(){return e},e}function ej(){var e=ec(["\n background-color: #f3f3f3;\n "]);return ej=function(){return e},e}function eS(){var e=ec(["\n flex-shrink: 0;\n padding: 2em 0;\n\n > .ant-btn {\n &:disabled {\n visibility: hidden;\n }\n }\n "]);return eS=function(){return e},e}function eE(){var e=ec(["\n position: relative;\n overflow: visible;\n\n > span {\n position: absolute;\n top: calc(1.5em - 1px);\n line-height: 1em;\n color: ",";\n background-color: ",";\n padding: 1px;\n }\n "]);return eE=function(){return e},e}function ek(){var e=ec(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 2em;\n height: 6em;\n "]);return ek=function(){return e},e}function eC(){var e=ec(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 4em;\n height: 4em;\n border-radius: 50%;\n background-color: ",";\n color: ",";\n "]);return eC=function(){return e},e}var eP=(0,f.createStyles)(function(e){var t=e.css,n=e.token;return{workflowPageClass:t(eu(),n.colorBgContainer,n.colorBorderSecondary,n.colorBgContainer),dropdownClass:t(es()),workflowVersionDropdownClass:t(ef()),executionsDropdownRowClass:t(ep()),branchBlockClass:t(ed(),n.colorBgLayout),branchClass:t(em(),n.colorBorder,n.colorBorder,n.colorBgLayout),nodeBlockClass:t(ey()),nodeClass:t(eb()),nodeCardClass:t(ev(),n.colorBgContainer,n.boxShadowTertiary,n.borderRadiusLG,n.boxShadow,n.boxShadow,n.colorText,n.colorErrorHover,n.colorBorderBg,n.colorBgContainerDisabled,n.colorPrimaryBorderHover,n.colorBorderBg),nodeJobButtonClass:t(eh(),n.colorTextLightSolid),nodeHeaderClass:t(eg()),nodeMetaClass:t(eO(),n.colorTextDescription),nodeTitleClass:t(ew(),n.colorTextDescription),nodeSubtreeClass:t(ex()),nodeJobResultClass:t(ej()),addButtonClass:t(eS()),conditionClass:t(eE(),n.colorTextSecondary,n.colorBgLayout),loopLineClass:t(ek()),terminalClass:t(eC(),n.colorText,n.colorBgContainer)}});function eA(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eD(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eT(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){eD(i,r,o,a,l,"next",e)}function l(e){eD(i,r,o,a,l,"throw",e)}a(void 0)})}}function eI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function eF(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){eF(e,t,n[t])})}return e}function eR(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eA(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eB(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eV(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function e_(){var e=eB(["\n margin-bottom: 1em;\n "]);return e_=function(){return e},e}function eW(){var e=eB(["\n display: flex;\n justify-content: space-between;\n\n strong {\n font-weight: bold;\n }\n\n .ant-tag {\n margin-inline-end: 0;\n }\n\n code {\n font-weight: normal;\n }\n "]);return eW=function(){return e},e}function ez(){var e=eB(["\n .ant-input,\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper {\n &.auto-width {\n width: auto;\n min-width: 6em;\n }\n }\n "]);return ez=function(){return e},e}var eq=function(){var e,t,n;function r(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),eF(this,"title",void 0),eF(this,"type",void 0),eF(this,"group",void 0),eF(this,"description",void 0),eF(this,"options",void 0),eF(this,"fieldset",void 0),eF(this,"presetFieldset",void 0),eF(this,"branching",void 0),eF(this,"view",void 0),eF(this,"scope",void 0),eF(this,"components",void 0),eF(this,"end",void 0),eF(this,"testable",void 0)}return e=r,t=[{key:"createDefaultConfig",value:function(){return{}}}],eI(e.prototype,t),r}();function eL(){var e=(0,u.useForm)(),t=(0,f.useAPIClient)(),n=(0,f.useActionContext)(),r=(0,f.useResourceActionContext)().refresh,o=eU(),i=j().workflow;return{run:function(){return eT(function(){var a,l;return eV(this,function(c){switch(c.label){case 0:if(i.executed)return m.message.error(k("Node in executed workflow cannot be modified")),[2];return[4,e.submit()];case 1:return c.sent(),[4,null===(a=(l=t.resource("flow_nodes")).update)||void 0===a?void 0:a.call(l,{filterByTk:o.id,values:{config:e.values}})];case 2:return c.sent(),e.setInitialValues((0,L.toJS)(e.values)),n.setFormValueChanged(!1),n.setVisible(!1),r(),[2]}})})()}}}var e$=c().createContext({});function eU(){return(0,l.useContext)(e$)}function eG(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=eU();return e.some(function(e){return null!=(0,B.get)(t.config,e)})}function eJ(e,t){var n=[];if(!e)return[];for(var r=e.upstream;r;r=r.upstream)("function"!=typeof t||t(r))&&n.push(r);return n}function eH(e){var t=[];if(!e)return[];for(var n=e;n;n=n.upstream)n.upstream&&null!=n.branchIndex&&t.push(n.upstream);return t}function eY(e){var t,n=e.data,r=eP().styles,o=el(n).getAriaLabel,i=null!==(t=(0,f.usePlugin)(ab).instructions.get(n.type))&&void 0!==t?t:{},a=i.Component,l=i.end;return c().createElement(e$.Provider,{value:n},c().createElement("div",{className:(0,f.cx)(r.nodeBlockClass)},c().createElement(void 0===a?e5:a,{data:n}),l&&("function"!=typeof l||l(n))?c().createElement("div",{className:"end-sign"},c().createElement(O.CloseOutlined,null)):c().createElement(t7,{"aria-label":o(),upstream:n})))}function eK(){var e,t=(0,S.useTranslation)().t,n=(0,f.useAPIClient)(),r=null!==(e=j())&&void 0!==e?e:{},o=r.workflow,i=r.nodes,a=r.refresh,u=eU(),s=m.App.useApp().modal,d=n.resource("flow_nodes"),y=(0,l.useCallback)(eT(function(){var e;return eV(this,function(t){switch(t.label){case 0:return[4,null===(e=d.destroy)||void 0===e?void 0:e.call(d,{filterByTk:u.id})];case 1:return t.sent(),a(),[2]}})}),[u.id,a,d]),b=(0,l.useCallback)(eT(function(){var e,n;return eV(this,function(r){return(e=i.filter(function(e){return e!==u&&(0,p.parse)(e.config).parameters.filter(function(e){var t=e.key;return t.startsWith("$jobsMapByNodeKey.".concat(u.key,"."))||t==="$jobsMapByNodeKey.".concat(u.key)}).length})).length?(s.error({title:k("Can not delete"),content:k("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:e.map(function(e){return"#".concat(e.id)}).join(", ")})}),[2]):(n=i.find(function(e){return e.upstream===u&&null!=e.branchIndex})?k("This node contains branches, deleting will also be preformed to them, are you sure?"):t("Are you sure you want to delete it?"),s.confirm({title:t("Delete"),content:n,onOk:y}),[2])})}),[u,s,i,y,t]);return o?o.executed?null:c().createElement(m.Button,{type:"text",shape:"circle",icon:c().createElement(O.DeleteOutlined,null),onClick:b,className:"workflow-node-remove-button",size:"small"}):null}function eQ(){var e,t=j(),n=t.execution,r=t.setViewJob,o=(null!==(e=eU())&&void 0!==e?e:{}).jobs,i=eP().styles;return n?o.length?c().createElement(m.Tooltip,{title:k("View result")},o.length>1?c().createElement(m.Dropdown,{menu:{items:o.map(function(e){return{key:e.id,label:c().createElement(c().Fragment,null,c().createElement(X,{statusMap:ea,status:e.status}),c().createElement("time",null,(0,p.str2moment)(e.updatedAt).format("YYYY-MM-DD HH:mm:ss")))}}),onClick:function(e){var t=e.key;r(o.find(function(e){return e.id==t}))},className:i.dropdownClass}},c().createElement(X,{statusMap:ea,status:o[o.length-1].status,className:i.nodeJobButtonClass})):c().createElement(X,{statusMap:ea,status:o[0].status,onClick:function(){return r(o[0])},className:i.nodeJobButtonClass})):c().createElement(X,{className:i.nodeJobButtonClass,disabled:!0}):null}function eZ(){return{form:(0,u.useForm)()}}var eX=function(){var e=(0,u.useForm)(),t=e.values,n=e.query,r=eU(),o=(0,f.useAPIClient)(),i=(0,f.useActionContext)(),a=(0,u.useField)();return{run:function(){return eT(function(){var e,l,c,u;return eV(this,function(s){switch(s.label){case 0:e=(0,p.parse)(r.config)((0,L.toJS)(t.config)),(l=n("result").take()).setValue(null),l.setFeedback({}),a.data=a.data||{},a.data.loading=!0,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,o.resource("flow_nodes").test({values:{config:e,type:r.type}})];case 2:return c=s.sent().data.data,l.setFeedback({type:c.status>0?"success":"error",messages:c.status>0?[k("Resolved")]:[k("Failed")]}),l.setValue(c.result),[3,4];case 3:return u=s.sent(),l.setFeedback({type:"error",messages:u.message}),[3,4];case 4:return a.data.loading=!1,i.setFormValueChanged(!1),[2]}})})()}}},e0=(0,l.createContext)([]);function e1(e){var t=e.name,n=e.value,r=e.onChange;return c().createElement(m.Space,null,c().createElement(tb,{variableOptions:{},value:"{{".concat(t,"}}"),disabled:!0}),c().createElement(f.Variable.Input,{useTypedConstant:["string","number","boolean","date"],value:n,onChange:r}))}function e2(e){var t=e.value,n=e.onChange,r=(0,l.useContext)(e0);return r.length?c().createElement(c().Fragment,null,r.map(function(e){return c().createElement(e1,{key:e,name:e,value:(0,B.get)(t,e),onChange:function(r){(0,B.set)(t,e,r),n(t)}})})):c().createElement(m.Empty,{image:m.Empty.PRESENTED_IMAGE_SIMPLE,description:k("No variable"),style:{margin:"1em"}})}function e3(){var e=eU(),t=(0,u.useForm)().values,n=(0,p.parse)(t).parameters.map(function(e){return e.key}),r=(0,l.useMemo)(function(){return(0,w.createForm)()},[]);return c().createElement(e$.Provider,{value:{type:e.type,config:t}},c().createElement(e0.Provider,{value:n},c().createElement(f.SchemaComponent,{components:{Alert:m.Alert},scope:{useCancelAction:f.useCancelAction,useRunAction:eX},schema:{type:"void",name:"testButton",title:'{{t("Test run")}}',"x-component":"Action","x-component-props":{icon:"CaretRightOutlined"},properties:{modal:{type:"void","x-decorator":"FormV2","x-decorator-props":{form:r},"x-component":"Action.Modal",title:'{{t("Test run", { ns: "workflow" })}}',properties:{alert:{type:"void","x-component":"Alert","x-component-props":{message:'{{t("Test run will do the actual data manipulating or API calling, please use with caution.", { ns: "workflow" })}}',type:"warning",showIcon:!0,className:(0,f.css)(e_())}},config:{type:"object",title:'{{t("Replace variables", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":e2},actions:{type:"void","x-component":"ActionBar",properties:{submit:{type:"void",title:'{{t("Run")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRunAction }}"}}}},result:{type:"string",title:'{{t("Result", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5,maxRows:20},style:{whiteSpace:"pre",cursor:"text"}},"x-pattern":"disabled"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Close")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}}}}}}}}})))}function e5(e){var t,n,r=e.data,o=e.children,i=(0,f.useCompile)(),a=(0,f.useAPIClient)(),s=null!==(n=j())&&void 0!==n?n:{},p=s.workflow,d=s.refresh,y=eP().styles,b=(0,f.usePlugin)(ab).instructions.get(r.type),v=p.executed?'{{t("View")}}':'{{t("Configure")}}',h=eM((0,l.useState)(r.title),2),g=h[0],O=h[1],x=eM((0,l.useState)(!1),2),S=x[0],E=x[1],C=eM((0,l.useState)(!1),2),P=C[0],A=C[1],D=(0,l.useMemo)(function(){var e=(0,B.cloneDeep)(r.config);return(0,w.createForm)({initialValues:e,disabled:p.executed})},[r,p]),T=(0,l.useCallback)(function(e){E(e),!e&&D.reset()},[D]);var I=(0,l.useCallback)((t=eT(function(e){var t,n,o;return eV(this,function(l){switch(l.label){case 0:if(O(o=e||i(null==b?void 0:b.title)),o===r.title)return[2];return[4,null===(t=(n=a.resource("flow_nodes")).update)||void 0===t?void 0:t.call(n,{filterByTk:r.id,values:{title:o}})];case 1:return l.sent(),d(),[2]}})}),function(e){return t.apply(this,arguments)}),[r,b]),F=(0,l.useCallback)(function(e){if(e.target===e.currentTarget){E(!0);return}for(var t=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]),n=e.target;n&&n!==e.currentTarget&&n!==document.documentElement;n=n.parentNode)if(Array.from(n.classList).some(function(e){return t.has(e)})){E(!0),e.stopPropagation();return}},[]);if(!b)return c().createElement("div",{className:(0,f.cx)(y.nodeClass,"workflow-node-type-".concat(r.type))},c().createElement(m.Tooltip,{title:k("Node with unknown type will cause error. Please delete it or check plugin which provide this type.")},c().createElement("div",{role:"button","aria-label":"_untyped-".concat(g),className:(0,f.cx)(y.nodeCardClass,"invalid")},c().createElement("div",{className:y.nodeHeaderClass},c().createElement("div",{className:(0,f.cx)(y.nodeMetaClass,"workflow-node-meta")},c().createElement(m.Tag,{color:"error"},k("Unknown node")),c().createElement("span",{className:"workflow-node-id"},r.id)),c().createElement("div",{className:"workflow-node-actions"},c().createElement(eK,null),c().createElement(eQ,null))),c().createElement(m.Input.TextArea,{value:g,disabled:!0,autoSize:!0}))));var N=i(b.title);return c().createElement("div",{className:(0,f.cx)(y.nodeClass,"workflow-node-type-".concat(r.type))},c().createElement("div",{role:"button","aria-label":"".concat(N,"-").concat(g),className:(0,f.cx)(y.nodeCardClass,{configuring:S}),onClick:F},c().createElement("div",{className:y.nodeHeaderClass},c().createElement("div",{className:(0,f.cx)(y.nodeMetaClass,"workflow-node-meta")},c().createElement(m.Tag,null,N),c().createElement("span",{className:"workflow-node-id"},r.id)),c().createElement("div",{className:"workflow-node-actions"},c().createElement(eK,null),c().createElement(eQ,null))),c().createElement(m.Input.TextArea,{disabled:p.executed,value:g,onChange:function(e){return O(e.target.value)},onBlur:function(e){return I(e.target.value)},autoSize:!0}),c().createElement(f.ActionContextProvider,{value:{visible:S,setVisible:T,formValueChanged:P,setFormValueChanged:A}},c().createElement(f.FormProvider,{form:D},c().createElement(f.SchemaComponent,{distributed:!1,scope:eR(eN({},b.scope),{useFormProviderProps:eZ,useUpdateAction:eL}),components:b.components,schema:{type:"void",properties:eR(eN({},b.view?{view:b.view}:{}),eF({button:{type:"void","x-content":v,"x-component":m.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}}},r.id,{type:"void",title:c().createElement("div",{className:(0,f.css)(eW())},c().createElement("strong",null,r.title),c().createElement(m.Tooltip,{title:k("Variable key of node")},c().createElement(m.Tag,null,c().createElement("code",null,r.key)))),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:eR(eN({},b.description?{description:{type:"void","x-component":G,"x-component-props":{label:k("Node type"),title:b.title,description:b.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,f.css)(ez())},properties:b.fieldset},footer:p.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{flexGrow:1}},properties:eR(eN({},b.testable?{test:{type:"void","x-component":(0,u.observer)(e3),"x-align":"left"}}:{}),{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}})}}}})}))}})))),o)}function e6(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function e4(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){e4(e,t,n[t])})}return e}function e7(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function e9(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function te(e,t){if(e){if("string"==typeof e)return e6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e6(e,t)}}var tt={label:"label",value:"value",children:"children"},tn={label:'{{t("Node result", { ns: "'.concat(E,'" })}}'),value:"$jobsMapByNodeKey",useOptions:function(e){var t=(0,f.usePlugin)(ab).instructions,n=eJ(eU()),r=[];return n.forEach(function(n){var o,i=t.get(n.type),a=null===(o=i.useVariables)||void 0===o?void 0:o.call(i,n,e);a&&r.push(a)}),r}},tr={label:'{{t("Trigger variables", { ns: "'.concat(E,'" })}}'),value:"$context",useOptions:function(e){var t,n,r=(0,f.usePlugin)(ab).triggers,o=j().workflow,i=r.get(o.type);return null!==(n=null==i?void 0:null===(t=i.useVariables)||void 0===t?void 0:t.call(i,o.config,e))&&void 0!==n?n:null}},to={label:'{{t("Scope variables", { ns: "'.concat(E,'" })}}'),value:"$scopes",useOptions:function(e){var t=e.fieldNames,n=void 0===t?tt:t,r=e.current,o=(0,f.usePlugin)(ab).instructions,i=eU(),a=eH(null!=r?r:i),l=[];return a.forEach(function(t){var r,i,a,c=o.get(t.type),u=null===(r=c.useScopeVariables)||void 0===r?void 0:r.call(c,t,e);u&&l.push((e4(a={key:t.key},n.value,t.key),e4(a,n.label,null!==(i=t.title)&&void 0!==i?i:"#".concat(t.id)),e4(a,n.children,u),a))}),l}},ti={label:'{{t("System variables", { ns: "'.concat(E,'" })}}'),value:"$system",useOptions:function(e){var t=(0,f.usePlugin)(ab).systemVariables;return(0,f.useCompile)()(Array.from(t.getValues()))}},ta={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function tl(e,t){var n,r,o,i,a,l,c;if("string"==typeof t)return null===(n=ta[t])||void 0===n?void 0:n.has(e.interface);if((void 0===t?"undefined":(c=t)&&"undefined"!=typeof Symbol&&c.constructor===Symbol?"symbol":typeof c)=="object"&&"reference"===t.type)return tc(e)?(null===(r=t.options)||void 0===r?void 0:r.entity)&&(e.collectionName===(null===(o=t.options)||void 0===o?void 0:o.collection)||(null===(i=t.options)||void 0===i?void 0:i.collection)==="*"):!!e.isForeignKey&&(e.collectionName===(null===(a=t.options)||void 0===a?void 0:a.collection)&&"id"===e.name||e.target===(null===(l=t.options)||void 0===l?void 0:l.collection));return"function"==typeof t&&t(e)}function tc(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function tu(e,t){if(null==t)return null;var n="".concat(e.name,".");return t.filter(function(e){return e.startsWith(n)}).map(function(e){return e.replace(n,"")})}function ts(e,t){var n,r,o,i=(0,f.useCompile)(),a=null===(r=e.useOptions)||void 0===r?void 0:null===(n=r.call(e,t))||void 0===n?void 0:n.filter(Boolean),l=t.fieldNames;return e4(o={},l.label,i(e.label)),e4(o,l.value,e.value),e4(o,"key",e[l.value]),e4(o,l.children,a),e4(o,"disabled",!a||!a.length),o}function tf(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},tt,null!==(e=t.fieldNames)&&void 0!==e?e:{}),r=Object.assign(t,{fieldNames:n});return[ts(to,r),ts(tn,r),ts(tr,r),ts(ti,r)]}function tp(e,t){var n,r,o,i=t.compile,a=t.getCollectionFields;var l=(n=(0,f.parseCollectionName)(e),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||te(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=l[0],u=a(l[1],c),s=[],p=[];u.forEach(function(e){if(e.isForeignKey&&!e.primaryKey)s.push(e);else{var t=u.find(function(t){return t.name===e.foreignKey});t&&s.push(t),p.push(e)}});for(var d=(0,B.uniqBy)(s,"name"),m=p.length-1;m>=0;m--)!function(e){var t=p[e];if("belongsTo"===t.type){var n,r,o=d.findIndex(function(e){return e.name===t.foreignKey});if(o>-1){var a,l,c=d[o];p.splice(e,0,e7(e8({},t,c),{uiSchema:e7(e8({},t.uiSchema),{title:(null===(a=c.uiSchema)||void 0===a?void 0:a.title)?i(null===(l=c.uiSchema)||void 0===l?void 0:l.title):c.name})})),d.splice(o,1)}else p.splice(e,0,e7(e8({},t),{name:t.foreignKey,type:"bigInt",isForeignKey:!0,interface:t.interface,uiSchema:e7(e8({},t.uiSchema),{title:(null===(n=t.uiSchema)||void 0===n?void 0:n.title)?"".concat(i(null===(r=t.uiSchema)||void 0===r?void 0:r.title)," ID"):t.name})}))}else"context"===t.type&&"users"===t.collectionName&&p.splice(e,1)}(m);return p.push.apply(p,function(e){if(Array.isArray(e))return e6(e)}(o=d)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||te(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),(0,B.uniqBy)(p,"name").filter(function(e){return e.interface&&!e.hidden})}function td(e){var t=tu(e.field,e.appends),n=tm(e8({collection:"".concat(e.field.dataSourceKey&&"main"!==e.field.dataSourceKey?"".concat(e.field.dataSourceKey,":"):"").concat(e.field.target),types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,n.length?e.children=n:(e.isLeaf=!0,!(!e.types||e.types.some(function(t){return tl(e.field,t)}))&&(e.disabled=!0))}function tm(e){var t=e.fields,n=e.collection,r=e.types,o=e.appends,i=void 0===o?[]:o,a=e.depth,l=void 0===a?1:a,c=e.compile,u=e.getCollectionFields,s=e.fieldNames,f=void 0===s?tt:s,p=null!=t?t:tp(n,{compile:c,getCollectionFields:u}),d=td.bind({compile:c,getCollectionFields:u,fieldNames:f});return(function e(t){var n=t.fields,r=t.types,o=t.appends,i=t.depth,a=void 0===i?1:i,l=t.compile,c=t.getCollectionFields;return n.filter(function(t){var n=null==r||!r.length||r.some(function(e){return tl(t,e)});if(!tc(t))return n;if(null===o)return!!a&&(n||e({fields:tp(t.target,{compile:l,getCollectionFields:c}),types:r,depth:a-1,appends:o,compile:l,getCollectionFields:c}));var i=tu(t,o),u=o.includes(t.name);return n?u:((null==i?void 0:i.length)||u)&&e({fields:tp(t.target,{compile:l,getCollectionFields:c}),types:r,appends:i,compile:l,getCollectionFields:c}).length})})({fields:p,types:r,depth:l,appends:i,compile:c,getCollectionFields:u}).map(function(e){var t,n,o=c((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name),a=tu(e,i),u=!tc(e)||a&&!a.length&&!i.includes(e.name)||!1;return e4(n={},f.label,o),e4(n,"key",e.name),e4(n,f.value,e.name),e4(n,"isLeaf",u),e4(n,"loadChildren",u?null:d),e4(n,"field",e),e4(n,"depth",l),e4(n,"appends",i),e4(n,"types",r),n})}function ty(e){var t=(0,f.useApp)().dataSourceManager.getDataSource(e).collectionManager;return(0,l.useCallback)(function(e){return t.getCollectionAllFields(e)},[t])}function tb(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tf(t);return c().createElement(f.Variable.Input,e8({scope:r},n))}function tv(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tf(t);return c().createElement(f.Variable.TextArea,e8({scope:r},n))}function th(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tf(t);return c().createElement(f.Variable.RawTextArea,e8({scope:r},n))}function tg(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tf(t);return c().createElement(f.Variable.JSON,e8({scope:r},n))}function tO(e){var t=e.value,n=e.onChange,r=e.renderSchemaComponent,o=tf();return c().createElement(f.Variable.Input,{value:t,onChange:n,scope:o},r())}function tw(){var e,t,n=(e=["\n & + .anticon {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return tw=function(){return n},n}function tx(e){var t=e.options,n=e.direction,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["options","direction"]),o=(0,f.useCompile)();return c().createElement(m.Radio.Group,r,c().createElement(m.Space,{direction:n},(void 0===t?[]:t).map(function(e){return c().createElement(m.Radio,{key:e.value,value:e.value},c().createElement("span",{className:(0,f.css)(tw())},o(e.label)),e.tooltip&&c().createElement(m.Tooltip,{title:o(e.tooltip)},c().createElement(O.QuestionCircleOutlined,{style:{color:"#666"}})))})))}function tj(){var e,t,n=(e=["\n & + .anticon {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return tj=function(){return n},n}function tS(e){var t=e.options,n=e.direction,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["options","direction"]),o=(0,f.useCompile)();return c().createElement(m.Checkbox.Group,r,c().createElement(m.Space,{direction:n},(void 0===t?[]:t).map(function(e){return c().createElement(m.Checkbox,{key:e.value,value:e.value},c().createElement("span",{className:(0,f.css)(tj())},o(e.label)),e.tooltip&&c().createElement(m.Tooltip,{title:o(e.tooltip)},c().createElement(O.QuestionCircleOutlined,{style:{color:"#666"}})))})))}function tE(){var e=(0,u.useFieldSchema)(),t=(0,f.useCompile)();return c().createElement(f.GeneralSchemaDesigner,{title:t(e.title)},c().createElement(f.SchemaSettingsBlockTitleItem,null),c().createElement(f.SchemaSettingsDivider,null),c().createElement(f.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}function tk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tC(){var e,t,n=(e=["\n margin: 0;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return tC=function(){return n},n}var tP=function(){return null};tP.Initializer=function(){var e,t,n=(0,f.useSchemaInitializerItem)(),r=n.node,o=n.resultTitle,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(n,["node","resultTitle"]),a=(0,f.useSchemaInitializer)().insert;return c().createElement(f.SchemaInitializerItem,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){tk(e,t,n[t])})}return e}({},i),t=(t={onClick:function(){var e;a({type:"void",name:r.id,title:r.title,"x-component":"CardItem","x-component-props":{title:null!==(e=r.title)&&void 0!==e?e:"#".concat(r.id)},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:o,"x-component":"ValueBlock.Result","x-component-props":{dataSource:"{{$jobsMapByNodeKey.".concat(r.key,"}}")}}}})}},t),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))},tP.Result=function(e){var t,n=e.dataSource,r=(0,u.useFieldSchema)(),o=j().execution;if(!o)return r.title;var i=(0,p.parse)(n)({$jobsMapByNodeKey:(null!==(t=o.jobs)&&void 0!==t?t:[]).reduce(function(e,t){return Object.assign(e,tk({},t.nodeKey,t.result))},{})});return c().createElement("pre",{className:(0,f.css)(tC())},JSON.stringify(i,null,2))},tP.Designer=tE;var tA=v("47");function tD(){var e,t,n=(e=["\n &:after {\n content: ':';\n }\n & + a {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return tD=function(){return n},n}var tT=function(e){var t=tA.evaluators.get(e);return t?t.link?c().createElement(c().Fragment,null,c().createElement("span",{className:(0,f.css)(tD())},f.i18n.t("Syntax references")),c().createElement("a",{href:t.link,target:"_blank",rel:"noreferrer"},t.label)):null:null};function tI(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function tN(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function tR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||tV(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tM(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function tB(e){return function(e){if(Array.isArray(e))return tI(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||tV(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tV(e,t){if(e){if("string"==typeof e)return tI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tI(e,t)}}function t_(){var e=tM(["\n display: flex;\n gap: 0.5em;\n align-items: center;\n flex-wrap: wrap;\n "]);return t_=function(){return e},e}function tW(){var e=tM(["\n display: flex;\n position: relative;\n margin: 0.5em 0;\n "]);return tW=function(){return e},e}function tz(){var e=tM(["\n position: relative;\n width: 100%;\n .node-type-condition-group {\n padding: 0.5em 1em;\n border: 1px dashed #ddd;\n }\n + button {\n position: absolute;\n right: 0;\n }\n "]);return tz=function(){return e},e}function tq(){var e=tM(["\n display: flex;\n align-items: center;\n gap: 0.5em;\n .ant-select {\n width: auto;\n min-width: 6em;\n }\n "]);return tq=function(){return e},e}function tL(){var e=tM(["\n button {\n padding: 0;\n &:not(:last-child) {\n margin-right: 1em;\n }\n }\n "]);return tL=function(){return e},e}var t$=new p.Registry;t$.register("equal",{name:"=",type:"boolean",group:"boolean"}),t$.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),t$.register("gt",{name:">",type:"boolean",group:"boolean"}),t$.register("gte",{name:"≥",type:"boolean",group:"boolean"}),t$.register("lt",{name:"<",type:"boolean",group:"boolean"}),t$.register("lte",{name:"≤",type:"boolean",group:"boolean"}),t$.register("add",{name:"+",type:"number",group:"number"}),t$.register("minus",{name:"-",type:"number",group:"number"}),t$.register("multiple",{name:"*",type:"number",group:"number"}),t$.register("divide",{name:"/",type:"number",group:"number"}),t$.register("mod",{name:"%",type:"number",group:"number"}),t$.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),t$.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),t$.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),t$.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),t$.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),t$.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),t$.register("concat",{name:'{{t("concat", { ns: "'.concat(E,'" })}}'),type:"string",group:"string"});var tU=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:'{{t("Arithmetic calculation", { ns: "'.concat(E,'" })}}')},{value:"string",title:'{{t("String operation", { ns: "'.concat(E,'" })}}')},{value:"date",title:'{{t("Date", { ns: "'.concat(E,'" })}}')}];function tG(e){return Array.from(t$.getEntities()).filter(function(t){var n=tR(t,2);return(n[0],n[1]).group===e})}function tJ(e){var t=e.calculator,n=e.operands,r=void 0===n?[]:n,o=e.onChange,i=(0,f.useCompile)(),a=(0,l.useContext)(tK),u=a(),s=a(),p=(0,l.useCallback)(function(e){return o({calculator:t,operands:[e,r[1]]})},[t,o,r]),d=(0,l.useCallback)(function(e){return o({calculator:t,operands:[r[0],e]})},[t,o,r]),y=(0,l.useCallback)(function(e){return o({operands:r,calculator:e})},[o,r]);return c().createElement("fieldset",{className:(0,f.css)(t_())},c().createElement(f.Variable.Input,{changeOnSelect:!0,value:r[0],onChange:p,scope:u,useTypedConstant:!0}),c().createElement(m.Select,{role:"button","aria-label":"select-operator-calc",value:t,onChange:y,placeholder:k("Operator"),popupMatchSelectWidth:!1,className:"auto-width"},tU.filter(function(e){return!!tG(e.value).length}).map(function(e){return c().createElement(m.Select.OptGroup,{key:e.value,label:i(e.title)},tG(e.value).map(function(e){var t=tR(e,2),n=t[0],r=t[1].name;return c().createElement(m.Select.Option,{key:n,value:n},i(r))}))})),c().createElement(f.Variable.Input,{changeOnSelect:!0,value:r[1],onChange:d,scope:s,useTypedConstant:!0}))}function tH(e){var t=e.value,n=e.onChange,r=e.onRemove;if(!t)return null;var o=t.calculator,i=t.operands;return c().createElement("div",{className:(0,f.css)(tW())},t.group?c().createElement(tY,{value:t.group,onChange:function(e){return n(tN(tF({},t),{group:e}))}}):c().createElement(tJ,{operands:void 0===i?[]:i,calculator:o,onChange:n}),c().createElement(m.Button,{"aria-label":"icon-close",onClick:r,type:"link",icon:c().createElement(O.CloseCircleOutlined,null)}))}function tY(e){var t=this,n=e.value,r=e.onChange,o=(0,S.useTranslation)().t,i=n.type,a=n.calculations,u=void 0===a?[]:a,s=(0,l.useCallback)(function(){r(tN(tF({},n),{calculations:tB(u).concat([{not:!1,calculator:"equal"}])}))},[n,u,r]),p=(0,l.useCallback)(function(){r(tN(tF({},n),{calculations:tB(u).concat([{not:!1,group:{type:"and",calculations:[]}}])}))},[n,u,r]),d=(0,l.useCallback)(function(e){u.splice(e,1),r(tN(tF({},n),{calculations:tB(u)}))},[n,u,r]),y=(0,l.useCallback)(function(e,t){u.splice(e,1,t),r(tN(tF({},n),{calculations:tB(u)}))},[n,u,r]);return c().createElement("div",{className:(0,f.cx)("node-type-condition-group",(0,f.css)(tz()))},c().createElement("div",{className:(0,f.css)(tq())},c().createElement(S.Trans,null,"Meet ",c().createElement(m.Select,{role:"button","data-testid":"filter-select-all-or-any",value:void 0===i?"and":i,onChange:function(e){return r(tN(tF({},n),{type:e}))}},c().createElement(m.Select.Option,{value:"and"},"All"),c().createElement(m.Select.Option,{value:"or"},"Any"))," conditions in the group")),c().createElement("div",{className:"calculation-items"},u.map(function(e,n){return c().createElement(tH,{key:"".concat(e.calculator,"_").concat(n),value:e,onChange:y.bind(t,n),onRemove:function(){return d(n)}})})),c().createElement("div",{className:(0,f.css)(tL())},c().createElement(m.Button,{type:"link",onClick:s},o("Add condition")),c().createElement(m.Button,{type:"link",onClick:p},o("Add condition group"))))}var tK=(0,l.createContext)(tf);function tQ(e){var t=e.value,n=e.onChange,r=e.useVariableHook,o=void 0===r?tf:r,i=t&&Object.keys(t).length?t:{group:{type:"and",calculations:[]}};return c().createElement(tK.Provider,{value:o},c().createElement(tY,{value:i.group,onChange:function(e){return n(tN(tF({},i),{group:e}))}}))}var tZ=v("632");function tX(e){return c().createElement(m.Card,null,c().createElement(tZ.FormLayout,{layout:e.layout||"vertical"},e.children))}function t0(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t1(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function t2(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){t1(i,r,o,a,l,"next",e)}function l(e){t1(i,r,o,a,l,"throw",e)}a(void 0)})}}function t3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function t5(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function t6(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return t0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t0(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t4(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function t8(){var e,t,n=(e=["\n .ant-dropdown-menu-root {\n max-height: 30em;\n overflow-y: auto;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return t8=function(){return n},n}function t7(e){var t,n,r=e.upstream,o=e.branchIndex,i=void 0===o?null:o,a=(0,f.usePlugin)(ab),u=(0,f.useCompile)(),s=(null!==(n=j())&&void 0!==n?n:{}).workflow,p=Array.from(a.instructions.getValues()),d=eP().styles,y=nt(),b=y.onCreate,v=y.creating,h=(0,l.useMemo)(function(){return u([{key:"control",label:'{{t("Control", { ns: "'.concat(E,'" })}}')},{key:"calculation",label:'{{t("Calculation", { ns: "'.concat(E,'" })}}')},{key:"collection",label:'{{t("Collection operations", { ns: "'.concat(E,'" })}}')},{key:"manual",label:'{{t("Manual", { ns: "'.concat(E,'" })}}')},{key:"extended",label:'{{t("Extended types", { ns: "'.concat(E,'" })}}')}].map(function(e){var t=p.filter(function(t){return t.group===e.key&&(!t.isAvailable||t.isAvailable({engine:a,workflow:s,upstream:r,branchIndex:i}))});return t5(t3({},e),{type:"group",children:t.map(function(e){return{role:"button","aria-label":e.type,key:e.type,label:e.title}})})}).filter(function(e){return e.children.length}))},[i,u,a,p,r,s]);var g=(0,l.useCallback)((t=t2(function(e){return t4(this,function(t){return b({type:t6(e.keyPath,1)[0],upstream:r,branchIndex:i}),[2]})}),function(e){return t.apply(this,arguments)}),[i,b,r]);return s?c().createElement("div",{className:d.addButtonClass},c().createElement(m.Dropdown,{menu:{items:h,onClick:g},disabled:s.executed,overlayClassName:(0,f.css)(t8())},c().createElement(m.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:c().createElement(O.PlusOutlined,null),loading:(null==v?void 0:v.upstreamId)==(null==r?void 0:r.id)&&(null==v?void 0:v.branchIndex)===i,size:"small"}))):null}function t9(){var e=(0,u.useForm)(),t=(0,f.useAPIClient)(),n=j(),r=n.workflow,o=n.refresh,i=nt(),a=i.presetting,l=i.setPresetting,c=i.setCreating,s=(0,f.useActionContext)();return{run:function(){return t2(function(){var n;return t4(this,function(i){switch(i.label){case 0:if(!a)return[2];return[4,e.submit()];case 1:i.sent(),c(a.data),i.label=2;case 2:return i.trys.push([2,6,7,8]),[4,t.resource("workflows.nodes",r.id).create({values:t5(t3({},a.data),{config:t3({},a.data.config,e.values.config)})})];case 3:if(n=i.sent().data.data,!("number"==typeof e.values.downstreamBranchIndex&&n.downstreamId))return[3,5];return[4,t.resource("flow_nodes").update({filterByTk:n.downstreamId,values:{branchIndex:e.values.downstreamBranchIndex,upstream:{id:n.id,downstreamId:null}},updateAssociationValues:["upstream"]})];case 4:i.sent(),i.label=5;case 5:return s.setVisible(!1),l(null),o(),[3,8];case 6:return console.error(i.sent()),[3,8];case 7:return c(null),[7];case 8:return[2]}})})()}}}var ne=(0,l.createContext)(null);function nt(){return(0,l.useContext)(ne)}var nn=[{label:"{{t('After end of branches', { ns: \"".concat(E,'" })}}'),value:!1},{label:"{{t('Inside of branch', { ns: \"".concat(E,'" })}}'),value:0}],nr=(0,u.observer)(function(e){var t,n,r=nt().presetting,o=j().nodes,i=(0,u.useForm)().values,a=(0,l.useMemo)(function(){if(!(null==r?void 0:r.instruction))return[];var e,t=r.instruction,n=r.data;if(!(n.upstreamId?o.find(function(e){return e.upstreamId===n.upstreamId&&e.branchIndex===n.branchIndex}):o.find(function(e){return null===e.upstreamId})))return[];var a="function"==typeof t.branching?t.branching(null!==(e=i.config)&&void 0!==e?e:{}):t.branching;return a?!0===a?nn:a:[]},[r,o,i.config]);if(!a.length)return null;var s=r.data;return c().createElement(f.SchemaComponent,{components:{RadioWithTooltip:tx},schema:{name:"".concat(null!==(t=s.type)&&void 0!==t?t:"unknown","-").concat(null!==(n=s.upstreamId)&&void 0!==n?n:"root","-").concat(s.branchIndex),type:"void",properties:{downstreamBranchIndex:{type:"number",title:k("Move all downstream nodes to",{ns:E}),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:a,direction:"vertical"},default:!1,required:!0}}}})});function no(){var e=nt().presetting;return(null==e?void 0:e.instruction.presetFieldset)?c().createElement(f.SchemaComponent,{schema:{type:"void",properties:{config:{type:"object",properties:e.instruction.presetFieldset}}}}):null}function ni(e){var t,n,r=(0,f.useAPIClient)(),o=(0,f.useCompile)(),i=(0,f.usePlugin)(ab),a=t6((0,l.useState)(null),2),u=a[0],s=a[1],d=t6((0,l.useState)(null),2),m=d[0],y=d[1],b=t6((0,l.useState)(!1),2),v=b[0],h=b[1],g=null!==(n=j())&&void 0!==n?n:{},O=g.workflow,x=g.nodes,S=g.refresh,k=(0,l.useMemo)(function(){return(0,w.createForm)()},[]),C=(0,l.useCallback)(function(e){!e&&(k.reset(),k.clearFormGraph("*"),y(null))},[k]);var P=(0,l.useCallback)((t=t2(function(e){return t4(this,function(t){switch(t.label){case 0:s(e),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,r.resource("workflows.nodes",O.id).create({values:e})];case 2:return t.sent(),S(),[3,5];case 3:return console.error(t.sent()),[3,5];case 4:return s(null),[7];case 5:return[2]}})}),function(e){return t.apply(this,arguments)}),[r,S,O.id]),A=(0,l.useCallback)(function(e){var t,n,r,a=e.type,l=e.upstream,c=e.branchIndex,u=i.instructions.get(a);if(!u){console.error('Instruction "'.concat(a,'" not found'));return}var s={key:(0,p.uid)(),type:a,upstreamId:null!==(n=null==l?void 0:l.id)&&void 0!==n?n:null,branchIndex:c,title:o(u.title),config:null!==(r=null===(t=u.createDefaultConfig)||void 0===t?void 0:t.call(u))&&void 0!==r?r:{}},f=(null==l?void 0:l.id)?x.find(function(e){return e.upstreamId===s.upstreamId&&e.branchIndex===s.branchIndex}):x.find(function(e){return null===e.upstreamId});if(u.presetFieldset||("function"==typeof u.branching?u.branching(s.config):u.branching)&&f){y({data:s,instruction:u});return}P(s)},[o,P,i.instructions]);return c().createElement(ne.Provider,{value:{presetting:m,setPresetting:y,onCreate:A,creating:u,setCreating:s}},e.children,c().createElement(f.ActionContextProvider,{value:{visible:!!m,setVisible:C,formValueChanged:v,setFormValueChanged:h,openSize:"small"}},c().createElement(f.SchemaComponent,{components:{DownstreamBranchIndex:nr,PresetFieldset:no},scope:{useCancelAction:f.useCancelAction,useAddNodeSubmitAction:t9},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:k},"x-component":"Action.Modal",title:'{{ t("Add node", { ns: "'.concat(E,'" }) }}'),properties:{config:{type:"void","x-component":"PresetFieldset"},downstreamBranchIndex:{type:"void","x-component":"DownstreamBranchIndex"},footer:{"x-component":"Action.Modal.Footer",properties:{actions:{type:"void","x-component":"ActionBar",properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{type:"void",title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useAddNodeSubmitAction }}"}}}}}}}}})))}function na(e){for(var t=e.from,n=void 0===t?null:t,r=e.entry,o=void 0===r?null:r,i=e.branchIndex,a=void 0===i?null:i,l=e.controller,u=e.className,s=e.end,p=eP().styles,d=el(n,a).getAriaLabel,m=[],y=o;y;y=y.downstream)m.push(y);return c().createElement("div",{className:(0,f.cx)("workflow-branch",p.branchClass,u)},c().createElement("div",{className:"workflow-branch-lines"}),void 0===l?null:l,c().createElement(t7,{"aria-label":d(),upstream:n,branchIndex:a}),c().createElement("div",{className:"workflow-node-list"},m.map(function(e){return c().createElement(eY,{data:e,key:e.id})})),s?c().createElement("div",{className:"end-sign"},c().createElement(O.CloseOutlined,null)):null)}function nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nc(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function nu(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){nc(i,r,o,a,l,"next",e)}function l(e){nc(i,r,o,a,l,"throw",e)}a(void 0)})}}function ns(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ns(e,t,n[t])})}return e}function np(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function nd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nl(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nm(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ny(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function nb(){var e=nm(["\n padding: 1em;\n background-color: #f3f3f3;\n "]);return nb=function(){return e},e}function nv(){var e=nm(["\n .ant-select.auto-width {\n width: auto;\n min-width: 6em;\n }\n "]);return nv=function(){return e},e}function nh(){var e,t=(0,u.useForm)(),n=(0,f.useAPIClient)(),r=(null!==(e=j())&&void 0!==e?e:{}).workflow,o=(0,f.useActionContext)(),i=(0,f.useResourceActionContext)().refresh;return{run:function(){return nu(function(){return ny(this,function(e){switch(e.label){case 0:if(r.executed)return m.message.error(k("Trigger in executed workflow cannot be modified")),[2];return[4,t.submit()];case 1:return e.sent(),[4,n.resource("workflows").update({filterByTk:r.id,values:{config:t.values}})];case 2:return e.sent(),o.setFormValueChanged(!1),o.setVisible(!1),i(),[2]}})})()}}}var ng=function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e),ns(this,"sync",void 0),ns(this,"title",void 0),ns(this,"description",void 0),ns(this,"fieldset",void 0),ns(this,"view",void 0),ns(this,"scope",void 0),ns(this,"components",void 0),ns(this,"initializers",void 0),ns(this,"isActionTriggerable",void 0)};function nO(){var e=(0,f.useCompile)(),t=j(),n=t.workflow,r=t.execution,o=eP().styles,i=nj();return r?c().createElement(f.SchemaComponent,{components:{Tooltip:m.Tooltip},schema:{type:"void",name:"execution","x-decorator":"Tooltip","x-decorator-props":{title:k("View result")},"x-component":"Action","x-component-props":{title:c().createElement(O.InfoOutlined,null),shape:"circle",size:"small",className:o.nodeJobButtonClass,type:"primary"},properties:ns({},r.id,{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:r},"x-component":"Action.Modal",title:c().createElement("div",{className:(0,f.cx)(o.nodeTitleClass)},c().createElement(m.Tag,null,e(i.title)),c().createElement("strong",null,n.title),c().createElement("span",{className:"workflow-node-id"},"#",r.id)),properties:{createdAt:{type:"string",title:'{{t("Triggered at", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:'{{t("Trigger variables", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:(0,f.css)(nb())},"x-read-pretty":!0}}})}}):null}function nw(){return{form:(0,u.useForm)()}}var nx=function(){var e,t=(0,f.useAPIClient)(),n=j(),r=n.workflow,o=n.refresh,i=nd((0,l.useState)(""),2),a=i[0],u=i[1],s=nd((0,l.useState)(!1),2),p=s[0],d=s[1],y=nd((0,l.useState)(!1),2),b=y[0],v=y[1],h=eP().styles,g=(0,f.useCompile)(),x=nj();(0,l.useEffect)(function(){if(r){var e,t;u(null!==(t=null!==(e=r.triggerTitle)&&void 0!==e?e:r.title)&&void 0!==t?t:g(null==x?void 0:x.title))}},[r,x]);var S=(0,l.useMemo)(function(){var e=(0,B.cloneDeep)(r.config);return(0,w.createForm)({initialValues:e,disabled:r.executed})},[r]),E=(0,l.useCallback)(function(e){d(e),!e&&S.reset()},[S]);var C=(0,l.useCallback)((e=nu(function(e){var n;return ny(this,function(i){switch(i.label){case 0:if(u(n=e||g(null==x?void 0:x.title)),n===r.triggerTitle)return[2];return[4,t.resource("workflows").update({filterByTk:r.id,values:{triggerTitle:n}})];case 1:return i.sent(),o(),[2]}})}),function(t){return e.apply(this,arguments)}),[r,x]),P=(0,l.useCallback)(function(e){if(e.target===e.currentTarget){d(!0);return}for(var t,n=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]),r=e.target;r&&r!==e.currentTarget;r=r.parentNode)if(Array.from(null!==(t=r.classList)&&void 0!==t?t:[]).some(function(e){return n.has(e)})){d(!0),e.stopPropagation();return}},[]),A=r.executed?'{{t("View")}}':'{{t("Configure")}}',D=k("Trigger");if(!x)return c().createElement(m.Tooltip,{title:k("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.")},c().createElement("div",{role:"button","aria-label":"".concat(D,"-").concat(a),className:(0,f.cx)(h.nodeCardClass,"invalid"),onClick:P},c().createElement("div",{className:h.nodeHeaderClass},c().createElement("div",{className:(0,f.cx)(h.nodeMetaClass,"workflow-node-meta")},c().createElement(m.Tag,{color:"error"},k("Unknown trigger")))),c().createElement("div",{className:"workflow-node-title"},c().createElement(m.Input.TextArea,{value:a,disabled:!0,autoSize:!0}))));var T=x.fieldset,I=x.scope,F=x.components;return c().createElement("div",{role:"button","aria-label":"".concat(D,"-").concat(a),className:(0,f.cx)(h.nodeCardClass),onClick:P},c().createElement("div",{className:h.nodeHeaderClass},c().createElement("div",{className:(0,f.cx)(h.nodeMetaClass,"workflow-node-meta")},c().createElement(m.Tag,{color:"gold"},c().createElement(O.ThunderboltOutlined,null),c().createElement("span",{className:"type"},g(x.title)))),c().createElement("div",{className:"workflow-node-actions"},c().createElement(nO,null))),c().createElement("div",{className:"workflow-node-title"},c().createElement(m.Input.TextArea,{value:a,onChange:function(e){return u(e.target.value)},onBlur:function(e){return C(e.target.value)},autoSize:!0,disabled:r.executed})),c().createElement(f.ActionContextProvider,{value:{visible:p,setVisible:E,formValueChanged:b,setFormValueChanged:v}},c().createElement(f.FormProvider,{form:S},c().createElement(f.SchemaComponent,{scope:np(nf({},I),{useFormProviderProps:nw}),components:F,schema:{name:"workflow-trigger-".concat(r.id),type:"void",properties:{config:{type:"void","x-content":A,"x-component":m.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:D,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:np(nf({},x.description?{description:{type:"void","x-component":G,"x-component-props":{label:k("Trigger type"),title:x.title,description:x.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,f.css)(nv())},properties:T},actions:nf({},r.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:nh}}}})})}}}}))))};function nj(){var e=(0,f.usePlugin)(ab),t=j().workflow;return e.triggers.get(t.type)}function nS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nE(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function nk(){var e=nE(["\n margin-top: 0 !important;\n "]);return nk=function(){return e},e}function nC(){var e=nE(["\n margin-bottom: 1em;\n "]);return nC=function(){return e},e}function nP(){var e=nE(["\n margin-top: 0 !important;\n "]);return nP=function(){return e},e}function nA(e){var t,n,r=e.entry,o=eP().styles,i=j().workflow;var a=(t=c().useState(100),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return nS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nS(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=a[0],u=a[1];return c().createElement("div",{className:"workflow-canvas-wrapper"},c().createElement(g,{FallbackComponent:f.ErrorFallback,onError:console.error},c().createElement(ni,null,c().createElement("div",{className:"workflow-canvas",style:{zoom:l/100}},c().createElement("div",{className:(0,f.cx)(o.branchBlockClass,(0,f.css)(nk()))},c().createElement("div",{className:o.branchClass},(null==i?void 0:i.executed)?c().createElement(m.Alert,{type:"warning",message:k("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:(0,f.css)(nC())}):null,c().createElement(nx,null),c().createElement("div",{className:(0,f.cx)(o.branchBlockClass,(0,f.css)(nP()))},c().createElement(na,{entry:r})),c().createElement("div",{className:o.terminalClass},k("End"))))))),c().createElement("div",{className:"workflow-canvas-zoomer"},c().createElement(m.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:l,onChange:u})))}function nD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nT(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function nI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||nN(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nF(e){return function(e){if(Array.isArray(e))return nD(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||nN(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nN(e,t){if(e){if("string"==typeof e)return nD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nD(e,t)}}function nR(){var e,t,n,r=(0,f.usePlugin)(ab).instructions,o=(0,f.useCompile)(),i=j(),a=i.viewJob,l=i.setViewJob,u=eP().styles,s=(null!=a?a:{}).node,p=void 0===s?{}:s,d=r.get(p.type);return c().createElement(f.ActionContextProvider,{value:{visible:!!a,setVisible:l}},c().createElement(f.SchemaComponent,{schema:{type:"void",properties:(e={},t="".concat(null==a?void 0:a.id,"-").concat(null==a?void 0:a.updatedAt,"-modal"),n={type:"void","x-decorator":"Form","x-decorator-props":{initialValue:a},"x-component":"Action.Modal",title:c().createElement("div",{className:u.nodeTitleClass},c().createElement(m.Tag,null,o(null==d?void 0:d.title)),c().createElement("strong",null,p.title),c().createElement("span",{className:"workflow-node-id"},"#",p.id)),properties:{status:{type:"number",title:'{{t("Status", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Select",enum:ei,"x-read-pretty":!0},updatedAt:{type:"string",title:'{{t("Executed at", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:'{{t("Node result", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:u.nodeJobResultClass},"x-read-pretty":!0}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)}}))}function nM(e){var t=j().execution,n=(0,f.useAPIClient)(),r=(0,d.useNavigate)(),o=eP().styles,i=nI((0,l.useState)([]),2),a=i[0],u=i[1],s=nI((0,l.useState)([]),2),y=s[0],b=s[1];(0,l.useEffect)(function(){if(!!t)n.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){u(e.data.data)}).catch(function(){})},[t]),(0,l.useEffect)(function(){if(!!t)n.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){b(e.data.data.reverse())}).catch(function(){})},[t]);var v=(0,l.useCallback)(function(e){var n=e.key;n!=t.id&&r(T(n))},[t]);return t?c().createElement(m.Dropdown,{menu:{onClick:v,defaultSelectedKeys:["".concat(t.id)],className:(0,f.cx)(o.dropdownClass,o.executionsDropdownRowClass),items:nF(y).concat([t],nF(a)).map(function(e){return{key:e.id,label:c().createElement(c().Fragment,null,c().createElement("span",{className:"id"},"#".concat(e.id)),c().createElement("time",null,(0,p.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss"))),icon:c().createElement("span",null,c().createElement(X,{statusMap:er,status:e.status}))}})}},c().createElement(m.Space,null,c().createElement("strong",null,"#".concat(t.id)),c().createElement(O.DownOutlined,null))):null}function nB(){var e,t=(0,S.useTranslation)().t,n=(0,f.useCompile)(),r=(0,f.useResourceActionContext)(),o=r.data,i=r.loading,a=r.refresh,u=(0,f.useDocumentTitle)().setTitle,s=nI((0,l.useState)(null),2),y=s[0],b=s[1],v=(0,f.useApp)(),h=(0,f.useAPIClient)();(0,l.useEffect)(function(){var e,t=(null!==(e=null==o?void 0:o.data)&&void 0!==e?e:{}).workflow;null==u||u("".concat((null==t?void 0:t.title)?"".concat(t.title," - "):"").concat(k("Execution history")))},[null==o?void 0:o.data]);var g=(0,l.useCallback)(function(){m.Modal.confirm({title:k("Cancel the execution"),icon:c().createElement(O.ExclamationCircleFilled,null),content:k("Are you sure you want to cancel the execution?"),onOk:function(){h.resource("executions").cancel({filterByTk:null==o?void 0:o.data.id}).then(function(){m.message.success(t("Operation succeeded")),a()}).catch(function(e){console.error(e.data.error)})}})},[null==o?void 0:o.data]);if(!(null==o?void 0:o.data))return i?c().createElement(m.Spin,null):c().createElement(m.Result,{status:"404",title:"Not found"});var w=null!==(e=null==o?void 0:o.data)&&void 0!==e?e:{},j=w.jobs,E=w.workflow,C=void 0===E?{}:E,A=C.nodes,T=void 0===A?[]:A,I=(C.revisions,nT(w.workflow,["nodes","revisions"])),F=nT(w,["jobs","workflow"]);P(T),!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map;e.forEach(function(e){e.jobs=[],n.set(e.id,e)}),t.forEach(function(e){var t=n.get(e.nodeId);t.jobs.push(e),e.node={id:t.id,key:t.key,title:t.title,type:t.type}}),e.forEach(function(e){e.jobs=e.jobs.sort(function(e,t){return e.id-t.id})})}(T,void 0===j?[]:j);var N=T.find(function(e){return!e.upstream}),R=er[F.status];return c().createElement(x.Provider,{value:{workflow:I.type?I:null,nodes:T,execution:F,viewJob:y,setViewJob:b}},c().createElement("div",{className:"workflow-toolbar"},c().createElement("header",null,c().createElement(m.Breadcrumb,{items:[{title:c().createElement(d.Link,{to:v.pluginSettingsManager.getRoutePath("workflow")},k("Workflow"))},{title:c().createElement(m.Tooltip,{title:"Key: ".concat(I.key)},c().createElement(d.Link,{to:D(I.id)},I.title))},{title:c().createElement(nM,null)}]})),c().createElement("aside",null,c().createElement(m.Tag,{color:R.color},n(R.label)),F.status?null:c().createElement(m.Tooltip,{title:k("Cancel the execution")},c().createElement(m.Button,{type:"link",danger:!0,onClick:g,shape:"circle",size:"small",icon:c().createElement(O.StopOutlined,null)})),c().createElement("time",null,(0,p.str2moment)(F.updatedAt).format("YYYY-MM-DD HH:mm:ss")))),c().createElement(nA,{entry:N}),c().createElement(nR,null))}var nV=function(){var e,t,n,r=(0,d.useParams)(),o=eP().styles;return c().createElement("div",{className:(0,f.cx)(o.workflowPageClass)},c().createElement(f.SchemaComponent,{schema:{type:"void",properties:(e={},t="execution_".concat(r.id),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:r,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},components:{ExecutionCanvas:nB}}))},n_=function(){var e=(0,S.useTranslation)().t,t=(0,f.useRecord)().id,n=(0,f.useActionContext)().setVisible;return c().createElement(d.Link,{to:T(t),onClick:function(){return n(!1)}},e("View"))};function nW(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}var nz={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:'{{t("Triggered at", { ns: "'.concat(E,'" })}}'),"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:(e={type:"number",title:'{{t("Version", { ns: "'.concat(E,'" })}}')},t="x-component",n=function(e){var t=e.value,n=(0,f.useActionContext)().setVisible;return c().createElement(d.Link,{to:D(t),onClick:function(){return n(!1)}},"#".concat(t))},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},{type:"number",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(E,'" })}}'),type:"string","x-component":"Select","x-decorator":"FormItem",enum:en}}]},nq={type:"void",name:"executionHistoryDrawer",title:'{{t("Execution history", { ns: "'.concat(E,'" })}}'),"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:nz,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction:function(){var e=(0,S.useTranslation)().t,t=(0,f.useResourceActionContext)(),n=t.refresh,r=t.defaultRequest,o=(0,f.useResourceContext)().resource,i=(0,f.useActionContext)().setVisible;return{run:function(){var t;return(t=function(){var t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(a){switch(a.label){case 0:return[4,o.destroy({filter:null===(t=r.params)||void 0===t?void 0:t.filter})];case 1:return a.sent(),m.message.success(e("Operation succeeded")),n(),i(!1),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(e){nW(i,r,o,a,l,"next",e)}function l(e){nW(i,r,o,a,l,"throw",e)}a(void 0)})})()}}},confirm:{title:'{{t("Clear all executions", { ns: "'.concat(E,'" })}}'),content:'{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "'.concat(E,'" })}}')}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Status", { ns: "'.concat(E,'" })}}'),properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:"{{ $deps[0] !== ".concat(et.STARTED," }}")}}}]}}}}}}}}}}};function nL(){return(nL=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function nU(){var e,t,n=(e=["\n display: flex;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return nU=function(){return n},n}function nG(e){var t,n=(0,f.useCompile)()(e.label),r=(0,l.useCallback)(function(e){e.preventDefault(),e.stopPropagation()},[]),o=(null!==(t=er[e.value])&&void 0!==t?t:{}).color;return c().createElement(m.Tag,{color:o,onMouseDown:r,closable:e.closable,onClose:e.onClose},n)}function nJ(e){var t=(0,f.useCompile)();return c().createElement(c().Fragment,null,c().createElement(nG,e),e.description?c().createElement("span",null,t(e.description)):null)}function nH(e){var t,n,r=nL({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),o=r.multiple?"multiple":null;return c().createElement(m.Select,(t=n$({role:"button","data-testid":"select-".concat(o||"single")},r),n=(n={mode:o,optionLabelProp:"label",tagRender:nG},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),en.filter(function(e){return!!e.value&&e.value!==et.ABORTED}).map(function(e){return c().createElement(m.Select.Option,n$({key:e.value},e),c().createElement(nJ,e))}))}function nY(e){var t=(0,S.useTranslation)().t,n=(0,f.useResourceActionContext)().refresh,r=(0,f.useResourceContext)().resource,o=(0,f.useRecord)(),i=(0,l.useCallback)(function(){m.Modal.confirm({title:k("Cancel the execution"),icon:c().createElement(O.ExclamationCircleFilled,null),content:k("Are you sure you want to cancel the execution?"),onOk:function(){r.cancel({filterByTk:o.id}).then(function(){m.message.success(t("Operation succeeded")),n()}).catch(function(e){console.error(e.data.error)})}})},[o]);return c().createElement("div",{className:(0,f.css)(nU())},e.children,o.status?null:c().createElement(m.Tooltip,{title:k("Cancel the execution")},c().createElement(m.Button,{type:"link",danger:!0,onClick:i,shape:"circle",size:"small",icon:c().createElement(O.StopOutlined,null)})))}function nK(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function nQ(){var e=(0,f.useResourceActionContext)();return{onClick:function(){var t;return(t=function(){var t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(n){return null==e||null===(t=e.refresh)||void 0===t||t.call(e),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(e){nK(i,r,o,a,l,"next",e)}function l(e){nK(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function nZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nX(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function n0(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){nX(i,r,o,a,l,"next",e)}function l(e){nX(i,r,o,a,l,"throw",e)}a(void 0)})}}function n1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function n2(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function n3(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function n5(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function n6(e){var t,n=e.request,r=(e.filter,n3(e,["request","filter"])),o=j().workflow,i=n2(n1({},r),{request:n2(n1({},n),{params:n2(n1({},null==n?void 0:n.params),{filter:n2(n1({},null==n?void 0:null===(t=n.params)||void 0===t?void 0:t.filter),{key:o.key})})})});return c().createElement(f.ResourceActionProvider,i)}function n4(){var e,t,n,r=(0,d.useNavigate)(),o=(0,S.useTranslation)().t,i=(0,f.useApp)(),a=(0,f.useResourceActionContext)(),u=a.data,s=a.refresh,y=a.loading,b=(0,f.useResourceContext)().resource,v=(0,f.useDocumentTitle)().setTitle;var h=(e=(0,l.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return nZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nZ(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=h[0],w=h[1],j=eP().styles,E=m.App.useApp().modal;if((0,l.useEffect)(function(){var e,t=(null!==(e=null==u?void 0:u.data)&&void 0!==e?e:{}).title;null==v||v("".concat(k("Workflow")).concat(t?": ".concat(t):""))},[null==u?void 0:u.data]),!(null==u?void 0:u.data))return y?c().createElement(m.Spin,null):c().createElement(m.Result,{status:"404",title:"Not found",extra:c().createElement(m.Button,{onClick:function(){return r(-1)}},k("Go back"))});var C=null!==(n=null==u?void 0:u.data)&&void 0!==n?n:{},A=C.nodes,T=void 0===A?[]:A,I=C.revisions,F=void 0===I?[]:I,N=n3(C,["nodes","revisions"]);P(T);var R=T.find(function(e){return!e.upstream});function M(){return(M=n0(function(e){return n5(this,function(t){switch(t.label){case 0:return[4,b.update({filterByTk:N.id,values:{enabled:e}})];case 1:return t.sent(),s(),[2]}})})).apply(this,arguments)}function B(){return(B=n0(function(){var e;return n5(this,function(t){switch(t.label){case 0:return[4,b.revision({filterByTk:N.id,filter:{key:N.key}})];case 1:return e=t.sent().data.data,m.message.success(o("Operation succeeded")),r("/admin/workflow/workflows/".concat(e.id)),[2]}})})).apply(this,arguments)}function V(){return(V=n0(function(){var e;return n5(this,function(t){return e=N.current?k("Delete a main version will cause all other revisions to be deleted too."):"",E.confirm({title:o("Are you sure you want to delete it?"),content:e,onOk:function(){return n0(function(){var e;return n5(this,function(t){switch(t.label){case 0:return[4,b.destroy({filterByTk:N.id})];case 1:return t.sent(),m.message.success(o("Operation succeeded")),r(N.current?i.pluginSettingsManager.getRoutePath("workflow"):D(null===(e=F.find(function(e){return e.current}))||void 0===e?void 0:e.id)),[2]}})})()}}),[2]})})).apply(this,arguments)}function _(){return(_=n0(function(e){return n5(this,function(t){switch(e.key){case"history":w(!0);break;case"revision":return[2,function(){return B.apply(this,arguments)}()];case"delete":return[2,function(){return V.apply(this,arguments)}()]}return[2]})})).apply(this,arguments)}var W=N.executed&&!F.find(function(e){return!e.executed&&new Date(e.createdAt)>new Date(N.createdAt)});return c().createElement(x.Provider,{value:{workflow:N,nodes:T,refresh:s}},c().createElement("div",{className:"workflow-toolbar"},c().createElement("header",null,c().createElement(m.Breadcrumb,{items:[{title:c().createElement(d.Link,{to:i.pluginSettingsManager.getRoutePath("workflow")},k("Workflow"))},{title:c().createElement(m.Tooltip,{title:"Key: ".concat(N.key)},c().createElement("strong",null,N.title))}]})),c().createElement("aside",null,N.sync?c().createElement(m.Tag,{color:"orange"},k("Synchronously")):c().createElement(m.Tag,{color:"cyan"},k("Asynchronously")),c().createElement(m.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:function(e){var t=e.key;t!=N.id&&r(D(t))},defaultSelectedKeys:["".concat(N.id)],className:(0,f.cx)(j.dropdownClass,j.workflowVersionDropdownClass),items:F.sort(function(e,t){return t.id-e.id}).map(function(e,t){return{role:"button","aria-label":"version-".concat(t),key:"".concat(e.id),icon:e.current?c().createElement(O.RightOutlined,null):null,className:(0,f.cx)({executed:e.executed,unexecuted:!e.executed,enabled:e.enabled}),label:c().createElement(c().Fragment,null,c().createElement("strong",null,"#".concat(e.id)),c().createElement("time",null,(0,p.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss")))}})}},c().createElement(m.Button,{type:"text","aria-label":"version"},c().createElement("label",null,k("Version")),c().createElement("span",null,(null==N?void 0:N.id)?"#".concat(N.id):null),c().createElement(O.DownOutlined,null))),c().createElement(m.Switch,{checked:N.enabled,onChange:function(e){return M.apply(this,arguments)},checkedChildren:k("On"),unCheckedChildren:k("Off")}),c().createElement(m.Dropdown,{menu:{items:[{key:"key",label:"Key: ".concat(N.key),disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:k("Execution history"),disabled:!N.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:k("Copy to new version"),disabled:!W},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:o("Delete")}],onClick:function(e){return _.apply(this,arguments)}}},c().createElement(m.Button,{"aria-label":"more",type:"text",icon:c().createElement(O.EllipsisOutlined,null)})),c().createElement(f.ActionContextProvider,{value:{visible:g,setVisible:w}},c().createElement(f.SchemaComponent,{schema:nq,components:{ExecutionResourceProvider:n6,ExecutionLink:n_,ExecutionStatusColumn:nY},scope:{useRefreshActionProps:nQ}})))),c().createElement(nA,{entry:R}))}var n8=function(){var e,t,n,r=(0,d.useParams)(),o=eP().styles;return c().createElement("div",{className:(0,f.cx)(o.workflowPageClass)},c().createElement(f.SchemaComponent,{schema:{type:"void",properties:(e={},t="provider_".concat(r.id),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:r.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},components:{WorkflowCanvas:n4}}))};function n7(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function n9(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var re=function(e){var t,n=e.request,r=(e.filter,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["request","filter"])),o=(0,f.useRecord)(),i=n9(n7({},r),{request:n9(n7({},n),{params:n9(n7({},null==n?void 0:n.params),{filter:n9(n7({},null==n?void 0:null===(t=n.params)||void 0===t?void 0:t.filter),{key:o.key})})})});return c().createElement(f.ResourceActionProvider,i)},rt=function(){var e=(0,S.useTranslation)().t,t=(0,f.useRecord)().id,n=(0,f.useActionContext)().setVisible,r=(0,f.useGetAriaLabelOfAction)("Configure").getAriaLabel;return c().createElement(d.Link,{"aria-label":r(),to:D(t),onClick:function(){return n(!1)}},e("Configure"))};function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rr(e){var t,n,r,o,i=e.component,a=e.children,s=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["component","children"]);var p=(t=(0,l.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rn(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=p[0],m=p[1],y=(0,u.useFieldSchema)();return c().createElement(f.ActionContextProvider,{value:{visible:d,setVisible:m,fieldSchema:y}},c().createElement(void 0===i?"div":i,(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},s),o=(o={onClick:function(){m(!0)}},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r),a),c().createElement(f.SchemaComponent,{schema:y,onlyRenderProperties:!0}))}function ro(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function ri(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ro(i,r,o,a,l,"next",e)}function l(e){ro(i,r,o,a,l,"throw",e)}a(void 0)})}}function ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rl(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var rc={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Trigger type", { ns: "'.concat(E,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Select",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:function(e){var t=e.data,n=t.label,r=t.color,o=t.options,i=(0,f.useCompile)();return c().createElement(m.Space,{direction:"vertical"},c().createElement(m.Tag,{color:r},i(n)),c().createElement(m.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"}},i(o.description)))},popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"select",uiSchema:{title:'{{t("Mode", { ns: "'.concat(E,'" })}}'),type:"boolean","x-decorator":"FormItem","x-component":"Select",enum:[{label:'{{ t("Asynchronously", { ns: "'.concat(E,'" }) }}'),value:!1,color:"cyan"},{label:'{{ t("Synchronously", { ns: "'.concat(E,'" }) }}'),value:!0,color:"orange"}],required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:'{{t("Status", { ns: "'.concat(E,'" })}}'),type:"string",enum:[{label:'{{t("On", { ns: "'.concat(E,'" })}}'),value:!0,color:"#52c41a"},{label:'{{t("Off", { ns: "'.concat(E,'" })}}'),value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:'{{t("Executed", { ns: "'.concat(E,'" })}}'),type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},ru={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:'{{ t("Execute mode", { ns: "'.concat(E,'" }) }}'),description:'{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "'.concat(E,'" }) }}'),"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:'{{ t("Asynchronously", { ns: "'.concat(E,'" }) }}'),value:!1,tooltip:'{{ t("Will be executed in the background as a queued task.", { ns: "'.concat(E,'" }) }}')},{label:'{{ t("Synchronously", { ns: "'.concat(E,'" }) }}'),value:!0,tooltip:'{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "'.concat(E,'" }) }}')}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:'{{ t("Auto delete history when execution is on end status", { ns: "'.concat(E,'" }) }}'),"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},rs=ra({name:"workflow",type:"void"},"properties",ra({},"provider",ra({type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:rc,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:rc}},"properties",ra({actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:'{{t("Sync", { ns: "'.concat(E,'" })}}'),"x-decorator":"Tooltip","x-decorator-props":{title:'{{ t("Sync enabled status of all workflows from database", { ns: "'.concat(E,'" }) }}')},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction:function(){var e=(0,S.useTranslation)().t,t=(0,f.useResourceContext)().resource,n=(0,f.useResourceActionContext)();return{run:function(){return ri(function(){return rl(this,function(r){switch(r.label){case 0:return[4,t.sync()];case 1:return r.sent(),[4,null==n?void 0:n.refresh()];case 2:return r.sent(),m.message.success(e("Operation succeeded")),[2]}})})()}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:ru.title,type:ru.type,sync:ru.sync,description:ru.description,options:ru.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}}},"table",ra({type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"}},"properties",ra({title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(e){var t=(0,f.useRecord)();return c().createElement("a",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ra(e,t,n[t])})}return e}({"aria-label":"executed-".concat(t.title)},e))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:nq}}}}},"actions",ra({type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column"},"properties",ra({},"actions",ra({type:"void","x-component":"Space","x-component-props":{split:"|"}},"properties",(ra(i={configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:ru.title,enabled:ru.enabled,sync:ru.sync,description:ru.description,options:ru.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}}},"revision",ra({type:"void",title:'{{t("Duplicate", { ns: "'.concat(E,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"}},"properties",ra({},"modal",ra({type:"void",title:'{{t("Duplicate to new workflow", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal"},"properties",ra({title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"}},"footer",ra({type:"void","x-component":"Action.Modal.Footer"},"properties",(ra(o={},"submit",ra({type:"void",title:'{{t("Submit")}}',"x-component":"Action"},"x-component-props",ra({type:"primary"},"useAction",function(){var e=(0,S.useTranslation)().t,t=(0,f.useResourceActionContext)().refresh,n=(0,f.useResourceContext)(),r=n.resource,o=n.targetKey,i=(0,f.useActionContext)().setVisible,a=(0,f.useRecord)()[o],l=(0,u.useForm)().values;return{run:function(){return ri(function(){return rl(this,function(n){switch(n.label){case 0:return[4,r.revision({filterByTk:a,values:l})];case 1:return n.sent(),m.message.success(e("Operation succeeded")),t(),i(!1),[2]}})})()}}}))),ra(o,"cancel",{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}),o))))))),ra(i,"delete",{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}),i))))))))));function rf(e){var t=(0,u.useField)(),n=(0,f.useRecord)(),r=(0,f.usePlugin)(ab);return(0,u.useFormEffects)(function(e){(0,w.onFieldChange)("type",function(e){var o=n.id||!e.value;if(e.value){var i=r.triggers.get(e.value);null!=i.sync?(o=!0,t.setValue(i.sync)):t.setInitialValue(!1)}t.setPattern(o?"disabled":"editable")})}),(0,l.useEffect)(function(){if(n.id){t.setPattern("disabled");var e=r.triggers.get(n.type);null!=e.sync?t.setValue(e.sync):t.setInitialValue(!1)}},[n.id,t,r.triggers]),c().createElement(tx,e)}function rp(e){var t=(0,f.useApp)();e.visible=!!((0,f.usePlugin)("multi-app-share-collection")||"main"!==t.name)}function rd(){var e,t,n=(0,l.useContext)(f.SchemaComponentContext),r=(0,f.usePlugin)(ab).useTriggersOptions;return c().createElement(m.Card,{bordered:!1},c().createElement(f.SchemaComponentContext.Provider,{value:(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},n),t=(t={designable:!1},t),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e)},c().createElement(f.SchemaComponent,{schema:rs,components:{WorkflowLink:rt,ExecutionResourceProvider:re,ExecutionLink:n_,OpenDrawer:rr,ExecutionStatusSelect:nH,SyncOptionSelect:rf,ExecutionStatusColumn:nY,Tooltip:m.Tooltip},scope:{useTriggersOptions:r,useWorkflowSyncAction:rp,useRefreshActionProps:nQ}})))}function rm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ry(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function rb(){var e=ry(["\n flex-direction: column;\n "]);return rb=function(){return e},e}function rv(){var e=ry(["\n position: relative;\n width: 100%;\n "]);return rv=function(){return e},e}var rh={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},rg={type:"object",title:'{{t("Fields values")}}',description:'{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:(0,f.css)(rb())},"x-component":"CollectionFieldset"},rO={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e,t,n=(0,u.useForm)().values;var r=(e=(0,f.parseCollectionName)(null==n?void 0:n.collection),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return rm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rm(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],i=r[1];return{options:(0,f.useCollectionFilterOptions)(i,o),className:(0,f.css)(rv())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},rw={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},rx={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1},default:20}}}}}}},rj={type:"array",title:'{{t("Preload associations", { ns: "'.concat(E,'" })}}'),description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection:function(){var e=(0,u.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function rS(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function rE(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){rS(i,r,o,a,l,"next",e)}function l(e){rS(i,r,o,a,l,"throw",e)}a(void 0)})}}function rk(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function rC(){var e=(0,f.useAPIClient)(),t=(0,u.useForm)(),n=(0,f.useBlockRequestContext)(),r=n.field,o=n.__parent,i=(0,f.useActionContext)().setVisible,a=(0,d.useNavigate)(),l=(0,u.useFieldSchema)(),c=(0,u.useField)(),s=(0,f.useCompile)(),y=m.App.useApp().modal,b=(0,f.useCollectValuesToSubmit)(),v=c.componentProps.filterKeys||[];return{onClick:function(){return rE(function(){var n,u,f,d,h,g,O,w,x,j;return rk(this,function(j){switch(j.label){case 0:if(f=(u=null!==(n=null==l?void 0:l["x-action-settings"])&&void 0!==n?n:{}).onSuccess,d=u.skipValidator,h=u.triggerWorkflows,d)return[3,2];return[4,t.submit()];case 1:j.sent(),j.label=2;case 2:return[4,b()];case 3:g=j.sent(),c.data=r.data||{},c.data.loading=!0,j.label=4;case 4:return j.trys.push([4,6,,7]),[4,e.resource("workflows").trigger({values:g,filterKeys:v,triggerWorkflows:(null==h?void 0:h.length)?h.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:if(x=j.sent(),c.data.loading=!1,c.data.data=x,null==o||null===(w=o.service)||void 0===w||null===(O=w.refresh)||void 0===O||O.call(w),null==i||i(!1),!(null==f?void 0:f.successMessage))return[2];return(null==f?void 0:f.manualClose)?y.success({title:s(null==f?void 0:f.successMessage),onOk:rE(function(){return rk(this,function(e){switch(e.label){case 0:return[4,t.reset()];case 1:return e.sent(),(null==f?void 0:f.redirecting)&&(null==f?void 0:f.redirectTo)&&((0,p.isURL)(f.redirectTo)?window.location.href=f.redirectTo:a(f.redirectTo)),[2]}})})}):m.message.success(s(null==f?void 0:f.successMessage)),[3,7];case 6:return j.sent(),c.data.loading=!1,[3,7];case 7:return[2]}})})()}}}function rP(){var e,t=(0,f.useCompile)(),n=(0,f.useAPIClient)(),r=(0,f.useRecord)(),o=(0,u.useField)(),i=(0,u.useFieldSchema)(),a=(0,f.useBlockRequestContext)(),l=a.field;a.__parent;var c=(0,f.useActionContext)(),s=c.setVisible,y=c.setSubmitted,b=m.App.useApp().modal,v=(0,d.useNavigate)(),h=null!==(e=null==i?void 0:i["x-action-settings"])&&void 0!==e?e:{},g=h.onSuccess,O=h.triggerWorkflows;return{onClick:function(e,i){return rE(function(){return rk(this,function(e){switch(e.label){case 0:o.data=l.data||{},o.data.loading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,n.resource("workflows").trigger({values:r,triggerWorkflows:(null==O?void 0:O.length)?O.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:if(e.sent(),i&&i(),null==s||s(!1),null==y||y(!0),!(null==g?void 0:g.successMessage))return[2];return(null==g?void 0:g.manualClose)?b.success({title:t(null==g?void 0:g.successMessage),onOk:function(){return rE(function(){return rk(this,function(e){return(null==g?void 0:g.redirecting)&&(null==g?void 0:g.redirectTo)&&((0,p.isURL)(g.redirectTo)?window.location.href=g.redirectTo:v(g.redirectTo)),[2]})})()}}):m.message.success(t(null==g?void 0:g.successMessage)),[3,5];case 3:return console.error(e.sent()),[3,5];case 4:return o.data.loading=!1,[7];case 5:return[2]}})})()}}}function rA(){var e=j().workflow;return!!(null==e?void 0:e.executed)}function rD(){var e=j().workflow;return!!(null==e?void 0:e.allExecuted)}function rT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rF(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rN(e){return(rN=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){rF(e,t,n[t])})}return e}function rM(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function rB(e,t){return(rB=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rV(e){return function(e){if(Array.isArray(e))return rT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r_(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r_(e,t){if(e){if("string"==typeof e)return rT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rT(e,t)}}function rW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rW=function(){return!!e})()}var rz=1,rq=2,rL=3,r$=4,rU=[{label:'{{t("After record added", { ns: "'.concat(E,'" })}}'),value:rz},{label:'{{t("After record updated", { ns: "'.concat(E,'" })}}'),value:rq},{label:'{{t("After record added or updated", { ns: "'.concat(E,'" })}}'),value:rL},{label:'{{t("After record deleted", { ns: "'.concat(E,'" })}}'),value:r$}];function rG(e,t){var n,r,o,i=(n=(0,f.parseCollectionName)(e.collection),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||r_(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=i[0],l=i[1],c=(0,f.useCompile)(),u=ty(a),s=[{collectionName:l,name:"data",type:"hasOne",target:l,uiSchema:{title:k("Trigger data")}}];return tm(rM(rR({appends:["data"].concat(rV((null===(o=e.appends)||void 0===o?void 0:o.map(function(e){return"data.".concat(e)}))||[]))},t),{fields:s,compile:c,getCollectionFields:u}))}var rJ=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=rN(n),rF(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,rW()?Reflect.construct(n,r||[],rN(t).constructor):n.apply(t,r)),"title",'{{t("Collection event", { ns: "'.concat(E,'" })}}')),rF(e,"description",'{{t(\'Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".\', { ns: "'.concat(E,'" })}}')),rF(e,"fieldset",{collection:rM(rR({},rh),rF({"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}}},"x-reactions",rV(rh["x-reactions"]).concat([{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]))),mode:{type:"number",title:'{{t("Trigger on", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:'{{t("Trigger on", { ns: "'.concat(E,'" })}}'),className:"auto-width"},enum:rU,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:'{{t("Changed fields", { ns: "'.concat(E,'" })}}'),description:'{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter:function(e){return!e.hidden&&(!e.uiSchema||!e.uiSchema["x-read-pretty"])&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(e.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && ($deps[1] & ".concat(rq,")}}")}}}]},condition:rM(rR({},rO),{title:'{{t("Only triggers when match conditions", { ns: "'.concat(E,'" })}}'),"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && !($deps[1] & ".concat(r$,")}}")}}}]}),appends:rM(rR({},rj),{"x-reactions":rV(rj["x-reactions"]).concat([{dependencies:["mode"],fulfill:{state:{visible:"{{!($deps[0] & ".concat(r$,")}}")}}}])})}),rF(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useWorkflowAnyExecuted:rD}),rF(e,"components",{FieldsSelect:q}),rF(e,"useVariables",rG),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rB(e,t)}(o,e),t=o,n=[{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(E,'" })}}'),Component:M,collection:e.collection,dataPath:"$context.data"}:null}}],rI(t.prototype,n),o}(ng),rH=0,rY=1,rK=v("760"),rQ=v.n(rK);function rZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function r0(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r1(){var e,t,n=(e=["\n display: flex;\n gap: 0.5em;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return r1=function(){return n},n}function r2(e){return!e.hidden&&!!e.uiSchema&&"date"===e.type}function r3(e){var t,n,r=e.value,o=e.onChange,i=null!=r?r:{},a=(0,S.useTranslation)().t;var u=(t=(0,l.useState)(i.offset?i.offset/Math.abs(i.offset):0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return rZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rZ(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],p=u[1];return c().createElement("fieldset",{className:(0,f.css)(r1())},c().createElement(q,{value:i.field,onChange:function(e){return o(r0(rX({},i),{field:e}))},filter:r2,placeholder:a("Select field"),className:"auto-width"}),i.field?c().createElement(m.Select,{value:s,onChange:function(e){p(e),o(r0(rX({},i),{offset:Math.abs(i.offset)*e}))},options:[{value:0,label:k("Exactly at")},{value:-1,label:a("Before")},{value:1,label:a("After")}],className:"auto-width"}):null,s?c().createElement(c().Fragment,null,c().createElement(m.InputNumber,{value:Math.abs(i.offset),onChange:function(e){return o(r0(rX({},i),{offset:(null!=e?e:0)*s}))}}),c().createElement(m.Select,{value:i.unit||864e5,onChange:function(e){return o(r0(rX({},i),{unit:e}))},options:[{value:864e5,label:k("Days")},{value:36e5,label:k("Hours")},{value:6e4,label:k("Minutes")},{value:1e3,label:k("Seconds")}],className:"auto-width"})):null)}function r5(){var e,t,n=(e=["\n display: flex;\n gap: 0.5em;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return r5=function(){return n},n}function r6(e){var t,n,r,o=e.value,i=e.onChange,a=C().t;var l=null!=o?(void 0===o?"undefined":(t=o)&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)!="object"||(n=o,null!=(r=Date)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)?"date":"field":null;return c().createElement("fieldset",{className:(0,f.css)(r5())},c().createElement(m.Select,{value:l,onChange:function(e){i(e?"field"===e?{}:new Date:null)},className:"auto-width"},c().createElement(m.Select.Option,{value:null},a("No end")),c().createElement(m.Select.Option,{value:"field"},a("By field")),c().createElement(m.Select.Option,{value:"date"},a("By custom date"))),"field"===l?c().createElement(r3,{value:o,onChange:i}):null,"date"===l?c().createElement(m.DatePicker,{showTime:!0,value:rQ()(o),onChange:function(e){i(e?e.toDate():null)}}):null)}var r4=v("704"),r8=function(){return(r8=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r7(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function r9(e,t,n){if(n||2==arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var oe=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],ot=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],on={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function or(e,t){for(var n=[],r=e;r<=t;r++)n.push(r);return n}function oo(e){return e.sort(function(e,t){return e-t}),e}function oi(e){var t=[];return e.forEach(function(e){0>t.indexOf(e)&&t.push(e)}),t}function oa(e){return Object.entries(e).filter(function(e){var t=e[0],n=e[1];return t&&n}).map(function(e){return e[0]}).join(" ")}function ol(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||on.errorInvalidCron})}function oc(e){var t=parseInt(e,10),n=Number(e);return t===n?n:NaN}function ou(e,t,n,r,o,i,a,l,c,u,s,f,p,d){n&&n(void 0),t(!1);var m=!1;if(!e){if("always"===r||i&&"for-default-value"===r)return;m=!0}if(!m){if(l&&(!0===l||l.includes(e))){if("@reboot"===e)return void d("reboot");var y=oe.find(function(t){return t.name===e});y&&(e=y.value)}try{var b,v=function(e){if("string"!=typeof e)throw Error("Invalid cron string");var t=e.replace(/\s+/g," ").trim().split(" ");if(5===t.length)return t.map(function(e,t){return function(e,t){if("*"===e||"*/1"===e)return[];var n=oo(oi(om((function(e,t,n){if(n){e=e.toUpperCase();for(var r=0;r<n.length;r++)e=e.replace(n[r],"".concat(r+t))}return e})(e,t.min,t.alt).split(",").map(function(n){var r,o=n.split("/");if(o.length>2)throw Error('Invalid value "'.concat(e,' for "').concat(t.type,'"'));var i=o[0],a=o[1];r="*"===i?or(t.min,t.max):function(e,t,n){var r=e.split("-");if(1===r.length){var o=oc(r[0]);if(isNaN(o))throw Error('Invalid value "'.concat(t,'" for ').concat(n.type));return[o]}if(2===r.length){var i=oc(r[0]),a=oc(r[1]);if(isNaN(i)||isNaN(a))throw Error('Invalid value "'.concat(t,'" for ').concat(n.type));if(a<i)throw Error('Max range is less than min range in "'.concat(e,'" for ').concat(n.type));return or(i,a)}throw Error('Invalid value "'.concat(e,'" for ').concat(n.type))}(i,e,t);var l=function(e,t){if(void 0!==e){var n=oc(e);if(isNaN(n)||n<1)throw Error('Invalid interval step value "'.concat(e,'" for ').concat(t.type));return n}}(a,t);return function(e,t){if(t){var n=e[0];e=e.filter(function(e){return e%t==n%t||e===n})}return e}(r,l)}).flat(),t))),r=oy(n,t);if(void 0!==r)throw Error('Value "'.concat(r,'" out of range for ').concat(t.type));return n.length===t.total?[]:n}(e,ot[t])});throw Error("Invalid cron string format")}(e),h=(b=v)[3].length>0?"year":b[2].length>0?"month":b[4].length>0?"week":b[1].length>0?"day":b[0].length>0?"hour":"minute";d(h),c(v[0]),u(v[1]),s(v[2]),f(v[3]),p(v[4])}catch(e){m=!0}}m&&(o.current=e,t(!0),ol(n,a))}function os(e,t,n,r,o,i,a){var l,c;if("reboot"===e)return"@reboot";return(l=["minute"!==e&&i?i:[],"minute"!==e&&"hour"!==e&&o?o:[],("year"===e||"month"===e)&&n?n:[],"year"===e&&t?t:[],("year"===e||"month"===e||"week"===e)&&r?r:[]],c=a,l.map(function(e,t){var n=ot[t];return of(od(e,n),n,c)})).join(" ")}function of(e,t,n,r,o){var i="";if(a=e,l=t,a.length===l.max-l.min+1||0===e.length)i="*";else{var a,l,c,u,s,f,p,d,m,y,b=function(e){if(e.length>2){var t=e[1]-e[0];if(t>1)return t}}(e);i=b&&function(e,t){for(var n=1;n<e.length;n++){var r=e[n-1];if(e[n]-r!==t)return!1}return!0}(e,b)?(c=e,u=t,s=b,f=function(e){return e[0]}(c),p=ov(c),d=c.length===(p-f)/s+1,f===u.min&&p+s>u.max&&d)?"*/".concat(b):"".concat(op(function(e){return e[0]}(e),t,n,r,o),"-").concat(op(ov(e),t,n,r,o),"/").concat(b):(m=[],y=null,e.forEach(function(e,t,n){e!==n[t+1]-1?null!==y?(m.push([y,e]),y=null):m.push(e):null===y&&(y=e)}),m).map(function(e){return Array.isArray(e)?"".concat(op(e[0],t,n,r,o),"-").concat(op(e[1],t,n,r,o)):op(e,t,n,r,o)}).join(",")}return i}function op(e,t,n,r,o){var i=e.toString(),a=t.type,l=t.alt,c=t.min,u=r&&(!0===r||r.includes(a)),s="24-hour-clock"===o&&("hours"===a||"minutes"===a);if(n&&"week-days"===a||n&&"months"===a?i=l[e-c]:e<10&&(u||s)&&(i=i.padStart(2,"0")),"hours"===a&&"12-hour-clock"===o){var f=e>=12?"PM":"AM",p=e%12||12;p<10&&u&&(p=p.toString().padStart(2,"0")),i="".concat(p).concat(f)}return i}function od(e,t){var n=oo(oi(om(e,t)));if(0===n.length)return n;var r=oy(n,t);if(void 0!==r)throw Error('Value "'.concat(r,'" out of range for ').concat(t.type));return n}function om(e,t){return"week-days"===t.type&&(e=e.map(function(e){return 7===e?0:e})),e}function oy(e,t){var n=e[0],r=e[e.length-1];return n<t.min?n:r>t.max?r:void 0}function ob(e){return e[0]}function ov(e){return e[e.length-1]}function oh(e){var t=e.value,n=e.grid,r=void 0===n||n,o=e.optionsList,i=e.setValue,a=e.locale,c=e.className,u=e.humanizeLabels,s=e.disabled,f=e.readOnly,p=e.leadingZero,d=e.clockFormat,y=e.period,b=e.unit,v=e.periodicityOnDoubleClick,h=e.mode,g=r7(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),O=(0,l.useMemo)(function(){if(t&&Array.isArray(t))return t.map(function(e){return e.toString()})},[t]),w=(0,l.useMemo)(function(){return o?o.map(function(e,t){return{value:(0===b.min?t:t+1).toString(),label:e}}):r9([],Array(b.total),!0).map(function(e,t){var n=0===b.min?t:t+1;return{value:n.toString(),label:op(n,b,u,p,d)}})},[o,p,u,d]),x=JSON.stringify(a),j=(0,l.useCallback)(function(e){var n=e.value;if(!t||t[0]!==Number(n))return(0,r4.jsx)(r4.Fragment,{});var r=of(od(t,b),b,u,p,d),o=r.match(/^\*\/([0-9]+),?/)||[];return(0,r4.jsx)("div",{children:o[1]?"".concat(a.everyText||on.everyText," ").concat(o[1]):r})},[t,x,u,p,d]),S=(0,l.useCallback)(function(e){var n=Array.isArray(e)?oo(e):[e],r=n;t&&(r="single"===h?[]:r9([],t,!0),n.forEach(function(e){var n=Number(e);r=t.some(function(e){return e===n})?r.filter(function(e){return e!==n}):oo(r9(r9([],r,!0),[n],!1))})),r.length===b.total?i([]):i(r)},[i,t]),E=(0,l.useCallback)(function(e){if(0!==e&&1!==e){for(var n=b.total+b.min,r=[],o=b.min;o<n;o++)o%e==0&&r.push(o);var a=t&&r&&t.length===r.length&&t.every(function(e,t){return e===r[t]});i(r.length===w.length||a?[]:r)}else i([])},[t,w,i]),k=(0,l.useRef)([]),C=(0,l.useCallback)(function(e){if(!f){var t=k.current;t.push({time:(new Date).getTime(),value:Number(e)});var n=window.setTimeout(function(){v&&t.length>1&&t[t.length-1].time-t[t.length-2].time<300?t[t.length-1].value===t[t.length-2].value?E(Number(e)):S([t[t.length-2].value,t[t.length-1].value]):S(Number(e)),k.current=[]},300);return function(){window.clearTimeout(n)}}},[k,S,E,f,v]),P=(0,l.useCallback)(function(){f||i([])},[i,f]),A=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,e))},[c]),D=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(b.type)]=!0,e["react-js-cron-custom-select-dropdown"]=!0,e["react-js-cron-custom-select-dropdown-".concat(b.type)]=!0,e["react-js-cron-custom-select-dropdown-minutes-large"]="minutes"===b.type&&"hour"!==y&&"day"!==y,e["react-js-cron-custom-select-dropdown-minutes-medium"]="minutes"===b.type&&("day"===y||"hour"===y),e["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]="hours"===b.type&&"12-hour-clock"===d,e["react-js-cron-custom-select-dropdown-grid"]=!!r,e["".concat(c,"-select-dropdown")]=!!c,e["".concat(c,"-select-dropdown-").concat(b.type)]=!!c,e))},[c,r,d,y]);return(0,r4.jsx)(m.Select,r8({mode:"single"!==h||v?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:O,onClear:P,tagRender:j,className:A,popupClassName:D,options:w,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:C,onDeselect:C,disabled:s,dropdownAlign:"minutes"!==b.type&&"hours"!==b.type||"day"===y||"hour"===y?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(b.type)},g))}function og(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.disabled,a=e.readOnly,c=e.leadingZero,u=e.clockFormat,s=e.period,f=e.periodicityOnDoubleClick,p=e.mode,d=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-hours")]=!!o,e))},[o]);return(0,r4.jsxs)("div",r8({className:d},{children:[""!==r.prefixHours&&(0,r4.jsx)("span",{children:r.prefixHours||on.prefixHours}),(0,r4.jsx)(oh,{placeholder:r.emptyHours||on.emptyHours,value:t,unit:ot[1],setValue:n,locale:r,className:o,disabled:i,readOnly:a,leadingZero:c,clockFormat:u,period:s,periodicityOnDoubleClick:f,mode:p})]}))}function oO(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.disabled,a=e.readOnly,c=e.leadingZero,u=e.clockFormat,s=e.period,f=e.periodicityOnDoubleClick,p=e.mode,d=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-minutes")]=!!o,e))},[o]);return(0,r4.jsxs)("div",r8({className:d},{children:["hour"===s?""!==r.prefixMinutesForHourPeriod&&(0,r4.jsx)("span",{children:r.prefixMinutesForHourPeriod||on.prefixMinutesForHourPeriod}):""!==r.prefixMinutes&&(0,r4.jsx)("span",{children:r.prefixMinutes||on.prefixMinutes}),(0,r4.jsx)(oh,{placeholder:"hour"===s?r.emptyMinutesForHourPeriod||on.emptyMinutesForHourPeriod:r.emptyMinutes||on.emptyMinutes,value:t,unit:ot[0],setValue:n,locale:r,className:o,disabled:i,readOnly:a,leadingZero:c,clockFormat:u,period:s,periodicityOnDoubleClick:f,mode:p}),"hour"===s&&""!==r.suffixMinutesForHourPeriod&&(0,r4.jsx)("span",{children:r.suffixMinutesForHourPeriod||on.suffixMinutesForHourPeriod})]}))}function ow(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.weekDays,a=e.disabled,c=e.readOnly,u=e.leadingZero,s=e.period,f=e.periodicityOnDoubleClick,p=e.mode,d=!i||0===i.length,m=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!d})["".concat(o,"-field")]=!!o,e["".concat(o,"-month-days")]=!!o,e))},[o,d]),y=JSON.stringify(r),b=(0,l.useMemo)(function(){return d?r.emptyMonthDays||on.emptyMonthDays:r.emptyMonthDaysShort||on.emptyMonthDaysShort},[d,y]);return c&&(!t||!(t.length>0))&&(t&&0!==t.length||i&&0!==i.length)?null:(0,r4.jsxs)("div",r8({className:m},{children:[""!==r.prefixMonthDays&&(0,r4.jsx)("span",{children:r.prefixMonthDays||on.prefixMonthDays}),(0,r4.jsx)(oh,{placeholder:b,value:t,setValue:n,unit:ot[2],locale:r,className:o,disabled:a,readOnly:c,leadingZero:u,period:s,periodicityOnDoubleClick:f,mode:p})]}))}function ox(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.humanizeLabels,a=e.disabled,c=e.readOnly,u=e.period,s=e.periodicityOnDoubleClick,f=e.mode,p=r.months||on.months,d=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-months")]=!!o,e))},[o]);return(0,r4.jsxs)("div",r8({className:d},{children:[""!==r.prefixMonths&&(0,r4.jsx)("span",{children:r.prefixMonths||on.prefixMonths}),(0,r4.jsx)(oh,{placeholder:r.emptyMonths||on.emptyMonths,optionsList:p,grid:!1,value:t,unit:r8(r8({},ot[3]),{alt:r.altMonths||on.altMonths}),setValue:n,locale:r,className:o,humanizeLabels:i,disabled:a,readOnly:c,period:u,periodicityOnDoubleClick:s,mode:f})]}))}function oj(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.disabled,a=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,s=[];u.includes("year")&&s.push({value:"year",label:r.yearOption||on.yearOption}),u.includes("month")&&s.push({value:"month",label:r.monthOption||on.monthOption}),u.includes("week")&&s.push({value:"week",label:r.weekOption||on.weekOption}),u.includes("day")&&s.push({value:"day",label:r.dayOption||on.dayOption}),u.includes("hour")&&s.push({value:"hour",label:r.hourOption||on.hourOption}),u.includes("minute")&&s.push({value:"minute",label:r.minuteOption||on.minuteOption}),u.includes("reboot")&&c&&(!0===c||c.includes("@reboot"))&&s.push({value:"reboot",label:r.rebootOption||on.rebootOption});var f=(0,l.useCallback)(function(e){a||n(e)},[n,a]),p=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-period")]=!!o,e))},[o]),d=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":""===r.prefixPeriod})["".concat(o,"-select")]=!!o,e))},[o,r.prefixPeriod]),y=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(o,"-select-dropdown")]=!!o,e["".concat(o,"-select-dropdown-period")]=!!o,e))},[o]);return(0,r4.jsxs)("div",r8({className:p},{children:[""!==r.prefixPeriod&&(0,r4.jsx)("span",{children:r.prefixPeriod||on.prefixPeriod}),(0,r4.jsx)(m.Select,{defaultValue:t,value:t,onChange:f,options:s,className:d,popupClassName:y,disabled:i,showArrow:!a,open:!a&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function oS(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,i=e.humanizeLabels,a=e.monthDays,c=e.disabled,u=e.readOnly,s=e.period,f=e.periodicityOnDoubleClick,p=e.mode,d=r.weekDays||on.weekDays,m="week"===s||!a||0===a.length,y=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!m})["".concat(o,"-field")]=!!o,e["".concat(o,"-week-days")]=!!o,e))},[o,m]),b=JSON.stringify(r),v=(0,l.useMemo)(function(){return m?r.emptyWeekDays||on.emptyWeekDays:r.emptyWeekDaysShort||on.emptyWeekDaysShort},[m,b]),h="week"===s||!u||t&&t.length>0||(!t||0===t.length)&&(!a||0===a.length),g=!u||a&&a.length>0||(!a||0===a.length)&&(!t||0===t.length);return h?(0,r4.jsxs)("div",r8({className:y},{children:[""!==r.prefixWeekDays&&("week"===s||!g)&&(0,r4.jsx)("span",{children:r.prefixWeekDays||on.prefixWeekDays}),""!==r.prefixWeekDaysForMonthAndYearPeriod&&"week"!==s&&g&&(0,r4.jsx)("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||on.prefixWeekDaysForMonthAndYearPeriod}),(0,r4.jsx)(oh,{placeholder:v,optionsList:d,grid:!1,value:t,unit:r8(r8({},ot[4]),{alt:r.altWeekDays||on.altWeekDays}),setValue:n,locale:r,className:o,humanizeLabels:i,disabled:c,readOnly:u,period:s,periodicityOnDoubleClick:f,mode:p})]})):null}function oE(e){var t,n,r=e.clearButton,o=void 0===r||r,i=e.clearButtonProps,a=void 0===i?{}:i,c=e.clearButtonAction,u=void 0===c?"fill-with-every":c,s=e.locale,f=void 0===s?on:s,p=e.value,d=void 0===p?"":p,y=e.setValue,b=e.displayError,v=void 0===b||b,h=e.onError,g=e.className,O=e.defaultPeriod,w=e.allowEmpty,x=void 0===w?"for-default-value":w,j=e.humanizeLabels,S=void 0===j||j,E=e.humanizeValue,k=void 0!==E&&E,C=e.disabled,P=void 0!==C&&C,A=e.readOnly,D=void 0!==A&&A,T=e.leadingZero,I=void 0!==T&&T,F=e.shortcuts,N=void 0===F?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:F,R=e.clockFormat,M=e.periodicityOnDoubleClick,B=void 0===M||M,V=e.mode,_=void 0===V?"multiple":V,W=e.allowedDropdowns,z=void 0===W?["period","months","month-days","week-days","hours","minutes"]:W,q=e.allowedPeriods,L=(0,l.useRef)(d),$=(0,l.useRef)(void 0===O?"day":O),U=(0,l.useState)(),G=U[0],J=U[1],H=(0,l.useState)(),Y=H[0],K=H[1],Q=(0,l.useState)(),Z=Q[0],X=Q[1],ee=(0,l.useState)(),et=ee[0],en=ee[1],er=(0,l.useState)(),eo=er[0],ei=er[1],ea=(0,l.useState)(),el=ea[0],ec=ea[1],eu=(0,l.useState)(!1),es=eu[0],ef=eu[1],ep=(0,l.useState)(!1),ed=ep[0],em=ep[1],ey=(t=ed,n=(0,l.useRef)(t),(0,l.useEffect)(function(){n.current=t},[t]),n.current),eb=JSON.stringify(f);(0,l.useEffect)(function(){ou(d,ef,h,x,L,!0,f,N,ec,ei,K,X,en,J)},[]),(0,l.useEffect)(function(){d!==L.current&&ou(d,ef,h,x,L,!1,f,N,ec,ei,K,X,en,J)},[d,L,eb,x,N]),(0,l.useEffect)(function(){if(!(G||el||Z||Y||et||eo)||ed||ey)ed&&em(!1);else{var e=G||$.current,t=os(e,Z,Y,et,eo,el,k);y(t,{selectedPeriod:e}),L.current=t,h&&h(void 0),ef(!1)}},[G,Y,Z,et,eo,el,k,ed]);var ev=(0,l.useCallback)(function(){K(void 0),X(void 0),en(void 0),ei(void 0),ec(void 0);var e="",t="reboot"!==G&&G?G:$.current;t!==G&&J(t),"fill-with-every"===u&&(e=os(t,void 0,void 0,void 0,void 0,void 0)),y(e,{selectedPeriod:t}),L.current=e,em(!0),"never"===x&&"empty"===u?(ef(!0),ol(h,f)):(h&&h(void 0),ef(!1))},[G,y,h,u]),eh=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron":!0,"react-js-cron-error":es&&v,"react-js-cron-disabled":P,"react-js-cron-read-only":D})["".concat(g)]=!!g,e["".concat(g,"-error")]=es&&v&&!!g,e["".concat(g,"-disabled")]=P&&!!g,e["".concat(g,"-read-only")]=D&&!!g,e))},[g,es,v,P,D]),eg=a.className,eO=r7(a,["className"]),ew=(0,l.useMemo)(function(){var e;return oa(((e={"react-js-cron-clear-button":!0})["".concat(g,"-clear-button")]=!!g,e["".concat(eg)]=!!eg,e))},[g,eg]),ex=JSON.stringify(eO),ej=(0,l.useMemo)(function(){return o&&!D?(0,r4.jsx)(m.Button,r8({className:ew,danger:!0,type:"primary",disabled:P},eO,{onClick:ev},{children:f.clearButtonText||on.clearButtonText})):null},[o,D,eb,ew,P,ex,ev]),eS=G||$.current;return(0,r4.jsxs)("div",r8({className:eh},{children:[z.includes("period")&&(0,r4.jsx)(oj,{value:eS,setValue:J,locale:f,className:g,disabled:P,readOnly:D,shortcuts:N,allowedPeriods:void 0===q?["year","month","week","day","hour","minute","reboot"]:q}),"reboot"===eS?ej:(0,r4.jsxs)(r4.Fragment,{children:["year"===eS&&z.includes("months")&&(0,r4.jsx)(ox,{value:Z,setValue:X,locale:f,className:g,humanizeLabels:S,disabled:P,readOnly:D,period:eS,periodicityOnDoubleClick:B,mode:_}),("year"===eS||"month"===eS)&&z.includes("month-days")&&(0,r4.jsx)(ow,{value:Y,setValue:K,locale:f,className:g,weekDays:et,disabled:P,readOnly:D,leadingZero:I,period:eS,periodicityOnDoubleClick:B,mode:_}),("year"===eS||"month"===eS||"week"===eS)&&z.includes("week-days")&&(0,r4.jsx)(oS,{value:et,setValue:en,locale:f,className:g,humanizeLabels:S,monthDays:Y,disabled:P,readOnly:D,period:eS,periodicityOnDoubleClick:B,mode:_}),(0,r4.jsxs)("div",{children:["minute"!==eS&&"hour"!==eS&&z.includes("hours")&&(0,r4.jsx)(og,{value:eo,setValue:ei,locale:f,className:g,disabled:P,readOnly:D,leadingZero:I,clockFormat:R,period:eS,periodicityOnDoubleClick:B,mode:_}),"minute"!==eS&&z.includes("minutes")&&(0,r4.jsx)(oO,{value:el,setValue:ec,locale:f,period:eS,className:g,disabled:P,readOnly:D,leadingZero:I,clockFormat:R,periodicityOnDoubleClick:B,mode:_}),ej]})]})]}))}Object.freeze({__proto__:null,setValuesFromCronString:ou,getCronStringFromValues:os,partToString:of,formatValue:op,parsePartArray:od});function ok(){var e,t,n=(e=["\n display: flex;\n flex-direction: ",";\n align-items: flex-start;\n gap: 0.5em;\n\n .react-js-cron {\n width: 100%;\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n\n .react-js-cron-field {\n margin-bottom: 0.5em;\n\n > span {\n margin: 0 0.5em 0 0;\n }\n\n > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n }\n\n .react-js-cron-week-days {\n > span {\n min-width: 2em;\n }\n }\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return ok=function(){return n},n}var oC=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function oP(e){return oC.filter(function(e){return"number"==typeof e.value}).reverse().find(function(t){return!(e%t.value)})}function oA(e){var t=e.value,n=e.onChange,r=C().t,o=oP(t);return c().createElement(m.InputNumber,{value:t/o.value,onChange:function(e){return n(e*o.value)},min:1,addonBefore:r("Every"),addonAfter:r(o.unitText),className:"auto-width"})}function oD(e){var t=e.value,n=void 0===t?null:t,r=e.onChange,o=C().t,i=function(e){var t,n;switch(void 0===e?"undefined":(n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n){case"number":return(t=oP(e))?t.value:"none";case"string":return"cron"}return"none"}(n),a=(0,l.useCallback)(function(e){if("none"===e){r(null);return}if("cron"===e){r("0 * * * * *");return}r(e)},[r]);return c().createElement("fieldset",{className:(0,f.css)(ok(),"cron"===i?"column":"row")},c().createElement(m.Select,{value:i,onChange:a,className:"auto-width"},oC.map(function(e){return c().createElement(m.Select.Option,{key:e.value,value:e.value},o(e.text))})),"number"==typeof i?c().createElement(oA,{value:n,onChange:r}):null,"cron"===i?c().createElement(oE,{value:n.trim().split(/\s+/).slice(1).join(" "),setValue:function(e){return r("0 ".concat(e))},clearButton:!1,locale:window.cronLocale}):null)}function oT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function oI(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){oI(e,t,n[t])})}return e}function oN(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function oR(e,t){if(e){if("string"==typeof e)return oT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oT(e,t)}}function oM(){var e,t,n=(e=["\n .ant-input-number {\n width: auto;\n min-width: 6em;\n }\n\n .ant-picker {\n width: auto;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return oM=function(){return n},n}var oB=(oI(a={},rH,{startsOn:{type:"datetime",title:'{{t("Starts on", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:'{{t("Ends on", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(E,'" })}}'),min:0}}}),oI(a,rY,{collection:oN(oF({},rh),{"x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}},"x-reactions":((function(e){if(Array.isArray(e))return oT(e)})(r=rh["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||oR(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}])}),startsOn:{type:"object",title:'{{t("Starts on", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:'{{t("Ends on", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(E,'" })}}'),min:0}},appends:oN(oF({},rj),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:"{{$deps[0] === ".concat(rY," && $deps[1]}}")}}}]})}),a),oV=[{value:rH,label:'{{t("Based on certain date", { ns: "'.concat(E,'" })}}')},{value:rY,label:'{{t("Based on date field of collection", { ns: "'.concat(E,'" })}}')}],o_=function(){var e,t,n=(0,u.useForm)(),r=n.values,o=n.clearFormGraph;var i=(e=(0,l.useState)((void 0===r?{}:r).mode),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||oR(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=i[0],s=i[1];return(0,u.useFormEffects)(function(){(0,w.onFieldValueChange)("mode",function(e){s(e.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),c().createElement(c().Fragment,null,c().createElement(f.SchemaComponent,{schema:{type:"number",title:'{{t("Trigger mode", { ns: "'.concat(E,'" })}}'),name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:oV},required:!0,default:rH}}),c().createElement(f.SchemaComponent,{schema:{type:"void",properties:oI({},"mode-".concat(a),{type:"void","x-component":"fieldset","x-component-props":{className:(0,f.css)(oM())},properties:oB[a]})},components:{OnField:r3,RepeatField:oD,EndsByField:r6}}))};function oW(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function oz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oL(e){return(oL=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o$(e,t){return(o$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function oU(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||oG(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oG(e,t){if(e){if("string"==typeof e)return oW(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oW(e,t)}}function oJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(oJ=function(){return!!e})()}function oH(e,t){var n=oU((0,f.parseCollectionName)(e.collection),2),r=n[0];n[1];var o=(0,f.useCompile)(),i=ty(r),a=[];if((!(null==t?void 0:t.types)||t.types.includes("date"))&&a.push({key:"date",value:"date",label:k("Trigger time")}),e.mode===rY){var l,c,u,s,p=oU(tm((c=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){oq(e,t,n[t])})}return e}({appends:["data"].concat(function(e){if(Array.isArray(e))return oW(e)}(l=(null===(s=e.appends)||void 0===s?void 0:s.map(function(e){return"data.".concat(e)}))||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||oG(l)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())},t),u=(u={fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:k("Trigger data")}}],compile:o,getCollectionFields:i},u),Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(u)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(u)).forEach(function(e){Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(u,e))}),c)),1)[0];p&&a.push(p)}return a}var oY=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=oL(n),oq(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,oJ()?Reflect.construct(n,r||[],oL(t).constructor):n.apply(t,r)),"sync",!1),oq(e,"title",'{{t("Schedule event", { ns: "'.concat(E,'" })}}')),oq(e,"description",'{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "'.concat(E,'" })}}')),oq(e,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}}),oq(e,"scope",{useCollectionDataSource:f.useCollectionDataSource}),oq(e,"components",{ScheduleConfig:o_}),oq(e,"useVariables",oH),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o$(e,t)}(o,e),t=o,n=[{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",title:'{{t("Trigger data", { ns: "'.concat(E,'" })}}'),Component:M,collection:e.collection,dataPath:"$context.data"}:null}}],oz(t.prototype,n),o}(ng);function oK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oZ(e){return(oZ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oX(e,t){return(oX=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o0(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o0=function(){return!!e})()}var o1=function(e){var t,n,r;function o(){var e,t,n,r,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),n=this,r=o,i=arguments,r=oZ(r),oQ(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,o0()?Reflect.construct(r,i||[],oZ(n).constructor):r.apply(n,i)),"title",'{{t("Calculation", { ns: "'.concat(E,'" })}}')),oQ(e,"type","calculation"),oQ(e,"group","calculation"),oQ(e,"description",'{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "'.concat(E,'" })}}')),oQ(e,"fieldset",{engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:(0,tA.getOptions)()},required:!0,default:"formula.js"},expression:(oQ(t={type:"string",title:'{{t("Calculation expression", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0}},"x-validator",function(e,t,n){var r=n.form.values,o=tA.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return k("Expression syntax error")}}),oQ(t,"x-reactions",[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}]),oQ(t,"required",!0),t)}),oQ(e,"scope",{renderEngineReference:tT}),oQ(e,"components",{WorkflowVariableTextArea:tv,RadioWithTooltip:tx,ValueBlock:tP}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oX(e,t)}(o,e),t=o,n=[{key:"useVariables",value:function(e,t){var n=e.key,r=e.title,o=t.types;return(t.fieldNames,o&&!o.some(function(e){return e in ta||Object.values(ta).some(function(t){return t.has(e)})}))?null:{value:n,label:r}}},{key:"useInitializers",value:function(e){var t,n;return{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:tP.Initializer,node:e,resultTitle:k("Calculation result")}}}],oK(t.prototype,n),o}(eq);function o2(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o3(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o5(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o6(e){return(o6=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o4(e,t){return(o4=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o8(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||o7(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o7(e,t){if(e){if("string"==typeof e)return o2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o2(e,t)}}function o9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o9=function(){return!!e})()}var ie={ON_TRUE:1,ON_FALSE:0},it=function(e){var t,n,r;function o(){var e,t,n,r,i,a;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),n=this,r=o,i=arguments,r=o6(r),o5(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,o9()?Reflect.construct(r,i||[],o6(n).constructor):r.apply(n,i)),"title",'{{t("Condition", { ns: "'.concat(E,'" })}}')),o5(e,"type","condition"),o5(e,"group","control"),o5(e,"description",'{{t(\'Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".\', { ns: "'.concat(E,'" })}}')),o5(e,"fieldset",{rejectOnFalse:{type:"boolean",title:'{{t("Mode", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(E,'" })}}')},{value:!1,label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(E,'" })}}')}]},engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:'{{t("Basic", { ns: "'.concat(E,'" })}}')}]].concat(function(e){if(Array.isArray(e))return o2(e)}(a=Array.from(tA.evaluators.getEntities()).filter(function(e){return["math.js","formula.js"].includes(o8(e,1)[0])}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||o7(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).reduce(function(e,t){var n=o8(t,2),r=n[0],o=n[1];return e.concat(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){o5(e,t,n[t])})}return e}({value:r},o))},[])},required:!0,default:"basic"},calculation:{type:"object",title:'{{t("Condition", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:(o5(t={type:"string",title:'{{t("Condition expression", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0}},"x-validator",function(e,t,n){var r=n.form.values,o=tA.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return k("Expression syntax error")}}),o5(t,"x-reactions",{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}}),o5(t,"required",!0),t)}),o5(e,"presetFieldset",{rejectOnFalse:{type:"boolean",title:'{{t("Mode", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(E,'" })}}'),value:!0},{label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(E,'" })}}'),value:!1}],default:!0}}),o5(e,"branching",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.rejectOnFalse;return!(void 0===t||t)&&[{label:"{{t('After end of branches', { ns: \"".concat(E,'" })}}'),value:!1},{label:'{{t(\'Inside of "Yes" branch\', { ns: "'.concat(E,'" })}}'),value:ie.ON_TRUE},{label:'{{t(\'Inside of "No" branch\', { ns: "'.concat(E,'" })}}'),value:ie.ON_FALSE}]}),o5(e,"scope",{renderEngineReference:tT,useWorkflowVariableOptions:tf}),o5(e,"components",{CalculationConfig:tQ,WorkflowVariableTextArea:tv,RadioWithTooltip:tx}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o4(e,t)}(o,e),t=o,n=[{key:"Component",value:function(e){var t=e.data,n=(0,S.useTranslation)().t,r=j().nodes,o=eP().styles,i=t.id,a=t.config.rejectOnFalse,l=r.find(function(e){return e.upstreamId===i&&1===e.branchIndex}),u=r.find(function(e){return e.upstreamId===i&&0===e.branchIndex});return c().createElement(e5,{data:t},a?null:c().createElement("div",{className:o.nodeSubtreeClass},c().createElement("div",{className:o.branchBlockClass},c().createElement(na,{from:t,entry:u,branchIndex:0}),c().createElement(na,{from:t,entry:l,branchIndex:1})),c().createElement("div",{className:o.conditionClass},c().createElement("span",{style:{right:"4em"}},n("No")),c().createElement("span",{style:{left:"4em"}},n("Yes")))))}}],o3(t.prototype,n),o}(eq);function ir(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function io(e){return(io=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ii(e,t){return(ii=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ia(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ia=function(){return!!e})()}var il=function(e){function t(){var e,n,r,o;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,r=t,o=arguments,r=io(r),ir(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,ia()?Reflect.construct(r,o||[],io(n).constructor):r.apply(n,o)),"title",'{{t("End process", { ns: "'.concat(E,'" })}}')),ir(e,"type","end"),ir(e,"group","control"),ir(e,"description",'{{t("End the process immediately, with set status.", { ns: "'.concat(E,'" })}}')),ir(e,"fieldset",{endStatus:{type:"number",title:'{{t("End status", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Succeeded", { ns: "'.concat(E,'" })}}'),value:eo.RESOLVED},{label:'{{t("Failed", { ns: "'.concat(E,'" })}}'),value:eo.FAILED}],required:!0,default:eo.RESOLVED}}),ir(e,"end",!0),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ii(e,t)}(t,e),t}(eq);function ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function is(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ip(e){return(ip=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function id(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){is(e,t,n[t])})}return e}function im(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function iy(e,t){return(iy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ib(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||ih(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iv(e){return function(e){if(Array.isArray(e))return ic(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ih(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ih(e,t){if(e){if("string"==typeof e)return ic(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ic(e,t)}}function ig(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ig=function(){return!!e})()}function iO(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=ib((0,f.parseCollectionName)(a.collection),2),c=l[0],u=l[1],s=(0,f.useCompile)(),p=ty(c);return ib(tm(im(id({appends:[o].concat(iv((null===(r=a.params)||void 0===r?void 0:null===(n=r.appends)||void 0===n?void 0:n.map(function(e){return"".concat(o,".").concat(e)}))||[]))},t),{fields:[{collectionName:u,name:o,type:"hasOne",target:u,uiSchema:{title:i}}],compile:s,getCollectionFields:p})),1)[0]}var iw=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=ip(n),is(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,ig()?Reflect.construct(n,r||[],ip(t).constructor):n.apply(t,r)),"title",'{{t("Query record", { ns: "'.concat(E,'" })}}')),is(e,"type","query"),is(e,"group","collection"),is(e,"description",'{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "'.concat(E,'" })}}')),is(e,"fieldset",{collection:im(id({},rh),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":iv(rh["x-reactions"]).concat([{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}])}),multiple:{type:"boolean",title:'{{t("Result type", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:'{{t("Single record", { ns: "'.concat(E,'" })}}'),value:!1,tooltip:'{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "'.concat(E,'" })}}')},{label:'{{t("Multiple records", { ns: "'.concat(E,'" })}}'),value:!0,tooltip:'{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "'.concat(E,'" })}}')}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:rO,sort:rw,pagination:rx,appends:rj},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Exit when query result is null", { ns: "'.concat(E,'" })}}')}}),is(e,"scope",{useNodeSavedConfig:eG,useCollectionDataSource:f.useCollectionDataSource,useSortableFields:function(){var e=(0,f.useCompile)(),t=(0,u.useForm)().values,n=ib((0,f.parseCollectionName)(t.collection),2),r=n[0],o=n[1],i=(0,f.useApp)();return i.dataSourceManager.getDataSource(r).collectionManager.getCollectionFields(o).filter(function(e){if(!e.interface)return!1;var t=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface);return(null==t?!!void 0:!!t.sortable)||!1}).map(function(t){var n,r;return{value:t.name,label:(null==t?void 0:null===(n=t.uiSchema)||void 0===n?void 0:n.title)?e(null==t?void 0:null===(r=t.uiSchema)||void 0===r?void 0:r.title):t.name}})}}),is(e,"components",{ArrayItems:tZ.ArrayItems,FilterDynamicComponent:tO,SchemaComponentContext:f.SchemaComponentContext,WorkflowVariableInput:tb,RadioWithTooltip:tx}),is(e,"useVariables",iO),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&iy(e,t)}(o,e),t=o,n=[{key:"useInitializers",value:function(e){var t,n;return!e.config.collection||e.config.multiple?null:{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:M,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}}}],iu(t.prototype,n),o}(eq);function ix(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ij(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ij(e,t,n[t])})}return e}function iE(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ik(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ix(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ix(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iC(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function iP(e){var t=function(e,t){if("object"!==iA(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==iA(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===iA(t)?t:String(t)}function iA(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function iD(){var e=iC(["\n margin-top: 0.5em;\n\n > .ant-formily-item {\n flex-direction: column;\n\n > .ant-formily-item-label {\n line-height: 32px;\n }\n }\n "]);return iD=function(){return e},e}function iT(){var e=iC(["\n .ant-form-item-control-input-content {\n display: flex;\n }\n "]);return iT=function(){return e},e}function iI(e){var t=(0,f.useCollectionManager_deprecated)().getCollectionFields,n=(0,u.useField)().path,r=n.segments[n.segments.length-1],o=(0,u.useForm)().values,i=ik((0,f.parseCollectionName)(null==o?void 0:o.collection),2),a=i[0],s=t(i[1],a).find(function(e){return e.name===r}).type,p=Array.isArray(e.value)?e.value.join(","):e.value,d=(0,l.useCallback)(function(t){var n=t.target.value.trim(),r=["belongsTo","hasOne"].includes(s)?n||null:n.split(",").map(function(e){return e.trim()}).filter(function(e){return""!==e});e.onChange(r)},[e.onChange,s]);return c().createElement(m.Input,iE(iS({},e),{value:p,onChange:d}))}var iF=(0,u.observer)(function(e){var t=e.value,n=e.disabled,r=e.onChange,o=e.filter,i=(0,f.useToken)().token,a=(0,S.useTranslation)().t,s=(0,f.useCompile)(),p=(0,u.useForm)(),d=(0,f.useCollectionManager_deprecated)().getCollectionFields,y=tf(),b=p.values,v=ik((0,f.parseCollectionName)(null==b?void 0:b.collection),2),h=v[0],g=v[1],w=d(g,h).filter(function(e){return e.uiSchema}),x=o?w.filter(o.bind(b)):w,j=(0,l.useMemo)(function(){return x.filter(function(e){return!t||!(e.name in t)})},[x,t]),E=n||p.disabled,C=(0,l.useMemo)(function(){return{onClick:function(e){var n=e.key;r(iE(iS({},t),ij({},n,null)))},style:{maxHeight:300,overflowY:"auto"},items:j.map(function(e){var t,n;return{key:e.name,label:s(null!==(n=null===(t=e.uiSchema)||void 0===t?void 0:t.title)&&void 0!==n?n:e.name)}})}},[r,j,t]);return c().createElement("fieldset",{className:(0,f.css)(iD())},x.length?c().createElement(f.CollectionProvider_deprecated,{name:g,dataSource:h},x.filter(function(e){return t&&e.name in t}).map(function(e){var n,o,i=["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)?iI:f.CollectionField;return c().createElement(m.Form.Item,{key:e.name,label:s(null!==(o=null===(n=e.uiSchema)||void 0===n?void 0:n.title)&&void 0!==o?o:e.name),labelAlign:"left",className:(0,f.css)(iT())},c().createElement(f.Variable.Input,{scope:y,value:t[e.name],changeOnSelect:!0,onChange:function(n){r(iE(iS({},t),ij({},e.name,n)))}},c().createElement(f.SchemaComponent,{schema:{type:"void",properties:ij({},e.name,ij({"x-component":i},"x-validator",function(){return""}))}})),E?null:c().createElement(m.Button,ij({"aria-label":"icon-close",type:"link",icon:c().createElement(O.CloseCircleOutlined,null)},"onClick",function(){var n=e.name;r((t[n],function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(t,[n].map(iP))))})))}),j.length?c().createElement(m.Dropdown,{menu:C},c().createElement(m.Button,{icon:c().createElement(O.PlusOutlined,null)},a("Add field"))):null):c().createElement("p",{style:{color:i.colorText}},k("Please select collection first")))},{displayName:"CollectionFieldSet"});function iN(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iR(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function iM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return iN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iN(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iB(){return{name:(0,s.uid)(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function iV(e){var t=j().workflow,n=(0,f.useActionContext)().setFormValueChanged;(0,f.useAPIClient)();var r=tf(),o=(0,u.useForm)(),i=o.values,a=o.setValuesIn,s=o.disabled,p=(0,L.toJS)(i.params),d=iM((0,f.parseCollectionName)(i.collection),2),y=d[0],b=d[1],v=(0,f.useSchemaOptionsContext)(),h=iM((0,l.useState)(e.value&&Object.keys(e.value).length?e.value:iB()),2),g=h[0],O=h[1],x=(0,l.useMemo)(function(){return(0,w.createForm)({initialValues:p.values,disabled:t.executed,effects:function(){(0,w.onFormValuesChange)(function(e){a("params.values",(0,L.toJS)(e.values)),n(!0)})}})},[t.executed]);(0,u.useFormEffects)(function(){var e,t;(0,w.onFieldValueChange)("collection",(t=(e=function(e){var t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(e){return x.clearFormGraph("*"),t=iB(),a("params.values",{}),O(t),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){iR(i,r,o,a,l,"next",e)}function l(e){iR(i,r,o,a,l,"throw",e)}a(void 0)})}),function(e){return t.apply(this,arguments)}))});var S=(0,l.useCallback)(function(t){var n=iM(Object.values(t.toJSON().properties),1)[0];e.onChange(n);var r=new Set;!function e(t,n){n(t),(null==t?void 0:t.properties)&&Object.values(t.properties).forEach(function(t){e(t,n)})}(n,function(e){if("AssignedField"===e["x-component"]){var t;if(null===(t=e["x-collection-field"])||void 0===t?void 0:t.startsWith("".concat(b,"."))){var n=iM(e["x-collection-field"].split("."),2)[1];r.add(n)}}});var o={};Array.from(r).forEach(function(e){e in x.values&&(o[e]=x.values[e])}),a("params.values",o)},[b,e.onChange]);return c().createElement(m.Card,null,c().createElement(f.CollectionManagerProvider,{dataSource:y},c().createElement(f.CollectionProvider,{name:b},c().createElement(f.RerenderDataBlockProvider,null,c().createElement(f.FormProvider,{form:x},c().createElement(tZ.FormLayout,{layout:"vertical"},c().createElement(f.VariableScopeProvider,{scope:r},c().createElement(f.SchemaComponentProvider,{form:x,designable:!s},c().createElement(f.SchemaComponentOptions,v,c().createElement(f.SchemaComponent,{schema:g,onChange:S}))))))))))}function i_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iW(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function iz(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iq(e){return(iq=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function iL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){iz(e,t,n[t])})}return e}function i$(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function iU(e,t){return(iU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function iG(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||iH(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iJ(e){return function(e){if(Array.isArray(e))return i_(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||iH(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iH(e,t){if(e){if("string"==typeof e)return i_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i_(e,t)}}function iY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(iY=function(){return!!e})()}function iK(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=iG((0,f.parseCollectionName)(a.collection),2),c=l[0],u=l[1],s=(0,f.useCompile)(),p=ty(c);return iG(tm(i$(iL({appends:[o].concat(iJ((null===(r=a.params)||void 0===r?void 0:null===(n=r.appends)||void 0===n?void 0:n.map(function(e){return"".concat(o,".").concat(e)}))||[]))},t),{fields:[{collectionName:u,name:o,type:"hasOne",target:u,uiSchema:{title:i}}],compile:s,getCollectionFields:p})),1)[0]}var iQ=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=iq(n),iz(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,iY()?Reflect.construct(n,r||[],iq(t).constructor):n.apply(t,r)),"title",'{{t("Create record", { ns: "'.concat(E,'" })}}')),iz(e,"type","create"),iz(e,"group","collection"),iz(e,"description",'{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "'.concat(E,'" })}}')),iz(e,"fieldset",{collection:i$(iL({},rh),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":iJ(rh["x-reactions"]).concat([{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:i$(iL({},rg),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:rj}}}),iz(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useNodeSavedConfig:eG}),iz(e,"components",{CollectionFieldset:iF,AssignedFieldsFormSchemaConfig:iV}),iz(e,"useVariables",iK),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&iU(e,t)}(o,e),t=o,n=[{key:"createDefaultConfig",value:function(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}},{key:"useInitializers",value:function(e){var t,n;return e.config.collection?{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:M,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}:null}}],iW(t.prototype,n),o}(eq);function iZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i1(e){return(i1=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i0(e,t,n[t])})}return e}function i3(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i5(e,t){return(i5=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i6(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i6=function(){return!!e})()}var i4=function(e){var t,n,r;function o(){var e,t,n,r,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=i1(n),i0(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,i6()?Reflect.construct(n,r||[],i1(t).constructor):n.apply(t,r)),"title",'{{t("Update record", { ns: "'.concat(E,'" })}}')),i0(e,"type","update"),i0(e,"group","collection"),i0(e,"description",'{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "'.concat(E,'" })}}')),i0(e,"fieldset",{collection:i3(i2({},rh),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return iZ(e)})(i=rh["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return iZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iZ(e,t)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:'{{t("Update mode", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:'{{t("Update in a batch", { ns: "'.concat(E,'" })}}'),value:!1,tooltip:'{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But association fields are not supported (unless foreign key in current collection), and the updated data will not trigger other workflows.", { ns: "'.concat(E,'" })}}')},{label:'{{t("Update one by one", { ns: "'.concat(E,'" })}}'),value:!0,tooltip:'{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "'.concat(E,'" })}}')}]},default:!1},filter:i3(i2({},rO),i0({title:'{{t("Only update records matching conditions", { ns: "'.concat(E,'" })}}')},"x-validator",function(e){return(0,p.isValidFilter)(e)?"":k("Please add at least one condition")})),values:i3(i2({},rg),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}}),i0(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useNodeSavedConfig:eG}),i0(e,"components",{FilterDynamicComponent:tO,CollectionFieldset:iF,AssignedFieldsFormSchemaConfig:iV,RadioWithTooltip:tx}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i5(e,t)}(o,e),t=o,n=[{key:"createDefaultConfig",value:function(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}],iX(t.prototype,n),o}(eq);function i8(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i7(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i9(e){return(i9=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i7(e,t,n[t])})}return e}function at(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function an(e,t){return(an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ar(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ar=function(){return!!e})()}var ao=function(e){function t(){var e,n,r,o,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,r=t,o=arguments,r=i9(r),i7(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,ar()?Reflect.construct(r,o||[],i9(n).constructor):r.apply(n,o)),"title",'{{t("Delete record")}}'),i7(e,"type","destroy"),i7(e,"group","collection"),i7(e,"description",'{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "'.concat(E,'" })}}')),i7(e,"fieldset",{collection:at(ae({},rh),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return i8(e)})(i=rh["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return i8(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i8(e,t)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),params:{type:"object",properties:{filter:at(ae({},rO),i7({},"x-validator",function(e){return(0,p.isValidFilter)(e)?"":k("Please add at least one condition")}))}}}),i7(e,"scope",{useNodeSavedConfig:eG,useCollectionDataSource:f.useCollectionDataSource}),i7(e,"components",{FilterDynamicComponent:tO}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&an(e,t)}(t,e),t}(eq),ai=new f.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:f.ButtonEditor,useComponentProps:function(){return(0,f.useSchemaToolbar)().buttonEditorProps}},{name:"secondConfirmation",Component:f.SecondConFirm},{name:"assignFieldValues",Component:f.AssignedFieldValues},{name:"skipRequiredValidation",Component:f.SkipValidation},{name:"afterSuccessfulSubmission",Component:f.AfterSuccess},{name:"bindWorkflow",Component:f.WorkflowConfig},{name:"delete",sort:100,Component:f.RemoveButton,useComponentProps:function(){return(0,f.useSchemaToolbar)().removeButtonProps}}]});function aa(e){var t=e.children,n=e.workflow,r=e.execution,o=e.nodes,i=(0,f.usePlugin)(ab),a=i.triggers.get(n.type).components,l=o.reduce(function(e,t){var n=t.type;return Object.assign(e,i.instructions.get(n).components)},{});return c().createElement(x.Provider,{value:{workflow:n,nodes:o,execution:r}},c().createElement(f.SchemaComponentOptions,{components:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},a,l)},t))}function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ac(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function au(e,t,n){return(au=ay()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ad(o,n.prototype),o}).apply(null,arguments)}function as(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function af(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ap(e){return(ap=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ad(e,t){return(ad=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function am(e){var t="function"==typeof Map?new Map:void 0;return(am=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return au(e,arguments,ap(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ad(r,e)})(e)}function ay(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ay=function(){return!!e})()}var ab=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=ap(n),af(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,ay()?Reflect.construct(n,r||[],ap(t).constructor):n.apply(t,r)),"triggers",new p.Registry),af(e,"instructions",new p.Registry),af(e,"systemVariables",new p.Registry),af(e,"useTriggersOptions",function(){var t=(0,f.useCompile)();return Array.from(e.triggers.getEntities()).map(function(e){var n,r,o=(r=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||function(e,t){if(e){if("string"==typeof e)return al(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return al(e,t)}}(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1].title,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e[1],["title"]);return{value:i,label:t(a),color:"gold",options:l}})}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ad(e,t)}(o,e),t=o,n=[{key:"isWorkflowSync",value:function(e){var t,n;return null!==(n=null===(t=this.triggers.get(e.type))||void 0===t?void 0:t.sync)&&void 0!==n?n:e.sync}},{key:"registerTrigger",value:function(e,t){if("function"==typeof t)this.triggers.register(e,new t);else if(t)this.triggers.register(e,t);else throw TypeError("invalid trigger type to register")}},{key:"registerInstruction",value:function(e,t){if("function"==typeof t)this.instructions.register(e,new t);else{var n,r;if(n=t,null!=(r=eq)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)this.instructions.register(e,t);else throw TypeError("invalid instruction type to register")}}},{key:"registerSystemVariable",value:function(e){this.systemVariables.register(e.key,e)}},{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(e){return t.app.router.add("admin.workflow.workflows.id",{path:D(":id"),element:c().createElement(n8,null)}),t.app.router.add("admin.workflow.executions.id",{path:T(":id"),element:c().createElement(nV,null)}),t.app.addComponents({WorkflowPage:n8,ExecutionPage:nV}),t.app.pluginSettingsManager.add(E,{icon:"PartitionOutlined",title:'{{t("Workflow", { ns: "'.concat(E,'" })}}'),Component:rd,aclSnippet:"pm.workflow.workflows"}),t.app.schemaSettingsManager.add(ai),t.app.schemaSettingsManager.addItem("actionSettings:delete","workflowConfig",{Component:f.WorkflowConfig,useVisible:function(){var e,t=(0,u.useFieldSchema)();return(0,s.isValid)(null==t?void 0:null===(e=t["x-action-settings"])||void 0===e?void 0:e.triggerWorkflows)}}),t.registerTrigger("collection",rJ),t.registerTrigger("schedule",oY),t.registerInstruction("calculation",o1),t.registerInstruction("condition",it),t.registerInstruction("end",il),t.registerInstruction("query",iw),t.registerInstruction("create",iQ),t.registerInstruction("update",i4),t.registerInstruction("destroy",ao),t.registerSystemVariable({key:"now",label:'{{t("System time", { ns: "'.concat(E,'" })}}'),value:"now"}),t.registerSystemVariable({key:"dateRange",label:'{{t("Date range", { ns: "'.concat(E,'" })}}'),value:"dateRange",children:[{key:"yesterday",value:"yesterday",label:'{{t("Yesterday", { ns: "'.concat(E,'" })}}')},{key:"today",value:"today",label:'{{t("Today", { ns: "'.concat(E,'" })}}')},{key:"tomorrow",value:"tomorrow",label:'{{t("Tomorrow", { ns: "'.concat(E,'" })}}')},{key:"lastWeek",value:"lastWeek",label:'{{t("Last week", { ns: "'.concat(E,'" })}}')},{key:"thisWeek",value:"thisWeek",label:'{{t("This week", { ns: "'.concat(E,'" })}}')},{key:"nextWeek",value:"nextWeek",label:'{{t("Next week", { ns: "'.concat(E,'" })}}')},{key:"lastMonth",value:"lastMonth",label:'{{t("Last month", { ns: "'.concat(E,'" })}}')},{key:"thisMonth",value:"thisMonth",label:'{{t("This month", { ns: "'.concat(E,'" })}}')},{key:"nextMonth",value:"nextMonth",label:'{{t("Next month", { ns: "'.concat(E,'" })}}')},{key:"lastQuarter",value:"lastQuarter",label:'{{t("Last quarter", { ns: "'.concat(E,'" })}}')},{key:"thisQuarter",value:"thisQuarter",label:'{{t("This quarter", { ns: "'.concat(E,'" })}}')},{key:"nextQuarter",value:"nextQuarter",label:'{{t("Next quarter", { ns: "'.concat(E,'" })}}')},{key:"lastYear",value:"lastYear",label:'{{t("Last year", { ns: "'.concat(E,'" })}}')},{key:"thisYear",value:"thisYear",label:'{{t("This year", { ns: "'.concat(E,'" })}}')},{key:"nextYear",value:"nextYear",label:'{{t("Next year", { ns: "'.concat(E,'" })}}')},{key:"last7Days",value:"last7Days",label:'{{t("Last 7 days", { ns: "'.concat(E,'" })}}')},{key:"next7Days",value:"next7Days",label:'{{t("Next 7 days", { ns: "'.concat(E,'" })}}')},{key:"last30Days",value:"last30Days",label:'{{t("Last 30 days", { ns: "'.concat(E,'" })}}')},{key:"next30Days",value:"next30Days",label:'{{t("Next 30 days", { ns: "'.concat(E,'" })}}')},{key:"last90Days",value:"last90Days",label:'{{t("Last 90 days", { ns: "'.concat(E,'" })}}')},{key:"next90Days",value:"next90Days",label:'{{t("Next 90 days", { ns: "'.concat(E,'" })}}')}]}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ac(i,r,o,a,l,"next",e)}function l(e){ac(i,r,o,a,l,"throw",e)}a(void 0)})})()}}],as(t.prototype,n),o}(am(f.Plugin))}(),h}()});
|
|
10
|
+
(function(x,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@formily/react"),require("@formily/shared"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("lodash"),require("@formily/reactive"),require("@nocobase/evaluators/client"),require("@formily/antd-v5"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@formily/react","@formily/shared","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","lodash","@formily/reactive","@nocobase/evaluators/client","@formily/antd-v5","dayjs"],n):(x=typeof globalThis!="undefined"?globalThis:x||self,n(x["@nocobase/plugin-workflow"]={},x.jsxRuntime,x["@formily/react"],x["@formily/shared"],x["@nocobase/client"],x["@nocobase/utils"],x["react-router-dom"],x.react,x.antd,x["react-i18next"],x["@ant-design/icons"],x["@formily/core"],x.lodash,x["@formily/reactive"],x["@nocobase/evaluators"],x["@formily/antd-v5"],x.dayjs))})(this,function(x,n,T,oe,l,Q,se,y,g,X,V,fe,we,Ge,De,gt,en){"use strict";var Hr=Object.defineProperty,Gr=Object.defineProperties;var qr=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var Qo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var Lt=(x,n,T)=>n in x?Hr(x,n,{enumerable:!0,configurable:!0,writable:!0,value:T}):x[n]=T,C=(x,n)=>{for(var T in n||(n={}))Qo.call(n,T)&&Lt(x,T,n[T]);if(yt)for(var T of yt(n))Xo.call(n,T)&&Lt(x,T,n[T]);return x},A=(x,n)=>Gr(x,qr(n));var Ro=x=>typeof x=="symbol"?x:x+"",Z=(x,n)=>{var T={};for(var oe in x)Qo.call(x,oe)&&n.indexOf(oe)<0&&(T[oe]=x[oe]);if(x!=null&&yt)for(var oe of yt(x))n.indexOf(oe)<0&&Xo.call(x,oe)&&(T[oe]=x[oe]);return T};var w=(x,n,T)=>(Lt(x,typeof n!="symbol"?n+"":n,T),T);var J=(x,n,T)=>new Promise((oe,l)=>{var Q=g=>{try{y(T.next(g))}catch(X){l(X)}},se=g=>{try{y(T.throw(g))}catch(X){l(X)}},y=g=>g.done?oe(g.value):Promise.resolve(g.value).then(Q,se);y((T=T.apply(x,n)).next())});const tn=y.createContext(null),bt={didCatch:!1,error:null};class on extends y.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=bt}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var o,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(o=(r=this.props).onReset)===null||o===void 0||o.call(r,{args:a,reason:"imperative-api"}),this.setState(bt)}}componentDidCatch(t,o){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,o)}componentDidUpdate(t,o){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&o.error!==null&&nn(t.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(bt)}}render(){const{children:t,fallbackRender:o,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=t;if(a){const p={error:i,resetErrorBoundary:this.resetErrorBoundary};if(y.isValidElement(s))c=s;else if(typeof o=="function")c=o(p);else if(r)c=y.createElement(r,p);else throw i}return y.createElement(tn.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function nn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((o,r)=>!Object.is(o,t[r]))}const Ie=y.createContext({});function H(){return y.useContext(Ie)}const u="workflow";function O(e,t={}){return l.i18n.t(e,A(C({},t),{ns:u}))}function xt(){return X.useTranslation(u)}function vt(e){const t=new Map;e.forEach(o=>t.set(o.id,o));for(const o of t.values())o.upstreamId&&(o.upstream=t.get(o.upstreamId)),o.downstreamId&&(o.downstream=t.get(o.downstreamId))}function wt(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(o=>{wt(e.properties[o],t)})}function Ce(e){return`/admin/workflow/workflows/${e}`}function qe(e){return`/admin/workflow/executions/${e}`}function rn(r){var s=r,{collection:e,dataPath:t}=s,o=Z(s,["collection","dataPath"]);const{insert:a}=l.useSchemaInitializer(),{getTemplateSchemaByMode:i}=l.useSchemaTemplateManager(),{getCollection:c}=l.useCollectionManager_deprecated(),p=l.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,v]=l.parseCollectionName(e);d=c(v,h)}else d=e;function m(v){return J(this,arguments,function*({item:h}){const b=h.template?yield i(h):null,f={type:"void",name:oe.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:t},"x-component":"CardItem","x-component-props":{title:o.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:b||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};wt(f,k=>{k["x-uid"]&&delete k["x-uid"]}),a(f)})}return n.jsx(l.SchemaInitializerItem,A(C({},o),{onClick:m,items:p}))}function Pe(e){var a;const t=l.useSchemaInitializerItem(),o=(a=e==null?void 0:e.collection)!=null?a:t.collection;let r,s;if(typeof o=="string"){const i=l.parseCollectionName(o);r=i[0],s=i[1]}else s=o;return n.jsx(l.CollectionProvider_deprecated,{dataSource:r,collection:s,children:n.jsx(rn,C(C({},t),e))})}function sn(e){const{execution:t,nodes:o}=H(),r=y.useMemo(()=>o.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[o]),s=y.useMemo(()=>{var i;return{$context:t==null?void 0:t.context,$jobsMapByNodeKey:((i=t==null?void 0:t.jobs)!=null?i:[]).reduce((c,p)=>Object.assign(c,{[r[p.nodeId]]:p.result}),{})}},[t==null?void 0:t.context,t==null?void 0:t.jobs,r]);return y.useMemo(()=>we.get(s,e),[s,e])}function ln({collection:e,dataPath:t,children:o}){const r=T.useField(),s=y.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),p=sn(t);let d,m;if(typeof e=="string"){const M=l.parseCollectionName(e);d=M[0],m=M[1]}else m=e;const h=y.useMemo(()=>fe.createForm({values:p,readPretty:!0}),[p]),v={appends:i},b={loading:!1,data:{data:p}},k=l.useAPIClient().resource(m),F=l.useBlockRequestContext();return n.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:m,children:n.jsx(l.RecordProvider,{record:p,parent:null,children:n.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:b,resource:k,__parent:F},children:n.jsx(l.FormBlockContext.Provider,{value:{params:v,form:h,field:r,service:b,updateAssociationValues:c,formBlockRef:s},children:o})})})})}function an(){return!0}const Ct=T.observer(e=>{const d=e,{filter:t=an}=d,o=Z(d,["filter"]),r=l.useCompile(),{getCollectionFields:s}=l.useCollectionManager_deprecated(),{values:a}=T.useForm(),[i,c]=l.parseCollectionName(a==null?void 0:a.collection),p=s(c,i);return n.jsx(g.Select,A(C({popupMatchSelectWidth:!1},o),{options:p.filter(t).map(m=>{var h;return{label:r((h=m.uiSchema)==null?void 0:h.title),value:m.name}})}))},{displayName:"FieldsSelect"}),cn=l.createStyles(({css:e,token:t})=>({container:e`
|
|
11
|
+
margin-bottom: 1.5em;
|
|
12
|
+
padding: 1em;
|
|
13
|
+
background-color: ${t.colorFillAlter};
|
|
14
|
+
|
|
15
|
+
> *:last-child {
|
|
16
|
+
margin-bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
dl {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: baseline;
|
|
22
|
+
|
|
23
|
+
dt {
|
|
24
|
+
color: ${t.colorText};
|
|
25
|
+
&:after {
|
|
26
|
+
content: ':';
|
|
27
|
+
margin-right: 0.5em;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
p {
|
|
33
|
+
color: ${t.colorTextDescription};
|
|
34
|
+
}
|
|
35
|
+
`}));function zt(e){const{label:t,title:o,description:r}=e,{styles:s}=cn();return n.jsxs("div",{className:l.cx(s.container,e.className),children:[n.jsxs("dl",{children:[n.jsx("dt",{children:t}),n.jsx("dd",{children:n.jsx(g.Tag,{style:{background:"none"},children:o})})]}),r?n.jsx("p",{children:r}):null]})}function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jt={exports:{}};/*!
|
|
36
|
+
Copyright (c) 2018 Jed Watson.
|
|
37
|
+
Licensed under the MIT License (MIT), see
|
|
38
|
+
http://jedwatson.github.io/classnames
|
|
39
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function o(){for(var a="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(a=s(a,r(c)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return o.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var c in a)t.call(a,c)&&a[c]&&(i=s(i,c));return i}function s(a,i){return i?a?a+" "+i:a+i:a}e.exports?(o.default=o,e.exports=o):window.classNames=o})()})(Jt);var un=Jt.exports;const pn=dn(un),mn=l.createStyles(({css:e,token:t})=>({statusButtonClass:e`
|
|
40
|
+
border: none;
|
|
41
|
+
.ant-tag {
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
padding: 0;
|
|
45
|
+
margin-right: 0;
|
|
46
|
+
border-radius: 50%;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
`,noStatusButtonClass:e`
|
|
50
|
+
border-width: 2px;
|
|
51
|
+
`}));function Me(e){const i=e,{status:t,statusMap:o}=i,r=Z(i,["status","statusMap"]),{styles:s}=mn();let a=null;if(typeof t!="undefined"&&(o!=null&&o[t])){const{icon:c,color:p}=o[t];a=n.jsx(g.Tag,{color:p,children:c})}return n.jsx(g.Button,A(C({},r),{shape:"circle",size:"small",className:pn(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const ie={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},Ye=[{value:ie.QUEUEING,label:`{{t("Queueing", { ns: "${u}" })}}`,color:"blue",icon:n.jsx(V.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${u}" })}}`},{value:ie.STARTED,label:`{{t("On going", { ns: "${u}" })}}`,color:"gold",icon:n.jsx(V.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${u}" })}}`},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${u}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${u}" })}}`},{value:ie.FAILED,label:`{{t("Failed", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${u}" })}}`},{value:ie.ERROR,label:`{{t("Error", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${u}" })}}`},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${u}" })}}`},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${u}" })}}`},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${u}" })}}`},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${u}" })}}`}],_e=Ye.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),ce={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},kt=[{value:ce.PENDING,label:`{{t("Pending", { ns: "${u}" })}}`,color:"gold",icon:n.jsx(V.ClockCircleOutlined,{})},{value:ce.RESOLVED,label:`{{t("Resolved", { ns: "${u}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{})},{value:ce.FAILED,label:`{{t("Failed", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{})},{value:ce.ERROR,label:`{{t("Error", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{})},{value:ce.ABORTED,label:`{{t("Aborted", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90})},{value:ce.CANCELED,label:`{{t("Canceled", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45})},{value:ce.REJECTED,label:`{{t("Rejected", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{})},{value:ce.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{})}],Ke=kt.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),St=(e,t)=>({getAriaLabel:y.useCallback(r=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,t!=null?String(t):"",r].filter(Boolean).join("-"),[t,e==null?void 0:e.title,e==null?void 0:e.type])}),ne=l.createStyles(({css:e,token:t})=>({workflowPageClass:e`
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
|
|
57
|
+
.workflow-toolbar {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
position: relative;
|
|
62
|
+
padding: 0.5rem 1rem;
|
|
63
|
+
background: ${t.colorBgContainer};
|
|
64
|
+
border-bottom: 1px solid ${t.colorBorderSecondary};
|
|
65
|
+
|
|
66
|
+
header {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
aside {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 0.5em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.workflow-versions {
|
|
78
|
+
label {
|
|
79
|
+
margin-right: 0.5em;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.workflow-canvas-wrapper {
|
|
85
|
+
flex-grow: 1;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
position: relative;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.workflow-canvas-zoomer {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 2em;
|
|
95
|
+
right: 2em;
|
|
96
|
+
height: 10em;
|
|
97
|
+
padding: 1em 0;
|
|
98
|
+
border-radius: 0.5em;
|
|
99
|
+
background: ${t.colorBgContainer};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.workflow-canvas {
|
|
103
|
+
overflow: auto;
|
|
104
|
+
height: 100%;
|
|
105
|
+
width: 100%;
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
align-items: center;
|
|
109
|
+
padding: 2em;
|
|
110
|
+
|
|
111
|
+
> .ant-alert {
|
|
112
|
+
margin-bottom: 2em;
|
|
113
|
+
font-size: 85%;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`,dropdownClass:e`
|
|
117
|
+
.ant-dropdown-menu-item {
|
|
118
|
+
justify-content: flex-end;
|
|
119
|
+
.ant-dropdown-menu-title-content {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: baseline;
|
|
122
|
+
justify-content: flex-end;
|
|
123
|
+
text-align: right;
|
|
124
|
+
|
|
125
|
+
time {
|
|
126
|
+
width: 14em;
|
|
127
|
+
font-size: 80%;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`,workflowVersionDropdownClass:e`
|
|
132
|
+
max-height: 80vh;
|
|
133
|
+
overflow-y: auto;
|
|
134
|
+
|
|
135
|
+
.ant-dropdown-menu-item {
|
|
136
|
+
.ant-dropdown-menu-title-content {
|
|
137
|
+
strong {
|
|
138
|
+
font-weight: normal;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
> .enabled {
|
|
142
|
+
strong {
|
|
143
|
+
font-weight: bold;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
> .unexecuted {
|
|
148
|
+
strong {
|
|
149
|
+
font-style: italic;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`,executionsDropdownRowClass:e`
|
|
155
|
+
.ant-dropdown-menu-item {
|
|
156
|
+
.id {
|
|
157
|
+
flex-grow: 1;
|
|
158
|
+
text-align: right;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`,branchBlockClass:e`
|
|
162
|
+
display: flex;
|
|
163
|
+
position: relative;
|
|
164
|
+
margin: 2em auto auto auto;
|
|
165
|
+
|
|
166
|
+
:before {
|
|
167
|
+
content: '';
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: 0;
|
|
170
|
+
bottom: 0;
|
|
171
|
+
left: calc(50% - 0.5px);
|
|
172
|
+
width: 1px;
|
|
173
|
+
background-color: ${t.colorBgLayout};
|
|
174
|
+
}
|
|
175
|
+
`,branchClass:e`
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
align-items: center;
|
|
179
|
+
position: relative;
|
|
180
|
+
min-width: 20em;
|
|
181
|
+
padding: 0 2em;
|
|
182
|
+
|
|
183
|
+
.workflow-node-list {
|
|
184
|
+
flex-grow: 1;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.workflow-branch-lines {
|
|
188
|
+
position: absolute;
|
|
189
|
+
top: 0;
|
|
190
|
+
bottom: 0;
|
|
191
|
+
width: 1px;
|
|
192
|
+
background-color: ${t.colorBorder};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
:before,
|
|
196
|
+
:after {
|
|
197
|
+
content: '';
|
|
198
|
+
position: absolute;
|
|
199
|
+
height: 1px;
|
|
200
|
+
background-color: ${t.colorBorder};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:before {
|
|
204
|
+
top: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:after {
|
|
208
|
+
bottom: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:not(:first-child):not(:last-child) {
|
|
212
|
+
:before,
|
|
213
|
+
:after {
|
|
214
|
+
left: 0;
|
|
215
|
+
width: 100%;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:last-child:not(:first-child) {
|
|
220
|
+
:before,
|
|
221
|
+
:after {
|
|
222
|
+
right: 50%;
|
|
223
|
+
width: 50%;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
:first-child:not(:last-child) {
|
|
228
|
+
:before,
|
|
229
|
+
:after {
|
|
230
|
+
left: 50%;
|
|
231
|
+
width: 50%;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.end-sign {
|
|
236
|
+
position: relative;
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
align-items: center;
|
|
240
|
+
justify-content: center;
|
|
241
|
+
width: 0;
|
|
242
|
+
height: 6em;
|
|
243
|
+
border-left: 1px dashed ${t.colorBgLayout};
|
|
244
|
+
|
|
245
|
+
.anticon {
|
|
246
|
+
font-size: 1.5em;
|
|
247
|
+
line-height: 100%;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`,nodeBlockClass:e`
|
|
251
|
+
flex-grow: 1;
|
|
252
|
+
flex-shrink: 0;
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
align-items: center;
|
|
256
|
+
position: relative;
|
|
257
|
+
`,nodeClass:e`
|
|
258
|
+
flex-shrink: 0;
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
align-items: center;
|
|
262
|
+
`,nodeCardClass:e`
|
|
263
|
+
position: relative;
|
|
264
|
+
width: 20em;
|
|
265
|
+
background: ${t.colorBgContainer};
|
|
266
|
+
padding: 1em;
|
|
267
|
+
box-shadow: ${t.boxShadowTertiary};
|
|
268
|
+
border-radius: ${t.borderRadiusLG}px;
|
|
269
|
+
cursor: pointer;
|
|
270
|
+
transition: box-shadow 0.3s ease;
|
|
271
|
+
|
|
272
|
+
&:hover {
|
|
273
|
+
box-shadow: ${t.boxShadow};
|
|
274
|
+
|
|
275
|
+
.workflow-node-remove-button {
|
|
276
|
+
display: block;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&.configuring {
|
|
281
|
+
box-shadow: ${t.boxShadow};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.workflow-node-remove-button {
|
|
285
|
+
display: none;
|
|
286
|
+
position: absolute;
|
|
287
|
+
right: 0;
|
|
288
|
+
top: 0;
|
|
289
|
+
color: ${t.colorText};
|
|
290
|
+
|
|
291
|
+
&[disabled] {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&:hover {
|
|
296
|
+
color: ${t.colorErrorHover};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.ant-input {
|
|
301
|
+
font-weight: bold;
|
|
302
|
+
|
|
303
|
+
&:not(:focus) {
|
|
304
|
+
transition:
|
|
305
|
+
background-color 0.3s ease,
|
|
306
|
+
border-color 0.3s ease;
|
|
307
|
+
border-color: ${t.colorBorderBg};
|
|
308
|
+
background-color: ${t.colorBgContainerDisabled};
|
|
309
|
+
|
|
310
|
+
&:not(:disabled):hover {
|
|
311
|
+
border-color: ${t.colorPrimaryBorderHover};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
&:disabled:hover {
|
|
315
|
+
border-color: ${t.colorBorderBg};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.workflow-node-config-button {
|
|
321
|
+
padding: 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&:hover {
|
|
325
|
+
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);
|
|
326
|
+
|
|
327
|
+
.workflow-node-remove-button {
|
|
328
|
+
display: block;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
`,nodeJobButtonClass:e`
|
|
332
|
+
display: flex;
|
|
333
|
+
position: absolute;
|
|
334
|
+
top: 0;
|
|
335
|
+
right: 0;
|
|
336
|
+
justify-content: center;
|
|
337
|
+
align-items: center;
|
|
338
|
+
color: ${t.colorTextLightSolid};
|
|
339
|
+
`,nodeHeaderClass:e`
|
|
340
|
+
display: flex;
|
|
341
|
+
margin-bottom: 0.5em;
|
|
342
|
+
|
|
343
|
+
.workflow-node-actions {
|
|
344
|
+
position: relative;
|
|
345
|
+
}
|
|
346
|
+
`,nodeMetaClass:e`
|
|
347
|
+
flex-grow: 1;
|
|
348
|
+
|
|
349
|
+
.workflow-node-id {
|
|
350
|
+
color: ${t.colorTextDescription};
|
|
351
|
+
|
|
352
|
+
&:before {
|
|
353
|
+
content: '#';
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
`,nodeTitleClass:e`
|
|
357
|
+
display: flex;
|
|
358
|
+
align-items: center;
|
|
359
|
+
font-weight: normal;
|
|
360
|
+
.workflow-node-id {
|
|
361
|
+
color: ${t.colorTextDescription};
|
|
362
|
+
}
|
|
363
|
+
`,nodeSubtreeClass:e`
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: column-reverse;
|
|
366
|
+
align-items: center;
|
|
367
|
+
margin: auto;
|
|
368
|
+
`,nodeJobResultClass:e`
|
|
369
|
+
background-color: #f3f3f3;
|
|
370
|
+
`,addButtonClass:e`
|
|
371
|
+
flex-shrink: 0;
|
|
372
|
+
padding: 2em 0;
|
|
373
|
+
|
|
374
|
+
> .ant-btn {
|
|
375
|
+
&:disabled {
|
|
376
|
+
visibility: hidden;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
`,conditionClass:e`
|
|
380
|
+
position: relative;
|
|
381
|
+
overflow: visible;
|
|
382
|
+
|
|
383
|
+
> span {
|
|
384
|
+
position: absolute;
|
|
385
|
+
top: calc(1.5em - 1px);
|
|
386
|
+
line-height: 1em;
|
|
387
|
+
color: ${t.colorTextSecondary};
|
|
388
|
+
background-color: ${t.colorBgLayout};
|
|
389
|
+
padding: 1px;
|
|
390
|
+
}
|
|
391
|
+
`,loopLineClass:e`
|
|
392
|
+
display: flex;
|
|
393
|
+
justify-content: center;
|
|
394
|
+
align-items: center;
|
|
395
|
+
position: absolute;
|
|
396
|
+
top: 50%;
|
|
397
|
+
transform: translateY(-50%);
|
|
398
|
+
width: 2em;
|
|
399
|
+
height: 6em;
|
|
400
|
+
`,terminalClass:e`
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
justify-content: center;
|
|
404
|
+
flex-shrink: 0;
|
|
405
|
+
width: 4em;
|
|
406
|
+
height: 4em;
|
|
407
|
+
border-radius: 50%;
|
|
408
|
+
background-color: ${t.colorText};
|
|
409
|
+
color: ${t.colorBgContainer};
|
|
410
|
+
`}));class be{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"presetFieldset");w(this,"branching");w(this,"view");w(this,"scope");w(this,"components");w(this,"end");w(this,"testable")}createDefaultConfig(){return{}}}function fn(){const e=T.useForm(),t=l.useAPIClient(),o=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=xe(),{workflow:a}=H();return{run(){return J(this,null,function*(){var c,p;if(a.executed){g.message.error(O("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(p=(c=t.resource("flow_nodes")).update)==null?void 0:p.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(Ge.toJS(e.values)),o.setFormValueChanged(!1),o.setVisible(!1),r()})}}}const Ze=y.createContext({});function xe(){return y.useContext(Ze)}function Be(e=[]){const t=xe();return e.some(o=>we.get(t.config,o)!=null)}function Ut(e,t){const o=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof t!="function"||t(r))&&o.push(r);return o}function Ht(e){const t=[];for(let o=e;o;o=o.upstream)o.upstream&&o.branchIndex!=null&&t.push(o.upstream);return t}function Gt({data:e}){var i;const{styles:t}=ne(),{getAriaLabel:o}=St(e),r=l.usePlugin(le),{Component:s=Tt,end:a}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(Ze.Provider,{value:e,children:n.jsxs("div",{className:l.cx(t.nodeBlockClass),children:[n.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?n.jsx(no,{"aria-label":o(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})})]})})}function At(){var m;const{t:e}=X.useTranslation(),t=l.useAPIClient(),{workflow:o,nodes:r,refresh:s}=(m=H())!=null?m:{},a=xe(),{modal:i}=g.App.useApp(),c=t.resource("flow_nodes"),p=y.useCallback(()=>J(this,null,function*(){var h;yield(h=c.destroy)==null?void 0:h.call(c,{filterByTk:a.id}),s()}),[a.id,s,c]),d=y.useCallback(()=>J(this,null,function*(){const h=r.filter(f=>f===a?!1:Q.parse(f.config).parameters.filter(({key:M})=>M.startsWith(`$jobsMapByNodeKey.${a.key}.`)||M===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:O("Can not delete"),content:O("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(f=>`#${f.id}`).join(", ")})});return}const b=!r.find(f=>f.upstream===a&&f.branchIndex!=null)?e("Are you sure you want to delete it?"):O("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:b,onOk:p})}),[a,i,r,p,e]);return o?o.executed?null:n.jsx(g.Button,{type:"text",shape:"circle",icon:n.jsx(V.DeleteOutlined,{}),onClick:d,className:"workflow-node-remove-button",size:"small"}):null}function Ft(){var a;const{execution:e,setViewJob:t}=H(),{jobs:o}=(a=xe())!=null?a:{},{styles:r}=ne();if(!e)return null;if(!o.length)return n.jsx(Me,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=o.find(p=>p.id==i);t(c)}return n.jsx(g.Tooltip,{title:O("View result"),children:o.length>1?n.jsx(g.Dropdown,{menu:{items:o.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Me,{statusMap:Ke,status:i.status}),n.jsx("time",{children:Q.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Me,{statusMap:Ke,status:o[o.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Me,{statusMap:Ke,status:o[0].status,onClick:()=>t(o[0]),className:r.nodeJobButtonClass})})}function hn(){return{form:T.useForm()}}const yn=()=>{const{values:e,query:t}=T.useForm(),o=xe(),r=l.useAPIClient(),s=l.useActionContext(),a=T.useField();return{run(){return J(this,null,function*(){const p=Q.parse(o.config)(Ge.toJS(e.config)),d=t("result").take();d.setValue(null),d.setFeedback({}),a.data=a.data||{},a.data.loading=!0;try{const{data:{data:m}}=yield r.resource("flow_nodes").test({values:{config:p,type:o.type}});d.setFeedback({type:m.status>0?"success":"error",messages:m.status>0?[O("Resolved")]:[O("Failed")]}),d.setValue(m.result)}catch(m){d.setFeedback({type:"error",messages:m.message})}a.data.loading=!1,s.setFormValueChanged(!1)})}}},qt=y.createContext([]);function gn({name:e,value:t,onChange:o}){return n.jsxs(g.Space,{children:[n.jsx(Dt,{variableOptions:{},value:`{{${e}}}`,disabled:!0}),n.jsx(l.Variable.Input,{useTypedConstant:["string","number","boolean","date"],value:t,onChange:o})]})}function bn({value:e,onChange:t}){const o=y.useContext(qt);return o.length?n.jsx(n.Fragment,{children:o.map(r=>n.jsx(gn,{name:r,value:we.get(e,r),onChange:s=>{we.set(e,r,s),t(e)}},r))}):n.jsx(g.Empty,{image:g.Empty.PRESENTED_IMAGE_SIMPLE,description:O("No variable"),style:{margin:"1em"}})}function xn(){const e=xe(),{values:t}=T.useForm(),r=Q.parse(t).parameters.map(a=>a.key),s=y.useMemo(()=>fe.createForm(),[]);return n.jsx(Ze.Provider,{value:A(C({},e),{config:t}),children:n.jsx(qt.Provider,{value:r,children:n.jsx(l.SchemaComponent,{components:{Alert:g.Alert,TestFormFieldset:bn},scope:{useCancelAction:l.useCancelAction,useRunAction:yn},schema:{type:"void",name:"testButton",title:'{{t("Test run")}}',"x-component":"Action","x-component-props":{icon:"CaretRightOutlined"},properties:{modal:{type:"void","x-decorator":"FormV2","x-decorator-props":{form:s},"x-component":"Action.Modal",title:'{{t("Test run", { ns: "workflow" })}}',properties:{alert:{type:"void","x-component":"Alert","x-component-props":{message:'{{t("Test run will do the actual data manipulating or API calling, please use with caution.", { ns: "workflow" })}}',type:"warning",showIcon:!0,className:l.css`
|
|
411
|
+
margin-bottom: 1em;
|
|
412
|
+
`}},config:{type:"object",title:'{{t("Replace variables", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TestFormFieldset"},actions:{type:"void","x-component":"ActionBar",properties:{submit:{type:"void",title:'{{t("Run")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRunAction }}"}}}},result:{type:"string",title:'{{t("Result", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5,maxRows:20},style:{whiteSpace:"pre",cursor:"text"}},"x-pattern":"disabled"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Close")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}}}}}}}}})})})}function Tt(e){var I;const{data:t,children:o}=e,r=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(I=H())!=null?I:{},{styles:c}=ne(),d=l.usePlugin(le).instructions.get(t.type),m=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,v]=y.useState(t.title),[b,f]=y.useState(!1),[k,F]=y.useState(!1),M=y.useMemo(()=>{const D=we.cloneDeep(t.config);return fe.createForm({initialValues:D,disabled:a.executed})},[t,a]),S=y.useCallback(D=>{f(D),D||M.reset()},[M]),E=y.useCallback(function(D){return J(this,null,function*(){var B,G;const N=D||r(d==null?void 0:d.title);v(N),N!==t.title&&(yield(G=(B=s.resource("flow_nodes")).update)==null?void 0:G.call(B,{filterByTk:t.id,values:{title:N}}),i())})},[t,d]),L=y.useCallback(function(D){if(D.target===D.currentTarget){f(!0);return}const N=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let B=D.target;B&&B!==D.currentTarget&&B!==document.documentElement;B=B.parentNode)if(Array.from(B.classList).some(G=>N.has(G))){f(!0),D.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${t.type}`),children:n.jsx(g.Tooltip,{title:O("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{color:"error",children:O("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:t.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(At,{}),n.jsx(Ft,{})]})]}),n.jsx(g.Input.TextArea,{value:h,disabled:!0,autoSize:!0})]})})});const $=r(d.title);return n.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${t.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:b}),onClick:L,children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{children:$}),n.jsx("span",{className:"workflow-node-id",children:t.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(At,{}),n.jsx(Ft,{})]})]}),n.jsx(g.Input.TextArea,{disabled:a.executed,value:h,onChange:D=>v(D.target.value),onBlur:D=>E(D.target.value),autoSize:!0}),n.jsx(l.ActionContextProvider,{value:{visible:b,setVisible:S,formValueChanged:k,setFormValueChanged:F},children:n.jsx(l.FormProvider,{form:M,children:n.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:hn,useUpdateAction:fn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":m,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[t.id]:{type:"void",title:n.jsxs("div",{className:l.css`
|
|
413
|
+
display: flex;
|
|
414
|
+
justify-content: space-between;
|
|
415
|
+
|
|
416
|
+
strong {
|
|
417
|
+
font-weight: bold;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.ant-tag {
|
|
421
|
+
margin-inline-end: 0;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
code {
|
|
425
|
+
font-weight: normal;
|
|
426
|
+
}
|
|
427
|
+
`,children:[n.jsx("strong",{children:t.title}),n.jsx(g.Tooltip,{title:O("Variable key of node"),children:n.jsx(g.Tag,{children:n.jsx("code",{children:t.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":zt,"x-component-props":{label:O("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
428
|
+
.ant-input,
|
|
429
|
+
.ant-select,
|
|
430
|
+
.ant-cascader-picker,
|
|
431
|
+
.ant-picker,
|
|
432
|
+
.ant-input-number,
|
|
433
|
+
.ant-input-affix-wrapper {
|
|
434
|
+
&.auto-width {
|
|
435
|
+
width: auto;
|
|
436
|
+
min-width: 6em;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
`},properties:d.fieldset},footer:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{flexGrow:1}},properties:A(C({},d.testable?{test:{type:"void","x-component":T.observer(xn),"x-align":"left"}}:{}),{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}})}}}})}})}})})})]}),o]})}const Ve={label:"label",value:"value",children:"children"},Yt={label:`{{t("Node result", { ns: "${u}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:t}=l.usePlugin(le),o=xe(),r=Ut(o),s=[];return r.forEach(a=>{var p;const i=t.get(a.type),c=(p=i.useVariables)==null?void 0:p.call(i,a,e);c&&s.push(c)}),s}},_t={label:`{{t("Trigger variables", { ns: "${u}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:t}=l.usePlugin(le),{workflow:o}=H(),r=t.get(o.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,o.config,e))!=null?a:null}},Kt={label:`{{t("Scope variables", { ns: "${u}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:t=Ve,current:o}=e,{instructions:r}=l.usePlugin(le),s=xe(),a=o!=null?o:s,i=Ht(a),c=[];return i.forEach(p=>{var h,v;const d=r.get(p.type),m=(h=d.useScopeVariables)==null?void 0:h.call(d,p,e);m&&c.push({key:p.key,[t.value]:p.key,[t.label]:(v=p.title)!=null?v:`#${p.id}`,[t.children]:m})}),c}},Zt={label:`{{t("System variables", { ns: "${u}" })}}`,value:"$system",useOptions(e){const{systemVariables:t}=l.usePlugin(le);return l.useCompile()(Array.from(t.getValues()))}},Qe={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function Qt(e,t){var o,r,s,a,i,c;return typeof t=="string"?(o=Qe[t])==null?void 0:o.has(e.interface):typeof t=="object"&&t.type==="reference"?Nt(e)?((r=t.options)==null?void 0:r.entity)&&(e.collectionName===((s=t.options)==null?void 0:s.collection)||((a=t.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=t.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=t.options)==null?void 0:c.collection):!1:typeof t=="function"?t(e):!1}function Nt(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function Ot(e,t){if(t==null)return null;const o=`${e.name}.`;return t.filter(r=>r.startsWith(o)).map(r=>r.replace(o,""))}function $t({fields:e,types:t,appends:o,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=t!=null&&t.length?t.some(p=>Qt(i,p)):!0;if(Nt(i)){if(o===null)return r?c||$t({fields:Et(i.target,{compile:s,getCollectionFields:a}),types:t,depth:r-1,appends:o,compile:s,getCollectionFields:a}):!1;const p=Ot(i,o),d=o.includes(i.name);return c?d:((p==null?void 0:p.length)||d)&&$t({fields:Et(i.target,{compile:s,getCollectionFields:a}),types:t,appends:p,compile:s,getCollectionFields:a}).length}else return c})}function Xe(e,t){var a,i;const o=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,t))==null?void 0:i.filter(Boolean),{fieldNames:s}=t;return{[s.label]:o(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const t=Object.assign({},Ve,(s=e.fieldNames)!=null?s:{}),o=Object.assign(e,{fieldNames:t});return[Xe(Kt,o),Xe(Yt,o),Xe(_t,o),Xe(Zt,o)]}function Et(e,{compile:t,getCollectionFields:o}){var d,m,h,v;const[r,s]=l.parseCollectionName(e),a=o(s,r),i=[],c=[];a.forEach(b=>{if(b.isForeignKey&&!b.primaryKey)i.push(b);else{const f=a.find(k=>k.name===b.foreignKey);f&&i.push(f),c.push(b)}});const p=we.uniqBy(i,"name");for(let b=c.length-1;b>=0;b--){const f=c[b];if(f.type==="belongsTo"){const k=p.findIndex(F=>F.name===f.foreignKey);if(k>-1){const F=p[k];c.splice(b,0,A(C(C({},f),F),{uiSchema:A(C({},f.uiSchema),{title:(d=F.uiSchema)!=null&&d.title?t((m=F.uiSchema)==null?void 0:m.title):F.name})})),p.splice(k,1)}else c.splice(b,0,A(C({},f),{name:f.foreignKey,type:"bigInt",isForeignKey:!0,interface:f.interface,uiSchema:A(C({},f.uiSchema),{title:(h=f.uiSchema)!=null&&h.title?`${t((v=f.uiSchema)==null?void 0:v.title)} ID`:f.name})}))}else f.type==="context"&&f.collectionName==="users"&&c.splice(b,1)}return c.push(...p),we.uniqBy(c,"name").filter(b=>b.interface&&!b.hidden)}function vn(e){const t=Ot(e.field,e.appends),o=Te(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,o.length?e.children=o:(e.isLeaf=!0,!e.types||e.types.some(s=>Qt(e.field,s))||(e.disabled=!0))}function Te(e){const{fields:t,collection:o,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:p=Ve}=e,d=t!=null?t:Et(o,{compile:i,getCollectionFields:c}),m=vn.bind({compile:i,getCollectionFields:c,fieldNames:p});return $t({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(v=>{var F;const b=i(((F=v.uiSchema)==null?void 0:F.title)||v.name),f=Ot(v,s),k=!Nt(v)||f&&!f.length&&!s.includes(v.name)||!1;return{[p.label]:b,key:v.name,[p.value]:v.name,isLeaf:k,loadChildren:k?null:m,field:v,depth:a,appends:s,types:r}})}function je(e){const t=l.useApp(),{collectionManager:o}=t.dataSourceManager.getDataSource(e);return y.useCallback(r=>o.getCollectionAllFields(r),[o])}function Dt(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},t))}function It(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},t))}function wn(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},t))}function Cn(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},t))}function Re({value:e,onChange:t,renderSchemaComponent:o}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:t,scope:r,children:o()})}function ke(e){const a=e,{options:t=[],direction:o}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(g.Radio.Group,A(C({},r),{children:n.jsx(g.Space,{direction:o,children:t.map(i=>n.jsxs(g.Radio,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
440
|
+
& + .anticon {
|
|
441
|
+
margin-left: 0.25em;
|
|
442
|
+
}
|
|
443
|
+
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function kn(e){const a=e,{options:t=[],direction:o}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(g.Checkbox.Group,A(C({},r),{children:n.jsx(g.Space,{direction:o,children:t.map(i=>n.jsxs(g.Checkbox,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
444
|
+
& + .anticon {
|
|
445
|
+
margin-left: 0.25em;
|
|
446
|
+
}
|
|
447
|
+
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function Xt(){const e=T.useFieldSchema(),t=l.useCompile();return n.jsxs(l.GeneralSchemaDesigner,{title:t(e.title),children:[n.jsx(l.SchemaSettingsBlockTitleItem,{}),n.jsx(l.SchemaSettingsDivider,{}),n.jsx(l.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Ne=()=>null;function Sn(){const a=l.useSchemaInitializerItem(),{node:t,resultTitle:o}=a,r=Z(a,["node","resultTitle"]),{insert:s}=l.useSchemaInitializer();return n.jsx(l.SchemaInitializerItem,A(C({},r),{onClick:()=>{var i;s({type:"void",name:t.id,title:t.title,"x-component":"CardItem","x-component-props":{title:(i=t.title)!=null?i:`#${t.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:o,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${t.key}}}`}}}})}}))}function An({dataSource:e}){var s;const t=T.useFieldSchema(),{execution:o}=H();if(!o)return t.title;const r=Q.parse(e)({$jobsMapByNodeKey:((s=o.jobs)!=null?s:[]).reduce((a,i)=>Object.assign(a,{[i.nodeKey]:i.result}),{})});return n.jsx("pre",{className:l.css`
|
|
448
|
+
margin: 0;
|
|
449
|
+
`,children:JSON.stringify(r,null,2)})}Ne.Initializer=Sn,Ne.Result=An,Ne.Designer=Xt;const Pt=e=>{const t=De.evaluators.get(e);return t&&t.link?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:l.css`
|
|
450
|
+
&:after {
|
|
451
|
+
content: ':';
|
|
452
|
+
}
|
|
453
|
+
& + a {
|
|
454
|
+
margin-left: 0.25em;
|
|
455
|
+
}
|
|
456
|
+
`,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer",children:t.label})]}):null},Y=new Q.Registry;Y.register("equal",{name:"=",type:"boolean",group:"boolean"}),Y.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),Y.register("gt",{name:">",type:"boolean",group:"boolean"}),Y.register("gte",{name:"≥",type:"boolean",group:"boolean"}),Y.register("lt",{name:"<",type:"boolean",group:"boolean"}),Y.register("lte",{name:"≤",type:"boolean",group:"boolean"}),Y.register("add",{name:"+",type:"number",group:"number"}),Y.register("minus",{name:"-",type:"number",group:"number"}),Y.register("multiple",{name:"*",type:"number",group:"number"}),Y.register("divide",{name:"/",type:"number",group:"number"}),Y.register("mod",{name:"%",type:"number",group:"number"}),Y.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),Y.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),Y.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),Y.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),Y.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),Y.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),Y.register("concat",{name:`{{t("concat", { ns: "${u}" })}}`,type:"string",group:"string"});const Fn=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${u}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${u}" })}}`},{value:"date",title:`{{t("Date", { ns: "${u}" })}}`}];function Rt(e){return Array.from(Y.getEntities()).filter(([t,o])=>o.group===e)}function Tn({calculator:e,operands:t=[],onChange:o}){const r=l.useCompile(),s=y.useContext(to),a=s(),i=s(),c=y.useCallback(m=>o({calculator:e,operands:[m,t[1]]}),[e,o,t]),p=y.useCallback(m=>o({calculator:e,operands:[t[0],m]}),[e,o,t]),d=y.useCallback(m=>o({operands:t,calculator:m}),[o,t]);return n.jsxs("fieldset",{className:l.css`
|
|
457
|
+
display: flex;
|
|
458
|
+
gap: 0.5em;
|
|
459
|
+
align-items: center;
|
|
460
|
+
flex-wrap: wrap;
|
|
461
|
+
`,children:[n.jsx(l.Variable.Input,{changeOnSelect:!0,value:t[0],onChange:c,scope:a,useTypedConstant:!0}),n.jsx(g.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:d,placeholder:O("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:Fn.filter(m=>!!Rt(m.value).length).map(m=>n.jsx(g.Select.OptGroup,{label:r(m.title),children:Rt(m.value).map(([h,{name:v}])=>n.jsx(g.Select.Option,{value:h,children:r(v)},h))},m.value))}),n.jsx(l.Variable.Input,{changeOnSelect:!0,value:t[1],onChange:p,scope:i,useTypedConstant:!0})]})}function Nn({value:e,onChange:t,onRemove:o}){if(!e)return null;const{calculator:r,operands:s=[]}=e;return n.jsxs("div",{className:l.css`
|
|
462
|
+
display: flex;
|
|
463
|
+
position: relative;
|
|
464
|
+
margin: 0.5em 0;
|
|
465
|
+
`,children:[e.group?n.jsx(eo,{value:e.group,onChange:a=>t(A(C({},e),{group:a}))}):n.jsx(Tn,{operands:s,calculator:r,onChange:t}),n.jsx(g.Button,{"aria-label":"icon-close",onClick:o,type:"link",icon:n.jsx(V.CloseCircleOutlined,{})})]})}function eo({value:e,onChange:t}){const{t:o}=X.useTranslation(),{type:r="and",calculations:s=[]}=e,a=y.useCallback(()=>{t(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))},[e,s,t]),i=y.useCallback(()=>{t(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))},[e,s,t]),c=y.useCallback(d=>{s.splice(d,1),t(A(C({},e),{calculations:[...s]}))},[e,s,t]),p=y.useCallback((d,m)=>{s.splice(d,1,m),t(A(C({},e),{calculations:[...s]}))},[e,s,t]);return n.jsxs("div",{className:l.cx("node-type-condition-group",l.css`
|
|
466
|
+
position: relative;
|
|
467
|
+
width: 100%;
|
|
468
|
+
.node-type-condition-group {
|
|
469
|
+
padding: 0.5em 1em;
|
|
470
|
+
border: 1px dashed #ddd;
|
|
471
|
+
}
|
|
472
|
+
+ button {
|
|
473
|
+
position: absolute;
|
|
474
|
+
right: 0;
|
|
475
|
+
}
|
|
476
|
+
`),children:[n.jsx("div",{className:l.css`
|
|
477
|
+
display: flex;
|
|
478
|
+
align-items: center;
|
|
479
|
+
gap: 0.5em;
|
|
480
|
+
.ant-select {
|
|
481
|
+
width: auto;
|
|
482
|
+
min-width: 6em;
|
|
483
|
+
}
|
|
484
|
+
`,children:n.jsxs(X.Trans,{children:["Meet ",n.jsxs(g.Select,{role:"button","data-testid":"filter-select-all-or-any",value:r,onChange:d=>t(A(C({},e),{type:d})),children:[n.jsx(g.Select.Option,{value:"and",children:"All"}),n.jsx(g.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),n.jsx("div",{className:"calculation-items",children:s.map((d,m)=>n.jsx(Nn,{value:d,onChange:p.bind(this,m),onRemove:()=>c(m)},`${d.calculator}_${m}`))}),n.jsxs("div",{className:l.css`
|
|
485
|
+
button {
|
|
486
|
+
padding: 0;
|
|
487
|
+
&:not(:last-child) {
|
|
488
|
+
margin-right: 1em;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
`,children:[n.jsx(g.Button,{type:"link",onClick:a,children:o("Add condition")}),n.jsx(g.Button,{type:"link",onClick:i,children:o("Add condition group")})]})]})}const to=y.createContext(me);function oo({value:e,onChange:t,useVariableHook:o=me}){const r=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(to.Provider,{value:o,children:n.jsx(eo,{value:r.group,onChange:s=>t(A(C({},r),{group:s}))})})}function On(e){return n.jsx(g.Card,{children:n.jsx(gt.FormLayout,{layout:e.layout||"vertical",children:e.children})})}function no(e){var v;const{upstream:t,branchIndex:o=null}=e,r=l.usePlugin(le),s=l.useCompile(),{workflow:a}=(v=H())!=null?v:{},i=Array.from(r.instructions.getValues()),{styles:c}=ne(),{onCreate:p,creating:d}=et(),m=y.useMemo(()=>{const b=[{key:"control",label:`{{t("Control", { ns: "${u}" })}}`},{key:"calculation",label:`{{t("Calculation", { ns: "${u}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${u}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${u}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${u}" })}}`}].map(f=>{const k=i.filter(F=>F.group===f.key&&(F.isAvailable?F.isAvailable({engine:r,workflow:a,upstream:t,branchIndex:o}):!0));return A(C({},f),{type:"group",children:k.map(F=>({role:"button","aria-label":F.type,key:F.type,label:F.title}))})}).filter(f=>f.children.length);return s(b)},[o,s,r,i,t,a]),h=y.useCallback(f=>J(this,[f],function*({keyPath:b}){const[k]=b;p({type:k,upstream:t,branchIndex:o})}),[o,p,t]);return a?n.jsx("div",{className:c.addButtonClass,children:n.jsx(g.Dropdown,{menu:{items:m,onClick:h},disabled:a.executed,overlayClassName:l.css`
|
|
492
|
+
.ant-dropdown-menu-root {
|
|
493
|
+
max-height: 30em;
|
|
494
|
+
overflow-y: auto;
|
|
495
|
+
}
|
|
496
|
+
`,children:n.jsx(g.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:n.jsx(V.PlusOutlined,{}),loading:(d==null?void 0:d.upstreamId)==(t==null?void 0:t.id)&&(d==null?void 0:d.branchIndex)===o,size:"small"})})}):null}function $n(){const e=T.useForm(),t=l.useAPIClient(),{workflow:o,refresh:r}=H(),{presetting:s,setPresetting:a,setCreating:i}=et(),c=l.useActionContext();return{run(){return J(this,null,function*(){if(s){yield e.submit(),i(s.data);try{const{data:{data:d}}=yield t.resource("workflows.nodes",o.id).create({values:A(C({},s.data),{config:C(C({},s.data.config),e.values.config)})});typeof e.values.downstreamBranchIndex=="number"&&d.downstreamId&&(yield t.resource("flow_nodes").update({filterByTk:d.downstreamId,values:{branchIndex:e.values.downstreamBranchIndex,upstream:{id:d.id,downstreamId:null}},updateAssociationValues:["upstream"]})),c.setVisible(!1),a(null),r()}catch(d){console.error(d)}finally{i(null)}}})}}}const ro=y.createContext(null);function et(){return y.useContext(ro)}const En=[{label:`{{t('After end of branches', { ns: "${u}" })}}`,value:!1},{label:`{{t('Inside of branch', { ns: "${u}" })}}`,value:0}],Dn=T.observer(e=>{var i,c;const{presetting:t}=et(),{nodes:o}=H(),{values:r}=T.useForm(),s=y.useMemo(()=>{var v;if(!(t!=null&&t.instruction))return[];const{instruction:p,data:d}=t;if(!(d.upstreamId?o.find(b=>b.upstreamId===d.upstreamId&&b.branchIndex===d.branchIndex):o.find(b=>b.upstreamId===null)))return[];const h=typeof p.branching=="function"?p.branching((v=r.config)!=null?v:{}):p.branching;return h?h===!0?En:h:[]},[t,o,r.config]);if(!s.length)return null;const{data:a}=t;return n.jsx(l.SchemaComponent,{components:{RadioWithTooltip:ke},schema:{name:`${(i=a.type)!=null?i:"unknown"}-${(c=a.upstreamId)!=null?c:"root"}-${a.branchIndex}`,type:"void",properties:{downstreamBranchIndex:{type:"number",title:O("Move all downstream nodes to",{ns:u}),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:s,direction:"vertical"},default:!1,required:!0}}}})});function In(){const{presetting:e}=et();return e!=null&&e.instruction.presetFieldset?n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{config:{type:"object",properties:e.instruction.presetFieldset}}}}):null}function Pn(e){var M;const t=l.useAPIClient(),o=l.useCompile(),r=l.usePlugin(le),[s,a]=y.useState(null),[i,c]=y.useState(null),[p,d]=y.useState(!1),{workflow:m,nodes:h,refresh:v}=(M=H())!=null?M:{},b=y.useMemo(()=>fe.createForm(),[]),f=y.useCallback(S=>{S||(b.reset(),b.clearFormGraph("*"),c(null))},[b]),k=y.useCallback(S=>J(this,null,function*(){a(S);try{yield t.resource("workflows.nodes",m.id).create({values:S}),v()}catch(E){console.error(E)}finally{a(null)}}),[t,v,m.id]),F=y.useCallback(({type:S,upstream:E,branchIndex:L})=>{var N,B,G;const $=r.instructions.get(S);if(!$){console.error(`Instruction "${S}" not found`);return}const I={key:Q.uid(),type:S,upstreamId:(N=E==null?void 0:E.id)!=null?N:null,branchIndex:L,title:o($.title),config:(G=(B=$.createDefaultConfig)==null?void 0:B.call($))!=null?G:{}},D=E!=null&&E.id?h.find(U=>U.upstreamId===I.upstreamId&&U.branchIndex===I.branchIndex):h.find(U=>U.upstreamId===null);if($.presetFieldset||(typeof $.branching=="function"?$.branching(I.config):$.branching)&&D){c({data:I,instruction:$});return}k(I)},[o,k,r.instructions]);return n.jsxs(ro.Provider,{value:{presetting:i,setPresetting:c,onCreate:F,creating:s,setCreating:a},children:[e.children,n.jsx(l.ActionContextProvider,{value:{visible:!!i,setVisible:f,formValueChanged:p,setFormValueChanged:d,openSize:"small"},children:n.jsx(l.SchemaComponent,{components:{DownstreamBranchIndex:Dn,PresetFieldset:In},scope:{useCancelAction:l.useCancelAction,useAddNodeSubmitAction:$n},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:b},"x-component":"Action.Modal",title:`{{ t("Add node", { ns: "${u}" }) }}`,properties:{config:{type:"void","x-component":"PresetFieldset"},downstreamBranchIndex:{type:"void","x-component":"DownstreamBranchIndex"},footer:{"x-component":"Action.Modal.Footer",properties:{actions:{type:"void","x-component":"ActionBar",properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{type:"void",title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useAddNodeSubmitAction }}"}}}}}}}}})})]})}function tt({from:e=null,entry:t=null,branchIndex:o=null,controller:r=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=St(e,o),p=[];for(let d=t;d;d=d.downstream)p.push(d);return n.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(no,{"aria-label":c(),upstream:e,branchIndex:o}),n.jsx("div",{className:"workflow-node-list",children:p.map(d=>n.jsx(Gt,{data:d},d.id))}),a?n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})}):null]})}function Mn(){var a;const e=T.useForm(),t=l.useAPIClient(),{workflow:o}=(a=H())!=null?a:{},r=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return J(this,null,function*(){if(o.executed){g.message.error(O("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield t.resource("workflows").update({filterByTk:o.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class Mt{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function Bn(){const e=l.useCompile(),{workflow:t,execution:o}=H(),{styles:r}=ne(),s=Bt();return o?n.jsx(l.SchemaComponent,{components:{Tooltip:g.Tooltip},schema:{type:"void",name:"execution","x-decorator":"Tooltip","x-decorator-props":{title:O("View result")},"x-component":"Action","x-component-props":{title:n.jsx(V.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[o.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:n.jsxs("div",{className:l.cx(r.nodeTitleClass),children:[n.jsx(g.Tag,{children:e(s.title)}),n.jsx("strong",{children:t.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",o.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
|
|
497
|
+
padding: 1em;
|
|
498
|
+
background-color: #f3f3f3;
|
|
499
|
+
`},"x-read-pretty":!0}}}}}}):null}function Vn(){return{form:T.useForm()}}const jn=()=>{const e=l.useAPIClient(),{workflow:t,refresh:o}=H(),[r,s]=y.useState(""),[a,i]=y.useState(!1),[c,p]=y.useState(!1),{styles:d}=ne(),m=l.useCompile(),h=Bt();y.useEffect(()=>{var $,I;t&&s((I=($=t.triggerTitle)!=null?$:t.title)!=null?I:m(h==null?void 0:h.title))},[t,h]);const v=y.useMemo(()=>{const $=we.cloneDeep(t.config);return fe.createForm({initialValues:$,disabled:t.executed})},[t]),b=y.useCallback($=>{i($),$||v.reset()},[v]),f=y.useCallback(function($){return J(this,null,function*(){const I=$||m(h==null?void 0:h.title);s(I),I!==t.triggerTitle&&(yield e.resource("workflows").update({filterByTk:t.id,values:{triggerTitle:I}}),o())})},[t,h]),k=y.useCallback(function($){var D;if($.target===$.currentTarget){i(!0);return}const I=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let N=$.target;N&&N!==$.currentTarget;N=N.parentNode)if(Array.from((D=N.classList)!=null?D:[]).some(B=>I.has(B))){i(!0),$.stopPropagation();return}},[]),F=t.executed?'{{t("View")}}':'{{t("Configure")}}',M=O("Trigger");if(!h)return n.jsx(g.Tooltip,{title:O("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:d.nodeHeaderClass,children:n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(g.Tag,{color:"error",children:O("Unknown trigger")})})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:L}=h;return n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:l.cx(d.nodeCardClass),onClick:k,children:[n.jsxs("div",{className:d.nodeHeaderClass,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(g.Tag,{color:"gold",children:[n.jsx(V.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:m(h.title)})]})}),n.jsx("div",{className:"workflow-node-actions",children:n.jsx(Bn,{})})]}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,onChange:$=>s($.target.value),onBlur:$=>f($.target.value),autoSize:!0,disabled:t.executed})}),n.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:b,formValueChanged:c,setFormValueChanged:p},children:n.jsx(l.FormProvider,{form:v,children:n.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:Vn}),components:L,schema:{name:`workflow-trigger-${t.id}`,type:"void",properties:{config:{type:"void","x-content":F,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:M,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":zt,"x-component-props":{label:O("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
500
|
+
.ant-select.auto-width {
|
|
501
|
+
width: auto;
|
|
502
|
+
min-width: 6em;
|
|
503
|
+
}
|
|
504
|
+
`},properties:S},actions:C({},t.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Mn}}}})})}}}})})})]})};function Bt(){const e=l.usePlugin(le),{workflow:t}=H();return e.triggers.get(t.type)}function so({entry:e}){const{styles:t}=ne(),{workflow:o}=H(),[r,s]=y.useState(100);return n.jsxs("div",{className:"workflow-canvas-wrapper",children:[n.jsx(on,{FallbackComponent:l.ErrorFallback,onError:console.error,children:n.jsx(Pn,{children:n.jsx("div",{className:"workflow-canvas",style:{zoom:r/100},children:n.jsx("div",{className:l.cx(t.branchBlockClass,l.css`
|
|
505
|
+
margin-top: 0 !important;
|
|
506
|
+
`),children:n.jsxs("div",{className:t.branchClass,children:[o!=null&&o.executed?n.jsx(g.Alert,{type:"warning",message:O("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:l.css`
|
|
507
|
+
margin-bottom: 1em;
|
|
508
|
+
`}):null,n.jsx(jn,{}),n.jsx("div",{className:l.cx(t.branchBlockClass,l.css`
|
|
509
|
+
margin-top: 0 !important;
|
|
510
|
+
`),children:n.jsx(tt,{entry:e})}),n.jsx("div",{className:t.terminalClass,children:O("End")})]})})})})}),n.jsx("div",{className:"workflow-canvas-zoomer",children:n.jsx(g.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:r,onChange:s})})]})}function Wn(e,t=[]){const o=new Map;e.forEach(r=>{r.jobs=[],o.set(r.id,r)}),t.forEach(r=>{const s=o.get(r.nodeId);s.jobs.push(r),r.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(r=>{r.jobs=r.jobs.sort((s,a)=>s.id-a.id)})}function Ln(){const{instructions:e}=l.usePlugin(le),t=l.useCompile(),{viewJob:o,setViewJob:r}=H(),{styles:s}=ne(),{node:a={}}=o!=null?o:{},i=e.get(a.type);return n.jsx(l.ActionContextProvider,{value:{visible:!!o,setVisible:r},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`${o==null?void 0:o.id}-${o==null?void 0:o.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:n.jsxs("div",{className:s.nodeTitleClass,children:[n.jsx(g.Tag,{children:t(i==null?void 0:i.title)}),n.jsx("strong",{children:a.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:kt,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function zn(e){const{execution:t}=H(),o=l.useAPIClient(),r=se.useNavigate(),{styles:s}=ne(),[a,i]=y.useState([]),[c,p]=y.useState([]);y.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{i(m.data)}).catch(()=>{})},[t]),y.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{p(m.data.reverse())}).catch(()=>{})},[t]);const d=y.useCallback(({key:m})=>{m!=t.id&&r(qe(m))},[t]);return t?n.jsx(g.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${t.id}`],className:l.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,t,...a].map(m=>({key:m.id,label:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"id",children:`#${m.id}`}),n.jsx("time",{children:Q.str2moment(m.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:n.jsx("span",{children:n.jsx(Me,{statusMap:_e,status:m.status})})}))},children:n.jsxs(g.Space,{children:[n.jsx("strong",{children:`#${t.id}`}),n.jsx(V.DownOutlined,{})]})}):null}function Jn(){var S;const{t:e}=X.useTranslation(),t=l.useCompile(),{data:o,loading:r,refresh:s}=l.useResourceActionContext(),{setTitle:a}=l.useDocumentTitle(),[i,c]=y.useState(null),p=l.useApp(),d=l.useAPIClient();y.useEffect(()=>{var D;const{workflow:I}=(D=o==null?void 0:o.data)!=null?D:{};a==null||a(`${I!=null&&I.title?`${I.title} - `:""}${O("Execution history")}`)},[o==null?void 0:o.data]);const m=y.useCallback(()=>{g.Modal.confirm({title:O("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:O("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:o==null?void 0:o.data.id}).then(()=>{g.message.success(e("Operation succeeded")),s()}).catch(I=>{console.error(I.data.error)})}})},[o==null?void 0:o.data]);if(!(o!=null&&o.data))return r?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found"});const E=(S=o==null?void 0:o.data)!=null?S:{},{jobs:h=[],workflow:L={}}=E,$=L,{nodes:v=[],revisions:b=[]}=$,f=Z($,["nodes","revisions"]),k=Z(E,["jobs","workflow"]);vt(v),Wn(v,h);const F=v.find(I=>!I.upstream),M=_e[k.status];return n.jsxs(Ie.Provider,{value:{workflow:f.type?f:null,nodes:v,execution:k,viewJob:i,setViewJob:c},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:p.pluginSettingsManager.getRoutePath("workflow"),children:O("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx(se.Link,{to:Ce(f.id),children:f.title})})},{title:n.jsx(zn,{})}]})}),n.jsxs("aside",{children:[n.jsx(g.Tag,{color:M.color,children:t(M.label)}),k.status?null:n.jsx(g.Tooltip,{title:O("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:m,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})}),n.jsx("time",{children:Q.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),n.jsx(so,{entry:F}),n.jsx(Ln,{})]})}const lo=()=>{const e=se.useParams(),{styles:t}=ne();return n.jsx("div",{className:l.cx(t.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:Jn}})})},ao=()=>{const{t:e}=X.useTranslation(),{id:t}=l.useRecord(),{setVisible:o}=l.useActionContext();return n.jsx(se.Link,{to:qe(t),onClick:()=>o(!1),children:e("View")})},Un={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${u}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${u}" })}}`,"x-component"({value:e}){const{setVisible:t}=l.useActionContext();return n.jsx(se.Link,{to:Ce(e),onClick:()=>t(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${u}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:Ye}}]},io={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${u}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:Un,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=X.useTranslation(),{refresh:t,defaultRequest:o}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext();return{run(){return J(this,null,function*(){var i;yield r.destroy({filter:(i=o.params)==null?void 0:i.filter}),g.message.success(e("Operation succeeded")),t(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${u}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${u}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${u}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:`{{ $deps[0] !== ${ie.STARTED} }}`}}}]}}}}}}}}}}};function co(e){var a;const o=l.useCompile()(e.label),r=y.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(a=_e[e.value])!=null?a:{};return n.jsx(g.Tag,{color:s,onMouseDown:r,closable:e.closable,onClose:e.onClose,children:o})}function Hn(e){const t=l.useCompile();return n.jsxs(n.Fragment,{children:[n.jsx(co,C({},e)),e.description?n.jsx("span",{children:t(e.description)}):null]})}function Gn(t){var e=Z(t,[]);const o=e.multiple?"multiple":null;return n.jsx(g.Select,A(C({role:"button","data-testid":`select-${o||"single"}`},e),{mode:o,optionLabelProp:"label",tagRender:co,children:Ye.filter(r=>!!r.value&&r.value!==ie.ABORTED).map(r=>n.jsx(g.Select.Option,A(C({},r),{children:n.jsx(Hn,C({},r))}),r.value))}))}function uo(e){const{t}=X.useTranslation(),{refresh:o}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),s=l.useRecord(),a=y.useCallback(()=>{g.Modal.confirm({title:O("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:O("Are you sure you want to cancel the execution?"),onOk:()=>{r.cancel({filterByTk:s.id}).then(()=>{g.message.success(t("Operation succeeded")),o()}).catch(i=>{console.error(i.data.error)})}})},[s]);return n.jsxs("div",{className:l.css`
|
|
511
|
+
display: flex;
|
|
512
|
+
`,children:[e.children,s.status?null:n.jsx(g.Tooltip,{title:O("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})})]})}function po(){const e=l.useResourceActionContext();return{onClick(){return J(this,null,function*(){var o;(o=e==null?void 0:e.refresh)==null||o.call(e)})}}}function qn(r){var s=r,{request:e,filter:t={}}=s,o=Z(s,["request","filter"]);var c;const{workflow:a}=H(),i=A(C({},o),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))}function Yn(){var I;const e=se.useNavigate(),{t}=X.useTranslation(),o=l.useApp(),{data:r,refresh:s,loading:a}=l.useResourceActionContext(),{resource:i}=l.useResourceContext(),{setTitle:c}=l.useDocumentTitle(),[p,d]=y.useState(!1),{styles:m}=ne(),{modal:h}=g.App.useApp();if(y.useEffect(()=>{var B;const{title:N}=(B=r==null?void 0:r.data)!=null?B:{};c==null||c(`${O("Workflow")}${N?`: ${N}`:""}`)},[r==null?void 0:r.data]),!(r!=null&&r.data))return a?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found",extra:n.jsx(g.Button,{onClick:()=>e(-1),children:O("Go back")})});const D=(I=r==null?void 0:r.data)!=null?I:{},{nodes:v=[],revisions:b=[]}=D,f=Z(D,["nodes","revisions"]);vt(v);const k=v.find(N=>!N.upstream);function F({key:N}){N!=f.id&&e(Ce(N))}function M(N){return J(this,null,function*(){yield i.update({filterByTk:f.id,values:{enabled:N}}),s()})}function S(){return J(this,null,function*(){const{data:{data:N}}=yield i.revision({filterByTk:f.id,filter:{key:f.key}});g.message.success(t("Operation succeeded")),e(`/admin/workflow/workflows/${N.id}`)})}function E(){return J(this,null,function*(){const N=f.current?O("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:t("Are you sure you want to delete it?"),content:N,onOk(){return J(this,null,function*(){var G;yield i.destroy({filterByTk:f.id}),g.message.success(t("Operation succeeded")),e(f.current?o.pluginSettingsManager.getRoutePath("workflow"):Ce((G=b.find(U=>U.current))==null?void 0:G.id))})}})})}function L(B){return J(this,arguments,function*({key:N}){switch(N){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const $=f.executed&&!b.find(N=>!N.executed&&new Date(N.createdAt)>new Date(f.createdAt));return n.jsxs(Ie.Provider,{value:{workflow:f,nodes:v,refresh:s},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:o.pluginSettingsManager.getRoutePath("workflow"),children:O("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx("strong",{children:f.title})})}]})}),n.jsxs("aside",{children:[f.sync?n.jsx(g.Tag,{color:"orange",children:O("Synchronously")}):n.jsx(g.Tag,{color:"cyan",children:O("Asynchronously")}),n.jsx(g.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:F,defaultSelectedKeys:[`${f.id}`],className:l.cx(m.dropdownClass,m.workflowVersionDropdownClass),items:b.sort((N,B)=>B.id-N.id).map((N,B)=>({role:"button","aria-label":`version-${B}`,key:`${N.id}`,icon:N.current?n.jsx(V.RightOutlined,{}):null,className:l.cx({executed:N.executed,unexecuted:!N.executed,enabled:N.enabled}),label:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:`#${N.id}`}),n.jsx("time",{children:Q.str2moment(N.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:n.jsxs(g.Button,{type:"text","aria-label":"version",children:[n.jsx("label",{children:O("Version")}),n.jsx("span",{children:f!=null&&f.id?`#${f.id}`:null}),n.jsx(V.DownOutlined,{})]})}),n.jsx(g.Switch,{checked:f.enabled,onChange:M,checkedChildren:O("On"),unCheckedChildren:O("Off")}),n.jsx(g.Dropdown,{menu:{items:[{key:"key",label:`Key: ${f.key}`,disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:O("Execution history"),disabled:!f.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:O("Copy to new version"),disabled:!$},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:t("Delete")}],onClick:L},children:n.jsx(g.Button,{"aria-label":"more",type:"text",icon:n.jsx(V.EllipsisOutlined,{})})}),n.jsx(l.ActionContextProvider,{value:{visible:p,setVisible:d},children:n.jsx(l.SchemaComponent,{schema:io,components:{ExecutionResourceProvider:qn,ExecutionLink:ao,ExecutionStatusColumn:uo},scope:{useRefreshActionProps:po}})})]})]}),n.jsx(so,{entry:k})]})}const mo=()=>{const e=se.useParams(),{styles:t}=ne();return n.jsx("div",{className:l.cx(t.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:Yn}})})},_n=r=>{var s=r,{request:e,filter:t={}}=s,o=Z(s,["request","filter"]);var c;const a=l.useRecord(),i=A(C({},o),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))},Kn=()=>{const{t:e}=X.useTranslation(),{id:t}=l.useRecord(),{setVisible:o}=l.useActionContext(),{getAriaLabel:r}=l.useGetAriaLabelOfAction("Configure");return n.jsx(se.Link,{"aria-label":r(),to:Ce(t),onClick:()=>o(!1),children:e("Configure")})};function Zn(r){var s=r,{component:e="div",children:t}=s,o=Z(s,["component","children"]);const[a,i]=y.useState(!1),c=T.useFieldSchema();return n.jsxs(l.ActionContextProvider,{value:{visible:a,setVisible:i,fieldSchema:c},children:[y.createElement(e,A(C({},o),{onClick(){i(!0)}}),t),n.jsx(l.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Qn({data:e}){const{label:t,color:o,options:r}=e,s=l.useCompile();return n.jsxs(g.Space,{direction:"vertical",children:[n.jsx(g.Tag,{color:o,children:s(t)}),n.jsx(g.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(r.description)})]})}const fo={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${u}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:Qn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"radioGroup",uiSchema:{title:`{{t("Mode", { ns: "${u}" })}}`,type:"boolean","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{ t("Asynchronously", { ns: "${u}" }) }}`,value:!1,color:"cyan"},{label:`{{ t("Synchronously", { ns: "${u}" }) }}`,value:!0,color:"orange"}],required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${u}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${u}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${u}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${u}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},he={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${u}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${u}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${u}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${u}" }) }}`},{label:`{{ t("Synchronously", { ns: "${u}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${u}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${u}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},Xn={name:"workflow",type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:fo,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:fo},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${u}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${u}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=X.useTranslation(),{resource:t}=l.useResourceContext(),o=l.useResourceActionContext();return{run(){return J(this,null,function*(){yield t.sync(),yield o==null?void 0:o.refresh(),g.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:he.title,type:he.type,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(t){const o=l.useRecord();return y.createElement("a",C({"aria-label":`executed-${o.title}`},t))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:io}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:he.title,enabled:he.enabled,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${u}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${u}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=X.useTranslation(),{refresh:t}=l.useResourceActionContext(),{resource:o,targetKey:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext(),{[r]:a}=l.useRecord(),{values:i}=T.useForm();return{run(){return J(this,null,function*(){yield o.revision({filterByTk:a,values:i}),g.message.success(e("Operation succeeded")),t(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function Rn(e){const t=T.useField(),o=l.useRecord(),r=l.usePlugin(le);return T.useFormEffects(s=>{fe.onFieldChange("type",a=>{let i=o.id||!a.value;if(a.value){const c=r.triggers.get(a.value);c.sync!=null?(i=!0,t.setValue(c.sync)):t.setInitialValue(!1)}t.setPattern(i?"disabled":"editable")})}),y.useEffect(()=>{if(o.id){t.setPattern("disabled");const s=r.triggers.get(o.type);s.sync!=null?t.setValue(s.sync):t.setInitialValue(!1)}},[o.id,t,r.triggers]),n.jsx(ke,C({},e))}function er(e){const t=l.useApp();e.visible=!!(l.usePlugin("multi-app-share-collection")||t.name!=="main")}function tr(){const e=y.useContext(l.SchemaComponentContext),{useTriggersOptions:t}=l.usePlugin(le);return n.jsx(g.Card,{bordered:!1,children:n.jsx(l.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:n.jsx(l.SchemaComponent,{schema:Xn,components:{WorkflowLink:Kn,ExecutionResourceProvider:_n,ExecutionLink:ao,OpenDrawer:Zn,ExecutionStatusSelect:Gn,SyncOptionSelect:Rn,ExecutionStatusColumn:uo,Tooltip:g.Tooltip},scope:{useTriggersOptions:t,useWorkflowSyncAction:er,useRefreshActionProps:po}})})})}const de={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},ho={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:l.css`
|
|
513
|
+
flex-direction: column;
|
|
514
|
+
`},"x-component":"CollectionFieldset"},ot={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=T.useForm(),[t,o]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(o,t),className:l.css`
|
|
515
|
+
position: relative;
|
|
516
|
+
width: 100%;
|
|
517
|
+
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},or={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},nr={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1},default:20}}}}}}},We={type:"array",title:`{{t("Preload associations", { ns: "${u}" })}}`,description:`{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=T.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function rr(){const e=l.useAPIClient(),t=T.useForm(),{field:o,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=se.useNavigate(),i=T.useFieldSchema(),c=T.useField(),p=l.useCompile(),{modal:d}=g.App.useApp(),m=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return J(this,null,function*(){var M,S,E;const{onSuccess:b,skipValidator:f,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};f||(yield t.submit());const F=yield m();c.data=o.data||{},c.data.loading=!0;try{const L=yield e.resource("workflows").trigger({values:F,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=L,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(b!=null&&b.successMessage))return;b!=null&&b.manualClose?d.success({title:p(b==null?void 0:b.successMessage),onOk:()=>J(this,null,function*(){yield t.reset(),b!=null&&b.redirecting&&(b!=null&&b.redirectTo)&&(Q.isURL(b.redirectTo)?window.location.href=b.redirectTo:a(b.redirectTo))})}):g.message.success(p(b==null?void 0:b.successMessage))}catch(L){c.data.loading=!1}})}}}function sr(){var b;const e=l.useCompile(),t=l.useAPIClient(),o=l.useRecord(),r=T.useField(),s=T.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:p}=l.useActionContext(),{modal:d}=g.App.useApp(),m=se.useNavigate(),{onSuccess:h,triggerWorkflows:v}=(b=s==null?void 0:s["x-action-settings"])!=null?b:{};return{onClick(k,F){return J(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:v!=null&&v.length?v.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),F&&F(),c==null||c(!1),p==null||p(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let M;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return J(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(Q.isURL(h.redirectTo)?window.location.href=h.redirectTo:m(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{r.data.loading=!1}})}}}function lr(){const{workflow:e}=H();return!!(e!=null&&e.executed)}function yo(){const{workflow:e}=H();return!!(e!=null&&e.allExecuted)}const Se={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},ar=[{label:`{{t("After record added", { ns: "${u}" })}}`,value:Se.CREATED},{label:`{{t("After record updated", { ns: "${u}" })}}`,value:Se.UPDATED},{label:`{{t("After record added or updated", { ns: "${u}" })}}`,value:Se.SAVED},{label:`{{t("After record deleted", { ns: "${u}" })}}`,value:Se.DELETED}];function ir(e,t){var p;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:O("Trigger data")}}];return Te(A(C({appends:["data",...((p=e.appends)==null?void 0:p.map(d=>`data.${d}`))||[]]},t),{fields:i,compile:s,getCollectionFields:a}))}class cr extends Mt{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${u}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${u}" })}}`,className:"auto-width"},enum:ar,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${u}" })}}`,description:`{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Se.UPDATED})}}`}}}]},condition:A(C({},ot),{title:`{{t("Only triggers when match conditions", { ns: "${u}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${Se.DELETED})}}`}}}]}),appends:A(C({},We),{"x-reactions":[...We["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Se.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:yo});w(this,"components",{FieldsSelect:Ct});w(this,"useVariables",ir)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}const Ae={STATIC:0,DATE_FIELD:1};function dr(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function go({value:e,onChange:t}){const o=e!=null?e:{},{t:r}=X.useTranslation(),[s,a]=y.useState(o.offset?o.offset/Math.abs(o.offset):0);return n.jsxs("fieldset",{className:l.css`
|
|
518
|
+
display: flex;
|
|
519
|
+
gap: 0.5em;
|
|
520
|
+
`,children:[n.jsx(Ct,{value:o.field,onChange:i=>t(A(C({},o),{field:i})),filter:dr,placeholder:r("Select field"),className:"auto-width"}),o.field?n.jsx(g.Select,{value:s,onChange:i=>{a(i),t(A(C({},o),{offset:Math.abs(o.offset)*i}))},options:[{value:0,label:O("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(g.InputNumber,{value:Math.abs(o.offset),onChange:i=>t(A(C({},o),{offset:(i!=null?i:0)*s}))}),n.jsx(g.Select,{value:o.unit||864e5,onChange:i=>t(A(C({},o),{unit:i})),options:[{value:864e5,label:O("Days")},{value:36e5,label:O("Hours")},{value:6e4,label:O("Minutes")},{value:1e3,label:O("Seconds")}],className:"auto-width"})]}):null]})}function ur({value:e,onChange:t}){const{t:o}=xt(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
|
|
521
|
+
display: flex;
|
|
522
|
+
gap: 0.5em;
|
|
523
|
+
`,children:[n.jsxs(g.Select,{value:r,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(g.Select.Option,{value:null,children:o("No end")}),n.jsx(g.Select.Option,{value:"field",children:o("By field")}),n.jsx(g.Select.Option,{value:"date",children:o("By custom date")})]}),r==="field"?n.jsx(go,{value:e,onChange:t}):null,r==="date"?n.jsx(g.DatePicker,{showTime:!0,value:en(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var s in t=arguments[o])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},re.apply(this,arguments)};function bo(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(o[r[s]]=e[r[s]])}return o}function nt(e,t,o){if(o||arguments.length===2)for(var r,s=0,a=t.length;s<a;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}var pr=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Fe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],j={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function xo(e,t){for(var o=[],r=e;r<=t;r++)o.push(r);return o}function rt(e){return e.sort(function(t,o){return t-o}),e}function vo(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ue(e){return Object.entries(e).filter(function(t){var o=t[0],r=t[1];return o&&r}).map(function(t){return t[0]}).join(" ")}function wo(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||j.errorInvalidCron})}function st(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function Co(e,t,o,r,s,a,i,c,p,d,m,h,v,b){o&&o(void 0),t(!1);var f=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void b("reboot");var k=pr.find(function(S){return S.name===e});k&&(e=k.value)}try{var F=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(L,$){return function(I,D){if(I==="*"||I==="*/1")return[];var N=rt(vo(Fo(function(G,U,pe){if(pe){G=G.toUpperCase();for(var P=0;P<pe.length;P++)G=G.replace(pe[P],"".concat(P+U))}return G}(I,D.min,D.alt).split(",").map(function(G){var U,pe=G.split("/");if(pe.length>2)throw new Error('Invalid value "'.concat(I,' for "').concat(D.type,'"'));var P=pe[0],W=pe[1];U=P==="*"?xo(D.min,D.max):function(q,_,R){var ee=q.split("-");if(ee.length===1){var ze=st(ee[0]);if(isNaN(ze))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));return[ze]}if(ee.length===2){var ye=st(ee[0]),$e=st(ee[1]);if(isNaN(ye)||isNaN($e))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));if($e<ye)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return xo(ye,$e)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,I,D);var z=function(q,_){if(q!==void 0){var R=st(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(_.type));return R}}(W,D),ae=function(q,_){if(_){var R=q[0];q=q.filter(function(ee){return ee%_==R%_||ee===R})}return q}(U,z);return ae}).flat(),D))),B=To(N,D);if(B!==void 0)throw new Error('Value "'.concat(B,'" out of range for ').concat(D.type));return N.length===D.total?[]:N}(L,Fe[$])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(F);b(M),p(F[0]),d(F[1]),m(F[2]),h(F[3]),v(F[4])}catch(S){f=!0}}f&&(s.current=e,t(!0),wo(o,i))}function ko(e,t,o,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(p,d){return p.map(function(m,h){var v=Fe[h];return So(Ao(m,v),v,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!o?[]:o,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function So(e,t,o,r,s){var a="";if(function(c,p){return c.length===p.max-p.min+1}(e,t)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var p=c[1]-c[0];if(p>1)return p}}(e);a=i&&function(c,p){for(var d=1;d<c.length;d++){var m=c[d-1];if(c[d]-m!==p)return!1}return!0}(e,i)?function(c,p,d){var m=No(c),h=Oo(c),v=c.length===(h-m)/d+1;return!!(m===p.min&&h+d>p.max&&v)}(e,t,i)?"*/".concat(i):"".concat(Oe(No(e),t,o,r,s),"-").concat(Oe(Oo(e),t,o,r,s),"/").concat(i):function(c){var p=[],d=null;return c.forEach(function(m,h,v){m!==v[h+1]-1?d!==null?(p.push([d,m]),d=null):p.push(m):d===null&&(d=m)}),p}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],t,o,r,s),"-").concat(Oe(c[1],t,o,r,s)):Oe(c,t,o,r,s)}).join(",")}return a}function Oe(e,t,o,r,s){var a=e.toString(),i=t.type,c=t.alt,p=t.min,d=r&&(r===!0||r.includes(i)),m=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(o&&i==="week-days"||o&&i==="months"?a=c[e-p]:e<10&&(d||m)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",v=e%12||12;v<10&&d&&(v=v.toString().padStart(2,"0")),a="".concat(v).concat(h)}return a}function Ao(e,t){var o=rt(vo(Fo(e,t)));if(o.length===0)return o;var r=To(o,t);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(t.type));return o}function Fo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function To(e,t){var o=e[0],r=e[e.length-1];return o<t.min?o:r>t.max?r:void 0}function No(e){return e[0]}function Oo(e){return e[e.length-1]}function Le(e){var t=e.value,o=e.grid,r=o===void 0||o,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,p=e.humanizeLabels,d=e.disabled,m=e.readOnly,h=e.leadingZero,v=e.clockFormat,b=e.period,f=e.unit,k=e.periodicityOnDoubleClick,F=e.mode,M=bo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=y.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(P){return P.toString()})},[t]),E=y.useMemo(function(){return s?s.map(function(P,W){return{value:(f.min===0?W:W+1).toString(),label:P}}):nt([],Array(f.total),!0).map(function(P,W){var z=f.min===0?W:W+1;return{value:z.toString(),label:Oe(z,f,p,h,v)}})},[s,h,p,v]),L=JSON.stringify(i),$=y.useCallback(function(P){var W=P.value;if(!t||t[0]!==Number(W))return n.jsx(n.Fragment,{});var z=So(Ao(t,f),f,p,h,v),ae=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:ae[1]?"".concat(i.everyText||j.everyText," ").concat(ae[1]):z})},[t,L,p,h,v]),I=y.useCallback(function(P){var W=Array.isArray(P)?rt(P):[P],z=W;t&&(z=F==="single"?[]:nt([],t,!0),W.forEach(function(ae){var q=Number(ae);z=t.some(function(_){return _===q})?z.filter(function(_){return _!==q}):rt(nt(nt([],z,!0),[q],!1))})),z.length===f.total?a([]):a(z)},[a,t]),D=y.useCallback(function(P){if(P!==0&&P!==1){for(var W=f.total+f.min,z=[],ae=f.min;ae<W;ae++)ae%P==0&&z.push(ae);var q=t&&z&&t.length===z.length&&t.every(function(R,ee){return R===z[ee]}),_=z.length===E.length;a(_||q?[]:z)}else a([])},[t,E,a]),N=y.useRef([]),B=y.useCallback(function(P){if(!m){var W=N.current;W.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&W.length>1&&W[W.length-1].time-W[W.length-2].time<300?W[W.length-1].value===W[W.length-2].value?D(Number(P)):I([W[W.length-2].value,W[W.length-1].value]):I(Number(P)),N.current=[]},300);return function(){window.clearTimeout(z)}}},[N,I,D,m,k]),G=y.useCallback(function(){m||a([])},[a,m]),U=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),pe=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&b!=="hour"&&b!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(b==="day"||b==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&v==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,P))},[c,r,v,b]);return n.jsx(g.Select,re({mode:F!=="single"||k?"multiple":void 0,allowClear:!m,virtual:!1,open:!m&&void 0,value:S,onClear:G,tagRender:$,className:U,popupClassName:pe,options:E,showSearch:!1,showArrow:!m,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:B,onDeselect:B,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||b==="day"||b==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},M))}function mr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,p=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-hours")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||j.prefixHours}),n.jsx(Le,{placeholder:r.emptyHours||j.emptyHours,value:t,unit:Fe[1],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:p,period:d,periodicityOnDoubleClick:m,mode:h})]}))}function fr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,p=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-minutes")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||j.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||j.prefixMinutes}),n.jsx(Le,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||j.emptyMinutesForHourPeriod:r.emptyMinutes||j.emptyMinutes,value:t,unit:Fe[0],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:p,period:d,periodicityOnDoubleClick:m,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||j.suffixMinutesForHourPeriod})]}))}function hr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,p=e.leadingZero,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=!a||a.length===0,b=y.useMemo(function(){var F;return ue(((F={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!v})["".concat(s,"-field")]=!!s,F["".concat(s,"-month-days")]=!!s,F))},[s,v]),f=JSON.stringify(r),k=y.useMemo(function(){return v?r.emptyMonthDays||j.emptyMonthDays:r.emptyMonthDaysShort||j.emptyMonthDaysShort},[v,f]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:b},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||j.prefixMonthDays}),n.jsx(Le,{placeholder:k,value:t,setValue:o,unit:Fe[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:p,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function yr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,p=e.period,d=e.periodicityOnDoubleClick,m=e.mode,h=r.months||j.months,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-months")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||j.prefixMonths}),n.jsx(Le,{placeholder:r.emptyMonths||j.emptyMonths,optionsList:h,grid:!1,value:t,unit:re(re({},Fe[3]),{alt:r.altMonths||j.altMonths}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:p,periodicityOnDoubleClick:d,mode:m})]}))}function gr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,p=e.allowedPeriods,d=[];p.includes("year")&&d.push({value:"year",label:r.yearOption||j.yearOption}),p.includes("month")&&d.push({value:"month",label:r.monthOption||j.monthOption}),p.includes("week")&&d.push({value:"week",label:r.weekOption||j.weekOption}),p.includes("day")&&d.push({value:"day",label:r.dayOption||j.dayOption}),p.includes("hour")&&d.push({value:"hour",label:r.hourOption||j.hourOption}),p.includes("minute")&&d.push({value:"minute",label:r.minuteOption||j.minuteOption}),p.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||j.rebootOption});var m=y.useCallback(function(f){i||o(f)},[o,i]),h=y.useMemo(function(){var f;return ue(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),v=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,r.prefixPeriod]),b=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,f["".concat(s,"-select-dropdown-period")]=!!s,f))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||j.prefixPeriod}),n.jsx(g.Select,{defaultValue:t,value:t,onChange:m,options:d,className:v,popupClassName:b,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function br(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,p=e.readOnly,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=r.weekDays||j.weekDays,b=d==="week"||!i||i.length===0,f=y.useMemo(function(){var E;return ue(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!b})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,b]),k=JSON.stringify(r),F=y.useMemo(function(){return b?r.emptyWeekDays||j.emptyWeekDays:r.emptyWeekDaysShort||j.emptyWeekDaysShort},[b,k]),M=d==="week"||!p||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),S=!p||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return M?n.jsxs("div",re({className:f},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||j.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||j.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(Le,{placeholder:F,optionsList:v,grid:!1,value:t,unit:re(re({},Fe[4]),{alt:r.altWeekDays||j.altWeekDays}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:p,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function xr(e){var t=e.clearButton,o=t===void 0||t,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,p=c===void 0?j:c,d=e.value,m=d===void 0?"":d,h=e.setValue,v=e.displayError,b=v===void 0||v,f=e.onError,k=e.className,F=e.defaultPeriod,M=F===void 0?"day":F,S=e.allowEmpty,E=S===void 0?"for-default-value":S,L=e.humanizeLabels,$=L===void 0||L,I=e.humanizeValue,D=I!==void 0&&I,N=e.disabled,B=N!==void 0&&N,G=e.readOnly,U=G!==void 0&&G,pe=e.leadingZero,P=pe!==void 0&&pe,W=e.shortcuts,z=W===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:W,ae=e.clockFormat,q=e.periodicityOnDoubleClick,_=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,ze=e.allowedDropdowns,ye=ze===void 0?["period","months","month-days","week-days","hours","minutes"]:ze,$e=e.allowedPeriods,Lr=$e===void 0?["year","month","week","day","hour","minute","reboot"]:$e,Ee=y.useRef(m),Vt=y.useRef(M),Vo=y.useState(),ve=Vo[0],lt=Vo[1],jo=y.useState(),Je=jo[0],at=jo[1],Wo=y.useState(),it=Wo[0],ct=Wo[1],Lo=y.useState(),Ue=Lo[0],dt=Lo[1],zo=y.useState(),ut=zo[0],pt=zo[1],Jo=y.useState(),mt=Jo[0],ft=Jo[1],Uo=y.useState(!1),jt=Uo[0],He=Uo[1],Ho=y.useState(!1),ht=Ho[0],Go=Ho[1],zr=function(K){var ge=y.useRef(K);return y.useEffect(function(){ge.current=K},[K]),ge.current}(ht),qo=JSON.stringify(p);y.useEffect(function(){Co(m,He,f,E,Ee,!0,p,z,ft,pt,at,ct,dt,lt)},[]),y.useEffect(function(){m!==Ee.current&&Co(m,He,f,E,Ee,!1,p,z,ft,pt,at,ct,dt,lt)},[m,Ee,qo,E,z]),y.useEffect(function(){if(!(ve||mt||it||Je||Ue||ut)||ht||zr)ht&&Go(!1);else{var K=ve||Vt.current,ge=ko(K,it,Je,Ue,ut,mt,D);h(ge,{selectedPeriod:K}),Ee.current=ge,f&&f(void 0),He(!1)}},[ve,Je,it,Ue,ut,mt,D,ht]);var Yo=y.useCallback(function(){at(void 0),ct(void 0),dt(void 0),pt(void 0),ft(void 0);var K="",ge=ve!=="reboot"&&ve?ve:Vt.current;ge!==ve&<(ge),i==="fill-with-every"&&(K=ko(ge,void 0,void 0,void 0,void 0,void 0)),h(K,{selectedPeriod:ge}),Ee.current=K,Go(!0),E==="never"&&i==="empty"?(He(!0),wo(f,p)):(f&&f(void 0),He(!1))},[ve,h,f,i]),Jr=y.useMemo(function(){var K;return ue(((K={"react-js-cron":!0,"react-js-cron-error":jt&&b,"react-js-cron-disabled":B,"react-js-cron-read-only":U})["".concat(k)]=!!k,K["".concat(k,"-error")]=jt&&b&&!!k,K["".concat(k,"-disabled")]=B&&!!k,K["".concat(k,"-read-only")]=U&&!!k,K))},[k,jt,b,B,U]),Wt=s.className,_o=bo(s,["className"]),Ko=y.useMemo(function(){var K;return ue(((K={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,K["".concat(Wt)]=!!Wt,K))},[k,Wt]),Ur=JSON.stringify(_o),Zo=y.useMemo(function(){return o&&!U?n.jsx(g.Button,re({className:Ko,danger:!0,type:"primary",disabled:B},_o,{onClick:Yo},{children:p.clearButtonText||j.clearButtonText})):null},[o,U,qo,Ko,B,Ur,Yo]),te=ve||Vt.current;return n.jsxs("div",re({className:Jr},{children:[ye.includes("period")&&n.jsx(gr,{value:te,setValue:lt,locale:p,className:k,disabled:B,readOnly:U,shortcuts:z,allowedPeriods:Lr}),te==="reboot"?Zo:n.jsxs(n.Fragment,{children:[te==="year"&&ye.includes("months")&&n.jsx(yr,{value:it,setValue:ct,locale:p,className:k,humanizeLabels:$,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month")&&ye.includes("month-days")&&n.jsx(hr,{value:Je,setValue:at,locale:p,className:k,weekDays:Ue,disabled:B,readOnly:U,leadingZero:P,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month"||te==="week")&&ye.includes("week-days")&&n.jsx(br,{value:Ue,setValue:dt,locale:p,className:k,humanizeLabels:$,monthDays:Je,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),n.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&ye.includes("hours")&&n.jsx(mr,{value:ut,setValue:pt,locale:p,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,period:te,periodicityOnDoubleClick:_,mode:ee}),te!=="minute"&&ye.includes("minutes")&&n.jsx(fr,{value:mt,setValue:ft,locale:p,period:te,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,periodicityOnDoubleClick:_,mode:ee}),Zo]})]})]}))}const $o=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Eo(e){return $o.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function vr(e){let t;switch(typeof e){case"number":return t=Eo(e),t?t.value:"none";case"string":return"cron"}return"none"}function wr({value:e,onChange:t}){const{t:o}=xt(),r=Eo(e);return n.jsx(g.InputNumber,{value:e/r.value,onChange:s=>t(s*r.value),min:1,addonBefore:o("Every"),addonAfter:o(r.unitText),className:"auto-width"})}function Cr({value:e=null,onChange:t}){const{t:o}=xt(),r=vr(e),s=y.useCallback(a=>{if(a==="none"){t(null);return}if(a==="cron"){t("0 * * * * *");return}t(a)},[t]);return n.jsxs("fieldset",{className:l.css`
|
|
524
|
+
display: flex;
|
|
525
|
+
flex-direction: ${r==="cron"?"column":"row"};
|
|
526
|
+
align-items: flex-start;
|
|
527
|
+
gap: 0.5em;
|
|
528
|
+
|
|
529
|
+
.react-js-cron {
|
|
530
|
+
width: 100%;
|
|
531
|
+
padding: 0.5em 0.5em 0 0.5em;
|
|
532
|
+
border: 1px dashed #ccc;
|
|
533
|
+
|
|
534
|
+
.react-js-cron-field {
|
|
535
|
+
margin-bottom: 0.5em;
|
|
536
|
+
|
|
537
|
+
> span {
|
|
538
|
+
margin: 0 0.5em 0 0;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
> .react-js-cron-select {
|
|
542
|
+
margin: 0 0.5em 0 0;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.react-js-cron-week-days {
|
|
547
|
+
> span {
|
|
548
|
+
min-width: 2em;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
`,children:[n.jsx(g.Select,{value:r,onChange:s,className:"auto-width",children:$o.map(a=>n.jsx(g.Select.Option,{value:a.value,children:o(a.text)},a.value))}),typeof r=="number"?n.jsx(wr,{value:e,onChange:t}):null,r==="cron"?n.jsx(xr,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>t(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const kr={[Ae.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${u}" })}}`,min:0}}},[Ae.DATE_FIELD]:{collection:A(C({},de),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${u}" })}}`,min:0}},appends:A(C({},We),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${Ae.DATE_FIELD} && $deps[1]}}`}}}]})}},Sr=[{value:Ae.STATIC,label:`{{t("Based on certain date", { ns: "${u}" })}}`},{value:Ae.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${u}" })}}`}],Ar=()=>{const{values:e={},clearFormGraph:t}=T.useForm(),[o,r]=y.useState(e.mode);return T.useFormEffects(()=>{fe.onFieldValueChange("mode",s=>{r(s.value),t("collection"),t("startsOn"),t("repeat"),t("endsOn"),t("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${u}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:Sr},required:!0,default:Ae.STATIC}}),n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${o}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
553
|
+
.ant-input-number {
|
|
554
|
+
width: auto;
|
|
555
|
+
min-width: 6em;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.ant-picker {
|
|
559
|
+
width: auto;
|
|
560
|
+
}
|
|
561
|
+
`},properties:kr[o]}}},components:{OnField:go,RepeatField:Cr,EndsByField:ur}})]})};function Fr(e,t){var c;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[];if((!(t!=null&&t.types)||t.types.includes("date"))&&i.push({key:"date",value:"date",label:O("Trigger time")}),e.mode===Ae.DATE_FIELD){const[p]=Te(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},t),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:O("Trigger data")}}],compile:s,getCollectionFields:a}));p&&i.push(p)}return i}class Tr extends Mt{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${u}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${u}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:Ar});w(this,"useVariables",Fr)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}class Nr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${u}" })}}`);w(this,"type","calculation");w(this,"group","calculation");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${u}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"formula.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(o,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(p){return O("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:Pt});w(this,"components",{WorkflowVariableTextArea:It,RadioWithTooltip:ke,ValueBlock:Ne})}useVariables({key:o,title:r},{types:s,fieldNames:a=Ve}){return s&&!s.some(i=>i in Qe||Object.values(Qe).some(c=>c.has(i)))?null:{value:o,label:r}}useInitializers(o){var r,s;return{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Ne.Initializer,node:o,resultTitle:O("Calculation result")}}}const Do={DEFAULT:null,ON_TRUE:1,ON_FALSE:0};class Or extends be{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${u}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${u}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${u}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${u}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${u}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([o])=>["math.js","formula.js"].includes(o))].reduce((o,[r,s])=>o.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"object",title:`{{t("Condition", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(o,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(p){return O("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"presetFieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t('Continue when "Yes"', { ns: "${u}" })}}`,value:!0},{label:`{{t('Branch into "Yes" and "No"', { ns: "${u}" })}}`,value:!1}],default:!0}});w(this,"branching",({rejectOnFalse:o=!0}={})=>o?!1:[{label:`{{t('After end of branches', { ns: "${u}" })}}`,value:!1},{label:`{{t('Inside of "Yes" branch', { ns: "${u}" })}}`,value:Do.ON_TRUE},{label:`{{t('Inside of "No" branch', { ns: "${u}" })}}`,value:Do.ON_FALSE}]);w(this,"scope",{renderEngineReference:Pt,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:oo,WorkflowVariableTextArea:It,RadioWithTooltip:ke})}Component({data:o}){const{t:r}=X.useTranslation(),{nodes:s}=H(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=o,p=s.find(m=>m.upstreamId===i&&m.branchIndex===1),d=s.find(m=>m.upstreamId===i&&m.branchIndex===0);return n.jsx(Tt,{data:o,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(tt,{from:o,entry:d,branchIndex:0}),n.jsx(tt,{from:o,entry:p,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class $r extends be{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${u}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${u}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${u}" })}}`,value:ce.RESOLVED},{label:`{{t("Failed", { ns: "${u}" })}}`,value:ce.FAILED}],required:!0,default:ce.RESOLVED}});w(this,"end",!0)}}function Er({key:e,title:t,config:o},r){var d,m;const[s,a]=l.parseCollectionName(o.collection),i=l.useCompile(),c=je(s),[p]=Te(A(C({appends:[e,...((m=(d=o.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:t}}],compile:i,getCollectionFields:c}));return p}class Dr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${u}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${u}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${u}" })}}`},{label:`{{t("Multiple records", { ns: "${u}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${u}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:ot,sort:or,pagination:nr,appends:We},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${u}" })}}`}});w(this,"scope",{useNodeSavedConfig:Be,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const o=l.useCompile(),{values:r}=T.useForm(),[s,a]=l.parseCollectionName(r.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const m=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(m!=null&&m.sortable)}).map(d=>{var m,h;return{value:d.name,label:(m=d==null?void 0:d.uiSchema)!=null&&m.title?o((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:gt.ArrayItems,FilterDynamicComponent:Re,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:Dt,RadioWithTooltip:ke});w(this,"useVariables",Er)}useInitializers(o){var r,s;return!o.config.collection||o.config.multiple?null:{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Pe,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}}}function Ir(e){const{getCollectionFields:t}=l.useCollectionManager_deprecated(),{path:o}=T.useField(),r=o.segments[o.segments.length-1],{values:s}=T.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=t(i,a),{type:p}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,m=y.useCallback(h=>{const v=h.target.value.trim(),b=["belongsTo","hasOne"].includes(p)?v||null:v.split(",").map(f=>f.trim()).filter(f=>f!=="");e.onChange(b)},[e.onChange,p]);return n.jsx(g.Input,A(C({},e),{value:d,onChange:m}))}const Io=T.observer(({value:e,disabled:t,onChange:o,filter:r})=>{const{token:s}=l.useToken(),{t:a}=X.useTranslation(),i=l.useCompile(),c=T.useForm(),{getCollectionFields:p}=l.useCollectionManager_deprecated(),d=me(),{values:m}=c,[h,v]=l.parseCollectionName(m==null?void 0:m.collection),b=p(v,h).filter(S=>S.uiSchema),f=r?b.filter(r.bind(m)):b,k=y.useMemo(()=>f.filter(S=>!e||!(S.name in e)),[f,e]),F=t||c.disabled,M=y.useMemo(()=>({onClick:({key:S})=>{o(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,L;return{key:S.name,label:i((L=(E=S.uiSchema)==null?void 0:E.title)!=null?L:S.name)}})}),[o,k,e]);return n.jsx("fieldset",{className:l.css`
|
|
562
|
+
margin-top: 0.5em;
|
|
563
|
+
|
|
564
|
+
> .ant-formily-item {
|
|
565
|
+
flex-direction: column;
|
|
566
|
+
|
|
567
|
+
> .ant-formily-item-label {
|
|
568
|
+
line-height: 32px;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
`,children:f.length?n.jsxs(l.CollectionProvider_deprecated,{name:v,dataSource:h,children:[f.filter(S=>e&&S.name in e).map(S=>{var L,$;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?Ir:l.CollectionField;return n.jsxs(g.Form.Item,{label:i(($=(L=S.uiSchema)==null?void 0:L.title)!=null?$:S.name),labelAlign:"left",className:l.css`
|
|
572
|
+
.ant-form-item-control-input-content {
|
|
573
|
+
display: flex;
|
|
574
|
+
}
|
|
575
|
+
`,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:I=>{o(A(C({},e),{[S.name]:I}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),F?null:n.jsx(g.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(V.CloseCircleOutlined,{}),onClick:()=>{var N;const B=e,{[N=S.name]:I}=B,D=Z(B,[Ro(N)]);o(D)}})]},S.name)}),k.length?n.jsx(g.Dropdown,{menu:M,children:n.jsx(g.Button,{icon:n.jsx(V.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:O("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Po(e,t){t(e),e!=null&&e.properties&&Object.values(e.properties).forEach(o=>{Po(o,t)})}function Mo(){return{name:oe.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Bo(e){const{workflow:t}=H(),{setFormValueChanged:o}=l.useActionContext();l.useAPIClient();const r=me(),{values:s,setValuesIn:a,disabled:i}=T.useForm(),c=Ge.toJS(s.params),[p,d]=l.parseCollectionName(s.collection),m=l.useSchemaOptionsContext(),[h,v]=y.useState(e.value&&Object.keys(e.value).length?e.value:Mo()),b=y.useMemo(()=>fe.createForm({initialValues:c.values,disabled:t.executed,effects(){fe.onFormValuesChange(k=>{a("params.values",Ge.toJS(k.values)),o(!0)})}}),[t.executed]);T.useFormEffects(()=>{fe.onFieldValueChange("collection",k=>J(this,null,function*(){b.clearFormGraph("*");const F=Mo();a("params.values",{}),v(F)}))});const f=y.useCallback(k=>{const[F]=Object.values(k.toJSON().properties);e.onChange(F);const M=new Set;Po(F,E=>{var L;if(E["x-component"]==="AssignedField"&&(L=E["x-collection-field"])!=null&&L.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");M.add($)}});const S={};Array.from(M).forEach(E=>{E in b.values&&(S[E]=b.values[E])}),a("params.values",S)},[d,e.onChange]);return n.jsx(g.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:p,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.RerenderDataBlockProvider,{children:n.jsx(l.FormProvider,{form:b,children:n.jsx(gt.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:b,designable:!i,children:n.jsx(l.SchemaComponentOptions,A(C({},m),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:f})}))})})})})})})})})}function Pr({key:e,title:t,config:o},r){var d,m;const[s,a]=l.parseCollectionName(o.collection),i=l.useCompile(),c=je(s),[p]=Te(A(C({appends:[e,...((m=(d=o.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:t}}],compile:i,getCollectionFields:c}));return p}class Mr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${u}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},ho),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:We}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Be});w(this,"components",{CollectionFieldset:Io,AssignedFieldsFormSchemaConfig:Bo});w(this,"useVariables",Pr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(o){var r,s;return o.config.collection?{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Pe,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}:null}}class Br extends be{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${u}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${u}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But association fields are not supported (unless foreign key in current collection), and the updated data will not trigger other workflows.", { ns: "${u}" })}}`},{label:`{{t("Update one by one", { ns: "${u}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${u}" })}}`}]},default:!1},filter:A(C({},ot),{title:`{{t("Only update records matching conditions", { ns: "${u}" })}}`,"x-validator"(o){return Q.isValidFilter(o)?"":O("Please add at least one condition")}}),values:A(C({},ho),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Be});w(this,"components",{FilterDynamicComponent:Re,CollectionFieldset:Io,AssignedFieldsFormSchemaConfig:Bo,RadioWithTooltip:ke})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Vr extends be{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},ot),{"x-validator"(o){return Q.isValidFilter(o)?"":O("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Be,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:Re})}}const jr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Wr({children:e,workflow:t,execution:o,nodes:r}){const s=l.usePlugin(le),a=s.triggers.get(t.type).components,i=r.reduce((c,{type:p})=>Object.assign(c,s.instructions.get(p).components),{});return n.jsx(Ie.Provider,{value:{workflow:t,nodes:r,execution:o},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class le extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new Q.Registry);w(this,"instructions",new Q.Registry);w(this,"systemVariables",new Q.Registry);w(this,"useTriggersOptions",()=>{const o=l.useCompile();return Array.from(this.triggers.getEntities()).map(i=>{var[r,c]=i,p=c,{title:s}=p,a=Z(p,["title"]);return{value:r,label:o(s),color:"gold",options:a}})})}isWorkflowSync(o){var r,s;return(s=(r=this.triggers.get(o.type))==null?void 0:r.sync)!=null?s:o.sync}registerTrigger(o,r){if(typeof r=="function")this.triggers.register(o,new r);else if(r)this.triggers.register(o,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(o,r){if(typeof r=="function")this.instructions.register(o,new r);else if(r instanceof be)this.instructions.register(o,r);else throw new TypeError("invalid instruction type to register")}registerSystemVariable(o){this.systemVariables.register(o.key,o)}load(){return J(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:Ce(":id"),element:n.jsx(mo,{})}),this.app.router.add("admin.workflow.executions.id",{path:qe(":id"),element:n.jsx(lo,{})}),this.app.addComponents({WorkflowPage:mo,ExecutionPage:lo}),this.app.pluginSettingsManager.add(u,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${u}" })}}`,Component:tr,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(jr),this.app.schemaSettingsManager.addItem("actionSettings:delete","workflowConfig",{Component:l.WorkflowConfig,useVisible(){var r;const o=T.useFieldSchema();return oe.isValid((r=o==null?void 0:o["x-action-settings"])==null?void 0:r.triggerWorkflows)}}),this.registerTrigger("collection",cr),this.registerTrigger("schedule",Tr),this.registerInstruction("calculation",Nr),this.registerInstruction("condition",Or),this.registerInstruction("end",$r),this.registerInstruction("query",Dr),this.registerInstruction("create",Mr),this.registerInstruction("update",Br),this.registerInstruction("destroy",Vr),this.registerSystemVariable({key:"now",label:`{{t("System time", { ns: "${u}" })}}`,value:"now"}),this.registerSystemVariable({key:"dateRange",label:`{{t("Date range", { ns: "${u}" })}}`,value:"dateRange",children:[{key:"yesterday",value:"yesterday",label:`{{t("Yesterday", { ns: "${u}" })}}`},{key:"today",value:"today",label:`{{t("Today", { ns: "${u}" })}}`},{key:"tomorrow",value:"tomorrow",label:`{{t("Tomorrow", { ns: "${u}" })}}`},{key:"lastWeek",value:"lastWeek",label:`{{t("Last week", { ns: "${u}" })}}`},{key:"thisWeek",value:"thisWeek",label:`{{t("This week", { ns: "${u}" })}}`},{key:"nextWeek",value:"nextWeek",label:`{{t("Next week", { ns: "${u}" })}}`},{key:"lastMonth",value:"lastMonth",label:`{{t("Last month", { ns: "${u}" })}}`},{key:"thisMonth",value:"thisMonth",label:`{{t("This month", { ns: "${u}" })}}`},{key:"nextMonth",value:"nextMonth",label:`{{t("Next month", { ns: "${u}" })}}`},{key:"lastQuarter",value:"lastQuarter",label:`{{t("Last quarter", { ns: "${u}" })}}`},{key:"thisQuarter",value:"thisQuarter",label:`{{t("This quarter", { ns: "${u}" })}}`},{key:"nextQuarter",value:"nextQuarter",label:`{{t("Next quarter", { ns: "${u}" })}}`},{key:"lastYear",value:"lastYear",label:`{{t("Last year", { ns: "${u}" })}}`},{key:"thisYear",value:"thisYear",label:`{{t("This year", { ns: "${u}" })}}`},{key:"nextYear",value:"nextYear",label:`{{t("Next year", { ns: "${u}" })}}`},{key:"last7Days",value:"last7Days",label:`{{t("Last 7 days", { ns: "${u}" })}}`},{key:"next7Days",value:"next7Days",label:`{{t("Next 7 days", { ns: "${u}" })}}`},{key:"last30Days",value:"last30Days",label:`{{t("Last 30 days", { ns: "${u}" })}}`},{key:"next30Days",value:"next30Days",label:`{{t("Next 30 days", { ns: "${u}" })}}`},{key:"last90Days",value:"last90Days",label:`{{t("Last 90 days", { ns: "${u}" })}}`},{key:"next90Days",value:"next90Days",label:`{{t("Next 90 days", { ns: "${u}" })}}`}]})})}}x.BaseTypeSets=Qe,x.Branch=tt,x.CalculationConfig=oo,x.CheckboxGroupWithTooltip=kn,x.CollectionBlockInitializer=Pe,x.DetailsBlockProvider=ln,x.EXECUTION_STATUS=ie,x.ExecutionContextProvider=Wr,x.ExecutionStatusOptions=Ye,x.ExecutionStatusOptionsMap=_e,x.FieldsSelect=Ct,x.Fieldset=On,x.FilterDynamicComponent=Re,x.FlowContext=Ie,x.Instruction=be,x.JOB_STATUS=ce,x.JobButton=Ft,x.JobStatusOptions=kt,x.JobStatusOptionsMap=Ke,x.Node=Gt,x.NodeContext=Ze,x.NodeDefaultView=Tt,x.RadioWithTooltip=ke,x.RemoveButton=At,x.SimpleDesigner=Xt,x.Trigger=Mt,x.ValueBlock=Ne,x.WorkflowVariableInput=Dt,x.WorkflowVariableJSON=Cn,x.WorkflowVariableRawTextArea=wn,x.WorkflowVariableTextArea=It,x.calculators=Y,x.default=le,x.defaultFieldNames=Ve,x.getCollectionFieldOptions=Te,x.getWorkflowDetailPath=Ce,x.getWorkflowExecutionsPath=qe,x.linkNodes=vt,x.nodesOptions=Yt,x.renderEngineReference=Pt,x.scopeOptions=Kt,x.systemOptions=Zt,x.traverseSchema=wt,x.triggerOptions=_t,x.useAvailableUpstreams=Ut,x.useFlowContext=H,x.useGetAriaLabelOfAddButton=St,x.useGetCollectionFields=je,x.useNodeContext=xe,x.useNodeSavedConfig=Be,x.useRecordTriggerWorkflowsActionProps=sr,x.useStyles=ne,x.useTrigger=Bt,x.useTriggerWorkflowsActionProps=rr,x.useUpstreamScopes=Ht,x.useWorkflowAnyExecuted=yo,x.useWorkflowExecuted=lr,x.useWorkflowVariableOptions=me,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|