@nocobase/plugin-workflow 1.4.0-alpha.8 → 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.
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +1 -566
- package/dist/client/variable.d.ts +1 -17
- package/dist/externalVersion.js +10 -10
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/triggers/CollectionTrigger.js +7 -6
- package/package.json +3 -3
package/dist/client/index.js
CHANGED
|
@@ -7,569 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(v,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@formily/react"),require("@formily/shared"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("lodash"),require("@formily/reactive"),require("@nocobase/evaluators/client"),require("@formily/antd-v5"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@formily/react","@formily/shared","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","lodash","@formily/reactive","@nocobase/evaluators/client","@formily/antd-v5","dayjs"],n):(v=typeof globalThis!="undefined"?globalThis:v||self,n(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@formily/react"],v["@formily/shared"],v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v.lodash,v["@formily/reactive"],v["@nocobase/evaluators"],v["@formily/antd-v5"],v.dayjs))})(this,function(v,n,T,te,a,X,se,y,g,Y,V,fe,we,Ge,Ie,bo,en){"use strict";var Gr=Object.defineProperty,qr=Object.defineProperties;var Yr=Object.getOwnPropertyDescriptors;var go=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var zo=(v,n,T)=>n in v?Gr(v,n,{enumerable:!0,configurable:!0,writable:!0,value:T}):v[n]=T,C=(v,n)=>{for(var T in n||(n={}))Qt.call(n,T)&&zo(v,T,n[T]);if(go)for(var T of go(n))Xt.call(n,T)&&zo(v,T,n[T]);return v},A=(v,n)=>qr(v,Yr(n));var Rt=v=>typeof v=="symbol"?v:v+"",Q=(v,n)=>{var T={};for(var te in v)Qt.call(v,te)&&n.indexOf(te)<0&&(T[te]=v[te]);if(v!=null&&go)for(var te of go(v))n.indexOf(te)<0&&Xt.call(v,te)&&(T[te]=v[te]);return T};var w=(v,n,T)=>(zo(v,typeof n!="symbol"?n+"":n,T),T);var J=(v,n,T)=>new Promise((te,a)=>{var X=g=>{try{y(T.next(g))}catch(Y){a(Y)}},se=g=>{try{y(T.throw(g))}catch(Y){a(Y)}},y=g=>g.done?te(g.value):Promise.resolve(g.value).then(X,se);y((T=T.apply(v,n)).next())});const on=y.createContext(null),vo={didCatch:!1,error:null};class tn extends y.Component{constructor(o){super(o),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=vo}static getDerivedStateFromError(o){return{didCatch:!0,error:o}}resetErrorBoundary(){const{error:o}=this.state;if(o!==null){for(var t,r,s=arguments.length,l=new Array(s),i=0;i<s;i++)l[i]=arguments[i];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:l,reason:"imperative-api"}),this.setState(vo)}}componentDidCatch(o,t){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,o,t)}componentDidUpdate(o,t){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&t.error!==null&&nn(o.resetKeys,s)){var l,i;(l=(i=this.props).onReset)===null||l===void 0||l.call(i,{next:s,prev:o.resetKeys,reason:"keys"}),this.setState(vo)}}render(){const{children:o,fallbackRender:t,FallbackComponent:r,fallback:s}=this.props,{didCatch:l,error:i}=this.state;let c=o;if(l){const u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(y.isValidElement(s))c=s;else if(typeof t=="function")c=t(u);else if(r)c=y.createElement(r,u);else throw i}return y.createElement(on.Provider,{value:{didCatch:l,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function nn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==o.length||e.some((t,r)=>!Object.is(t,o[r]))}const Pe=y.createContext({});function H(){return y.useContext(Pe)}const p="workflow";function N(e,o={}){return a.i18n.t(e,A(C({},o),{ns:p}))}function xo(){return Y.useTranslation(p)}function wo(e){const o=new Map;e.forEach(t=>o.set(t.id,t));for(const t of o.values())t.upstreamId&&(t.upstream=o.get(t.upstreamId)),t.downstreamId&&(t.downstream=o.get(t.downstreamId))}function Co(e,o){o(e),e.properties&&Object.keys(e.properties).forEach(t=>{Co(e.properties[t],o)})}function Ce(e){return`/admin/workflow/workflows/${e}`}function qe(e){return`/admin/workflow/executions/${e}`}function rn(r){var s=r,{collection:e,dataPath:o}=s,t=Q(s,["collection","dataPath"]);const{insert:l}=a.useSchemaInitializer(),{getTemplateSchemaByMode:i}=a.useSchemaTemplateManager(),{getCollection:c}=a.useCollectionManager_deprecated(),u=a.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,x]=a.parseCollectionName(e);d=c(x,h)}else d=e;function m(x){return J(this,arguments,function*({item:h}){const b=h.template?yield i(h):null,f={type:"void",name:te.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:o},"x-component":"CardItem","x-component-props":{title:t.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:b||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};Co(f,k=>{k["x-uid"]&&delete k["x-uid"]}),l(f)})}return n.jsx(a.SchemaInitializerItem,A(C({},t),{onClick:m,items:u}))}function Me(e){var l;const o=a.useSchemaInitializerItem(),t=(l=e==null?void 0:e.collection)!=null?l:o.collection;let r,s;if(typeof t=="string"){const i=a.parseCollectionName(t);r=i[0],s=i[1]}else s=t;return n.jsx(a.CollectionProvider_deprecated,{dataSource:r,collection:s,children:n.jsx(rn,C(C({},o),e))})}function sn(e){const{execution:o,nodes:t}=H(),r=y.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=y.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[r[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,r]);return y.useMemo(()=>we.get(s,e),[s,e])}function ln({collection:e,dataPath:o,children:t}){const r=T.useField(),s=y.useRef(null),{getAssociationAppends:l}=a.useAssociationNames(),{appends:i,updateAssociationValues:c}=l(),u=sn(o);let d,m;if(typeof e=="string"){const M=a.parseCollectionName(e);d=M[0],m=M[1]}else m=e;const h=y.useMemo(()=>fe.createForm({values:u,readPretty:!0}),[u]),x={appends:i},b={loading:!1,data:{data:u}},k=a.useAPIClient().resource(m),F=a.useBlockRequestContext();return n.jsx(a.CollectionProvider_deprecated,{dataSource:d,collection:m,children:n.jsx(a.RecordProvider,{record:u,parent:null,children:n.jsx(a.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:b,resource:k,__parent:F},children:n.jsx(a.FormBlockContext.Provider,{value:{params:x,form:h,field:r,service:b,updateAssociationValues:c,formBlockRef:s},children:t})})})})}function an(){return!0}const ko=T.observer(e=>{const d=e,{filter:o=an}=d,t=Q(d,["filter"]),r=a.useCompile(),{getCollectionFields:s}=a.useCollectionManager_deprecated(),{values:l}=T.useForm(),[i,c]=a.parseCollectionName(l==null?void 0:l.collection),u=s(c,i);return n.jsx(g.Select,A(C({popupMatchSelectWidth:!1},t),{options:u.filter(o).map(m=>{var h;return{label:r((h=m.uiSchema)==null?void 0:h.title),value:m.name}})}))},{displayName:"FieldsSelect"}),cn=a.createStyles(({css:e,token:o})=>({container:e`
|
|
11
|
-
margin-bottom: 1.5em;
|
|
12
|
-
padding: 1em;
|
|
13
|
-
background-color: ${o.colorFillAlter};
|
|
14
|
-
|
|
15
|
-
> *:last-child {
|
|
16
|
-
margin-bottom: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
dl {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: baseline;
|
|
22
|
-
|
|
23
|
-
dt {
|
|
24
|
-
color: ${o.colorText};
|
|
25
|
-
&:after {
|
|
26
|
-
content: ':';
|
|
27
|
-
margin-right: 0.5em;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
p {
|
|
33
|
-
color: ${o.colorTextDescription};
|
|
34
|
-
}
|
|
35
|
-
`}));function Jo(e){const{label:o,title:t,description:r}=e,{styles:s}=cn();return n.jsxs("div",{className:a.cx(s.container,e.className),children:[n.jsxs("dl",{children:[n.jsx("dt",{children:o}),n.jsx("dd",{children:n.jsx(g.Tag,{style:{background:"none"},children:t})})]}),r?n.jsx("p",{children:r}):null]})}function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}};/*!
|
|
36
|
-
Copyright (c) 2018 Jed Watson.
|
|
37
|
-
Licensed under the MIT License (MIT), see
|
|
38
|
-
http://jedwatson.github.io/classnames
|
|
39
|
-
*/(function(e){(function(){var o={}.hasOwnProperty;function t(){for(var l="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(l=s(l,r(c)))}return l}function r(l){if(typeof l=="string"||typeof l=="number")return l;if(typeof l!="object")return"";if(Array.isArray(l))return t.apply(null,l);if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]"))return l.toString();var i="";for(var c in l)o.call(l,c)&&l[c]&&(i=s(i,c));return i}function s(l,i){return i?l?l+" "+i:l+i:l}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(Uo);var un=Uo.exports;const pn=dn(un),mn=a.createStyles(({css:e,token:o})=>({statusButtonClass:e`
|
|
40
|
-
border: none;
|
|
41
|
-
.ant-tag {
|
|
42
|
-
width: 100%;
|
|
43
|
-
height: 100%;
|
|
44
|
-
padding: 0;
|
|
45
|
-
margin-right: 0;
|
|
46
|
-
border-radius: 50%;
|
|
47
|
-
text-align: center;
|
|
48
|
-
}
|
|
49
|
-
`,noStatusButtonClass:e`
|
|
50
|
-
border-width: 2px;
|
|
51
|
-
`}));function Be(e){const i=e,{status:o,statusMap:t}=i,r=Q(i,["status","statusMap"]),{styles:s}=mn();let l=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];l=n.jsx(g.Tag,{color:u,children:c})}return n.jsx(g.Button,A(C({},r),{shape:"circle",size:"small",className:pn(l?s.statusButtonClass:s.noStatusButtonClass,e.className),children:l}))}const ie={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},Ye=[{value:ie.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:n.jsx(V.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:ie.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(V.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],_e=Ye.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ce={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},So=[{value:ce.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(V.ClockCircleOutlined,{})},{value:ce.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{})},{value:ce.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{})},{value:ce.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{})},{value:ce.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90})},{value:ce.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45})},{value:ce.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{})},{value:ce.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{})}],Ke=So.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),Ao=(e,o)=>({getAriaLabel:y.useCallback(r=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,o!=null?String(o):"",r].filter(Boolean).join("-"),[o,e==null?void 0:e.title,e==null?void 0:e.type])}),ne=a.createStyles(({css:e,token:o})=>({workflowPageClass:e`
|
|
52
|
-
flex-grow: 1;
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
|
|
57
|
-
.workflow-toolbar {
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: space-between;
|
|
61
|
-
position: relative;
|
|
62
|
-
padding: 0.5rem 1rem;
|
|
63
|
-
background: ${o.colorBgContainer};
|
|
64
|
-
border-bottom: 1px solid ${o.colorBorderSecondary};
|
|
65
|
-
|
|
66
|
-
header {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
aside {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 0.5em;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.workflow-versions {
|
|
78
|
-
label {
|
|
79
|
-
margin-right: 0.5em;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.workflow-canvas-wrapper {
|
|
85
|
-
flex-grow: 1;
|
|
86
|
-
overflow: hidden;
|
|
87
|
-
position: relative;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.workflow-canvas-zoomer {
|
|
91
|
-
display: flex;
|
|
92
|
-
align-items: center;
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 2em;
|
|
95
|
-
right: 2em;
|
|
96
|
-
height: 10em;
|
|
97
|
-
padding: 1em 0;
|
|
98
|
-
border-radius: 0.5em;
|
|
99
|
-
background: ${o.colorBgContainer};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.workflow-canvas {
|
|
103
|
-
overflow: auto;
|
|
104
|
-
height: 100%;
|
|
105
|
-
width: 100%;
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
align-items: center;
|
|
109
|
-
padding: 2em;
|
|
110
|
-
|
|
111
|
-
> .ant-alert {
|
|
112
|
-
margin-bottom: 2em;
|
|
113
|
-
font-size: 85%;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`,dropdownClass:e`
|
|
117
|
-
.ant-dropdown-menu-item {
|
|
118
|
-
justify-content: flex-end;
|
|
119
|
-
.ant-dropdown-menu-title-content {
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: baseline;
|
|
122
|
-
justify-content: flex-end;
|
|
123
|
-
text-align: right;
|
|
124
|
-
|
|
125
|
-
time {
|
|
126
|
-
width: 14em;
|
|
127
|
-
font-size: 80%;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`,workflowVersionDropdownClass:e`
|
|
132
|
-
max-height: 80vh;
|
|
133
|
-
overflow-y: auto;
|
|
134
|
-
|
|
135
|
-
.ant-dropdown-menu-item {
|
|
136
|
-
.ant-dropdown-menu-title-content {
|
|
137
|
-
strong {
|
|
138
|
-
font-weight: normal;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
> .enabled {
|
|
142
|
-
strong {
|
|
143
|
-
font-weight: bold;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
> .unexecuted {
|
|
148
|
-
strong {
|
|
149
|
-
font-style: italic;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
`,executionsDropdownRowClass:e`
|
|
155
|
-
.ant-dropdown-menu-item {
|
|
156
|
-
.id {
|
|
157
|
-
flex-grow: 1;
|
|
158
|
-
text-align: right;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
`,branchBlockClass:e`
|
|
162
|
-
display: flex;
|
|
163
|
-
position: relative;
|
|
164
|
-
margin: 2em auto auto auto;
|
|
165
|
-
|
|
166
|
-
:before {
|
|
167
|
-
content: '';
|
|
168
|
-
position: absolute;
|
|
169
|
-
top: 0;
|
|
170
|
-
bottom: 0;
|
|
171
|
-
left: calc(50% - 0.5px);
|
|
172
|
-
width: 1px;
|
|
173
|
-
background-color: ${o.colorBgLayout};
|
|
174
|
-
}
|
|
175
|
-
`,branchClass:e`
|
|
176
|
-
display: flex;
|
|
177
|
-
flex-direction: column;
|
|
178
|
-
align-items: center;
|
|
179
|
-
position: relative;
|
|
180
|
-
min-width: 20em;
|
|
181
|
-
padding: 0 2em;
|
|
182
|
-
|
|
183
|
-
.workflow-node-list {
|
|
184
|
-
flex-grow: 1;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.workflow-branch-lines {
|
|
188
|
-
position: absolute;
|
|
189
|
-
top: 0;
|
|
190
|
-
bottom: 0;
|
|
191
|
-
width: 1px;
|
|
192
|
-
background-color: ${o.colorBorder};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
:before,
|
|
196
|
-
:after {
|
|
197
|
-
content: '';
|
|
198
|
-
position: absolute;
|
|
199
|
-
height: 1px;
|
|
200
|
-
background-color: ${o.colorBorder};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
:before {
|
|
204
|
-
top: 0;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
:after {
|
|
208
|
-
bottom: 0;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
:not(:first-child):not(:last-child) {
|
|
212
|
-
:before,
|
|
213
|
-
:after {
|
|
214
|
-
left: 0;
|
|
215
|
-
width: 100%;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:last-child:not(:first-child) {
|
|
220
|
-
:before,
|
|
221
|
-
:after {
|
|
222
|
-
right: 50%;
|
|
223
|
-
width: 50%;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
:first-child:not(:last-child) {
|
|
228
|
-
:before,
|
|
229
|
-
:after {
|
|
230
|
-
left: 50%;
|
|
231
|
-
width: 50%;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.end-sign {
|
|
236
|
-
position: relative;
|
|
237
|
-
display: flex;
|
|
238
|
-
flex-direction: column;
|
|
239
|
-
align-items: center;
|
|
240
|
-
justify-content: center;
|
|
241
|
-
width: 0;
|
|
242
|
-
height: 6em;
|
|
243
|
-
border-left: 1px dashed ${o.colorBgLayout};
|
|
244
|
-
|
|
245
|
-
.anticon {
|
|
246
|
-
font-size: 1.5em;
|
|
247
|
-
line-height: 100%;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
`,nodeBlockClass:e`
|
|
251
|
-
flex-grow: 1;
|
|
252
|
-
flex-shrink: 0;
|
|
253
|
-
display: flex;
|
|
254
|
-
flex-direction: column;
|
|
255
|
-
align-items: center;
|
|
256
|
-
position: relative;
|
|
257
|
-
`,nodeClass:e`
|
|
258
|
-
flex-shrink: 0;
|
|
259
|
-
display: flex;
|
|
260
|
-
flex-direction: column;
|
|
261
|
-
align-items: center;
|
|
262
|
-
`,nodeCardClass:e`
|
|
263
|
-
position: relative;
|
|
264
|
-
width: 20em;
|
|
265
|
-
background: ${o.colorBgContainer};
|
|
266
|
-
padding: 1em;
|
|
267
|
-
box-shadow: ${o.boxShadowTertiary};
|
|
268
|
-
border-radius: ${o.borderRadiusLG}px;
|
|
269
|
-
cursor: pointer;
|
|
270
|
-
transition: box-shadow 0.3s ease;
|
|
271
|
-
|
|
272
|
-
&:hover {
|
|
273
|
-
box-shadow: ${o.boxShadow};
|
|
274
|
-
|
|
275
|
-
.workflow-node-remove-button {
|
|
276
|
-
display: block;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
&.configuring {
|
|
281
|
-
box-shadow: ${o.boxShadow};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.workflow-node-remove-button {
|
|
285
|
-
display: none;
|
|
286
|
-
position: absolute;
|
|
287
|
-
right: 0;
|
|
288
|
-
top: 0;
|
|
289
|
-
color: ${o.colorText};
|
|
290
|
-
|
|
291
|
-
&[disabled] {
|
|
292
|
-
display: none;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&:hover {
|
|
296
|
-
color: ${o.colorErrorHover};
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.ant-input {
|
|
301
|
-
font-weight: bold;
|
|
302
|
-
|
|
303
|
-
&:not(:focus) {
|
|
304
|
-
transition:
|
|
305
|
-
background-color 0.3s ease,
|
|
306
|
-
border-color 0.3s ease;
|
|
307
|
-
border-color: ${o.colorBorderBg};
|
|
308
|
-
background-color: ${o.colorBgContainerDisabled};
|
|
309
|
-
|
|
310
|
-
&:not(:disabled):hover {
|
|
311
|
-
border-color: ${o.colorPrimaryBorderHover};
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
&:disabled:hover {
|
|
315
|
-
border-color: ${o.colorBorderBg};
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.workflow-node-config-button {
|
|
321
|
-
padding: 0;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
&:hover {
|
|
325
|
-
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);
|
|
326
|
-
|
|
327
|
-
.workflow-node-remove-button {
|
|
328
|
-
display: block;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
`,nodeJobButtonClass:e`
|
|
332
|
-
display: flex;
|
|
333
|
-
position: absolute;
|
|
334
|
-
top: 0;
|
|
335
|
-
right: 0;
|
|
336
|
-
justify-content: center;
|
|
337
|
-
align-items: center;
|
|
338
|
-
color: ${o.colorTextLightSolid};
|
|
339
|
-
`,nodeHeaderClass:e`
|
|
340
|
-
display: flex;
|
|
341
|
-
margin-bottom: 0.5em;
|
|
342
|
-
|
|
343
|
-
.workflow-node-actions {
|
|
344
|
-
position: relative;
|
|
345
|
-
}
|
|
346
|
-
`,nodeMetaClass:e`
|
|
347
|
-
flex-grow: 1;
|
|
348
|
-
|
|
349
|
-
.workflow-node-id {
|
|
350
|
-
color: ${o.colorTextDescription};
|
|
351
|
-
|
|
352
|
-
&:before {
|
|
353
|
-
content: '#';
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
`,nodeTitleClass:e`
|
|
357
|
-
display: flex;
|
|
358
|
-
align-items: center;
|
|
359
|
-
font-weight: normal;
|
|
360
|
-
.workflow-node-id {
|
|
361
|
-
color: ${o.colorTextDescription};
|
|
362
|
-
}
|
|
363
|
-
`,nodeSubtreeClass:e`
|
|
364
|
-
display: flex;
|
|
365
|
-
flex-direction: column-reverse;
|
|
366
|
-
align-items: center;
|
|
367
|
-
margin: auto;
|
|
368
|
-
`,nodeJobResultClass:e`
|
|
369
|
-
background-color: #f3f3f3;
|
|
370
|
-
`,addButtonClass:e`
|
|
371
|
-
flex-shrink: 0;
|
|
372
|
-
padding: 2em 0;
|
|
373
|
-
|
|
374
|
-
> .ant-btn {
|
|
375
|
-
&:disabled {
|
|
376
|
-
visibility: hidden;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
`,conditionClass:e`
|
|
380
|
-
position: relative;
|
|
381
|
-
overflow: visible;
|
|
382
|
-
|
|
383
|
-
> span {
|
|
384
|
-
position: absolute;
|
|
385
|
-
top: calc(1.5em - 1px);
|
|
386
|
-
line-height: 1em;
|
|
387
|
-
color: ${o.colorTextSecondary};
|
|
388
|
-
background-color: ${o.colorBgLayout};
|
|
389
|
-
padding: 1px;
|
|
390
|
-
}
|
|
391
|
-
`,loopLineClass:e`
|
|
392
|
-
display: flex;
|
|
393
|
-
justify-content: center;
|
|
394
|
-
align-items: center;
|
|
395
|
-
position: absolute;
|
|
396
|
-
top: 50%;
|
|
397
|
-
transform: translateY(-50%);
|
|
398
|
-
width: 2em;
|
|
399
|
-
height: 6em;
|
|
400
|
-
`,terminalClass:e`
|
|
401
|
-
display: flex;
|
|
402
|
-
align-items: center;
|
|
403
|
-
justify-content: center;
|
|
404
|
-
flex-shrink: 0;
|
|
405
|
-
width: 4em;
|
|
406
|
-
height: 4em;
|
|
407
|
-
border-radius: 50%;
|
|
408
|
-
background-color: ${o.colorText};
|
|
409
|
-
color: ${o.colorBgContainer};
|
|
410
|
-
`}));class be{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"presetFieldset");w(this,"branching");w(this,"view");w(this,"scope");w(this,"components");w(this,"end");w(this,"testable")}createDefaultConfig(){return{}}}function fn(){const e=T.useForm(),o=a.useAPIClient(),t=a.useActionContext(),{refresh:r}=a.useResourceActionContext(),s=ve(),{workflow:l}=H();return{run(){return J(this,null,function*(){var c,u;if(l.executed){g.message.error(N("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(Ge.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),r()})}}}const Ze=y.createContext({});function ve(){return y.useContext(Ze)}function Ve(e=[]){const o=ve();return e.some(t=>we.get(o.config,t)!=null)}function Ho(e,o){const t=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof o!="function"||o(r))&&t.push(r);return t}function Go(e){const o=[];if(!e)return[];for(let t=e;t;t=t.upstream)t.upstream&&t.branchIndex!=null&&o.push(t.upstream);return o}function qo({data:e}){var i;const{styles:o}=ne(),{getAriaLabel:t}=Ao(e),r=a.usePlugin(ae),{Component:s=No,end:l}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(Ze.Provider,{value:e,children:n.jsxs("div",{className:a.cx(o.nodeBlockClass),children:[n.jsx(s,{data:e}),!l||typeof l=="function"&&!l(e)?n.jsx(rt,{"aria-label":t(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})})]})})}function Fo(){var m;const{t:e}=Y.useTranslation(),o=a.useAPIClient(),{workflow:t,nodes:r,refresh:s}=(m=H())!=null?m:{},l=ve(),{modal:i}=g.App.useApp(),c=o.resource("flow_nodes"),u=y.useCallback(()=>J(this,null,function*(){var h;yield(h=c.destroy)==null?void 0:h.call(c,{filterByTk:l.id}),s()}),[l.id,s,c]),d=y.useCallback(()=>J(this,null,function*(){const h=r.filter(f=>f===l?!1:X.parse(f.config).parameters.filter(({key:M})=>M.startsWith(`$jobsMapByNodeKey.${l.key}.`)||M===`$jobsMapByNodeKey.${l.key}`).length);if(h.length){i.error({title:N("Can not delete"),content:N("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(f=>`#${f.id}`).join(", ")})});return}const b=!r.find(f=>f.upstream===l&&f.branchIndex!=null)?e("Are you sure you want to delete it?"):N("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:b,onOk:u})}),[l,i,r,u,e]);return t?t.executed?null:n.jsx(g.Button,{type:"text",shape:"circle",icon:n.jsx(V.DeleteOutlined,{}),onClick:d,className:"workflow-node-remove-button",size:"small"}):null}function To(){var l;const{execution:e,setViewJob:o}=H(),{jobs:t}=(l=ve())!=null?l:{},{styles:r}=ne();if(!e)return null;if(!t.length)return n.jsx(Be,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=t.find(u=>u.id==i);o(c)}return n.jsx(g.Tooltip,{title:N("View result"),children:t.length>1?n.jsx(g.Dropdown,{menu:{items:t.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Be,{statusMap:Ke,status:i.status}),n.jsx("time",{children:X.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Be,{statusMap:Ke,status:t[t.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Be,{statusMap:Ke,status:t[0].status,onClick:()=>o(t[0]),className:r.nodeJobButtonClass})})}function hn(){return{form:T.useForm()}}const yn=()=>{const{values:e,query:o}=T.useForm(),t=ve(),r=a.useAPIClient(),s=a.useActionContext(),l=T.useField();return{run(){return J(this,null,function*(){const u=X.parse(t.config)(Ge.toJS(e.config)),d=o("result").take();d.setValue(null),d.setFeedback({}),l.data=l.data||{},l.data.loading=!0;try{const{data:{data:m}}=yield r.resource("flow_nodes").test({values:{config:u,type:t.type}});d.setFeedback({type:m.status>0?"success":"error",messages:m.status>0?[N("Resolved")]:[N("Failed")]}),d.setValue(m.result)}catch(m){d.setFeedback({type:"error",messages:m.message})}l.data.loading=!1,s.setFormValueChanged(!1)})}}},Yo=y.createContext([]);function gn({name:e,value:o,onChange:t}){return n.jsxs(g.Space,{children:[n.jsx(Io,{variableOptions:{},value:`{{${e}}}`,disabled:!0}),n.jsx(a.Variable.Input,{useTypedConstant:["string","number","boolean","date"],value:o,onChange:t})]})}function bn({value:e,onChange:o}){const t=y.useContext(Yo);return t.length?n.jsx(n.Fragment,{children:t.map(r=>n.jsx(gn,{name:r,value:we.get(e,r),onChange:s=>{we.set(e,r,s),o(e)}},r))}):n.jsx(g.Empty,{image:g.Empty.PRESENTED_IMAGE_SIMPLE,description:N("No variable"),style:{margin:"1em"}})}function vn(){const e=ve(),{values:o}=T.useForm(),r=X.parse(o).parameters.map(l=>l.key),s=y.useMemo(()=>fe.createForm(),[]);return n.jsx(Ze.Provider,{value:{type:e.type,config:o},children:n.jsx(Yo.Provider,{value:r,children:n.jsx(a.SchemaComponent,{components:{Alert:g.Alert},scope:{useCancelAction:a.useCancelAction,useRunAction:yn},schema:{type:"void",name:"testButton",title:'{{t("Test run")}}',"x-component":"Action","x-component-props":{icon:"CaretRightOutlined"},properties:{modal:{type:"void","x-decorator":"FormV2","x-decorator-props":{form:s},"x-component":"Action.Modal",title:'{{t("Test run", { ns: "workflow" })}}',properties:{alert:{type:"void","x-component":"Alert","x-component-props":{message:'{{t("Test run will do the actual data manipulating or API calling, please use with caution.", { ns: "workflow" })}}',type:"warning",showIcon:!0,className:a.css`
|
|
411
|
-
margin-bottom: 1em;
|
|
412
|
-
`}},config:{type:"object",title:'{{t("Replace variables", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":bn},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 No(e){var I;const{data:o,children:t}=e,r=a.useCompile(),s=a.useAPIClient(),{workflow:l,refresh:i}=(I=H())!=null?I:{},{styles:c}=ne(),d=a.usePlugin(ae).instructions.get(o.type),m=l.executed?'{{t("View")}}':'{{t("Configure")}}',[h,x]=y.useState(o.title),[b,f]=y.useState(!1),[k,F]=y.useState(!1),M=y.useMemo(()=>{const $=we.cloneDeep(o.config);return fe.createForm({initialValues:$,disabled:l.executed})},[o,l]),S=y.useCallback($=>{f($),$||M.reset()},[M]),E=y.useCallback(function($){return J(this,null,function*(){var B,G;const O=$||r(d==null?void 0:d.title);x(O),O!==o.title&&(yield(G=(B=s.resource("flow_nodes")).update)==null?void 0:G.call(B,{filterByTk:o.id,values:{title:O}}),i())})},[o,d]),L=y.useCallback(function($){if($.target===$.currentTarget){f(!0);return}const O=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let B=$.target;B&&B!==$.currentTarget&&B!==document.documentElement;B=B.parentNode)if(Array.from(B.classList).some(G=>O.has(G))){f(!0),$.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:a.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:n.jsx(g.Tooltip,{title:N("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:a.cx(c.nodeCardClass,"invalid"),children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:a.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{color:"error",children:N("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(Fo,{}),n.jsx(To,{})]})]}),n.jsx(g.Input.TextArea,{value:h,disabled:!0,autoSize:!0})]})})});const D=r(d.title);return n.jsxs("div",{className:a.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${D}-${h}`,className:a.cx(c.nodeCardClass,{configuring:b}),onClick:L,children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:a.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{children:D}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(Fo,{}),n.jsx(To,{})]})]}),n.jsx(g.Input.TextArea,{disabled:l.executed,value:h,onChange:$=>x($.target.value),onBlur:$=>E($.target.value),autoSize:!0}),n.jsx(a.ActionContextProvider,{value:{visible:b,setVisible:S,formValueChanged:k,setFormValueChanged:F},children:n.jsx(a.FormProvider,{form:M,children:n.jsx(a.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:hn,useUpdateAction:fn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":m,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[o.id]:{type:"void",title:n.jsxs("div",{className:a.css`
|
|
413
|
-
display: flex;
|
|
414
|
-
justify-content: space-between;
|
|
415
|
-
|
|
416
|
-
strong {
|
|
417
|
-
font-weight: bold;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.ant-tag {
|
|
421
|
-
margin-inline-end: 0;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
code {
|
|
425
|
-
font-weight: normal;
|
|
426
|
-
}
|
|
427
|
-
`,children:[n.jsx("strong",{children:o.title}),n.jsx(g.Tooltip,{title:N("Variable key of node"),children:n.jsx(g.Tag,{children:n.jsx("code",{children:o.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":Jo,"x-component-props":{label:N("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:a.css`
|
|
428
|
-
.ant-input,
|
|
429
|
-
.ant-select,
|
|
430
|
-
.ant-cascader-picker,
|
|
431
|
-
.ant-picker,
|
|
432
|
-
.ant-input-number,
|
|
433
|
-
.ant-input-affix-wrapper {
|
|
434
|
-
&.auto-width {
|
|
435
|
-
width: auto;
|
|
436
|
-
min-width: 6em;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
`},properties:d.fieldset},footer:l.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{flexGrow:1}},properties:A(C({},d.testable?{test:{type:"void","x-component":T.observer(vn),"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 }}"}}})}}}})}})}})})})]}),t]})}const Te={label:"label",value:"value",children:"children"},xn=e=>[{key:"yesterday",value:"yesterday",label:e("Yesterday")},{key:"today",value:"today",label:e("Today")},{key:"tomorrow",value:"tomorrow",label:e("Tomorrow")},{key:"lastWeek",value:"lastWeek",label:e("Last week")},{key:"thisWeek",value:"thisWeek",label:e("This week")},{key:"nextWeek",value:"nextWeek",label:e("Next week")},{key:"lastMonth",value:"lastMonth",label:e("Last month")},{key:"thisMonth",value:"thisMonth",label:e("This month")},{key:"nextMonth",value:"nextMonth",label:e("Next month")},{key:"lastQuarter",value:"lastQuarter",label:e("Last quarter")},{key:"thisQuarter",value:"thisQuarter",label:e("This quarter")},{key:"nextQuarter",value:"nextQuarter",label:e("Next quarter")},{key:"lastYear",value:"lastYear",label:e("Last year")},{key:"thisYear",value:"thisYear",label:e("This year")},{key:"nextYear",value:"nextYear",label:e("Next year")},{key:"last7Days",value:"last7Days",label:e("Last 7 days")},{key:"next7Days",value:"next7Days",label:e("Next 7 days")},{key:"last30Days",value:"last30Days",label:e("Last 30 days")},{key:"next30Days",value:"next30Days",label:e("Next 30 days")},{key:"last90Days",value:"last90Days",label:e("Last 90 days")},{key:"next90Days",value:"next90Days",label:e("Next 90 days")}],_o={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=a.usePlugin(ae),t=ve(),r=Ho(t),s=[];return r.forEach(l=>{var u;const i=o.get(l.type),c=(u=i.useVariables)==null?void 0:u.call(i,l,e);c&&s.push(c)}),s}},Ko={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,l;const{triggers:o}=a.usePlugin(ae),{workflow:t}=H(),r=o.get(t.type);return(l=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,t.config,e))!=null?l:null}},Zo={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Te,current:t}=e,{instructions:r}=a.usePlugin(ae),s=ve(),l=t!=null?t:s,i=Go(l),c=[];return i.forEach(u=>{var h,x;const d=r.get(u.type),m=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);m&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:m})}),c}},Qo={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Te}){const{t}=Y.useTranslation();return[...!e||e.includes("date")?[{key:"now",[o.label]:N("System time"),[o.value]:"now"},{key:"dateRange",[o.label]:N("Date range"),[o.value]:"dateRange",children:xn(t)}]:[]]}},Qe={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function Xo(e,o){var t,r,s,l,i,c;return typeof o=="string"?(t=Qe[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?Oo(e)?((r=o.options)==null?void 0:r.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((l=o.options)==null?void 0:l.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function Oo(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function Do(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(r=>r.startsWith(t)).map(r=>r.replace(t,""))}function Eo({fields:e,types:o,appends:t,depth:r=1,compile:s,getCollectionFields:l}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>Xo(i,u)):!0;if(Oo(i)){if(t===null)return r?c||Eo({fields:$o(i.target,{compile:s,getCollectionFields:l}),types:o,depth:r-1,appends:t,compile:s,getCollectionFields:l}):!1;const u=Do(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&Eo({fields:$o(i.target,{compile:s,getCollectionFields:l}),types:o,appends:u,compile:s,getCollectionFields:l}).length}else return c})}function Xe(e,o){var l,i;const t=a.useCompile(),r=(i=(l=e.useOptions)==null?void 0:l.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const o=Object.assign({},Te,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Xe(Zo,t),Xe(_o,t),Xe(Ko,t),Xe(Qo,t)]}function $o(e,{compile:o,getCollectionFields:t}){var d,m,h,x;const[r,s]=a.parseCollectionName(e),l=t(s,r),i=[],c=[];l.forEach(b=>{if(b.isForeignKey&&!b.primaryKey)i.push(b);else{const f=l.find(k=>k.name===b.foreignKey);f&&i.push(f),c.push(b)}});const u=we.uniqBy(i,"name");for(let b=c.length-1;b>=0;b--){const f=c[b];if(f.type==="belongsTo"){const k=u.findIndex(F=>F.name===f.foreignKey);if(k>-1){const F=u[k];c.splice(b,0,A(C(C({},f),F),{uiSchema:A(C({},f.uiSchema),{title:(d=F.uiSchema)!=null&&d.title?o((m=F.uiSchema)==null?void 0:m.title):F.name})})),u.splice(k,1)}else c.splice(b,0,A(C({},f),{name:f.foreignKey,type:"bigInt",isForeignKey:!0,interface:f.interface,uiSchema:A(C({},f.uiSchema),{title:(h=f.uiSchema)!=null&&h.title?`${o((x=f.uiSchema)==null?void 0:x.title)} ID`:f.name})}))}else f.type==="context"&&f.collectionName==="users"&&c.splice(b,1)}return c.push(...u),we.uniqBy(c,"name").filter(b=>b.interface&&!b.hidden)}function wn(e){const o=Do(e.field,e.appends),t=Ne(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>Xo(e.field,s))||(e.disabled=!0))}function Ne(e){const{fields:o,collection:t,types:r,appends:s=[],depth:l=1,compile:i,getCollectionFields:c,fieldNames:u=Te}=e,d=o!=null?o:$o(t,{compile:i,getCollectionFields:c}),m=wn.bind({compile:i,getCollectionFields:c,fieldNames:u});return Eo({fields:d,types:r,depth:l,appends:s,compile:i,getCollectionFields:c}).map(x=>{var F;const b=i(((F=x.uiSchema)==null?void 0:F.title)||x.name),f=Do(x,s),k=!Oo(x)||f&&!f.length&&!s.includes(x.name)||!1;return{[u.label]:b,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:m,field:x,depth:l,appends:s,types:r}})}function je(e){const o=a.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return y.useCallback(r=>t.getCollectionAllFields(r),[t])}function Io(t){var r=t,{variableOptions:e}=r,o=Q(r,["variableOptions"]);const s=me(e);return n.jsx(a.Variable.Input,C({scope:s},o))}function Po(t){var r=t,{variableOptions:e}=r,o=Q(r,["variableOptions"]);const s=me(e);return n.jsx(a.Variable.TextArea,C({scope:s},o))}function Cn(t){var r=t,{variableOptions:e}=r,o=Q(r,["variableOptions"]);const s=me(e);return n.jsx(a.Variable.RawTextArea,C({scope:s},o))}function kn(t){var r=t,{variableOptions:e}=r,o=Q(r,["variableOptions"]);const s=me(e);return n.jsx(a.Variable.JSON,C({scope:s},o))}function Re({value:e,onChange:o,renderSchemaComponent:t}){const r=me();return n.jsx(a.Variable.Input,{value:e,onChange:o,scope:r,children:t()})}function ke(e){const l=e,{options:o=[],direction:t}=l,r=Q(l,["options","direction"]),s=a.useCompile();return n.jsx(g.Radio.Group,A(C({},r),{children:n.jsx(g.Space,{direction:t,children:o.map(i=>n.jsxs(g.Radio,{value:i.value,children:[n.jsx("span",{className:a.css`
|
|
440
|
-
& + .anticon {
|
|
441
|
-
margin-left: 0.25em;
|
|
442
|
-
}
|
|
443
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function Sn(e){const l=e,{options:o=[],direction:t}=l,r=Q(l,["options","direction"]),s=a.useCompile();return n.jsx(g.Checkbox.Group,A(C({},r),{children:n.jsx(g.Space,{direction:t,children:o.map(i=>n.jsxs(g.Checkbox,{value:i.value,children:[n.jsx("span",{className:a.css`
|
|
444
|
-
& + .anticon {
|
|
445
|
-
margin-left: 0.25em;
|
|
446
|
-
}
|
|
447
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function Ro(){const e=T.useFieldSchema(),o=a.useCompile();return n.jsxs(a.GeneralSchemaDesigner,{title:o(e.title),children:[n.jsx(a.SchemaSettingsBlockTitleItem,{}),n.jsx(a.SchemaSettingsDivider,{}),n.jsx(a.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Oe=()=>null;function An(){const l=a.useSchemaInitializerItem(),{node:o,resultTitle:t}=l,r=Q(l,["node","resultTitle"]),{insert:s}=a.useSchemaInitializer();return n.jsx(a.SchemaInitializerItem,A(C({},r),{onClick:()=>{var i;s({type:"void",name:o.id,title:o.title,"x-component":"CardItem","x-component-props":{title:(i=o.title)!=null?i:`#${o.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:t,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${o.key}}}`}}}})}}))}function Fn({dataSource:e}){var s;const o=T.useFieldSchema(),{execution:t}=H();if(!t)return o.title;const r=X.parse(e)({$jobsMapByNodeKey:((s=t.jobs)!=null?s:[]).reduce((l,i)=>Object.assign(l,{[i.nodeKey]:i.result}),{})});return n.jsx("pre",{className:a.css`
|
|
448
|
-
margin: 0;
|
|
449
|
-
`,children:JSON.stringify(r,null,2)})}Oe.Initializer=An,Oe.Result=Fn,Oe.Designer=Ro;const Mo=e=>{const o=Ie.evaluators.get(e);return o&&o.link?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:a.css`
|
|
450
|
-
&:after {
|
|
451
|
-
content: ':';
|
|
452
|
-
}
|
|
453
|
-
& + a {
|
|
454
|
-
margin-left: 0.25em;
|
|
455
|
-
}
|
|
456
|
-
`,children:a.i18n.t("Syntax references")}),n.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null},_=new X.Registry;_.register("equal",{name:"=",type:"boolean",group:"boolean"}),_.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),_.register("gt",{name:">",type:"boolean",group:"boolean"}),_.register("gte",{name:"≥",type:"boolean",group:"boolean"}),_.register("lt",{name:"<",type:"boolean",group:"boolean"}),_.register("lte",{name:"≤",type:"boolean",group:"boolean"}),_.register("add",{name:"+",type:"number",group:"number"}),_.register("minus",{name:"-",type:"number",group:"number"}),_.register("multiple",{name:"*",type:"number",group:"number"}),_.register("divide",{name:"/",type:"number",group:"number"}),_.register("mod",{name:"%",type:"number",group:"number"}),_.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),_.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),_.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),_.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),_.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),_.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),_.register("concat",{name:`{{t("concat", { ns: "${p}" })}}`,type:"string",group:"string"});const Tn=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${p}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${p}" })}}`},{value:"date",title:`{{t("Date", { ns: "${p}" })}}`}];function et(e){return Array.from(_.getEntities()).filter(([o,t])=>t.group===e)}function Nn({calculator:e,operands:o=[],onChange:t}){const r=a.useCompile(),s=y.useContext(tt),l=s(),i=s(),c=y.useCallback(m=>t({calculator:e,operands:[m,o[1]]}),[e,t,o]),u=y.useCallback(m=>t({calculator:e,operands:[o[0],m]}),[e,t,o]),d=y.useCallback(m=>t({operands:o,calculator:m}),[t,o]);return n.jsxs("fieldset",{className:a.css`
|
|
457
|
-
display: flex;
|
|
458
|
-
gap: 0.5em;
|
|
459
|
-
align-items: center;
|
|
460
|
-
flex-wrap: wrap;
|
|
461
|
-
`,children:[n.jsx(a.Variable.Input,{changeOnSelect:!0,value:o[0],onChange:c,scope:l,useTypedConstant:!0}),n.jsx(g.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:d,placeholder:N("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:Tn.filter(m=>!!et(m.value).length).map(m=>n.jsx(g.Select.OptGroup,{label:r(m.title),children:et(m.value).map(([h,{name:x}])=>n.jsx(g.Select.Option,{value:h,children:r(x)},h))},m.value))}),n.jsx(a.Variable.Input,{changeOnSelect:!0,value:o[1],onChange:u,scope:i,useTypedConstant:!0})]})}function On({value:e,onChange:o,onRemove:t}){if(!e)return null;const{calculator:r,operands:s=[]}=e;return n.jsxs("div",{className:a.css`
|
|
462
|
-
display: flex;
|
|
463
|
-
position: relative;
|
|
464
|
-
margin: 0.5em 0;
|
|
465
|
-
`,children:[e.group?n.jsx(ot,{value:e.group,onChange:l=>o(A(C({},e),{group:l}))}):n.jsx(Nn,{operands:s,calculator:r,onChange:o}),n.jsx(g.Button,{"aria-label":"icon-close",onClick:t,type:"link",icon:n.jsx(V.CloseCircleOutlined,{})})]})}function ot({value:e,onChange:o}){const{t}=Y.useTranslation(),{type:r="and",calculations:s=[]}=e,l=y.useCallback(()=>{o(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))},[e,s,o]),i=y.useCallback(()=>{o(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))},[e,s,o]),c=y.useCallback(d=>{s.splice(d,1),o(A(C({},e),{calculations:[...s]}))},[e,s,o]),u=y.useCallback((d,m)=>{s.splice(d,1,m),o(A(C({},e),{calculations:[...s]}))},[e,s,o]);return n.jsxs("div",{className:a.cx("node-type-condition-group",a.css`
|
|
466
|
-
position: relative;
|
|
467
|
-
width: 100%;
|
|
468
|
-
.node-type-condition-group {
|
|
469
|
-
padding: 0.5em 1em;
|
|
470
|
-
border: 1px dashed #ddd;
|
|
471
|
-
}
|
|
472
|
-
+ button {
|
|
473
|
-
position: absolute;
|
|
474
|
-
right: 0;
|
|
475
|
-
}
|
|
476
|
-
`),children:[n.jsx("div",{className:a.css`
|
|
477
|
-
display: flex;
|
|
478
|
-
align-items: center;
|
|
479
|
-
gap: 0.5em;
|
|
480
|
-
.ant-select {
|
|
481
|
-
width: auto;
|
|
482
|
-
min-width: 6em;
|
|
483
|
-
}
|
|
484
|
-
`,children:n.jsxs(Y.Trans,{children:["Meet ",n.jsxs(g.Select,{role:"button","data-testid":"filter-select-all-or-any",value:r,onChange:d=>o(A(C({},e),{type:d})),children:[n.jsx(g.Select.Option,{value:"and",children:"All"}),n.jsx(g.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),n.jsx("div",{className:"calculation-items",children:s.map((d,m)=>n.jsx(On,{value:d,onChange:u.bind(this,m),onRemove:()=>c(m)},`${d.calculator}_${m}`))}),n.jsxs("div",{className:a.css`
|
|
485
|
-
button {
|
|
486
|
-
padding: 0;
|
|
487
|
-
&:not(:last-child) {
|
|
488
|
-
margin-right: 1em;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
`,children:[n.jsx(g.Button,{type:"link",onClick:l,children:t("Add condition")}),n.jsx(g.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}const tt=y.createContext(me);function nt({value:e,onChange:o,useVariableHook:t=me}){const r=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(tt.Provider,{value:t,children:n.jsx(ot,{value:r.group,onChange:s=>o(A(C({},r),{group:s}))})})}function Dn(e){return n.jsx(g.Card,{children:n.jsx(bo.FormLayout,{layout:e.layout||"vertical",children:e.children})})}function rt(e){var x;const{upstream:o,branchIndex:t=null}=e,r=a.usePlugin(ae),s=a.useCompile(),{workflow:l}=(x=H())!=null?x:{},i=Array.from(r.instructions.getValues()),{styles:c}=ne(),{onCreate:u,creating:d}=eo(),m=y.useMemo(()=>{const b=[{key:"control",label:`{{t("Control", { ns: "${p}" })}}`},{key:"calculation",label:`{{t("Calculation", { ns: "${p}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${p}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${p}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${p}" })}}`}].map(f=>{const k=i.filter(F=>F.group===f.key&&(F.isAvailable?F.isAvailable({engine:r,workflow:l,upstream:o,branchIndex:t}):!0));return A(C({},f),{type:"group",children:k.map(F=>({role:"button","aria-label":F.type,key:F.type,label:F.title}))})}).filter(f=>f.children.length);return s(b)},[t,s,r,i,o,l]),h=y.useCallback(f=>J(this,[f],function*({keyPath:b}){const[k]=b;u({type:k,upstream:o,branchIndex:t})}),[t,u,o]);return l?n.jsx("div",{className:c.addButtonClass,children:n.jsx(g.Dropdown,{menu:{items:m,onClick:h},disabled:l.executed,overlayClassName:a.css`
|
|
492
|
-
.ant-dropdown-menu-root {
|
|
493
|
-
max-height: 30em;
|
|
494
|
-
overflow-y: auto;
|
|
495
|
-
}
|
|
496
|
-
`,children:n.jsx(g.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:n.jsx(V.PlusOutlined,{}),loading:(d==null?void 0:d.upstreamId)==(o==null?void 0:o.id)&&(d==null?void 0:d.branchIndex)===t,size:"small"})})}):null}function En(){const e=T.useForm(),o=a.useAPIClient(),{workflow:t,refresh:r}=H(),{presetting:s,setPresetting:l,setCreating:i}=eo(),c=a.useActionContext();return{run(){return J(this,null,function*(){if(s){yield e.submit(),i(s.data);try{const{data:{data:d}}=yield o.resource("workflows.nodes",t.id).create({values:A(C({},s.data),{config:C(C({},s.data.config),e.values.config)})});e.values.downstreamBranchIndex!==!1&&d.downstreamId&&(yield o.resource("flow_nodes").update({filterByTk:d.downstreamId,values:{branchIndex:e.values.downstreamBranchIndex,upstream:{id:d.id,downstreamId:null}},updateAssociationValues:["upstream"]})),c.setVisible(!1),l(null),r()}catch(d){console.error(d)}finally{i(null)}}})}}}const st=y.createContext(null);function eo(){return y.useContext(st)}const $n=[{label:`{{t('After end of branches', { ns: "${p}" })}}`,value:!1},{label:`{{t('Inside of branch', { ns: "${p}" })}}`,value:0}],In=T.observer(e=>{var i,c;const{presetting:o}=eo(),{nodes:t}=H(),{values:r}=T.useForm(),s=y.useMemo(()=>{var x;if(!(o!=null&&o.instruction))return[];const{instruction:u,data:d}=o;if(!(d.upstreamId?t.find(b=>b.upstreamId===d.upstreamId&&b.branchIndex===d.branchIndex):t.find(b=>b.upstreamId===null)))return[];const h=typeof u.branching=="function"?u.branching((x=r.config)!=null?x:{}):u.branching;return h?h===!0?$n:h:[]},[o,t,r.config]);if(!s.length)return null;const{data:l}=o;return n.jsx(a.SchemaComponent,{components:{RadioWithTooltip:ke},schema:{name:`${(i=l.type)!=null?i:"unknown"}-${(c=l.upstreamId)!=null?c:"root"}-${l.branchIndex}`,type:"void",properties:{downstreamBranchIndex:{type:"number",title:N("Move all downstream nodes to",{ns:p}),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:s,direction:"vertical"},default:!1,required:!0}}}})});function Pn(){const{presetting:e}=eo();return e!=null&&e.instruction.presetFieldset?n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{config:{type:"object",properties:e.instruction.presetFieldset}}}}):null}function Mn(e){var M;const o=a.useAPIClient(),t=a.useCompile(),r=a.usePlugin(ae),[s,l]=y.useState(null),[i,c]=y.useState(null),[u,d]=y.useState(!1),{workflow:m,nodes:h,refresh:x}=(M=H())!=null?M:{},b=y.useMemo(()=>fe.createForm(),[]),f=y.useCallback(S=>{S||(b.reset(),b.clearFormGraph("*"),c(null))},[b]),k=y.useCallback(S=>J(this,null,function*(){l(S);try{yield o.resource("workflows.nodes",m.id).create({values:S}),x()}catch(E){console.error(E)}finally{l(null)}}),[o,x,m.id]),F=y.useCallback(({type:S,upstream:E,branchIndex:L})=>{var O,B,G;const D=r.instructions.get(S);if(!D){console.error(`Instruction "${S}" not found`);return}const I={key:X.uid(),type:S,upstreamId:(O=E==null?void 0:E.id)!=null?O:null,branchIndex:L,title:t(D.title),config:(G=(B=D.createDefaultConfig)==null?void 0:B.call(D))!=null?G:{}},$=E!=null&&E.id?h.find(U=>U.upstreamId===I.upstreamId&&U.branchIndex===I.branchIndex):h.find(U=>U.upstreamId===null);if(D.presetFieldset||(typeof D.branching=="function"?D.branching(I.config):D.branching)&&$){c({data:I,instruction:D});return}k(I)},[t,k,r.instructions]);return n.jsxs(st.Provider,{value:{presetting:i,setPresetting:c,onCreate:F,creating:s,setCreating:l},children:[e.children,n.jsx(a.ActionContextProvider,{value:{visible:!!i,setVisible:f,formValueChanged:u,setFormValueChanged:d,openSize:"small"},children:n.jsx(a.SchemaComponent,{components:{DownstreamBranchIndex:In,PresetFieldset:Pn},scope:{useCancelAction:a.useCancelAction,useAddNodeSubmitAction:En},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:b},"x-component":"Action.Modal",title:`{{ t("Add node", { ns: "${p}" }) }}`,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 oo({from:e=null,entry:o=null,branchIndex:t=null,controller:r=null,className:s,end:l}){const{styles:i}=ne(),{getAriaLabel:c}=Ao(e,t),u=[];for(let d=o;d;d=d.downstream)u.push(d);return n.jsxs("div",{className:a.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(rt,{"aria-label":c(),upstream:e,branchIndex:t}),n.jsx("div",{className:"workflow-node-list",children:u.map(d=>n.jsx(qo,{data:d},d.id))}),l?n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})}):null]})}function Bn(){var l;const e=T.useForm(),o=a.useAPIClient(),{workflow:t}=(l=H())!=null?l:{},r=a.useActionContext(),{refresh:s}=a.useResourceActionContext();return{run(){return J(this,null,function*(){if(t.executed){g.message.error(N("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield o.resource("workflows").update({filterByTk:t.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class Bo{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function Vn(){const e=a.useCompile(),{workflow:o,execution:t}=H(),{styles:r}=ne(),s=Vo();return t?n.jsx(a.SchemaComponent,{components:{Tooltip:g.Tooltip},schema:{type:"void",name:"execution","x-decorator":"Tooltip","x-decorator-props":{title:N("View result")},"x-component":"Action","x-component-props":{title:n.jsx(V.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[t.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:a.cx(r.nodeTitleClass),children:[n.jsx(g.Tag,{children:e(s.title)}),n.jsx("strong",{children:o.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",t.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:a.css`
|
|
497
|
-
padding: 1em;
|
|
498
|
-
background-color: #f3f3f3;
|
|
499
|
-
`},"x-read-pretty":!0}}}}}}):null}function jn(){return{form:T.useForm()}}const Wn=()=>{const e=a.useAPIClient(),{workflow:o,refresh:t}=H(),[r,s]=y.useState(""),[l,i]=y.useState(!1),[c,u]=y.useState(!1),{styles:d}=ne(),m=a.useCompile(),h=Vo();y.useEffect(()=>{var D,I;o&&s((I=(D=o.triggerTitle)!=null?D:o.title)!=null?I:m(h==null?void 0:h.title))},[o,h]);const x=y.useMemo(()=>{const D=we.cloneDeep(o.config);return fe.createForm({initialValues:D,disabled:o.executed})},[o]),b=y.useCallback(D=>{i(D),D||x.reset()},[x]),f=y.useCallback(function(D){return J(this,null,function*(){const I=D||m(h==null?void 0:h.title);s(I),I!==o.triggerTitle&&(yield e.resource("workflows").update({filterByTk:o.id,values:{triggerTitle:I}}),t())})},[o,h]),k=y.useCallback(function(D){var $;if(D.target===D.currentTarget){i(!0);return}const I=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let O=D.target;O&&O!==D.currentTarget;O=O.parentNode)if(Array.from(($=O.classList)!=null?$:[]).some(B=>I.has(B))){i(!0),D.stopPropagation();return}},[]),F=o.executed?'{{t("View")}}':'{{t("Configure")}}',M=N("Trigger");if(!h)return n.jsx(g.Tooltip,{title:N("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:a.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:d.nodeHeaderClass,children:n.jsx("div",{className:a.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(g.Tag,{color:"error",children:N("Unknown trigger")})})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:L}=h;return n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:a.cx(d.nodeCardClass),onClick:k,children:[n.jsxs("div",{className:d.nodeHeaderClass,children:[n.jsx("div",{className:a.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(g.Tag,{color:"gold",children:[n.jsx(V.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:m(h.title)})]})}),n.jsx("div",{className:"workflow-node-actions",children:n.jsx(Vn,{})})]}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,onChange:D=>s(D.target.value),onBlur:D=>f(D.target.value),autoSize:!0,disabled:o.executed})}),n.jsx(a.ActionContextProvider,{value:{visible:l,setVisible:b,formValueChanged:c,setFormValueChanged:u},children:n.jsx(a.FormProvider,{form:x,children:n.jsx(a.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:jn}),components:L,schema:{name:`workflow-trigger-${o.id}`,type:"void",properties:{config:{type:"void","x-content":F,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:M,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":Jo,"x-component-props":{label:N("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:a.css`
|
|
500
|
-
.ant-select.auto-width {
|
|
501
|
-
width: auto;
|
|
502
|
-
min-width: 6em;
|
|
503
|
-
}
|
|
504
|
-
`},properties:S},actions:C({},o.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:Bn}}}})})}}}})})})]})};function Vo(){const e=a.usePlugin(ae),{workflow:o}=H();return e.triggers.get(o.type)}function lt({entry:e}){const{styles:o}=ne(),{workflow:t}=H(),[r,s]=y.useState(100);return n.jsxs("div",{className:"workflow-canvas-wrapper",children:[n.jsx(tn,{FallbackComponent:a.ErrorFallback,onError:console.error,children:n.jsx(Mn,{children:n.jsx("div",{className:"workflow-canvas",style:{zoom:r/100},children:n.jsx("div",{className:a.cx(o.branchBlockClass,a.css`
|
|
505
|
-
margin-top: 0 !important;
|
|
506
|
-
`),children:n.jsxs("div",{className:o.branchClass,children:[t!=null&&t.executed?n.jsx(g.Alert,{type:"warning",message:N("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:a.css`
|
|
507
|
-
margin-bottom: 1em;
|
|
508
|
-
`}):null,n.jsx(Wn,{}),n.jsx("div",{className:a.cx(o.branchBlockClass,a.css`
|
|
509
|
-
margin-top: 0 !important;
|
|
510
|
-
`),children:n.jsx(oo,{entry:e})}),n.jsx("div",{className:o.terminalClass,children:N("End")})]})})})})}),n.jsx("div",{className:"workflow-canvas-zoomer",children:n.jsx(g.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:r,onChange:s})})]})}function Ln(e,o=[]){const t=new Map;e.forEach(r=>{r.jobs=[],t.set(r.id,r)}),o.forEach(r=>{const s=t.get(r.nodeId);s.jobs.push(r),r.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(r=>{r.jobs=r.jobs.sort((s,l)=>s.id-l.id)})}function zn(){const{instructions:e}=a.usePlugin(ae),o=a.useCompile(),{viewJob:t,setViewJob:r}=H(),{styles:s}=ne(),{node:l={}}=t!=null?t:{},i=e.get(l.type);return n.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:r},children:n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{[`${t==null?void 0:t.id}-${t==null?void 0:t.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:s.nodeTitleClass,children:[n.jsx(g.Tag,{children:o(i==null?void 0:i.title)}),n.jsx("strong",{children:l.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",l.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:So,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function Jn(e){const{execution:o}=H(),t=a.useAPIClient(),r=se.useNavigate(),{styles:s}=ne(),[l,i]=y.useState([]),[c,u]=y.useState([]);y.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$lt:o.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{i(m.data)}).catch(()=>{})},[o]),y.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$gt:o.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{u(m.data.reverse())}).catch(()=>{})},[o]);const d=y.useCallback(({key:m})=>{m!=o.id&&r(qe(m))},[o]);return o?n.jsx(g.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${o.id}`],className:a.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,o,...l].map(m=>({key:m.id,label:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"id",children:`#${m.id}`}),n.jsx("time",{children:X.str2moment(m.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:n.jsx("span",{children:n.jsx(Be,{statusMap:_e,status:m.status})})}))},children:n.jsxs(g.Space,{children:[n.jsx("strong",{children:`#${o.id}`}),n.jsx(V.DownOutlined,{})]})}):null}function Un(){var S;const{t:e}=Y.useTranslation(),o=a.useCompile(),{data:t,loading:r,refresh:s}=a.useResourceActionContext(),{setTitle:l}=a.useDocumentTitle(),[i,c]=y.useState(null),u=a.useApp(),d=a.useAPIClient();y.useEffect(()=>{var $;const{workflow:I}=($=t==null?void 0:t.data)!=null?$:{};l==null||l(`${I!=null&&I.title?`${I.title} - `:""}${N("Execution history")}`)},[t==null?void 0:t.data]);const m=y.useCallback(()=>{g.Modal.confirm({title:N("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:N("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:t==null?void 0:t.data.id}).then(()=>{g.message.success(e("Operation succeeded")),s()}).catch(I=>{console.error(I.data.error)})}})},[t==null?void 0:t.data]);if(!(t!=null&&t.data))return r?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found"});const E=(S=t==null?void 0:t.data)!=null?S:{},{jobs:h=[],workflow:L={}}=E,D=L,{nodes:x=[],revisions:b=[]}=D,f=Q(D,["nodes","revisions"]),k=Q(E,["jobs","workflow"]);wo(x),Ln(x,h);const F=x.find(I=>!I.upstream),M=_e[k.status];return n.jsxs(Pe.Provider,{value:{workflow:f.type?f:null,nodes:x,execution:k,viewJob:i,setViewJob:c},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:N("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx(se.Link,{to:Ce(f.id),children:f.title})})},{title:n.jsx(Jn,{})}]})}),n.jsxs("aside",{children:[n.jsx(g.Tag,{color:M.color,children:o(M.label)}),k.status?null:n.jsx(g.Tooltip,{title:N("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:m,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})}),n.jsx("time",{children:X.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),n.jsx(lt,{entry:F}),n.jsx(zn,{})]})}const at=()=>{const e=se.useParams(),{styles:o}=ne();return n.jsx("div",{className:a.cx(o.workflowPageClass),children:n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:Un}})})},it=()=>{const{t:e}=Y.useTranslation(),{id:o}=a.useRecord(),{setVisible:t}=a.useActionContext();return n.jsx(se.Link,{to:qe(o),onClick:()=>t(!1),children:e("View")})},Hn={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: "${p}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${p}" })}}`,"x-component"({value:e}){const{setVisible:o}=a.useActionContext();return n.jsx(se.Link,{to:Ce(e),onClick:()=>o(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:Ye}}]},ct={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${p}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:Hn,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=Y.useTranslation(),{refresh:o,defaultRequest:t}=a.useResourceActionContext(),{resource:r}=a.useResourceContext(),{setVisible:s}=a.useActionContext();return{run(){return J(this,null,function*(){var i;yield r.destroy({filter:(i=t.params)==null?void 0:i.filter}),g.message.success(e("Operation succeeded")),o(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${p}" })}}`,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: "${p}" })}}`}}}}},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: "${p}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:`{{ $deps[0] !== ${ie.STARTED} }}`}}}]}}}}}}}}}}};function dt(e){var l;const t=a.useCompile()(e.label),r=y.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(l=_e[e.value])!=null?l:{};return n.jsx(g.Tag,{color:s,onMouseDown:r,closable:e.closable,onClose:e.onClose,children:t})}function Gn(e){const o=a.useCompile();return n.jsxs(n.Fragment,{children:[n.jsx(dt,C({},e)),e.description?n.jsx("span",{children:o(e.description)}):null]})}function qn(o){var e=Q(o,[]);const t=e.multiple?"multiple":null;return n.jsx(g.Select,A(C({role:"button","data-testid":`select-${t||"single"}`},e),{mode:t,optionLabelProp:"label",tagRender:dt,children:Ye.filter(r=>!!r.value&&r.value!==ie.ABORTED).map(r=>n.jsx(g.Select.Option,A(C({},r),{children:n.jsx(Gn,C({},r))}),r.value))}))}function ut(e){const{t:o}=Y.useTranslation(),{refresh:t}=a.useResourceActionContext(),{resource:r}=a.useResourceContext(),s=a.useRecord(),l=y.useCallback(()=>{g.Modal.confirm({title:N("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:N("Are you sure you want to cancel the execution?"),onOk:()=>{r.cancel({filterByTk:s.id}).then(()=>{g.message.success(o("Operation succeeded")),t()}).catch(i=>{console.error(i.data.error)})}})},[s]);return n.jsxs("div",{className:a.css`
|
|
511
|
-
display: flex;
|
|
512
|
-
`,children:[e.children,s.status?null:n.jsx(g.Tooltip,{title:N("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:l,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})})]})}function pt(){const e=a.useResourceActionContext();return{onClick(){return J(this,null,function*(){var t;(t=e==null?void 0:e.refresh)==null||t.call(e)})}}}function Yn(r){var s=r,{request:e,filter:o={}}=s,t=Q(s,["request","filter"]);var c;const{workflow:l}=H(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:l.key})})})});return n.jsx(a.ResourceActionProvider,C({},i))}function _n(){var I;const e=se.useNavigate(),{t:o}=Y.useTranslation(),t=a.useApp(),{data:r,refresh:s,loading:l}=a.useResourceActionContext(),{resource:i}=a.useResourceContext(),{setTitle:c}=a.useDocumentTitle(),[u,d]=y.useState(!1),{styles:m}=ne(),{modal:h}=g.App.useApp();if(y.useEffect(()=>{var B;const{title:O}=(B=r==null?void 0:r.data)!=null?B:{};c==null||c(`${N("Workflow")}${O?`: ${O}`:""}`)},[r==null?void 0:r.data]),!(r!=null&&r.data))return l?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found",extra:n.jsx(g.Button,{onClick:()=>e(-1),children:N("Go back")})});const $=(I=r==null?void 0:r.data)!=null?I:{},{nodes:x=[],revisions:b=[]}=$,f=Q($,["nodes","revisions"]);wo(x);const k=x.find(O=>!O.upstream);function F({key:O}){O!=f.id&&e(Ce(O))}function M(O){return J(this,null,function*(){yield i.update({filterByTk:f.id,values:{enabled:O}}),s()})}function S(){return J(this,null,function*(){const{data:{data:O}}=yield i.revision({filterByTk:f.id,filter:{key:f.key}});g.message.success(o("Operation succeeded")),e(`/admin/workflow/workflows/${O.id}`)})}function E(){return J(this,null,function*(){const O=f.current?N("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:o("Are you sure you want to delete it?"),content:O,onOk(){return J(this,null,function*(){var G;yield i.destroy({filterByTk:f.id}),g.message.success(o("Operation succeeded")),e(f.current?t.pluginSettingsManager.getRoutePath("workflow"):Ce((G=b.find(U=>U.current))==null?void 0:G.id))})}})})}function L(B){return J(this,arguments,function*({key:O}){switch(O){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const D=f.executed&&!b.find(O=>!O.executed&&new Date(O.createdAt)>new Date(f.createdAt));return n.jsxs(Pe.Provider,{value:{workflow:f,nodes:x,refresh:s},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:t.pluginSettingsManager.getRoutePath("workflow"),children:N("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx("strong",{children:f.title})})}]})}),n.jsxs("aside",{children:[f.sync?n.jsx(g.Tag,{color:"orange",children:N("Synchronously")}):n.jsx(g.Tag,{color:"cyan",children:N("Asynchronously")}),n.jsx(g.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:F,defaultSelectedKeys:[`${f.id}`],className:a.cx(m.dropdownClass,m.workflowVersionDropdownClass),items:b.sort((O,B)=>B.id-O.id).map((O,B)=>({role:"button","aria-label":`version-${B}`,key:`${O.id}`,icon:O.current?n.jsx(V.RightOutlined,{}):null,className:a.cx({executed:O.executed,unexecuted:!O.executed,enabled:O.enabled}),label:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:`#${O.id}`}),n.jsx("time",{children:X.str2moment(O.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:n.jsxs(g.Button,{type:"text","aria-label":"version",children:[n.jsx("label",{children:N("Version")}),n.jsx("span",{children:f!=null&&f.id?`#${f.id}`:null}),n.jsx(V.DownOutlined,{})]})}),n.jsx(g.Switch,{checked:f.enabled,onChange:M,checkedChildren:N("On"),unCheckedChildren:N("Off")}),n.jsx(g.Dropdown,{menu:{items:[{key:"key",label:`Key: ${f.key}`,disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:N("Execution history"),disabled:!f.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:N("Copy to new version"),disabled:!D},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:o("Delete")}],onClick:L},children:n.jsx(g.Button,{"aria-label":"more",type:"text",icon:n.jsx(V.EllipsisOutlined,{})})}),n.jsx(a.ActionContextProvider,{value:{visible:u,setVisible:d},children:n.jsx(a.SchemaComponent,{schema:ct,components:{ExecutionResourceProvider:Yn,ExecutionLink:it,ExecutionStatusColumn:ut},scope:{useRefreshActionProps:pt}})})]})]}),n.jsx(lt,{entry:k})]})}const mt=()=>{const e=se.useParams(),{styles:o}=ne();return n.jsx("div",{className:a.cx(o.workflowPageClass),children:n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:_n}})})},Kn=r=>{var s=r,{request:e,filter:o={}}=s,t=Q(s,["request","filter"]);var c;const l=a.useRecord(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:l.key})})})});return n.jsx(a.ResourceActionProvider,C({},i))},Zn=()=>{const{t:e}=Y.useTranslation(),{id:o}=a.useRecord(),{setVisible:t}=a.useActionContext(),{getAriaLabel:r}=a.useGetAriaLabelOfAction("Configure");return n.jsx(se.Link,{"aria-label":r(),to:Ce(o),onClick:()=>t(!1),children:e("Configure")})};function Qn(r){var s=r,{component:e="div",children:o}=s,t=Q(s,["component","children"]);const[l,i]=y.useState(!1),c=T.useFieldSchema();return n.jsxs(a.ActionContextProvider,{value:{visible:l,setVisible:i,fieldSchema:c},children:[y.createElement(e,A(C({},t),{onClick(){i(!0)}}),o),n.jsx(a.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Xn({data:e}){const{label:o,color:t,options:r}=e,s=a.useCompile();return n.jsxs(g.Space,{direction:"vertical",children:[n.jsx(g.Tag,{color:t,children:s(o)}),n.jsx(g.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(r.description)})]})}const ft={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: "${p}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:Xn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"select",uiSchema:{title:`{{t("Mode", { ns: "${p}" })}}`,type:"boolean","x-decorator":"FormItem","x-component":"Select",enum:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,color:"cyan"},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,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: "${p}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${p}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${p}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${p}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},he={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${p}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${p}" }) }}`},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,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: "${p}" }) }}`}]}},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: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},Rn={name:"workflow",type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:ft,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:ft},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${p}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${p}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=Y.useTranslation(),{resource:o}=a.useResourceContext(),t=a.useResourceActionContext();return{run(){return J(this,null,function*(){yield o.sync(),yield t==null?void 0:t.refresh(),g.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:he.title,type:he.type,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(o){const t=a.useRecord();return y.createElement("a",C({"aria-label":`executed-${t.title}`},o))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:ct}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:he.title,enabled:he.enabled,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${p}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${p}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=Y.useTranslation(),{refresh:o}=a.useResourceActionContext(),{resource:t,targetKey:r}=a.useResourceContext(),{setVisible:s}=a.useActionContext(),{[r]:l}=a.useRecord(),{values:i}=T.useForm();return{run(){return J(this,null,function*(){yield t.revision({filterByTk:l,values:i}),g.message.success(e("Operation succeeded")),o(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function er(e){const o=T.useField(),t=a.useRecord(),r=a.usePlugin(ae);return T.useFormEffects(s=>{fe.onFieldChange("type",l=>{let i=t.id||!l.value;if(l.value){const c=r.triggers.get(l.value);c.sync!=null?(i=!0,o.setValue(c.sync)):o.setInitialValue(!1)}o.setPattern(i?"disabled":"editable")})}),y.useEffect(()=>{if(t.id){o.setPattern("disabled");const s=r.triggers.get(t.type);s.sync!=null?o.setValue(s.sync):o.setInitialValue(!1)}},[t.id,o,r.triggers]),n.jsx(ke,C({},e))}function or(e){const o=a.useApp();e.visible=!!(a.usePlugin("multi-app-share-collection")||o.name!=="main")}function tr(){const e=y.useContext(a.SchemaComponentContext),{useTriggersOptions:o}=a.usePlugin(ae);return n.jsx(g.Card,{bordered:!1,children:n.jsx(a.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:n.jsx(a.SchemaComponent,{schema:Rn,components:{WorkflowLink:Zn,ExecutionResourceProvider:Kn,ExecutionLink:it,OpenDrawer:Qn,ExecutionStatusSelect:qn,SyncOptionSelect:er,ExecutionStatusColumn:ut,Tooltip:g.Tooltip},scope:{useTriggersOptions:o,useWorkflowSyncAction:or,useRefreshActionProps:pt}})})})}const de={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},ht={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: "${p}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:a.css`
|
|
513
|
-
flex-direction: column;
|
|
514
|
-
`},"x-component":"CollectionFieldset"},to={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=T.useForm(),[o,t]=a.parseCollectionName(e==null?void 0:e.collection);return{options:a.useCollectionFilterOptions(t,o),className:a.css`
|
|
515
|
-
position: relative;
|
|
516
|
-
width: 100%;
|
|
517
|
-
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},nr={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"}}},rr={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1},default:20}}}}}}},We={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=T.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function sr(){const e=a.useAPIClient(),o=T.useForm(),{field:t,__parent:r}=a.useBlockRequestContext(),{setVisible:s}=a.useActionContext(),l=se.useNavigate(),i=T.useFieldSchema(),c=T.useField(),u=a.useCompile(),{modal:d}=g.App.useApp(),m=a.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return J(this,null,function*(){var M,S,E;const{onSuccess:b,skipValidator:f,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};f||(yield o.submit());const F=yield m();c.data=t.data||{},c.data.loading=!0;try{const L=yield e.resource("workflows").trigger({values:F,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map(D=>[D.workflowKey,D.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=L,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(b!=null&&b.successMessage))return;b!=null&&b.manualClose?d.success({title:u(b==null?void 0:b.successMessage),onOk:()=>J(this,null,function*(){yield o.reset(),b!=null&&b.redirecting&&(b!=null&&b.redirectTo)&&(X.isURL(b.redirectTo)?window.location.href=b.redirectTo:l(b.redirectTo))})}):g.message.success(u(b==null?void 0:b.successMessage))}catch(L){c.data.loading=!1}})}}}function lr(){var b;const e=a.useCompile(),o=a.useAPIClient(),t=a.useRecord(),r=T.useField(),s=T.useFieldSchema(),{field:l,__parent:i}=a.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=a.useActionContext(),{modal:d}=g.App.useApp(),m=se.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(b=s==null?void 0:s["x-action-settings"])!=null?b:{};return{onClick(k,F){return J(this,null,function*(){r.data=l.data||{},r.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),F&&F(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let M;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return J(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(X.isURL(h.redirectTo)?window.location.href=h.redirectTo:m(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{r.data.loading=!1}})}}}function ar(){const{workflow:e}=H();return!!(e!=null&&e.executed)}function yt(){const{workflow:e}=H();return!!(e!=null&&e.allExecuted)}const Se={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},ir=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Se.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Se.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Se.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Se.DELETED}];function cr(e,o){var u;const[t,r]=a.parseCollectionName(e.collection),s=a.useCompile(),l=je(t),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:N("Trigger data")}}];return Ne(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:l}))}class dr extends Bo{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:ir,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Se.UPDATED})}}`}}}]},condition:A(C({},to),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${Se.DELETED})}}`}}}]}),appends:A(C({},We),{"x-reactions":[...We["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Se.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:a.useCollectionDataSource,useWorkflowAnyExecuted:yt});w(this,"components",{FieldsSelect:ko});w(this,"useVariables",cr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Me,collection:t.collection,dataPath:"$context.data"}:null}}const Ae={STATIC:0,DATE_FIELD:1};function ur(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function gt({value:e,onChange:o}){const t=e!=null?e:{},{t:r}=Y.useTranslation(),[s,l]=y.useState(t.offset?t.offset/Math.abs(t.offset):0);return n.jsxs("fieldset",{className:a.css`
|
|
518
|
-
display: flex;
|
|
519
|
-
gap: 0.5em;
|
|
520
|
-
`,children:[n.jsx(ko,{value:t.field,onChange:i=>o(A(C({},t),{field:i})),filter:ur,placeholder:r("Select field"),className:"auto-width"}),t.field?n.jsx(g.Select,{value:s,onChange:i=>{l(i),o(A(C({},t),{offset:Math.abs(t.offset)*i}))},options:[{value:0,label:N("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(g.InputNumber,{value:Math.abs(t.offset),onChange:i=>o(A(C({},t),{offset:(i!=null?i:0)*s}))}),n.jsx(g.Select,{value:t.unit||864e5,onChange:i=>o(A(C({},t),{unit:i})),options:[{value:864e5,label:N("Days")},{value:36e5,label:N("Hours")},{value:6e4,label:N("Minutes")},{value:1e3,label:N("Seconds")}],className:"auto-width"})]}):null]})}function pr({value:e,onChange:o}){const{t}=xo(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:a.css`
|
|
521
|
-
display: flex;
|
|
522
|
-
gap: 0.5em;
|
|
523
|
-
`,children:[n.jsxs(g.Select,{value:r,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(g.Select.Option,{value:null,children:t("No end")}),n.jsx(g.Select.Option,{value:"field",children:t("By field")}),n.jsx(g.Select.Option,{value:"date",children:t("By custom date")})]}),r==="field"?n.jsx(gt,{value:e,onChange:o}):null,r==="date"?n.jsx(g.DatePicker,{showTime:!0,value:en(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function bt(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)o.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(t[r[s]]=e[r[s]])}return t}function no(e,o,t){if(t||arguments.length===2)for(var r,s=0,l=o.length;s<l;s++)!r&&s in o||(r||(r=Array.prototype.slice.call(o,0,s)),r[s]=o[s]);return e.concat(r||Array.prototype.slice.call(o))}var mr=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Fe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],j={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function vt(e,o){for(var t=[],r=e;r<=o;r++)t.push(r);return t}function ro(e){return e.sort(function(o,t){return o-t}),e}function xt(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ue(e){return Object.entries(e).filter(function(o){var t=o[0],r=o[1];return t&&r}).map(function(o){return o[0]}).join(" ")}function wt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||j.errorInvalidCron})}function so(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function Ct(e,o,t,r,s,l,i,c,u,d,m,h,x,b){t&&t(void 0),o(!1);var f=!1;if(!e){if(r==="always"||l&&r==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void b("reboot");var k=mr.find(function(S){return S.name===e});k&&(e=k.value)}try{var F=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(L,D){return function(I,$){if(I==="*"||I==="*/1")return[];var O=ro(xt(Ft(function(G,U,pe){if(pe){G=G.toUpperCase();for(var P=0;P<pe.length;P++)G=G.replace(pe[P],"".concat(P+U))}return G}(I,$.min,$.alt).split(",").map(function(G){var U,pe=G.split("/");if(pe.length>2)throw new Error('Invalid value "'.concat(I,' for "').concat($.type,'"'));var P=pe[0],W=pe[1];U=P==="*"?vt($.min,$.max):function(q,K,R){var ee=q.split("-");if(ee.length===1){var ze=so(ee[0]);if(isNaN(ze))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));return[ze]}if(ee.length===2){var ye=so(ee[0]),Ee=so(ee[1]);if(isNaN(ye)||isNaN(Ee))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));if(Ee<ye)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return vt(ye,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,I,$);var z=function(q,K){if(q!==void 0){var R=so(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(K.type));return R}}(W,$),le=function(q,K){if(K){var R=q[0];q=q.filter(function(ee){return ee%K==R%K||ee===R})}return q}(U,z);return le}).flat(),$))),B=Tt(O,$);if(B!==void 0)throw new Error('Value "'.concat(B,'" out of range for ').concat($.type));return O.length===$.total?[]:O}(L,Fe[D])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(F);b(M),u(F[0]),d(F[1]),m(F[2]),h(F[3]),x(F[4])}catch(S){f=!0}}f&&(s.current=e,o(!0),wt(t,i))}function kt(e,o,t,r,s,l,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(m,h){var x=Fe[h];return St(At(m,x),x,d)})}([e!=="minute"&&l?l:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function St(e,o,t,r,s){var l="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)l="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);l=i&&function(c,u){for(var d=1;d<c.length;d++){var m=c[d-1];if(c[d]-m!==u)return!1}return!0}(e,i)?function(c,u,d){var m=Nt(c),h=Ot(c),x=c.length===(h-m)/d+1;return!!(m===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(De(Nt(e),o,t,r,s),"-").concat(De(Ot(e),o,t,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(m,h,x){m!==x[h+1]-1?d!==null?(u.push([d,m]),d=null):u.push(m):d===null&&(d=m)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(De(c[0],o,t,r,s),"-").concat(De(c[1],o,t,r,s)):De(c,o,t,r,s)}).join(",")}return l}function De(e,o,t,r,s){var l=e.toString(),i=o.type,c=o.alt,u=o.min,d=r&&(r===!0||r.includes(i)),m=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?l=c[e-u]:e<10&&(d||m)&&(l=l.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),l="".concat(x).concat(h)}return l}function At(e,o){var t=ro(xt(Ft(e,o)));if(t.length===0)return t;var r=Tt(t,o);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(o.type));return t}function Ft(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function Tt(e,o){var t=e[0],r=e[e.length-1];return t<o.min?t:r>o.max?r:void 0}function Nt(e){return e[0]}function Ot(e){return e[e.length-1]}function Le(e){var o=e.value,t=e.grid,r=t===void 0||t,s=e.optionsList,l=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,m=e.readOnly,h=e.leadingZero,x=e.clockFormat,b=e.period,f=e.unit,k=e.periodicityOnDoubleClick,F=e.mode,M=bt(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=y.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(P){return P.toString()})},[o]),E=y.useMemo(function(){return s?s.map(function(P,W){return{value:(f.min===0?W:W+1).toString(),label:P}}):no([],Array(f.total),!0).map(function(P,W){var z=f.min===0?W:W+1;return{value:z.toString(),label:De(z,f,u,h,x)}})},[s,h,u,x]),L=JSON.stringify(i),D=y.useCallback(function(P){var W=P.value;if(!o||o[0]!==Number(W))return n.jsx(n.Fragment,{});var z=St(At(o,f),f,u,h,x),le=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:le[1]?"".concat(i.everyText||j.everyText," ").concat(le[1]):z})},[o,L,u,h,x]),I=y.useCallback(function(P){var W=Array.isArray(P)?ro(P):[P],z=W;o&&(z=F==="single"?[]:no([],o,!0),W.forEach(function(le){var q=Number(le);z=o.some(function(K){return K===q})?z.filter(function(K){return K!==q}):ro(no(no([],z,!0),[q],!1))})),z.length===f.total?l([]):l(z)},[l,o]),$=y.useCallback(function(P){if(P!==0&&P!==1){for(var W=f.total+f.min,z=[],le=f.min;le<W;le++)le%P==0&&z.push(le);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),K=z.length===E.length;l(K||q?[]:z)}else l([])},[o,E,l]),O=y.useRef([]),B=y.useCallback(function(P){if(!m){var W=O.current;W.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&W.length>1&&W[W.length-1].time-W[W.length-2].time<300?W[W.length-1].value===W[W.length-2].value?$(Number(P)):I([W[W.length-2].value,W[W.length-1].value]):I(Number(P)),O.current=[]},300);return function(){window.clearTimeout(z)}}},[O,I,$,m,k]),G=y.useCallback(function(){m||l([])},[l,m]),U=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),pe=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&b!=="hour"&&b!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(b==="day"||b==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&x==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,P))},[c,r,x,b]);return n.jsx(g.Select,re({mode:F!=="single"||k?"multiple":void 0,allowClear:!m,virtual:!1,open:!m&&void 0,value:S,onClear:G,tagRender:D,className:U,popupClassName:pe,options:E,showSearch:!1,showArrow:!m,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:B,onDeselect:B,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||b==="day"||b==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},M))}function fr(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,x=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-hours")]=!!s,b))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||j.prefixHours}),n.jsx(Le,{placeholder:r.emptyHours||j.emptyHours,value:o,unit:Fe[1],setValue:t,locale:r,className:s,disabled:l,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h})]}))}function hr(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,x=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-minutes")]=!!s,b))},[s]);return n.jsxs("div",re({className:x},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||j.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||j.prefixMinutes}),n.jsx(Le,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||j.emptyMinutesForHourPeriod:r.emptyMinutes||j.emptyMinutes,value:o,unit:Fe[0],setValue:t,locale:r,className:s,disabled:l,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||j.suffixMinutesForHourPeriod})]}))}function yr(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,x=!l||l.length===0,b=y.useMemo(function(){var F;return ue(((F={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,F["".concat(s,"-month-days")]=!!s,F))},[s,x]),f=JSON.stringify(r),k=y.useMemo(function(){return x?r.emptyMonthDays||j.emptyMonthDays:r.emptyMonthDaysShort||j.emptyMonthDaysShort},[x,f]);return!c||o&&o.length>0||(!o||o.length===0)&&(!l||l.length===0)?n.jsxs("div",re({className:b},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||j.prefixMonthDays}),n.jsx(Le,{placeholder:k,value:o,setValue:t,unit:Fe[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function gr(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,m=e.mode,h=r.months||j.months,x=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-months")]=!!s,b))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||j.prefixMonths}),n.jsx(Le,{placeholder:r.emptyMonths||j.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},Fe[3]),{alt:r.altMonths||j.altMonths}),setValue:t,locale:r,className:s,humanizeLabels:l,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:m})]}))}function br(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||j.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||j.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||j.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||j.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||j.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||j.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||j.rebootOption});var m=y.useCallback(function(f){i||t(f)},[t,i]),h=y.useMemo(function(){var f;return ue(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),x=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,r.prefixPeriod]),b=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,f["".concat(s,"-select-dropdown-period")]=!!s,f))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||j.prefixPeriod}),n.jsx(g.Select,{defaultValue:o,value:o,onChange:m,options:d,className:x,popupClassName:b,disabled:l,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function vr(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,l=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,x=r.weekDays||j.weekDays,b=d==="week"||!i||i.length===0,f=y.useMemo(function(){var E;return ue(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!b})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,b]),k=JSON.stringify(r),F=y.useMemo(function(){return b?r.emptyWeekDays||j.emptyWeekDays:r.emptyWeekDaysShort||j.emptyWeekDaysShort},[b,k]),M=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return M?n.jsxs("div",re({className:f},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||j.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||j.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(Le,{placeholder:F,optionsList:x,grid:!1,value:o,unit:re(re({},Fe[4]),{alt:r.altWeekDays||j.altWeekDays}),setValue:t,locale:r,className:s,humanizeLabels:l,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function xr(e){var o=e.clearButton,t=o===void 0||o,r=e.clearButtonProps,s=r===void 0?{}:r,l=e.clearButtonAction,i=l===void 0?"fill-with-every":l,c=e.locale,u=c===void 0?j:c,d=e.value,m=d===void 0?"":d,h=e.setValue,x=e.displayError,b=x===void 0||x,f=e.onError,k=e.className,F=e.defaultPeriod,M=F===void 0?"day":F,S=e.allowEmpty,E=S===void 0?"for-default-value":S,L=e.humanizeLabels,D=L===void 0||L,I=e.humanizeValue,$=I!==void 0&&I,O=e.disabled,B=O!==void 0&&O,G=e.readOnly,U=G!==void 0&&G,pe=e.leadingZero,P=pe!==void 0&&pe,W=e.shortcuts,z=W===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:W,le=e.clockFormat,q=e.periodicityOnDoubleClick,K=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,ze=e.allowedDropdowns,ye=ze===void 0?["period","months","month-days","week-days","hours","minutes"]:ze,Ee=e.allowedPeriods,zr=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=y.useRef(m),jo=y.useRef(M),Vt=y.useState(),xe=Vt[0],lo=Vt[1],jt=y.useState(),Je=jt[0],ao=jt[1],Wt=y.useState(),io=Wt[0],co=Wt[1],Lt=y.useState(),Ue=Lt[0],uo=Lt[1],zt=y.useState(),po=zt[0],mo=zt[1],Jt=y.useState(),fo=Jt[0],ho=Jt[1],Ut=y.useState(!1),Wo=Ut[0],He=Ut[1],Ht=y.useState(!1),yo=Ht[0],Gt=Ht[1],Jr=function(Z){var ge=y.useRef(Z);return y.useEffect(function(){ge.current=Z},[Z]),ge.current}(yo),qt=JSON.stringify(u);y.useEffect(function(){Ct(m,He,f,E,$e,!0,u,z,ho,mo,ao,co,uo,lo)},[]),y.useEffect(function(){m!==$e.current&&Ct(m,He,f,E,$e,!1,u,z,ho,mo,ao,co,uo,lo)},[m,$e,qt,E,z]),y.useEffect(function(){if(!(xe||fo||io||Je||Ue||po)||yo||Jr)yo&&Gt(!1);else{var Z=xe||jo.current,ge=kt(Z,io,Je,Ue,po,fo,$);h(ge,{selectedPeriod:Z}),$e.current=ge,f&&f(void 0),He(!1)}},[xe,Je,io,Ue,po,fo,$,yo]);var Yt=y.useCallback(function(){ao(void 0),co(void 0),uo(void 0),mo(void 0),ho(void 0);var Z="",ge=xe!=="reboot"&&xe?xe:jo.current;ge!==xe&&lo(ge),i==="fill-with-every"&&(Z=kt(ge,void 0,void 0,void 0,void 0,void 0)),h(Z,{selectedPeriod:ge}),$e.current=Z,Gt(!0),E==="never"&&i==="empty"?(He(!0),wt(f,u)):(f&&f(void 0),He(!1))},[xe,h,f,i]),Ur=y.useMemo(function(){var Z;return ue(((Z={"react-js-cron":!0,"react-js-cron-error":Wo&&b,"react-js-cron-disabled":B,"react-js-cron-read-only":U})["".concat(k)]=!!k,Z["".concat(k,"-error")]=Wo&&b&&!!k,Z["".concat(k,"-disabled")]=B&&!!k,Z["".concat(k,"-read-only")]=U&&!!k,Z))},[k,Wo,b,B,U]),Lo=s.className,_t=bt(s,["className"]),Kt=y.useMemo(function(){var Z;return ue(((Z={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,Z["".concat(Lo)]=!!Lo,Z))},[k,Lo]),Hr=JSON.stringify(_t),Zt=y.useMemo(function(){return t&&!U?n.jsx(g.Button,re({className:Kt,danger:!0,type:"primary",disabled:B},_t,{onClick:Yt},{children:u.clearButtonText||j.clearButtonText})):null},[t,U,qt,Kt,B,Hr,Yt]),oe=xe||jo.current;return n.jsxs("div",re({className:Ur},{children:[ye.includes("period")&&n.jsx(br,{value:oe,setValue:lo,locale:u,className:k,disabled:B,readOnly:U,shortcuts:z,allowedPeriods:zr}),oe==="reboot"?Zt:n.jsxs(n.Fragment,{children:[oe==="year"&&ye.includes("months")&&n.jsx(gr,{value:io,setValue:co,locale:u,className:k,humanizeLabels:D,disabled:B,readOnly:U,period:oe,periodicityOnDoubleClick:K,mode:ee}),(oe==="year"||oe==="month")&&ye.includes("month-days")&&n.jsx(yr,{value:Je,setValue:ao,locale:u,className:k,weekDays:Ue,disabled:B,readOnly:U,leadingZero:P,period:oe,periodicityOnDoubleClick:K,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&ye.includes("week-days")&&n.jsx(vr,{value:Ue,setValue:uo,locale:u,className:k,humanizeLabels:D,monthDays:Je,disabled:B,readOnly:U,period:oe,periodicityOnDoubleClick:K,mode:ee}),n.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&ye.includes("hours")&&n.jsx(fr,{value:po,setValue:mo,locale:u,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:le,period:oe,periodicityOnDoubleClick:K,mode:ee}),oe!=="minute"&&ye.includes("minutes")&&n.jsx(hr,{value:fo,setValue:ho,locale:u,period:oe,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:le,periodicityOnDoubleClick:K,mode:ee}),Zt]})]})]}))}const Dt=[{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 Et(e){return Dt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function wr(e){let o;switch(typeof e){case"number":return o=Et(e),o?o.value:"none";case"string":return"cron"}return"none"}function Cr({value:e,onChange:o}){const{t}=xo(),r=Et(e);return n.jsx(g.InputNumber,{value:e/r.value,onChange:s=>o(s*r.value),min:1,addonBefore:t("Every"),addonAfter:t(r.unitText),className:"auto-width"})}function kr({value:e=null,onChange:o}){const{t}=xo(),r=wr(e),s=y.useCallback(l=>{if(l==="none"){o(null);return}if(l==="cron"){o("0 * * * * *");return}o(l)},[o]);return n.jsxs("fieldset",{className:a.css`
|
|
524
|
-
display: flex;
|
|
525
|
-
flex-direction: ${r==="cron"?"column":"row"};
|
|
526
|
-
align-items: flex-start;
|
|
527
|
-
gap: 0.5em;
|
|
528
|
-
|
|
529
|
-
.react-js-cron {
|
|
530
|
-
width: 100%;
|
|
531
|
-
padding: 0.5em 0.5em 0 0.5em;
|
|
532
|
-
border: 1px dashed #ccc;
|
|
533
|
-
|
|
534
|
-
.react-js-cron-field {
|
|
535
|
-
margin-bottom: 0.5em;
|
|
536
|
-
|
|
537
|
-
> span {
|
|
538
|
-
margin: 0 0.5em 0 0;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
> .react-js-cron-select {
|
|
542
|
-
margin: 0 0.5em 0 0;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.react-js-cron-week-days {
|
|
547
|
-
> span {
|
|
548
|
-
min-width: 2em;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
`,children:[n.jsx(g.Select,{value:r,onChange:s,className:"auto-width",children:Dt.map(l=>n.jsx(g.Select.Option,{value:l.value,children:t(l.text)},l.value))}),typeof r=="number"?n.jsx(Cr,{value:e,onChange:o}):null,r==="cron"?n.jsx(xr,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:l=>o(`0 ${l}`),clearButton:!1,locale:window.cronLocale}):null]})}const Sr={[Ae.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}}},[Ae.DATE_FIELD]:{collection:A(C({},de),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${p}" })}}`,"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: "${p}" })}}`,"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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}},appends:A(C({},We),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${Ae.DATE_FIELD} && $deps[1]}}`}}}]})}},Ar=[{value:Ae.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:Ae.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],Fr=()=>{const{values:e={},clearFormGraph:o}=T.useForm(),[t,r]=y.useState(e.mode);return T.useFormEffects(()=>{fe.onFieldValueChange("mode",s=>{r(s.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(a.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:Ar},required:!0,default:Ae.STATIC}}),n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{[`mode-${t}`]:{type:"void","x-component":"fieldset","x-component-props":{className:a.css`
|
|
553
|
-
.ant-input-number {
|
|
554
|
-
width: auto;
|
|
555
|
-
min-width: 6em;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
.ant-picker {
|
|
559
|
-
width: auto;
|
|
560
|
-
}
|
|
561
|
-
`},properties:Sr[t]}}},components:{OnField:gt,RepeatField:kr,EndsByField:pr}})]})};function Tr(e,o){var c;const[t,r]=a.parseCollectionName(e.collection),s=a.useCompile(),l=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:N("Trigger time")}),e.mode===Ae.DATE_FIELD){const[u]=Ne(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},o),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:N("Trigger data")}}],compile:s,getCollectionFields:l}));u&&i.push(u)}return i}class Nr extends Bo{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${p}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${p}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:a.useCollectionDataSource});w(this,"components",{ScheduleConfig:Fr});w(this,"useVariables",Tr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Me,collection:t.collection,dataPath:"$context.data"}:null}}class Or extends be{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","calculation");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:Ie.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:l}=s,{evaluate:i}=Ie.evaluators.get(l.engine),c=t.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(u){return N("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:Mo});w(this,"components",{WorkflowVariableTextArea:Po,RadioWithTooltip:ke,ValueBlock:Oe})}useVariables({key:t,title:r},{types:s,fieldNames:l=Te}){return s&&!s.some(i=>i in Qe||Object.values(Qe).some(c=>c.has(i)))?null:{value:t,label:r}}useInitializers(t){var r,s;return{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Oe.Initializer,node:t,resultTitle:N("Calculation result")}}}const $t={DEFAULT:null,ON_TRUE:1,ON_FALSE:0};class Dr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(Ie.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[r,s])=>t.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"object",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:l}=s,{evaluate:i}=Ie.evaluators.get(l.engine),c=t.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(u){return N("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"presetFieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,value:!0},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,value:!1}],default:!0}});w(this,"branching",({rejectOnFalse:t=!0}={})=>t?!1:[{label:`{{t('After end of branches', { ns: "${p}" })}}`,value:!1},{label:`{{t('Inside of "Yes" branch', { ns: "${p}" })}}`,value:$t.ON_TRUE},{label:`{{t('Inside of "No" branch', { ns: "${p}" })}}`,value:$t.ON_FALSE}]);w(this,"scope",{renderEngineReference:Mo,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:nt,WorkflowVariableTextArea:Po,RadioWithTooltip:ke})}Component({data:t}){const{t:r}=Y.useTranslation(),{nodes:s}=H(),{styles:l}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(m=>m.upstreamId===i&&m.branchIndex===1),d=s.find(m=>m.upstreamId===i&&m.branchIndex===0);return n.jsx(No,{data:t,children:c?null:n.jsxs("div",{className:l.nodeSubtreeClass,children:[n.jsxs("div",{className:l.branchBlockClass,children:[n.jsx(oo,{from:t,entry:d,branchIndex:0}),n.jsx(oo,{from:t,entry:u,branchIndex:1})]}),n.jsxs("div",{className:l.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class Er extends be{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ce.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ce.FAILED}],required:!0,default:ce.RESOLVED}});w(this,"end",!0)}}function $r({key:e,title:o,config:t},r){var d,m;const[s,l]=a.parseCollectionName(t.collection),i=a.useCompile(),c=je(s),[u]=Ne(A(C({appends:[e,...((m=(d=t.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:l,name:e,type:"hasOne",target:l,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class Ir extends be{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${p}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${p}" })}}`},{label:`{{t("Multiple records", { ns: "${p}" })}}`,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: "${p}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:to,sort:nr,pagination:rr,appends:We},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${p}" })}}`}});w(this,"scope",{useNodeSavedConfig:Ve,useCollectionDataSource:a.useCollectionDataSource,useSortableFields(){const t=a.useCompile(),{values:r}=T.useForm(),[s,l]=a.parseCollectionName(r.collection),i=a.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(l).filter(d=>{if(!d.interface)return!1;const m=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(m!=null&&m.sortable)}).map(d=>{var m,h;return{value:d.name,label:(m=d==null?void 0:d.uiSchema)!=null&&m.title?t((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:bo.ArrayItems,FilterDynamicComponent:Re,SchemaComponentContext:a.SchemaComponentContext,WorkflowVariableInput:Io,RadioWithTooltip:ke});w(this,"useVariables",$r)}useInitializers(t){var r,s;return!t.config.collection||t.config.multiple?null:{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Me,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}}}function Pr(e){const{getCollectionFields:o}=a.useCollectionManager_deprecated(),{path:t}=T.useField(),r=t.segments[t.segments.length-1],{values:s}=T.useForm(),[l,i]=a.parseCollectionName(s==null?void 0:s.collection),c=o(i,l),{type:u}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,m=y.useCallback(h=>{const x=h.target.value.trim(),b=["belongsTo","hasOne"].includes(u)?x||null:x.split(",").map(f=>f.trim()).filter(f=>f!=="");e.onChange(b)},[e.onChange,u]);return n.jsx(g.Input,A(C({},e),{value:d,onChange:m}))}const It=T.observer(({value:e,disabled:o,onChange:t,filter:r})=>{const{token:s}=a.useToken(),{t:l}=Y.useTranslation(),i=a.useCompile(),c=T.useForm(),{getCollectionFields:u}=a.useCollectionManager_deprecated(),d=me(),{values:m}=c,[h,x]=a.parseCollectionName(m==null?void 0:m.collection),b=u(x,h).filter(S=>S.uiSchema),f=r?b.filter(r.bind(m)):b,k=y.useMemo(()=>f.filter(S=>!e||!(S.name in e)),[f,e]),F=o||c.disabled,M=y.useMemo(()=>({onClick:({key:S})=>{t(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,L;return{key:S.name,label:i((L=(E=S.uiSchema)==null?void 0:E.title)!=null?L:S.name)}})}),[t,k,e]);return n.jsx("fieldset",{className:a.css`
|
|
562
|
-
margin-top: 0.5em;
|
|
563
|
-
|
|
564
|
-
> .ant-formily-item {
|
|
565
|
-
flex-direction: column;
|
|
566
|
-
|
|
567
|
-
> .ant-formily-item-label {
|
|
568
|
-
line-height: 32px;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
`,children:f.length?n.jsxs(a.CollectionProvider_deprecated,{name:x,dataSource:h,children:[f.filter(S=>e&&S.name in e).map(S=>{var L,D;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?Pr:a.CollectionField;return n.jsxs(g.Form.Item,{label:i((D=(L=S.uiSchema)==null?void 0:L.title)!=null?D:S.name),labelAlign:"left",className:a.css`
|
|
572
|
-
.ant-form-item-control-input-content {
|
|
573
|
-
display: flex;
|
|
574
|
-
}
|
|
575
|
-
`,children:[n.jsx(a.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:I=>{t(A(C({},e),{[S.name]:I}))},children:n.jsx(a.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),F?null:n.jsx(g.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(V.CloseCircleOutlined,{}),onClick:()=>{var O;const B=e,{[O=S.name]:I}=B,$=Q(B,[Rt(O)]);t($)}})]},S.name)}),k.length?n.jsx(g.Dropdown,{menu:M,children:n.jsx(g.Button,{icon:n.jsx(V.PlusOutlined,{}),children:l("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:N("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Pt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Pt(t,o)})}function Mt(){return{name:te.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Bt(e){const{workflow:o}=H(),{setFormValueChanged:t}=a.useActionContext();a.useAPIClient();const r=me(),{values:s,setValuesIn:l,disabled:i}=T.useForm(),c=Ge.toJS(s.params),[u,d]=a.parseCollectionName(s.collection),m=a.useSchemaOptionsContext(),[h,x]=y.useState(e.value&&Object.keys(e.value).length?e.value:Mt()),b=y.useMemo(()=>fe.createForm({initialValues:c.values,disabled:o.executed,effects(){fe.onFormValuesChange(k=>{l("params.values",Ge.toJS(k.values)),t(!0)})}}),[o.executed]);T.useFormEffects(()=>{fe.onFieldValueChange("collection",k=>J(this,null,function*(){b.clearFormGraph("*");const F=Mt();l("params.values",{}),x(F)}))});const f=y.useCallback(k=>{const[F]=Object.values(k.toJSON().properties);e.onChange(F);const M=new Set;Pt(F,E=>{var L;if(E["x-component"]==="AssignedField"&&(L=E["x-collection-field"])!=null&&L.startsWith(`${d}.`)){const[,D]=E["x-collection-field"].split(".");M.add(D)}});const S={};Array.from(M).forEach(E=>{E in b.values&&(S[E]=b.values[E])}),l("params.values",S)},[d,e.onChange]);return n.jsx(g.Card,{children:n.jsx(a.CollectionManagerProvider,{dataSource:u,children:n.jsx(a.CollectionProvider,{name:d,children:n.jsx(a.RerenderDataBlockProvider,{children:n.jsx(a.FormProvider,{form:b,children:n.jsx(bo.FormLayout,{layout:"vertical",children:n.jsx(a.VariableScopeProvider,{scope:r,children:n.jsx(a.SchemaComponentProvider,{form:b,designable:!i,children:n.jsx(a.SchemaComponentOptions,A(C({},m),{children:n.jsx(a.SchemaComponent,{schema:h,onChange:f})}))})})})})})})})})}function Mr({key:e,title:o,config:t},r){var d,m;const[s,l]=a.parseCollectionName(t.collection),i=a.useCompile(),c=je(s),[u]=Ne(A(C({appends:[e,...((m=(d=t.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:l,name:e,type:"hasOne",target:l,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class Br extends be{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},ht),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:We}}});w(this,"scope",{useCollectionDataSource:a.useCollectionDataSource,useNodeSavedConfig:Ve});w(this,"components",{CollectionFieldset:It,AssignedFieldsFormSchemaConfig:Bt});w(this,"useVariables",Mr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var r,s;return t.config.collection?{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Me,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class Vr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,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: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,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: "${p}" })}}`}]},default:!1},filter:A(C({},to),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return X.isValidFilter(t)?"":N("Please add at least one condition")}}),values:A(C({},ht),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:a.useCollectionDataSource,useNodeSavedConfig:Ve});w(this,"components",{FilterDynamicComponent:Re,CollectionFieldset:It,AssignedFieldsFormSchemaConfig:Bt,RadioWithTooltip:ke})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class jr extends be{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},to),{"x-validator"(t){return X.isValidFilter(t)?"":N("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Ve,useCollectionDataSource:a.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:Re})}}const Wr=new a.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:a.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=a.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:a.SecondConFirm},{name:"assignFieldValues",Component:a.AssignedFieldValues},{name:"skipRequiredValidation",Component:a.SkipValidation},{name:"afterSuccessfulSubmission",Component:a.AfterSuccess},{name:"bindWorkflow",Component:a.WorkflowConfig},{name:"delete",sort:100,Component:a.RemoveButton,useComponentProps(){const{removeButtonProps:e}=a.useSchemaToolbar();return e}}]});function Lr({children:e,workflow:o,execution:t,nodes:r}){const s=a.usePlugin(ae),l=s.triggers.get(o.type).components,i=r.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return n.jsx(Pe.Provider,{value:{workflow:o,nodes:r,execution:t},children:n.jsx(a.SchemaComponentOptions,{components:C(C({},l),i),children:e})})}class ae extends a.Plugin{constructor(){super(...arguments);w(this,"triggers",new X.Registry);w(this,"instructions",new X.Registry);w(this,"useTriggersOptions",()=>{const t=a.useCompile();return Array.from(this.triggers.getEntities()).map(i=>{var[r,c]=i,u=c,{title:s}=u,l=Q(u,["title"]);return{value:r,label:t(s),color:"gold",options:l}})})}isWorkflowSync(t){var r,s;return(s=(r=this.triggers.get(t.type))==null?void 0:r.sync)!=null?s:t.sync}registerTrigger(t,r){if(typeof r=="function")this.triggers.register(t,new r);else if(r)this.triggers.register(t,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,r){if(typeof r=="function")this.instructions.register(t,new r);else if(r instanceof be)this.instructions.register(t,r);else throw new TypeError("invalid instruction type to register")}load(){return J(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:Ce(":id"),element:n.jsx(mt,{})}),this.app.router.add("admin.workflow.executions.id",{path:qe(":id"),element:n.jsx(at,{})}),this.app.addComponents({WorkflowPage:mt,ExecutionPage:at}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:tr,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(Wr),this.app.schemaSettingsManager.addItem("actionSettings:delete","workflowConfig",{Component:a.WorkflowConfig,useVisible(){var r;const t=T.useFieldSchema();return te.isValid((r=t==null?void 0:t["x-action-settings"])==null?void 0:r.triggerWorkflows)}}),this.registerTrigger("collection",dr),this.registerTrigger("schedule",Nr),this.registerInstruction("calculation",Or),this.registerInstruction("condition",Dr),this.registerInstruction("end",Er),this.registerInstruction("query",Ir),this.registerInstruction("create",Br),this.registerInstruction("update",Vr),this.registerInstruction("destroy",jr)})}}v.BaseTypeSets=Qe,v.Branch=oo,v.CalculationConfig=nt,v.CheckboxGroupWithTooltip=Sn,v.CollectionBlockInitializer=Me,v.DetailsBlockProvider=ln,v.EXECUTION_STATUS=ie,v.ExecutionContextProvider=Lr,v.ExecutionStatusOptions=Ye,v.ExecutionStatusOptionsMap=_e,v.FieldsSelect=ko,v.Fieldset=Dn,v.FilterDynamicComponent=Re,v.FlowContext=Pe,v.Instruction=be,v.JOB_STATUS=ce,v.JobButton=To,v.JobStatusOptions=So,v.JobStatusOptionsMap=Ke,v.Node=qo,v.NodeContext=Ze,v.NodeDefaultView=No,v.RadioWithTooltip=ke,v.RemoveButton=Fo,v.SimpleDesigner=Ro,v.Trigger=Bo,v.ValueBlock=Oe,v.WorkflowVariableInput=Io,v.WorkflowVariableJSON=kn,v.WorkflowVariableRawTextArea=Cn,v.WorkflowVariableTextArea=Po,v.calculators=_,v.default=ae,v.defaultFieldNames=Te,v.getCollectionFieldOptions=Ne,v.getWorkflowDetailPath=Ce,v.getWorkflowExecutionsPath=qe,v.linkNodes=wo,v.nodesOptions=_o,v.renderEngineReference=Mo,v.scopeOptions=Zo,v.systemOptions=Qo,v.traverseSchema=Co,v.triggerOptions=Ko,v.useAvailableUpstreams=Ho,v.useFlowContext=H,v.useGetAriaLabelOfAddButton=Ao,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Ve,v.useRecordTriggerWorkflowsActionProps=lr,v.useStyles=ne,v.useTrigger=Vo,v.useTriggerWorkflowsActionProps=sr,v.useUpstreamScopes=Go,v.useWorkflowAnyExecuted=yt,v.useWorkflowExecuted=ar,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
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}()});
|