@nocobase/plugin-workflow 1.4.0-alpha.9 → 1.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
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("@nocobase/utils"),require("react"),require("react-i18next"),require("dayjs"),require("antd"),require("@nocobase/evaluators"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@formily/core"),require("lodash"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow",["@nocobase/client","@formily/react","@nocobase/utils","react","react-i18next","dayjs","antd","@nocobase/evaluators","react-router-dom","@ant-design/icons","@formily/antd-v5","@formily/shared","@formily/core","lodash","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow"]=t(require("@nocobase/client"),require("@formily/react"),require("@nocobase/utils"),require("react"),require("react-i18next"),require("dayjs"),require("antd"),require("@nocobase/evaluators"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@formily/core"),require("lodash"),require("@formily/reactive")):e["@nocobase/plugin-workflow"]=t(e["@nocobase/client"],e["@formily/react"],e["@nocobase/utils"],e.react,e["react-i18next"],e.dayjs,e.antd,e["@nocobase/evaluators"],e["react-router-dom"],e["@ant-design/icons"],e["@formily/antd-v5"],e["@formily/shared"],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=u},632:function(e){"use strict";e.exports=s},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=f},772:function(t){"use strict";t.exports=e},76:function(e){"use strict";e.exports=l},473:function(e){"use strict";e.exports=n},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=r},238:function(e){"use strict";e.exports=o},128:function(e){"use strict";e.exports=c},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 tO},useWorkflowAnyExecuted:function(){return rT},systemOptions:function(){return ta},useRecordTriggerWorkflowsActionProps:function(){return rA},Trigger:function(){return nO},JobStatusOptions:function(){return ei},ValueBlock:function(){return tA},WorkflowVariableInput:function(){return tv},useWorkflowVariableOptions:function(){return tp},Fieldset:function(){return t0},CollectionBlockInitializer:function(){return M},ExecutionStatusOptions:function(){return en},nodesOptions:function(){return tr},FilterDynamicComponent:function(){return tw},useNodeSavedConfig:function(){return eG},Instruction:function(){return eq},NodeDefaultView:function(){return e5},getWorkflowDetailPath:function(){return D},useWorkflowExecuted:function(){return rD},scopeOptions:function(){return ti},traverseSchema:function(){return A},CalculationConfig:function(){return tZ},defaultFieldNames:function(){return tn},WorkflowVariableRawTextArea:function(){return tg},useGetAriaLabelOfAddButton:function(){return el},SimpleDesigner:function(){return tk},DetailsBlockProvider:function(){return _},useStyles:function(){return eP},FlowContext:function(){return x},JobButton:function(){return eQ},NodeContext:function(){return e$},useTrigger:function(){return nS},useUpstreamScopes:function(){return eH},Node:function(){return eY},useTriggerWorkflowsActionProps:function(){return rP},BaseTypeSets:function(){return tl},triggerOptions:function(){return to},RadioWithTooltip:function(){return tj},useGetCollectionFields:function(){return tb},RemoveButton:function(){return eK},default:function(){return av},EXECUTION_STATUS:function(){return et},useNodeContext:function(){return eU},ExecutionStatusOptionsMap:function(){return er},JOB_STATUS:function(){return eo},ExecutionContextProvider:function(){return al},getWorkflowExecutionsPath:function(){return T},linkNodes:function(){return P},WorkflowVariableTextArea:function(){return th},CheckboxGroupWithTooltip:function(){return tE},calculators:function(){return tU},Branch:function(){return nl},useFlowContext:function(){return j},renderEngineReference:function(){return tI},FieldsSelect:function(){return q},useAvailableUpstreams:function(){return eJ},getCollectionFieldOptions:function(){return ty}});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("473"),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)(av).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(t9,{"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(tv,{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)(av).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){return function(e){if(Array.isArray(e))return e6(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||tt(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 tt(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 tn={label:"label",value:"value",children:"children"},tr={label:'{{t("Node result", { ns: "'.concat(E,'" })}}'),value:"$jobsMapByNodeKey",useOptions:function(e){var t=(0,f.usePlugin)(av).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}},to={label:'{{t("Trigger variables", { ns: "'.concat(E,'" })}}'),value:"$context",useOptions:function(e){var t,n,r=(0,f.usePlugin)(av).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}},ti={label:'{{t("Scope variables", { ns: "'.concat(E,'" })}}'),value:"$scopes",useOptions:function(e){var t=e.fieldNames,n=void 0===t?tn:t,r=e.current,o=(0,f.usePlugin)(av).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}},ta={label:'{{t("System variables", { ns: "'.concat(E,'" })}}'),value:"$system",useOptions:function(e){var t,n,r,o=e.types,i=e.fieldNames,a=void 0===i?tn:i,l=(0,S.useTranslation)().t;return te(!o||o.includes("date")?[(e4(n={key:"now"},a.label,k("System time")),e4(n,a.value,"now"),n),(e4(r={key:"dateRange"},a.label,k("Date range")),e4(r,a.value,"dateRange"),e4(r,"children",[{key:"yesterday",value:"yesterday",label:(t=l)("Yesterday")},{key:"today",value:"today",label:t("Today")},{key:"tomorrow",value:"tomorrow",label:t("Tomorrow")},{key:"lastWeek",value:"lastWeek",label:t("Last week")},{key:"thisWeek",value:"thisWeek",label:t("This week")},{key:"nextWeek",value:"nextWeek",label:t("Next week")},{key:"lastMonth",value:"lastMonth",label:t("Last month")},{key:"thisMonth",value:"thisMonth",label:t("This month")},{key:"nextMonth",value:"nextMonth",label:t("Next month")},{key:"lastQuarter",value:"lastQuarter",label:t("Last quarter")},{key:"thisQuarter",value:"thisQuarter",label:t("This quarter")},{key:"nextQuarter",value:"nextQuarter",label:t("Next quarter")},{key:"lastYear",value:"lastYear",label:t("Last year")},{key:"thisYear",value:"thisYear",label:t("This year")},{key:"nextYear",value:"nextYear",label:t("Next year")},{key:"last7Days",value:"last7Days",label:t("Last 7 days")},{key:"next7Days",value:"next7Days",label:t("Next 7 days")},{key:"last30Days",value:"last30Days",label:t("Last 30 days")},{key:"next30Days",value:"next30Days",label:t("Next 30 days")},{key:"last90Days",value:"last90Days",label:t("Last 90 days")},{key:"next90Days",value:"next90Days",label:t("Next 90 days")}]),r)]:[])}},tl={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 tc(e,t){var n,r,o,i,a,l,c;if("string"==typeof t)return null===(n=tl[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 tu(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 tu(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function ts(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 tf(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 tp(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},tn,null!==(e=t.fieldNames)&&void 0!==e?e:{}),r=Object.assign(t,{fieldNames:n});return[tf(ti,r),tf(tr,r),tf(to,r),tf(ta,r)]}function td(e,t){var n,r,o=t.compile,i=t.getCollectionFields;var a=(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)||tt(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.")}()),l=a[0],c=i(a[1],l),u=[],s=[];c.forEach(function(e){if(e.isForeignKey&&!e.primaryKey)u.push(e);else{var t=c.find(function(t){return t.name===e.foreignKey});t&&u.push(t),s.push(e)}});for(var p=(0,B.uniqBy)(u,"name"),d=s.length-1;d>=0;d--)!function(e){var t=s[e];if("belongsTo"===t.type){var n,r,i=p.findIndex(function(e){return e.name===t.foreignKey});if(i>-1){var a,l,c=p[i];s.splice(e,0,e7(e8({},t,c),{uiSchema:e7(e8({},t.uiSchema),{title:(null===(a=c.uiSchema)||void 0===a?void 0:a.title)?o(null===(l=c.uiSchema)||void 0===l?void 0:l.title):c.name})})),p.splice(i,1)}else s.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(o(null===(r=t.uiSchema)||void 0===r?void 0:r.title)," ID"):t.name})}))}else"context"===t.type&&"users"===t.collectionName&&s.splice(e,1)}(d);return s.push.apply(s,te(p)),(0,B.uniqBy)(s,"name").filter(function(e){return e.interface&&!e.hidden})}function tm(e){var t=ts(e.field,e.appends),n=ty(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 tc(e.field,t)}))&&(e.disabled=!0))}function ty(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?tn:s,p=null!=t?t:td(n,{compile:c,getCollectionFields:u}),d=tm.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 tc(t,e)});if(!tu(t))return n;if(null===o)return!!a&&(n||e({fields:td(t.target,{compile:l,getCollectionFields:c}),types:r,depth:a-1,appends:o,compile:l,getCollectionFields:c}));var i=ts(t,o),u=o.includes(t.name);return n?u:((null==i?void 0:i.length)||u)&&e({fields:td(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=ts(e,i),u=!tu(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 tb(e){var t=(0,f.useApp)().dataSourceManager.getDataSource(e).collectionManager;return(0,l.useCallback)(function(e){return t.getCollectionAllFields(e)},[t])}function tv(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tp(t);return c().createElement(f.Variable.Input,e8({scope:r},n))}function th(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tp(t);return c().createElement(f.Variable.TextArea,e8({scope:r},n))}function tg(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tp(t);return c().createElement(f.Variable.RawTextArea,e8({scope:r},n))}function tO(e){var t=e.variableOptions,n=e9(e,["variableOptions"]),r=tp(t);return c().createElement(f.Variable.JSON,e8({scope:r},n))}function tw(e){var t=e.value,n=e.onChange,r=e.renderSchemaComponent,o=tp();return c().createElement(f.Variable.Input,{value:t,onChange:n,scope:o},r())}function tx(){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 tx=function(){return n},n}function tj(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)(tx())},o(e.label)),e.tooltip&&c().createElement(m.Tooltip,{title:o(e.tooltip)},c().createElement(O.QuestionCircleOutlined,{style:{color:"#666"}})))})))}function tS(){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 tS=function(){return n},n}function tE(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)(tS())},o(e.label)),e.tooltip&&c().createElement(m.Tooltip,{title:o(e.tooltip)},c().createElement(O.QuestionCircleOutlined,{style:{color:"#666"}})))})))}function tk(){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 tC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tP(){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 tP=function(){return n},n}var tA=function(){return null};tA.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){tC(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))},tA.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,tC({},t.nodeKey,t.result))},{})});return c().createElement("pre",{className:(0,f.css)(tP())},JSON.stringify(i,null,2))},tA.Designer=tk;var tD=v("76");function tT(){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 tT=function(){return n},n}var tI=function(e){var t=tD.evaluators.get(e);return t?t.link?c().createElement(c().Fragment,null,c().createElement("span",{className:(0,f.css)(tT())},f.i18n.t("Syntax references")),c().createElement("a",{href:t.link,target:"_blank",rel:"noreferrer"},t.label)):null:null};function tF(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 tN(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 tR(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 tM(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)||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 tB(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function tV(e){return function(e){if(Array.isArray(e))return tF(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||t_(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 t_(e,t){if(e){if("string"==typeof e)return tF(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 tF(e,t)}}function tW(){var e=tB(["\n display: flex;\n gap: 0.5em;\n align-items: center;\n flex-wrap: wrap;\n "]);return tW=function(){return e},e}function tz(){var e=tB(["\n display: flex;\n position: relative;\n margin: 0.5em 0;\n "]);return tz=function(){return e},e}function tq(){var e=tB(["\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 tq=function(){return e},e}function tL(){var e=tB(["\n display: flex;\n align-items: center;\n gap: 0.5em;\n .ant-select {\n width: auto;\n min-width: 6em;\n }\n "]);return tL=function(){return e},e}function t$(){var e=tB(["\n button {\n padding: 0;\n &:not(:last-child) {\n margin-right: 1em;\n }\n }\n "]);return t$=function(){return e},e}var tU=new p.Registry;tU.register("equal",{name:"=",type:"boolean",group:"boolean"}),tU.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),tU.register("gt",{name:">",type:"boolean",group:"boolean"}),tU.register("gte",{name:"≥",type:"boolean",group:"boolean"}),tU.register("lt",{name:"<",type:"boolean",group:"boolean"}),tU.register("lte",{name:"≤",type:"boolean",group:"boolean"}),tU.register("add",{name:"+",type:"number",group:"number"}),tU.register("minus",{name:"-",type:"number",group:"number"}),tU.register("multiple",{name:"*",type:"number",group:"number"}),tU.register("divide",{name:"/",type:"number",group:"number"}),tU.register("mod",{name:"%",type:"number",group:"number"}),tU.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),tU.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),tU.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),tU.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),tU.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),tU.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),tU.register("concat",{name:'{{t("concat", { ns: "'.concat(E,'" })}}'),type:"string",group:"string"});var tG=[{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 tJ(e){return Array.from(tU.getEntities()).filter(function(t){var n=tM(t,2);return(n[0],n[1]).group===e})}function tH(e){var t=e.calculator,n=e.operands,r=void 0===n?[]:n,o=e.onChange,i=(0,f.useCompile)(),a=(0,l.useContext)(tQ),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)(tW())},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"},tG.filter(function(e){return!!tJ(e.value).length}).map(function(e){return c().createElement(m.Select.OptGroup,{key:e.value,label:i(e.title)},tJ(e.value).map(function(e){var t=tM(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 tY(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)(tz())},t.group?c().createElement(tK,{value:t.group,onChange:function(e){return n(tR(tN({},t),{group:e}))}}):c().createElement(tH,{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 tK(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(tR(tN({},n),{calculations:tV(u).concat([{not:!1,calculator:"equal"}])}))},[n,u,r]),p=(0,l.useCallback)(function(){r(tR(tN({},n),{calculations:tV(u).concat([{not:!1,group:{type:"and",calculations:[]}}])}))},[n,u,r]),d=(0,l.useCallback)(function(e){u.splice(e,1),r(tR(tN({},n),{calculations:tV(u)}))},[n,u,r]),y=(0,l.useCallback)(function(e,t){u.splice(e,1,t),r(tR(tN({},n),{calculations:tV(u)}))},[n,u,r]);return c().createElement("div",{className:(0,f.cx)("node-type-condition-group",(0,f.css)(tq()))},c().createElement("div",{className:(0,f.css)(tL())},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(tR(tN({},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(tY,{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)(t$())},c().createElement(m.Button,{type:"link",onClick:s},o("Add condition")),c().createElement(m.Button,{type:"link",onClick:p},o("Add condition group"))))}var tQ=(0,l.createContext)(tp);function tZ(e){var t=e.value,n=e.onChange,r=e.useVariableHook,o=void 0===r?tp:r,i=t&&Object.keys(t).length?t:{group:{type:"and",calculations:[]}};return c().createElement(tQ.Provider,{value:o},c().createElement(tK,{value:i.group,onChange:function(e){return n(tR(tN({},i),{group:e}))}}))}var tX=v("632");function t0(e){return c().createElement(m.Card,null,c().createElement(tX.FormLayout,{layout:e.layout||"vertical"},e.children))}function t1(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 t2(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 t3(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){t2(i,r,o,a,l,"next",e)}function l(e){t2(i,r,o,a,l,"throw",e)}a(void 0)})}}function t5(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 t6(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 t4(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 t1(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 t1(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 t8(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 t7(){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 t7=function(){return n},n}function t9(e){var t,n,r=e.upstream,o=e.branchIndex,i=void 0===o?null:o,a=(0,f.usePlugin)(av),u=(0,f.useCompile)(),s=(null!==(n=j())&&void 0!==n?n:{}).workflow,p=Array.from(a.instructions.getValues()),d=eP().styles,y=nn(),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 t6(t5({},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=t3(function(e){return t8(this,function(t){return b({type:t4(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)(t7())},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 ne(){var e=(0,u.useForm)(),t=(0,f.useAPIClient)(),n=j(),r=n.workflow,o=n.refresh,i=nn(),a=i.presetting,l=i.setPresetting,c=i.setCreating,s=(0,f.useActionContext)();return{run:function(){return t3(function(){var n;return t8(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:t6(t5({},a.data),{config:t5({},a.data.config,e.values.config)})})];case 3:if(n=i.sent().data.data,!(!1!==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 nt=(0,l.createContext)(null);function nn(){return(0,l.useContext)(nt)}var nr=[{label:"{{t('After end of branches', { ns: \"".concat(E,'" })}}'),value:!1},{label:"{{t('Inside of branch', { ns: \"".concat(E,'" })}}'),value:0}],no=(0,u.observer)(function(e){var t,n,r=nn().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?nr:a:[]},[r,o,i.config]);if(!a.length)return null;var s=r.data;return c().createElement(f.SchemaComponent,{components:{RadioWithTooltip:tj},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 ni(){var e=nn().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 na(e){var t,n,r=(0,f.useAPIClient)(),o=(0,f.useCompile)(),i=(0,f.usePlugin)(av),a=t4((0,l.useState)(null),2),u=a[0],s=a[1],d=t4((0,l.useState)(null),2),m=d[0],y=d[1],b=t4((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=t3(function(e){return t8(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(nt.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:no,PresetFieldset:ni},scope:{useCancelAction:f.useCancelAction,useAddNodeSubmitAction:ne},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 nl(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(t9,{"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 nc(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 nu(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 ns(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){nu(i,r,o,a,l,"next",e)}function l(e){nu(i,r,o,a,l,"throw",e)}a(void 0)})}}function nf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function np(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){nf(e,t,n[t])})}return e}function nd(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 nm(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 nc(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 nc(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 ny(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function nb(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 nv(){var e=ny(["\n padding: 1em;\n background-color: #f3f3f3;\n "]);return nv=function(){return e},e}function nh(){var e=ny(["\n .ant-select.auto-width {\n width: auto;\n min-width: 6em;\n }\n "]);return nh=function(){return e},e}function ng(){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 ns(function(){return nb(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 nO=function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e),nf(this,"sync",void 0),nf(this,"title",void 0),nf(this,"description",void 0),nf(this,"fieldset",void 0),nf(this,"view",void 0),nf(this,"scope",void 0),nf(this,"components",void 0),nf(this,"initializers",void 0),nf(this,"isActionTriggerable",void 0)};function nw(){var e=(0,f.useCompile)(),t=j(),n=t.workflow,r=t.execution,o=eP().styles,i=nS();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:nf({},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)(nv())},"x-read-pretty":!0}}})}}):null}function nx(){return{form:(0,u.useForm)()}}var nj=function(){var e,t=(0,f.useAPIClient)(),n=j(),r=n.workflow,o=n.refresh,i=nm((0,l.useState)(""),2),a=i[0],u=i[1],s=nm((0,l.useState)(!1),2),p=s[0],d=s[1],y=nm((0,l.useState)(!1),2),b=y[0],v=y[1],h=eP().styles,g=(0,f.useCompile)(),x=nS();(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=ns(function(e){var n;return nb(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(nw,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:nd(np({},I),{useFormProviderProps:nx}),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:nd(np({},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)(nh())},properties:T},actions:np({},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:ng}}}})})}}}}))))};function nS(){var e=(0,f.usePlugin)(av),t=j().workflow;return e.triggers.get(t.type)}function nE(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 nk(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function nC(){var e=nk(["\n margin-top: 0 !important;\n "]);return nC=function(){return e},e}function nP(){var e=nk(["\n margin-bottom: 1em;\n "]);return nP=function(){return e},e}function nA(){var e=nk(["\n margin-top: 0 !important;\n "]);return nA=function(){return e},e}function nD(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 nE(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 nE(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(na,null,c().createElement("div",{className:"workflow-canvas",style:{zoom:l/100}},c().createElement("div",{className:(0,f.cx)(o.branchBlockClass,(0,f.css)(nC()))},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)(nP())}):null,c().createElement(nj,null),c().createElement("div",{className:(0,f.cx)(o.branchBlockClass,(0,f.css)(nA()))},c().createElement(nl,{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 nT(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 nI(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 nF(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)||nR(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 nN(e){return function(e){if(Array.isArray(e))return nT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||nR(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 nR(e,t){if(e){if("string"==typeof e)return nT(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 nT(e,t)}}function nM(){var e,t,n,r=(0,f.usePlugin)(av).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 nB(e){var t=j().execution,n=(0,f.useAPIClient)(),r=(0,d.useNavigate)(),o=eP().styles,i=nF((0,l.useState)([]),2),a=i[0],u=i[1],s=nF((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:nN(y).concat([t],nN(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 nV(){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=nF((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,nI(w.workflow,["nodes","revisions"])),F=nI(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(nB,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(nD,{entry:N}),c().createElement(nM,null))}var n_=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:nV}}))},nW=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 nz(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 nq={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}}]},nL={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:nq,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){nz(i,r,o,a,l,"next",e)}function l(e){nz(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 n$(){return(n$=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 nU(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 nG(){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 nG=function(){return n},n}function nJ(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 nH(e){var t=(0,f.useCompile)();return c().createElement(c().Fragment,null,c().createElement(nJ,e),e.description?c().createElement("span",null,t(e.description)):null)}function nY(e){var t,n,r=n$({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),o=r.multiple?"multiple":null;return c().createElement(m.Select,(t=nU({role:"button","data-testid":"select-".concat(o||"single")},r),n=(n={mode:o,optionLabelProp:"label",tagRender:nJ},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,nU({key:e.value},e),c().createElement(nH,e))}))}function nK(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)(nG())},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 nQ(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 nZ(){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){nQ(i,r,o,a,l,"next",e)}function l(e){nQ(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function nX(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 n0(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 n1(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){n0(i,r,o,a,l,"next",e)}function l(e){n0(i,r,o,a,l,"throw",e)}a(void 0)})}}function n2(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 n3(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 n5(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 n6(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 n4(e){var t,n=e.request,r=(e.filter,n5(e,["request","filter"])),o=j().workflow,i=n3(n2({},r),{request:n3(n2({},n),{params:n3(n2({},null==n?void 0:n.params),{filter:n3(n2({},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 n8(){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 nX(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 nX(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=n5(C,["nodes","revisions"]);P(T);var R=T.find(function(e){return!e.upstream});function M(){return(M=n1(function(e){return n6(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=n1(function(){var e;return n6(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=n1(function(){var e;return n6(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 n1(function(){var e;return n6(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(_=n1(function(e){return n6(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:nL,components:{ExecutionResourceProvider:n4,ExecutionLink:nW,ExecutionStatusColumn:nK},scope:{useRefreshActionProps:nZ}})))),c().createElement(nD,{entry:R}))}var n7=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:n8}}))};function n9(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 re(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 rt=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=re(n9({},r),{request:re(n9({},n),{params:re(n9({},null==n?void 0:n.params),{filter:re(n9({},null==n?void 0:null===(t=n.params)||void 0===t?void 0:t.filter),{key:o.key})})})});return c().createElement(f.ResourceActionProvider,i)},rn=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 rr(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 ro(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 rr(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 rr(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 ri(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 ra(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ri(i,r,o,a,l,"next",e)}function l(e){ri(i,r,o,a,l,"throw",e)}a(void 0)})}}function rl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rc(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 ru={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"}]},rs={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}}}}},rf=rl({name:"workflow",type:"void"},"properties",rl({},"provider",rl({type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:ru,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:ru}},"properties",rl({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 ra(function(){return rc(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:rs.title,type:rs.type,sync:rs.sync,description:rs.description,options:rs.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",rl({type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"}},"properties",rl({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){rl(e,t,n[t])})}return e}({"aria-label":"executed-".concat(t.title)},e))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:nL}}}}},"actions",rl({type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column"},"properties",rl({},"actions",rl({type:"void","x-component":"Space","x-component-props":{split:"|"}},"properties",(rl(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:rs.title,enabled:rs.enabled,sync:rs.sync,description:rs.description,options:rs.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",rl({type:"void",title:'{{t("Duplicate", { ns: "'.concat(E,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"}},"properties",rl({},"modal",rl({type:"void",title:'{{t("Duplicate to new workflow", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal"},"properties",rl({title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"}},"footer",rl({type:"void","x-component":"Action.Modal.Footer"},"properties",(rl(o={},"submit",rl({type:"void",title:'{{t("Submit")}}',"x-component":"Action"},"x-component-props",rl({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 ra(function(){return rc(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]}})})()}}}))),rl(o,"cancel",{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}),o))))))),rl(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 rp(e){var t=(0,u.useField)(),n=(0,f.useRecord)(),r=(0,f.usePlugin)(av);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(tj,e)}function rd(e){var t=(0,f.useApp)();e.visible=!!((0,f.usePlugin)("multi-app-share-collection")||"main"!==t.name)}function rm(){var e,t,n=(0,l.useContext)(f.SchemaComponentContext),r=(0,f.usePlugin)(av).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:rf,components:{WorkflowLink:rn,ExecutionResourceProvider:rt,ExecutionLink:nW,OpenDrawer:ro,ExecutionStatusSelect:nY,SyncOptionSelect:rp,ExecutionStatusColumn:nK,Tooltip:m.Tooltip},scope:{useTriggersOptions:r,useWorkflowSyncAction:rd,useRefreshActionProps:nZ}})))}function ry(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 rb(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function rv(){var e=rb(["\n flex-direction: column;\n "]);return rv=function(){return e},e}function rh(){var e=rb(["\n position: relative;\n width: 100%;\n "]);return rh=function(){return e},e}var rg={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},rO={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)(rv())},"x-component":"CollectionFieldset"},rw={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 ry(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 ry(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)(rh())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},rx={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"}}},rj={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}}}}}}},rS={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 rE(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 rk(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){rE(i,r,o,a,l,"next",e)}function l(e){rE(i,r,o,a,l,"throw",e)}a(void 0)})}}function rC(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 rP(){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 rk(function(){var n,u,f,d,h,g,O,w,x,j;return rC(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:rk(function(){return rC(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 rA(){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 rk(function(){return rC(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 rk(function(){return rC(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 rD(){var e=j().workflow;return!!(null==e?void 0:e.executed)}function rT(){var e=j().workflow;return!!(null==e?void 0:e.allExecuted)}function rI(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 rF(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 rN(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rR(e){return(rR=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rM(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){rN(e,t,n[t])})}return e}function rB(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 rV(e,t){return(rV=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r_(e){return function(e){if(Array.isArray(e))return rI(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rW(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 rW(e,t){if(e){if("string"==typeof e)return rI(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 rI(e,t)}}function rz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rz=function(){return!!e})()}var rq=1,rL=2,r$=3,rU=4,rG=[{label:'{{t("After record added", { ns: "'.concat(E,'" })}}'),value:rq},{label:'{{t("After record updated", { ns: "'.concat(E,'" })}}'),value:rL},{label:'{{t("After record added or updated", { ns: "'.concat(E,'" })}}'),value:r$},{label:'{{t("After record deleted", { ns: "'.concat(E,'" })}}'),value:rU}];function rJ(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)||rW(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=tb(a),s=[{collectionName:l,name:"data",type:"hasOne",target:l,uiSchema:{title:k("Trigger data")}}];return ty(rB(rM({appends:["data"].concat(r_((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 rH=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=rR(n),rN(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,rz()?Reflect.construct(n,r||[],rR(t).constructor):n.apply(t,r)),"title",'{{t("Collection event", { ns: "'.concat(E,'" })}}')),rN(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,'" })}}')),rN(e,"fieldset",{collection:rB(rM({},rg),rN({"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}}},"x-reactions",r_(rg["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:rG,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(rL,")}}")}}}]},condition:rB(rM({},rw),{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(rU,")}}")}}}]}),appends:rB(rM({},rS),{"x-reactions":r_(rS["x-reactions"]).concat([{dependencies:["mode"],fulfill:{state:{visible:"{{!($deps[0] & ".concat(rU,")}}")}}}])})}),rN(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useWorkflowAnyExecuted:rT}),rN(e,"components",{FieldsSelect:q}),rN(e,"useVariables",rJ),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&&rV(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}}],rF(t.prototype,n),o}(nO),rY=0,rK=1,rQ=v("760"),rZ=v.n(rQ);function rX(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 r0(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 r1(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 r2(){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 r2=function(){return n},n}function r3(e){return!e.hidden&&!!e.uiSchema&&"date"===e.type}function r5(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 rX(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 rX(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)(r2())},c().createElement(q,{value:i.field,onChange:function(e){return o(r1(r0({},i),{field:e}))},filter:r3,placeholder:a("Select field"),className:"auto-width"}),i.field?c().createElement(m.Select,{value:s,onChange:function(e){p(e),o(r1(r0({},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(r1(r0({},i),{offset:(null!=e?e:0)*s}))}}),c().createElement(m.Select,{value:i.unit||864e5,onChange:function(e){return o(r1(r0({},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 r6(){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 r6=function(){return n},n}function r4(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)(r6())},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(r5,{value:o,onChange:i}):null,"date"===l?c().createElement(m.DatePicker,{showTime:!0,value:rZ()(o),onChange:function(e){i(e?e.toDate():null)}}):null)}var r8=v("704"),r7=function(){return(r7=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 r9(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 oe(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 ot=[{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 * * * *"}],on=[{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"]}],or={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 oo(e,t){for(var n=[],r=e;r<=t;r++)n.push(r);return n}function oi(e){return e.sort(function(e,t){return e-t}),e}function oa(e){var t=[];return e.forEach(function(e){0>t.indexOf(e)&&t.push(e)}),t}function ol(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 oc(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||or.errorInvalidCron})}function ou(e){var t=parseInt(e,10),n=Number(e);return t===n?n:NaN}function os(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=ot.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=oi(oa(oy((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?oo(t.min,t.max):function(e,t,n){var r=e.split("-");if(1===r.length){var o=ou(r[0]);if(isNaN(o))throw Error('Invalid value "'.concat(t,'" for ').concat(n.type));return[o]}if(2===r.length){var i=ou(r[0]),a=ou(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 oo(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=ou(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=ob(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,on[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),oc(n,a))}function of(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=on[t];return op(om(e,n),n,c)})).join(" ")}function op(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=oh(c),d=c.length===(p-f)/s+1,f===u.min&&p+s>u.max&&d)?"*/".concat(b):"".concat(od(function(e){return e[0]}(e),t,n,r,o),"-").concat(od(oh(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(od(e[0],t,n,r,o),"-").concat(od(e[1],t,n,r,o)):od(e,t,n,r,o)}).join(",")}return i}function od(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 om(e,t){var n=oi(oa(oy(e,t)));if(0===n.length)return n;var r=ob(n,t);if(void 0!==r)throw Error('Value "'.concat(r,'" out of range for ').concat(t.type));return n}function oy(e,t){return"week-days"===t.type&&(e=e.map(function(e){return 7===e?0:e})),e}function ob(e,t){var n=e[0],r=e[e.length-1];return n<t.min?n:r>t.max?r:void 0}function ov(e){return e[0]}function oh(e){return e[e.length-1]}function og(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=r9(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}}):oe([],Array(b.total),!0).map(function(e,t){var n=0===b.min?t:t+1;return{value:n.toString(),label:od(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,r8.jsx)(r8.Fragment,{});var r=op(om(t,b),b,u,p,d),o=r.match(/^\*\/([0-9]+),?/)||[];return(0,r8.jsx)("div",{children:o[1]?"".concat(a.everyText||or.everyText," ").concat(o[1]):r})},[t,x,u,p,d]),S=(0,l.useCallback)(function(e){var n=Array.isArray(e)?oi(e):[e],r=n;t&&(r="single"===h?[]:oe([],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}):oi(oe(oe([],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 ol(((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 ol(((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,r8.jsx)(m.Select,r7({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 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 ol(((e={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-hours")]=!!o,e))},[o]);return(0,r8.jsxs)("div",r7({className:d},{children:[""!==r.prefixHours&&(0,r8.jsx)("span",{children:r.prefixHours||or.prefixHours}),(0,r8.jsx)(og,{placeholder:r.emptyHours||or.emptyHours,value:t,unit:on[1],setValue:n,locale:r,className:o,disabled:i,readOnly:a,leadingZero:c,clockFormat:u,period:s,periodicityOnDoubleClick:f,mode:p})]}))}function ow(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 ol(((e={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-minutes")]=!!o,e))},[o]);return(0,r8.jsxs)("div",r7({className:d},{children:["hour"===s?""!==r.prefixMinutesForHourPeriod&&(0,r8.jsx)("span",{children:r.prefixMinutesForHourPeriod||or.prefixMinutesForHourPeriod}):""!==r.prefixMinutes&&(0,r8.jsx)("span",{children:r.prefixMinutes||or.prefixMinutes}),(0,r8.jsx)(og,{placeholder:"hour"===s?r.emptyMinutesForHourPeriod||or.emptyMinutesForHourPeriod:r.emptyMinutes||or.emptyMinutes,value:t,unit:on[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,r8.jsx)("span",{children:r.suffixMinutesForHourPeriod||or.suffixMinutesForHourPeriod})]}))}function ox(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 ol(((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||or.emptyMonthDays:r.emptyMonthDaysShort||or.emptyMonthDaysShort},[d,y]);return c&&(!t||!(t.length>0))&&(t&&0!==t.length||i&&0!==i.length)?null:(0,r8.jsxs)("div",r7({className:m},{children:[""!==r.prefixMonthDays&&(0,r8.jsx)("span",{children:r.prefixMonthDays||or.prefixMonthDays}),(0,r8.jsx)(og,{placeholder:b,value:t,setValue:n,unit:on[2],locale:r,className:o,disabled:a,readOnly:c,leadingZero:u,period:s,periodicityOnDoubleClick:f,mode:p})]}))}function oj(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||or.months,d=(0,l.useMemo)(function(){var e;return ol(((e={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-months")]=!!o,e))},[o]);return(0,r8.jsxs)("div",r7({className:d},{children:[""!==r.prefixMonths&&(0,r8.jsx)("span",{children:r.prefixMonths||or.prefixMonths}),(0,r8.jsx)(og,{placeholder:r.emptyMonths||or.emptyMonths,optionsList:p,grid:!1,value:t,unit:r7(r7({},on[3]),{alt:r.altMonths||or.altMonths}),setValue:n,locale:r,className:o,humanizeLabels:i,disabled:a,readOnly:c,period:u,periodicityOnDoubleClick:s,mode:f})]}))}function oS(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||or.yearOption}),u.includes("month")&&s.push({value:"month",label:r.monthOption||or.monthOption}),u.includes("week")&&s.push({value:"week",label:r.weekOption||or.weekOption}),u.includes("day")&&s.push({value:"day",label:r.dayOption||or.dayOption}),u.includes("hour")&&s.push({value:"hour",label:r.hourOption||or.hourOption}),u.includes("minute")&&s.push({value:"minute",label:r.minuteOption||or.minuteOption}),u.includes("reboot")&&c&&(!0===c||c.includes("@reboot"))&&s.push({value:"reboot",label:r.rebootOption||or.rebootOption});var f=(0,l.useCallback)(function(e){a||n(e)},[n,a]),p=(0,l.useMemo)(function(){var e;return ol(((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 ol(((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 ol(((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,r8.jsxs)("div",r7({className:p},{children:[""!==r.prefixPeriod&&(0,r8.jsx)("span",{children:r.prefixPeriod||or.prefixPeriod}),(0,r8.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 oE(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||or.weekDays,m="week"===s||!a||0===a.length,y=(0,l.useMemo)(function(){var e;return ol(((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||or.emptyWeekDays:r.emptyWeekDaysShort||or.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,r8.jsxs)("div",r7({className:y},{children:[""!==r.prefixWeekDays&&("week"===s||!g)&&(0,r8.jsx)("span",{children:r.prefixWeekDays||or.prefixWeekDays}),""!==r.prefixWeekDaysForMonthAndYearPeriod&&"week"!==s&&g&&(0,r8.jsx)("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||or.prefixWeekDaysForMonthAndYearPeriod}),(0,r8.jsx)(og,{placeholder:v,optionsList:d,grid:!1,value:t,unit:r7(r7({},on[4]),{alt:r.altWeekDays||or.altWeekDays}),setValue:n,locale:r,className:o,humanizeLabels:i,disabled:c,readOnly:u,period:s,periodicityOnDoubleClick:f,mode:p})]})):null}function ok(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?or: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(){os(d,ef,h,x,L,!0,f,N,ec,ei,K,X,en,J)},[]),(0,l.useEffect)(function(){d!==L.current&&os(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=of(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=of(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),oc(h,f)):(h&&h(void 0),ef(!1))},[G,y,h,u]),eh=(0,l.useMemo)(function(){var e;return ol(((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=r9(a,["className"]),ew=(0,l.useMemo)(function(){var e;return ol(((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,r8.jsx)(m.Button,r7({className:ew,danger:!0,type:"primary",disabled:P},eO,{onClick:ev},{children:f.clearButtonText||or.clearButtonText})):null},[o,D,eb,ew,P,ex,ev]),eS=G||$.current;return(0,r8.jsxs)("div",r7({className:eh},{children:[z.includes("period")&&(0,r8.jsx)(oS,{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,r8.jsxs)(r8.Fragment,{children:["year"===eS&&z.includes("months")&&(0,r8.jsx)(oj,{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,r8.jsx)(ox,{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,r8.jsx)(oE,{value:et,setValue:en,locale:f,className:g,humanizeLabels:S,monthDays:Y,disabled:P,readOnly:D,period:eS,periodicityOnDoubleClick:B,mode:_}),(0,r8.jsxs)("div",{children:["minute"!==eS&&"hour"!==eS&&z.includes("hours")&&(0,r8.jsx)(oO,{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,r8.jsx)(ow,{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:os,getCronStringFromValues:of,partToString:op,formatValue:od,parsePartArray:om});function oC(){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 oC=function(){return n},n}var oP=[{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 oA(e){return oP.filter(function(e){return"number"==typeof e.value}).reverse().find(function(t){return!(e%t.value)})}function oD(e){var t=e.value,n=e.onChange,r=C().t,o=oA(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 oT(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=oA(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)(oC(),"cron"===i?"column":"row")},c().createElement(m.Select,{value:i,onChange:a,className:"auto-width"},oP.map(function(e){return c().createElement(m.Select.Option,{key:e.value,value:e.value},o(e.text))})),"number"==typeof i?c().createElement(oD,{value:n,onChange:r}):null,"cron"===i?c().createElement(ok,{value:n.trim().split(/\s+/).slice(1).join(" "),setValue:function(e){return r("0 ".concat(e))},clearButton:!1,locale:window.cronLocale}):null)}function oI(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 oF(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oN(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){oF(e,t,n[t])})}return e}function oR(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 oM(e,t){if(e){if("string"==typeof e)return oI(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 oI(e,t)}}function oB(){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 oB=function(){return n},n}var oV=(oF(a={},rY,{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}}}),oF(a,rK,{collection:oR(oN({},rg),{"x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}},"x-reactions":((function(e){if(Array.isArray(e))return oI(e)})(r=rg["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||oM(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:oR(oN({},rS),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:"{{$deps[0] === ".concat(rK," && $deps[1]}}")}}}]})}),a),o_=[{value:rY,label:'{{t("Based on certain date", { ns: "'.concat(E,'" })}}')},{value:rK,label:'{{t("Based on date field of collection", { ns: "'.concat(E,'" })}}')}],oW=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)||oM(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:o_},required:!0,default:rY}}),c().createElement(f.SchemaComponent,{schema:{type:"void",properties:oF({},"mode-".concat(a),{type:"void","x-component":"fieldset","x-component-props":{className:(0,f.css)(oB())},properties:oV[a]})},components:{OnField:r5,RepeatField:oT,EndsByField:r4}}))};function oz(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 oq(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 oL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o$(e){return(o$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oU(e,t){return(oU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function oG(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)||oJ(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 oJ(e,t){if(e){if("string"==typeof e)return oz(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 oz(e,t)}}function oH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(oH=function(){return!!e})()}function oY(e,t){var n=oG((0,f.parseCollectionName)(e.collection),2),r=n[0];n[1];var o=(0,f.useCompile)(),i=tb(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===rK){var l,c,u,s,p=oG(ty((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){oL(e,t,n[t])})}return e}({appends:["data"].concat(function(e){if(Array.isArray(e))return oz(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)||oJ(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 oK=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=o$(n),oL(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,oH()?Reflect.construct(n,r||[],o$(t).constructor):n.apply(t,r)),"sync",!1),oL(e,"title",'{{t("Schedule event", { ns: "'.concat(E,'" })}}')),oL(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,'" })}}')),oL(e,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}}),oL(e,"scope",{useCollectionDataSource:f.useCollectionDataSource}),oL(e,"components",{ScheduleConfig:oW}),oL(e,"useVariables",oY),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&&oU(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}}],oq(t.prototype,n),o}(nO);function oQ(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 oZ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oX(e){return(oX=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o0(e,t){return(o0=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o1(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o1=function(){return!!e})()}var o2=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=oX(r),oZ(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,o1()?Reflect.construct(r,i||[],oX(n).constructor):r.apply(n,i)),"title",'{{t("Calculation", { ns: "'.concat(E,'" })}}')),oZ(e,"type","calculation"),oZ(e,"group","calculation"),oZ(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,'" })}}')),oZ(e,"fieldset",{engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:(0,tD.getOptions)()},required:!0,default:"formula.js"},expression:(oZ(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=tD.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return k("Expression syntax error")}}),oZ(t,"x-reactions",[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}]),oZ(t,"required",!0),t)}),oZ(e,"scope",{renderEngineReference:tI}),oZ(e,"components",{WorkflowVariableTextArea:th,RadioWithTooltip:tj,ValueBlock:tA}),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&&o0(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 tl||Object.values(tl).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:tA.Initializer,node:e,resultTitle:k("Calculation result")}}}],oQ(t.prototype,n),o}(eq);function o3(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 o5(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 o6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o4(e){return(o4=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o8(e,t){return(o8=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o7(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)||o9(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 o9(e,t){if(e){if("string"==typeof e)return o3(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 o3(e,t)}}function ie(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ie=function(){return!!e})()}var it={ON_TRUE:1,ON_FALSE:0},ir=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=o4(r),o6(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,ie()?Reflect.construct(r,i||[],o4(n).constructor):r.apply(n,i)),"title",'{{t("Condition", { ns: "'.concat(E,'" })}}')),o6(e,"type","condition"),o6(e,"group","control"),o6(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,'" })}}')),o6(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 o3(e)}(a=Array.from(tD.evaluators.getEntities()).filter(function(e){return["math.js","formula.js"].includes(o7(e,1)[0])}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||o9(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=o7(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){o6(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:(o6(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=tD.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return k("Expression syntax error")}}),o6(t,"x-reactions",{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}}),o6(t,"required",!0),t)}),o6(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}}),o6(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:it.ON_TRUE},{label:'{{t(\'Inside of "No" branch\', { ns: "'.concat(E,'" })}}'),value:it.ON_FALSE}]}),o6(e,"scope",{renderEngineReference:tI,useWorkflowVariableOptions:tp}),o6(e,"components",{CalculationConfig:tZ,WorkflowVariableTextArea:th,RadioWithTooltip:tj}),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&&o8(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(nl,{from:t,entry:u,branchIndex:0}),c().createElement(nl,{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")))))}}],o5(t.prototype,n),o}(eq);function io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ii(e){return(ii=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ia(e,t){return(ia=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function il(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(il=function(){return!!e})()}var ic=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=ii(r),io(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,il()?Reflect.construct(r,o||[],ii(n).constructor):r.apply(n,o)),"title",'{{t("End process", { ns: "'.concat(E,'" })}}')),io(e,"type","end"),io(e,"group","control"),io(e,"description",'{{t("End the process immediately, with set status.", { ns: "'.concat(E,'" })}}')),io(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}}),io(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&&ia(e,t)}(t,e),t}(eq);function iu(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 is(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 ip(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function id(e){return(id=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function im(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){ip(e,t,n[t])})}return e}function iy(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 ib(e,t){return(ib=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function iv(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)||ig(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 ih(e){return function(e){if(Array.isArray(e))return iu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ig(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 ig(e,t){if(e){if("string"==typeof e)return iu(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 iu(e,t)}}function iO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(iO=function(){return!!e})()}function iw(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=iv((0,f.parseCollectionName)(a.collection),2),c=l[0],u=l[1],s=(0,f.useCompile)(),p=tb(c);return iv(ty(iy(im({appends:[o].concat(ih((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 ix=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=id(n),ip(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,iO()?Reflect.construct(n,r||[],id(t).constructor):n.apply(t,r)),"title",'{{t("Query record", { ns: "'.concat(E,'" })}}')),ip(e,"type","query"),ip(e,"group","collection"),ip(e,"description",'{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "'.concat(E,'" })}}')),ip(e,"fieldset",{collection:iy(im({},rg),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":ih(rg["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:rw,sort:rx,pagination:rj,appends:rS},"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,'" })}}')}}),ip(e,"scope",{useNodeSavedConfig:eG,useCollectionDataSource:f.useCollectionDataSource,useSortableFields:function(){var e=(0,f.useCompile)(),t=(0,u.useForm)().values,n=iv((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}})}}),ip(e,"components",{ArrayItems:tX.ArrayItems,FilterDynamicComponent:tw,SchemaComponentContext:f.SchemaComponentContext,WorkflowVariableInput:tv,RadioWithTooltip:tj}),ip(e,"useVariables",iw),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&&ib(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)}}}],is(t.prototype,n),o}(eq);function ij(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 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 iE(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 ik(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 iC(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 ij(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 ij(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 iP(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function iA(e){var t=function(e,t){if("object"!==iD(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==iD(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===iD(t)?t:String(t)}function iD(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function iT(){var e=iP(["\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 iT=function(){return e},e}function iI(){var e=iP(["\n .ant-form-item-control-input-content {\n display: flex;\n }\n "]);return iI=function(){return e},e}function iF(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=iC((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,ik(iE({},e),{value:p,onChange:d}))}var iN=(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=tp(),b=p.values,v=iC((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(ik(iE({},t),iS({},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)(iT())},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)?iF: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)(iI())},c().createElement(f.Variable.Input,{scope:y,value:t[e.name],changeOnSelect:!0,onChange:function(n){r(ik(iE({},t),iS({},e.name,n)))}},c().createElement(f.SchemaComponent,{schema:{type:"void",properties:iS({},e.name,iS({"x-component":i},"x-validator",function(){return""}))}})),E?null:c().createElement(m.Button,iS({"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(iA))))})))}),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 iR(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 iM(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 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)||function(e,t){if(e){if("string"==typeof e)return iR(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 iR(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 iV(){return{name:(0,s.uid)(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function i_(e){var t=j().workflow,n=(0,f.useActionContext)().setFormValueChanged;(0,f.useAPIClient)();var r=tp(),o=(0,u.useForm)(),i=o.values,a=o.setValuesIn,s=o.disabled,p=(0,L.toJS)(i.params),d=iB((0,f.parseCollectionName)(i.collection),2),y=d[0],b=d[1],v=(0,f.useSchemaOptionsContext)(),h=iB((0,l.useState)(e.value&&Object.keys(e.value).length?e.value:iV()),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=iV(),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){iM(i,r,o,a,l,"next",e)}function l(e){iM(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=iB(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=iB(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(tX.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 iW(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 iz(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 iq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iL(e){return(iL=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i$(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){iq(e,t,n[t])})}return e}function iU(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 iG(e,t){return(iG=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function iJ(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)||iY(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 iH(e){return function(e){if(Array.isArray(e))return iW(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||iY(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 iY(e,t){if(e){if("string"==typeof e)return iW(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 iW(e,t)}}function iK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(iK=function(){return!!e})()}function iQ(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=iJ((0,f.parseCollectionName)(a.collection),2),c=l[0],u=l[1],s=(0,f.useCompile)(),p=tb(c);return iJ(ty(iU(i$({appends:[o].concat(iH((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 iZ=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=iL(n),iq(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,iK()?Reflect.construct(n,r||[],iL(t).constructor):n.apply(t,r)),"title",'{{t("Create record", { ns: "'.concat(E,'" })}}')),iq(e,"type","create"),iq(e,"group","collection"),iq(e,"description",'{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "'.concat(E,'" })}}')),iq(e,"fieldset",{collection:iU(i$({},rg),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":iH(rg["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:iU(i$({},rO),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:rS}}}),iq(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useNodeSavedConfig:eG}),iq(e,"components",{CollectionFieldset:iN,AssignedFieldsFormSchemaConfig:i_}),iq(e,"useVariables",iQ),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&&iG(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}}],iz(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 i0(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 i1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i2(e){return(i2=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i3(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){i1(e,t,n[t])})}return e}function i5(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 i6(e,t){return(i6=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i4=function(){return!!e})()}var i8=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=i2(n),i1(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,i4()?Reflect.construct(n,r||[],i2(t).constructor):n.apply(t,r)),"title",'{{t("Update record", { ns: "'.concat(E,'" })}}')),i1(e,"type","update"),i1(e,"group","collection"),i1(e,"description",'{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "'.concat(E,'" })}}')),i1(e,"fieldset",{collection:i5(i3({},rg),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return iX(e)})(i=rg["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 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)}}(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:i5(i3({},rw),i1({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:i5(i3({},rO),{"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"}}'}}}]}}),i1(e,"scope",{useCollectionDataSource:f.useCollectionDataSource,useNodeSavedConfig:eG}),i1(e,"components",{FilterDynamicComponent:tw,CollectionFieldset:iN,AssignedFieldsFormSchemaConfig:i_,RadioWithTooltip:tj}),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&&i6(e,t)}(o,e),t=o,n=[{key:"createDefaultConfig",value:function(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}],i0(t.prototype,n),o}(eq);function i7(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 i9(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function at(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){i9(e,t,n[t])})}return e}function an(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 ar(e,t){return(ar=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ao(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ao=function(){return!!e})()}var ai=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=ae(r),i9(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,ao()?Reflect.construct(r,o||[],ae(n).constructor):r.apply(n,o)),"title",'{{t("Delete record")}}'),i9(e,"type","destroy"),i9(e,"group","collection"),i9(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,'" })}}')),i9(e,"fieldset",{collection:an(at({},rg),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return i7(e)})(i=rg["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 i7(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 i7(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:an(at({},rw),i9({},"x-validator",function(e){return(0,p.isValidFilter)(e)?"":k("Please add at least one condition")}))}}}),i9(e,"scope",{useNodeSavedConfig:eG,useCollectionDataSource:f.useCollectionDataSource}),i9(e,"components",{FilterDynamicComponent:tw}),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&&ar(e,t)}(t,e),t}(eq),aa=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 al(e){var t=e.children,n=e.workflow,r=e.execution,o=e.nodes,i=(0,f.usePlugin)(av),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 ac(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 au(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 as(e,t,n){return(as=ab()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&am(o,n.prototype),o}).apply(null,arguments)}function af(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 ap(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ad(e){return(ad=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function am(e,t){return(am=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ay(e){var t="function"==typeof Map?new Map:void 0;return(ay=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 as(e,arguments,ad(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),am(r,e)})(e)}function ab(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ab=function(){return!!e})()}var av=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=ad(n),ap(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,ab()?Reflect.construct(n,r||[],ad(t).constructor):n.apply(t,r)),"triggers",new p.Registry),ap(e,"instructions",new p.Registry),ap(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 ac(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 ac(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&&am(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:"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(n7,null)}),t.app.router.add("admin.workflow.executions.id",{path:T(":id"),element:c().createElement(n_,null)}),t.app.addComponents({WorkflowPage:n7,ExecutionPage:n_}),t.app.pluginSettingsManager.add(E,{icon:"PartitionOutlined",title:'{{t("Workflow", { ns: "'.concat(E,'" })}}'),Component:rm,aclSnippet:"pm.workflow.workflows"}),t.app.schemaSettingsManager.add(aa),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",rH),t.registerTrigger("schedule",oK),t.registerInstruction("calculation",o2),t.registerInstruction("condition",ir),t.registerInstruction("end",ic),t.registerInstruction("query",ix),t.registerInstruction("create",iZ),t.registerInstruction("update",i8),t.registerInstruction("destroy",ai),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){au(i,r,o,a,l,"next",e)}function l(e){au(i,r,o,a,l,"throw",e)}a(void 0)})})()}}],af(t.prototype,n),o}(ay(f.Plugin))}(),h}()});
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}()});