@rytass/bpm-core-react 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/chunks/{compose-B1quUa7y.js → compose-CQHDT7vh.js} +2 -2
  3. package/dist/chunks/{compose-B1quUa7y.js.map → compose-CQHDT7vh.js.map} +1 -1
  4. package/dist/chunks/{compose-B6nevcwq.cjs → compose-Ds_cAefe.cjs} +2 -2
  5. package/dist/chunks/{compose-B6nevcwq.cjs.map → compose-Ds_cAefe.cjs.map} +1 -1
  6. package/dist/chunks/designer-CQ9hxSdD.cjs +65 -0
  7. package/dist/chunks/designer-CQ9hxSdD.cjs.map +1 -0
  8. package/dist/chunks/{designer-BLfz5Dk9.js → designer-CUbVXEtS.js} +1075 -868
  9. package/dist/chunks/designer-CUbVXEtS.js.map +1 -0
  10. package/dist/chunks/detail-B-Q4W-iw.cjs +2 -0
  11. package/dist/chunks/detail-B-Q4W-iw.cjs.map +1 -0
  12. package/dist/chunks/{detail-fg8MTwuH.js → detail-Cts5_gVp.js} +285 -283
  13. package/dist/chunks/detail-Cts5_gVp.js.map +1 -0
  14. package/dist/pages/instances/detail/index.cjs +1 -1
  15. package/dist/pages/instances/detail/index.js +1 -1
  16. package/dist/pages/templates/compose/index.cjs +1 -1
  17. package/dist/pages/templates/compose/index.js +1 -1
  18. package/dist/pages/templates/designer/index.cjs +1 -1
  19. package/dist/pages/templates/designer/index.js +1 -1
  20. package/dist/views/instances/detail/index.cjs +1 -1
  21. package/dist/views/instances/detail/index.js +1 -1
  22. package/dist/views/templates/compose/index.cjs +1 -1
  23. package/dist/views/templates/compose/index.js +1 -1
  24. package/dist/views/templates/designer/index.cjs +1 -1
  25. package/dist/views/templates/designer/index.js +1 -1
  26. package/package.json +3 -3
  27. package/dist/chunks/designer-BLfz5Dk9.js.map +0 -1
  28. package/dist/chunks/designer-DP002lt7.cjs +0 -65
  29. package/dist/chunks/designer-DP002lt7.cjs.map +0 -1
  30. package/dist/chunks/detail-KEmfpCtt.cjs +0 -2
  31. package/dist/chunks/detail-KEmfpCtt.cjs.map +0 -1
  32. package/dist/chunks/detail-fg8MTwuH.js.map +0 -1
@@ -6,21 +6,22 @@ import { t as o } from "./bpm-form-field-Cao0rMol.js";
6
6
  import '../style.css';/* empty css */
7
7
  import { t as s } from "./FormBuilderView-D8DrQOXD.js";
8
8
  import { Fragment as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
9
- import { AutoComplete as m, Button as h, Icon as ee, Input as g, Modal as _, PageHeader as te, Section as ne, SectionGroup as re, Select as v, Textarea as ie, Toggle as ae, Typography as y } from "@mezzanine-ui/react";
10
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
11
- import oe from "@mezzanine-ui/react/Drawer";
12
- import se from "@mezzanine-ui/react/ContentHeader";
13
- import { CheckedIcon as ce, DotGridIcon as le, EyeIcon as ue, FilterIcon as de, MailIcon as fe, SaveIcon as pe, TrashIcon as me, UserIcon as he } from "@mezzanine-ui/icons";
14
- import { DefaultChatTransport as ge, getToolName as _e, isToolUIPart as ve, lastAssistantMessageIsCompleteWithToolCalls as ye } from "ai";
15
- import { WORKFLOW_TOOLSET as be, applyWorkflowCommand as C, applyWorkflowMacroCommand as xe, executeWorkflowTool as Se, readWorkflowSnapshot as Ce } from "@rytass/bpm-core-shared";
16
- import { readFormBuilder as we } from "@rytass/bpm-core-client/form";
17
- import { readOrganizationDashboard as Te } from "@rytass/bpm-core-client/organization";
18
- import { Background as Ee, ConnectionMode as De, ControlButton as Oe, Controls as ke, Handle as Ae, MiniMap as je, Panel as Me, Position as w, ReactFlow as Ne, applyNodeChanges as Pe, getViewportForBounds as Fe } from "@xyflow/react";
19
- import * as Ie from "dagre";
20
- import { composeApprovalTemplateWithForm as Le, dryRunApprovalWorkflow as Re, forkApprovalTemplate as ze, publishApprovalTemplateVersion as Be, readTemplateDesigner as Ve, resolveMemberOptions as He, searchMemberOptions as Ue, searchPublishedFormVersionOptions as We, updateApprovalTemplateDraft as Ge } from "@rytass/bpm-core-client/template";
21
- import { useChat as Ke } from "@ai-sdk/react";
9
+ import { AutoComplete as m, Button as h, Icon as g, Input as _, Modal as v, PageHeader as ee, Section as te, SectionGroup as ne, Select as y, Textarea as re, Toggle as ie, Typography as b } from "@mezzanine-ui/react";
10
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
11
+ import ae from "@mezzanine-ui/react/Drawer";
12
+ import oe from "@mezzanine-ui/react/ContentHeader";
13
+ import { CheckedIcon as se, DotGridIcon as ce, EyeIcon as le, FilterIcon as ue, MailIcon as de, SaveIcon as fe, TrashIcon as pe, UserIcon as me } from "@mezzanine-ui/icons";
14
+ import { DefaultChatTransport as he, getToolName as ge, isToolUIPart as _e, lastAssistantMessageIsCompleteWithToolCalls as ve } from "ai";
15
+ import { WORKFLOW_TOOLSET as ye, applyWorkflowCommand as w, applyWorkflowMacroCommand as be, executeWorkflowTool as xe, readWorkflowSnapshot as Se } from "@rytass/bpm-core-shared";
16
+ import { readFormBuilder as Ce } from "@rytass/bpm-core-client/form";
17
+ import { readOrganizationDashboard as we } from "@rytass/bpm-core-client/organization";
18
+ import { Background as Te, ConnectionMode as Ee, ControlButton as De, Controls as Oe, Handle as T, MiniMap as ke, Panel as Ae, Position as E, ReactFlow as je, applyNodeChanges as Me, getViewportForBounds as Ne } from "@xyflow/react";
19
+ import * as Pe from "dagre";
20
+ import { composeApprovalTemplateWithForm as Fe, dryRunApprovalWorkflow as Ie, forkApprovalTemplate as Le, publishApprovalTemplateVersion as Re, readTemplateDesigner as ze, resolveMemberOptions as Be, searchMemberOptions as Ve, searchPublishedFormVersionOptions as He, updateApprovalTemplateDraft as Ue } from "@rytass/bpm-core-client/template";
21
+ import { useChat as We } from "@ai-sdk/react";
22
+ import { DEFAULT_SLA_CONFIG as Ge, SLA_CALENDAR_MODE_OPTIONS as Ke, SLA_DURATION_UNIT_OPTIONS as qe, SLA_TIMEOUT_ACTION_OPTIONS as Je, composeSlaDuration as Ye, readSlaDurationParts as Xe } from "@rytass/bpm-core-shared/workflow-graph";
22
23
  //#region src/views/templates/designer/use-workflow-designer-controller.ts
23
- function qe({ directory: e, initialState: t, layout: n, onLayout: r }) {
24
+ function Ze({ directory: e, initialState: t, layout: n, onLayout: r }) {
24
25
  let [i, a] = p(t), o = f(t), s = f(e);
25
26
  s.current = e;
26
27
  let c = l((e) => {
@@ -33,46 +34,46 @@ function qe({ directory: e, initialState: t, layout: n, onLayout: r }) {
33
34
  ...e,
34
35
  state: i
35
36
  };
36
- }, [n, r]), u = l((e) => c(C(o.current, e)), [c]), m = l((e) => c(xe(o.current, e)), [c]), h = l(async (e, t) => {
37
- let n = await Se(o.current, e, t, { directory: s.current });
37
+ }, [n, r]), u = l((e) => c(w(o.current, e)), [c]), m = l((e) => c(be(o.current, e)), [c]), h = l(async (e, t) => {
38
+ let n = await xe(o.current, e, t, { directory: s.current });
38
39
  if (n.ok && (n.kind === "mutation" || n.kind === "macro")) {
39
40
  let e = c(n.result);
40
41
  return {
41
42
  ...n,
42
43
  result: e,
43
- snapshot: Ce(e.state)
44
+ snapshot: Se(e.state)
44
45
  };
45
46
  }
46
47
  return n;
47
- }, [c]), ee = l((e) => {
48
+ }, [c]), g = l((e) => {
48
49
  let t = typeof e == "function" ? e(o.current) : e;
49
50
  o.current = t, a(t);
50
- }, []), g = l(() => o.current, []), _ = d(() => Ce(i), [i]);
51
+ }, []), _ = l(() => o.current, []), v = d(() => Se(i), [i]);
51
52
  return d(() => ({
52
53
  dispatch: u,
53
54
  dispatchMacro: m,
54
55
  executeTool: h,
55
- getState: g,
56
- replaceState: ee,
57
- snapshot: _,
56
+ getState: _,
57
+ replaceState: g,
58
+ snapshot: v,
58
59
  state: i,
59
- tools: be
60
+ tools: ye
60
61
  }), [
61
62
  u,
62
63
  m,
63
64
  h,
64
- g,
65
- ee,
66
65
  _,
66
+ g,
67
+ v,
67
68
  i
68
69
  ]);
69
70
  }
70
71
  //#endregion
71
72
  //#region src/views/templates/designer/use-workflow-chat.ts
72
- function Je({ controller: e, api: t = "/api/chat" }) {
73
- let n = Ke({
74
- transport: d(() => new ge({ api: t }), [t]),
75
- sendAutomaticallyWhen: ye,
73
+ function Qe({ controller: e, api: t = "/api/chat" }) {
74
+ let n = We({
75
+ transport: d(() => new he({ api: t }), [t]),
76
+ sendAutomaticallyWhen: ve,
76
77
  async onToolCall({ toolCall: t }) {
77
78
  let r = await e.executeTool(t.toolName, t.input);
78
79
  if (r.ok) {
@@ -95,12 +96,12 @@ function Je({ controller: e, api: t = "/api/chat" }) {
95
96
  }
96
97
  //#endregion
97
98
  //#region src/views/templates/designer/chrome-workflow-chat.ts
98
- var Ye = 12;
99
- function Xe() {
99
+ var $e = 12;
100
+ function et() {
100
101
  let e = globalThis.LanguageModel;
101
102
  return e && typeof e == "object" ? e : null;
102
103
  }
103
- var Ze = {
104
+ var tt = {
104
105
  additionalProperties: !1,
105
106
  properties: {
106
107
  action: {
@@ -114,7 +115,7 @@ var Ze = {
114
115
  required: ["action"],
115
116
  type: "object"
116
117
  };
117
- function Qe() {
118
+ function D() {
118
119
  return `你是「簽核流程設計器」頁面的離線 AI 助理。只能透過下列工具操作這個流程畫布,其他請求一律婉拒並引導回流程設計。
119
120
 
120
121
  每一步只輸出一個 JSON 決策物件:
@@ -124,12 +125,12 @@ function Qe() {
124
125
  規則:先用 get_workflow_snapshot 了解現況再規劃;完成後用 validate_workflow 檢查並以 message 說明做了什麼。
125
126
 
126
127
  可用工具:
127
- ${be.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
128
+ ${ye.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
128
129
  }
129
- function T({ controller: e }) {
130
+ function O({ controller: e }) {
130
131
  let [t, n] = p(!1), [r, i] = p([]), [a, o] = p("ready"), s = f(0);
131
132
  u(() => {
132
- let e = Xe();
133
+ let e = et();
133
134
  e && e.availability().then((e) => {
134
135
  n(e !== "unavailable");
135
136
  }).catch(() => n(!1));
@@ -148,14 +149,14 @@ function T({ controller: e }) {
148
149
  available: t,
149
150
  messages: r,
150
151
  send: l((t) => {
151
- let n = Xe();
152
- !n || a !== "ready" || (c("user", t), o("submitted"), E({
152
+ let n = et();
153
+ !n || a !== "ready" || (c("user", t), o("submitted"), k({
153
154
  appendMessage: c,
154
155
  controller: e,
155
156
  model: n,
156
157
  userText: t
157
158
  }).then(() => o("ready")).catch((e) => {
158
- c("assistant", O(e)), o("error");
159
+ c("assistant", nt(e)), o("error");
159
160
  }));
160
161
  }, [
161
162
  c,
@@ -165,15 +166,15 @@ function T({ controller: e }) {
165
166
  status: a
166
167
  };
167
168
  }
168
- async function E({ appendMessage: e, controller: t, model: n, userText: r }) {
169
+ async function k({ appendMessage: e, controller: t, model: n, userText: r }) {
169
170
  let i = await n.create({ initialPrompts: [{
170
- content: Qe(),
171
+ content: D(),
171
172
  role: "system"
172
173
  }] });
173
174
  try {
174
175
  let n = `使用者需求:${r}\n目前流程:${JSON.stringify(t.snapshot)}`;
175
- for (let r = 0; r < Ye; r += 1) {
176
- let r = D(await i.prompt(n, { responseConstraint: Ze }));
176
+ for (let r = 0; r < $e; r += 1) {
177
+ let r = A(await i.prompt(n, { responseConstraint: tt }));
177
178
  if (!r || r.action === "message") {
178
179
  e("assistant", r?.text ?? "我已完成可處理的部分。");
179
180
  return;
@@ -193,7 +194,7 @@ async function E({ appendMessage: e, controller: t, model: n, userText: r }) {
193
194
  i.destroy();
194
195
  }
195
196
  }
196
- function D(e) {
197
+ function A(e) {
197
198
  try {
198
199
  let t = JSON.parse(e);
199
200
  return typeof t == "object" && t && t.action !== void 0 ? t : null;
@@ -201,51 +202,51 @@ function D(e) {
201
202
  return null;
202
203
  }
203
204
  }
204
- function O(e) {
205
+ function nt(e) {
205
206
  return e instanceof Error ? `離線模式發生錯誤:${e.message}` : "離線模式發生未知錯誤。";
206
207
  }
207
208
  //#endregion
208
209
  //#region src/views/templates/designer/workflow-chat-drawer.tsx
209
- var $e = {
210
+ var j = {
210
211
  display: "flex",
211
212
  flexDirection: "column",
212
213
  gap: 12,
213
214
  height: "100%"
214
- }, k = {
215
+ }, rt = {
215
216
  display: "flex",
216
217
  flex: 1,
217
218
  flexDirection: "column",
218
219
  gap: 12,
219
220
  minHeight: 0,
220
221
  overflowY: "auto"
221
- }, et = {
222
+ }, it = {
222
223
  display: "flex",
223
224
  gap: 8,
224
225
  paddingBottom: 4
225
- }, tt = {
226
+ }, at = {
226
227
  borderTop: "1px solid var(--mzn-color-border-neutral, #e5e7eb)",
227
228
  display: "flex",
228
229
  flexDirection: "column",
229
230
  gap: 8,
230
231
  paddingTop: 12
231
- }, nt = {
232
+ }, ot = {
232
233
  display: "flex",
233
234
  justifyContent: "flex-end"
234
- }, rt = { width: "100%" }, A = "workflow-chat-input-field", it = `
235
- .${A}.mzn-text-field {
235
+ }, st = { width: "100%" }, ct = "workflow-chat-input-field", lt = `
236
+ .${ct}.mzn-text-field {
236
237
  width: 100%;
237
238
  }
238
- `, at = {
239
+ `, ut = {
239
240
  color: "var(--mzn-color-text-secondary, #6b7280)",
240
241
  fontSize: 12,
241
242
  padding: "2px 0"
242
- }, ot = {
243
+ }, M = {
243
244
  "input-available": "執行中…",
244
245
  "input-streaming": "準備中…",
245
246
  "output-available": "完成",
246
247
  "output-error": "失敗"
247
248
  };
248
- function j(e) {
249
+ function dt(e) {
249
250
  let t = e === "user";
250
251
  return {
251
252
  alignSelf: t ? "flex-end" : "flex-start",
@@ -258,11 +259,11 @@ function j(e) {
258
259
  wordBreak: "break-word"
259
260
  };
260
261
  }
261
- function st({ api: e, controller: t, onClose: n, open: r }) {
262
- let i = Je({
262
+ function ft({ api: e, controller: t, onClose: n, open: r }) {
263
+ let i = Qe({
263
264
  api: e,
264
265
  controller: t
265
- }), a = T({ controller: t }), [o, s] = p("online"), [u, d] = p(""), f = o === "offline" ? {
266
+ }), a = O({ controller: t }), [o, s] = p("online"), [u, d] = p(""), f = o === "offline" ? {
266
267
  messages: a.messages,
267
268
  send: a.send,
268
269
  status: a.status
@@ -272,72 +273,72 @@ function st({ api: e, controller: t, onClose: n, open: r }) {
272
273
  i.sendMessage({ text: e });
273
274
  },
274
275
  status: i.status
275
- }, { messages: m, send: ee } = f, g = f.status === "submitted" || f.status === "streaming", _ = l(() => {
276
+ }, { messages: m, send: g } = f, _ = f.status === "submitted" || f.status === "streaming", v = l(() => {
276
277
  let e = u.trim();
277
- !e || g || (d(""), ee(e));
278
+ !e || _ || (d(""), g(e));
278
279
  }, [
279
- g,
280
+ _,
280
281
  u,
281
- ee
282
- ]), te = l((e) => {
283
- e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), _());
284
- }, [_]);
285
- return /* @__PURE__ */ S(oe, {
282
+ g
283
+ ]), ee = l((e) => {
284
+ e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), v());
285
+ }, [v]);
286
+ return /* @__PURE__ */ C(ae, {
286
287
  headerTitle: "AI 流程助理",
287
288
  isHeaderDisplay: !0,
288
289
  onClose: n,
289
290
  open: r,
290
291
  size: "medium",
291
- children: [/* @__PURE__ */ x("style", { children: it }), /* @__PURE__ */ S("div", {
292
- style: $e,
292
+ children: [/* @__PURE__ */ S("style", { children: lt }), /* @__PURE__ */ C("div", {
293
+ style: j,
293
294
  children: [
294
- a.available ? /* @__PURE__ */ S("div", {
295
- style: et,
296
- children: [/* @__PURE__ */ x(h, {
295
+ a.available ? /* @__PURE__ */ C("div", {
296
+ style: it,
297
+ children: [/* @__PURE__ */ S(h, {
297
298
  onClick: () => s("online"),
298
299
  variant: o === "online" ? "base-primary" : "base-tertiary",
299
300
  children: "線上"
300
- }), /* @__PURE__ */ x(h, {
301
+ }), /* @__PURE__ */ S(h, {
301
302
  onClick: () => s("offline"),
302
303
  variant: o === "offline" ? "base-primary" : "base-tertiary",
303
304
  children: "離線(裝置內,實驗)"
304
305
  })]
305
306
  }) : null,
306
- /* @__PURE__ */ S("div", {
307
+ /* @__PURE__ */ C("div", {
307
308
  role: "log",
308
- style: k,
309
+ style: rt,
309
310
  children: [
310
- m.length === 0 ? /* @__PURE__ */ x(y, {
311
+ m.length === 0 ? /* @__PURE__ */ S(b, {
311
312
  color: "text-neutral",
312
313
  variant: "body",
313
314
  children: "用一句話描述你想要的流程,例如:「建立三關簽核:部門主管 → 經理 → 財務,金額大於十萬走財務複核」。我會直接在畫布上幫你繪製。"
314
315
  }) : null,
315
- m.map((e) => /* @__PURE__ */ x(c, { children: ct(e) }, e.id)),
316
- g ? /* @__PURE__ */ x(y, {
316
+ m.map((e) => /* @__PURE__ */ S(c, { children: pt(e) }, e.id)),
317
+ _ ? /* @__PURE__ */ S(b, {
317
318
  color: "text-neutral",
318
319
  variant: "body",
319
320
  children: "思考中…"
320
321
  }) : null
321
322
  ]
322
323
  }),
323
- /* @__PURE__ */ S("div", {
324
- style: tt,
325
- children: [/* @__PURE__ */ x(ie, {
326
- className: A,
327
- disabled: g,
324
+ /* @__PURE__ */ C("div", {
325
+ style: at,
326
+ children: [/* @__PURE__ */ S(re, {
327
+ className: ct,
328
+ disabled: _,
328
329
  maxLength: 2e3,
329
330
  onChange: (e) => d(e.target.value),
330
- onKeyDown: te,
331
+ onKeyDown: ee,
331
332
  placeholder: "描述你想要的流程…(Enter 送出,Shift + Enter 換行)",
332
333
  rows: 3,
333
- style: rt,
334
+ style: st,
334
335
  value: u
335
- }), /* @__PURE__ */ x("div", {
336
- style: nt,
337
- children: /* @__PURE__ */ x(h, {
338
- disabled: g || u.trim().length === 0,
339
- loading: g,
340
- onClick: _,
336
+ }), /* @__PURE__ */ S("div", {
337
+ style: ot,
338
+ children: /* @__PURE__ */ S(h, {
339
+ disabled: _ || u.trim().length === 0,
340
+ loading: _,
341
+ onClick: v,
341
342
  type: "button",
342
343
  variant: "base-primary",
343
344
  children: "送出"
@@ -348,32 +349,32 @@ function st({ api: e, controller: t, onClose: n, open: r }) {
348
349
  })]
349
350
  });
350
351
  }
351
- function ct(e) {
352
- return e.parts.map((t, n) => t.type === "text" ? /* @__PURE__ */ x("div", {
353
- style: j(e.role),
352
+ function pt(e) {
353
+ return e.parts.map((t, n) => t.type === "text" ? /* @__PURE__ */ S("div", {
354
+ style: dt(e.role),
354
355
  children: t.text
355
- }, `${e.id}-${n}`) : t.type === "dynamic-tool" || ve(t) ? /* @__PURE__ */ x("div", {
356
- style: at,
357
- children: `⚙ ${_e(t)} · ${ot[t.state] ?? t.state}`
356
+ }, `${e.id}-${n}`) : t.type === "dynamic-tool" || _e(t) ? /* @__PURE__ */ S("div", {
357
+ style: ut,
358
+ children: `⚙ ${ge(t)} · ${M[t.state] ?? t.state}`
358
359
  }, `${e.id}-${n}`) : null);
359
360
  }
360
361
  //#endregion
361
362
  //#region src/views/templates/designer/TemplateDesignerView.tsx
362
- var lt = {
363
+ var mt = {
363
364
  display: "grid",
364
365
  gap: 16
365
- }, ut = {
366
+ }, ht = {
366
367
  alignItems: "start",
367
368
  display: "grid",
368
369
  gap: 16,
369
370
  gridTemplateColumns: "minmax(0, 1fr) 420px"
370
- }, dt = {
371
+ }, gt = {
371
372
  border: "1px solid var(--mzn-color-border-neutral)",
372
373
  borderRadius: 6,
373
374
  height: 620,
374
375
  minWidth: 0,
375
376
  overflow: "hidden"
376
- }, ft = {
377
+ }, _t = {
377
378
  alignItems: "center",
378
379
  boxSizing: "border-box",
379
380
  color: "var(--mzn-color-text-error)",
@@ -383,24 +384,24 @@ var lt = {
383
384
  lineHeight: 0,
384
385
  padding: 0,
385
386
  width: 26
386
- }, pt = {
387
+ }, vt = {
387
388
  alignItems: "center",
388
389
  display: "flex",
389
390
  height: "100%",
390
391
  justifyContent: "center",
391
392
  width: "100%"
392
- }, mt = "workflow-designer-side-panel", M = 96, ht = `
393
- .${mt} .mzn-form-field--stretch .mzn-form-field__label-area,
394
- .${mt} .mzn-form-field--horizontal .mzn-form-field__label-area {
395
- flex: 0 0 ${M}px;
396
- width: ${M}px;
393
+ }, yt = "workflow-designer-side-panel", bt = 96, xt = `
394
+ .${yt} .mzn-form-field--stretch .mzn-form-field__label-area,
395
+ .${yt} .mzn-form-field--horizontal .mzn-form-field__label-area {
396
+ flex: 0 0 ${bt}px;
397
+ width: ${bt}px;
397
398
  }
398
399
 
399
- .${mt} .mzn-form-field--stretch .mzn-form-field__data-entry,
400
- .${mt} .mzn-form-field--horizontal .mzn-form-field__data-entry {
400
+ .${yt} .mzn-form-field--stretch .mzn-form-field__data-entry,
401
+ .${yt} .mzn-form-field--horizontal .mzn-form-field__data-entry {
401
402
  min-width: 0;
402
403
  }
403
- `, gt = "#2563eb", N = "#64748b", _t = "var(--mzn-color-text-error, #dc2626)", vt = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", yt = `
404
+ `, St = "#2563eb", Ct = "#64748b", wt = "var(--mzn-color-text-error, #dc2626)", Tt = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", Et = `
404
405
  .workflow-selection-delete-control.react-flow__controls-button {
405
406
  align-items: center !important;
406
407
  display: flex !important;
@@ -425,26 +426,26 @@ var lt = {
425
426
 
426
427
  .workflow-edge--selected .react-flow__edge-path,
427
428
  .react-flow__edge-path.workflow-edge--selected {
428
- filter: ${vt};
429
+ filter: ${Tt};
429
430
  opacity: 1 !important;
430
- stroke: ${N} !important;
431
+ stroke: ${Ct} !important;
431
432
  stroke-opacity: 1 !important;
432
433
  stroke-width: 1.5px !important;
433
434
  }
434
435
 
435
436
  .workflow-edge--selected {
436
- --xy-edge-stroke: ${N};
437
- --xy-edge-stroke-selected: ${N};
437
+ --xy-edge-stroke: ${Ct};
438
+ --xy-edge-stroke-selected: ${Ct};
438
439
  --xy-edge-stroke-width: 1.5px;
439
440
  }
440
441
 
441
- `, bt = {
442
+ `, Dt = {
442
443
  display: "grid",
443
444
  gap: 12
444
- }, P = {
445
+ }, Ot = {
445
446
  display: "grid",
446
447
  gap: 12
447
- }, xt = {
448
+ }, kt = {
448
449
  border: "1px solid var(--mzn-color-border-neutral)",
449
450
  borderRadius: 6,
450
451
  display: "grid",
@@ -452,26 +453,26 @@ var lt = {
452
453
  maxHeight: 360,
453
454
  overflow: "auto",
454
455
  padding: 12
455
- }, St = {
456
+ }, At = {
456
457
  borderBottom: "1px solid var(--mzn-color-border-neutral)",
457
458
  display: "grid",
458
459
  gap: 4,
459
460
  padding: "0 0 8px"
460
- }, Ct = {
461
+ }, jt = {
461
462
  display: "flex",
462
463
  flexWrap: "wrap",
463
464
  gap: 8
464
- }, wt = {
465
+ }, Mt = {
465
466
  alignItems: "center",
466
467
  display: "flex",
467
468
  gap: 8
468
- }, Tt = {
469
+ }, Nt = {
469
470
  flex: "1 1 auto",
470
471
  minWidth: 0
471
- }, Et = { flex: "0 0 auto" }, Dt = {
472
+ }, Pt = { flex: "0 0 auto" }, Ft = {
472
473
  display: "grid",
473
474
  gap: 8
474
- }, F = {
475
+ }, N = {
475
476
  alignContent: "center",
476
477
  background: "var(--mzn-color-bg-surface)",
477
478
  border: "1px solid var(--mzn-color-border-neutral)",
@@ -486,70 +487,91 @@ var lt = {
486
487
  padding: "10px 12px",
487
488
  textAlign: "center",
488
489
  width: "100%"
489
- }, Ot = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", kt = 64, At = 160, I = 20, jt = 64, Mt = 180, L = {
490
- ...F,
490
+ }, It = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", Lt = 64, P = 160, Rt = 20, zt = 64, F = 180, Bt = {
491
+ ...N,
491
492
  display: "grid",
492
493
  gap: 8,
493
494
  padding: "10px 12px"
494
- }, Nt = {
495
- ...L,
495
+ }, I = {
496
+ ...Bt,
496
497
  background: "#eff6ff",
497
498
  border: "1px solid #2563eb"
498
- }, R = {
499
- ...L,
499
+ }, Vt = {
500
+ ...Bt,
500
501
  background: "#f0fdfa",
501
502
  border: "1px solid #0f766e"
502
- }, Pt = {
503
- ...F,
503
+ }, L = {
504
+ ...N,
504
505
  background: "#ffffff"
505
- }, z = {
506
- ...F,
506
+ }, Ht = {
507
+ ...N,
507
508
  background: "#ecfdf3",
508
509
  border: "1px solid #2f855a"
509
- }, Ft = {
510
- ...F,
510
+ }, Ut = {
511
+ ...N,
511
512
  background: "#fff4ed",
512
513
  border: "1px solid #c2410c"
513
- }, It = {
514
+ }, Wt = {
514
515
  display: "block",
515
516
  maxWidth: "100%",
516
517
  minWidth: 0
517
- }, Lt = {
518
+ }, Gt = {
518
519
  display: "grid",
519
520
  gap: 2,
520
521
  minWidth: 0
521
- }, Rt = "input", B = "output", zt = {
522
+ }, Kt = "input", qt = "output", Jt = {
522
523
  endEvent: "結束",
523
524
  exclusiveGateway: "條件分流",
524
525
  parallelGateway: "並行處理",
525
526
  serviceTask: "系統",
526
527
  startEvent: "開始",
527
528
  userTask: "簽核"
528
- }, Bt = [{
529
- icon: he,
529
+ }, Yt = [{
530
+ icon: me,
530
531
  label: "簽核節點",
531
532
  type: "userTask"
532
533
  }, {
533
- icon: fe,
534
+ icon: de,
534
535
  label: "知會節點",
535
536
  type: "serviceTask"
536
- }], Vt = [{
537
- icon: de,
537
+ }], Xt = [{
538
+ icon: ue,
538
539
  label: "條件分流",
539
540
  type: "exclusiveGateway"
540
- }], Ht = [{
541
+ }], Zt = [{
541
542
  id: "AND",
542
543
  name: "全部前置完成"
543
544
  }, {
544
545
  id: "OR",
545
546
  name: "任一前置完成"
546
- }], Ut = [{
547
+ }], Qt = [{
547
548
  id: "RESTART",
548
549
  name: "重新送出後從開始重跑"
549
550
  }, {
550
551
  id: "FROM_RETURN_POINT",
551
552
  name: "重新送出後回到退回節點"
552
- }], Wt = [
553
+ }], $t = [
554
+ {
555
+ id: "NONE",
556
+ name: "不提醒",
557
+ value: null
558
+ },
559
+ {
560
+ id: "0.5",
561
+ name: "過半時提醒",
562
+ value: .5
563
+ },
564
+ {
565
+ id: "0.75",
566
+ name: "剩四分之一時提醒",
567
+ value: .75
568
+ },
569
+ {
570
+ id: "0.9",
571
+ name: "剩十分之一時提醒",
572
+ value: .9
573
+ }
574
+ ], en = [
553
575
  {
554
576
  id: "DIRECT",
555
577
  name: "指定會員"
@@ -574,7 +596,7 @@ var lt = {
574
596
  id: "POSITION",
575
597
  name: "指定職位"
576
598
  }
577
- ], Gt = [
599
+ ], R = [
578
600
  {
579
601
  id: "1",
580
602
  name: "直屬主管",
@@ -590,13 +612,13 @@ var lt = {
590
612
  name: "第三層主管",
591
613
  value: 3
592
614
  }
593
- ], Kt = [{
615
+ ], tn = [{
594
616
  id: "NONE",
595
617
  name: "停止流程並提示"
596
618
  }, {
597
619
  id: "DIRECT",
598
620
  name: "固定改派"
599
- }], qt = [
621
+ }], nn = [
600
622
  {
601
623
  id: "EQUALS",
602
624
  name: "等於"
@@ -629,14 +651,14 @@ var lt = {
629
651
  id: "IS_EMPTY",
630
652
  name: "未填寫"
631
653
  }
632
- ], Jt = [
654
+ ], rn = [
633
655
  "EQUALS",
634
656
  "GREATER_THAN",
635
657
  "GREATER_THAN_OR_EQUALS",
636
658
  "LESS_THAN",
637
659
  "LESS_THAN_OR_EQUALS",
638
660
  "NOT_EQUALS"
639
- ], Yt = [
661
+ ], an = [
640
662
  {
641
663
  id: "NONE",
642
664
  name: "未設定"
@@ -653,317 +675,317 @@ var lt = {
653
675
  id: "ORG_UNIT_POSITION",
654
676
  name: "指定組織職位"
655
677
  }
656
- ], Xt = {
678
+ ], on = {
657
679
  id: "CUSTOM",
658
680
  name: "既有自訂規則"
659
- }, Zt = "member-001", Qt = {
681
+ }, sn = "member-001", cn = {
660
682
  display: "flex",
661
683
  flexDirection: "column",
662
684
  height: "100%"
663
- }, $t = {
685
+ }, ln = {
664
686
  flex: 1,
665
687
  minHeight: 0,
666
688
  overflowY: "auto"
667
- }, en = {
689
+ }, un = {
668
690
  borderTop: "1px solid var(--mzn-color-border-neutral)",
669
691
  display: "flex",
670
692
  gap: 8,
671
693
  paddingTop: 12
672
- }, tn = {
694
+ }, dn = {
673
695
  fields: [],
674
696
  schemaVersion: 1
675
- }, nn = {
697
+ }, fn = {
676
698
  layout: [],
677
699
  schemaVersion: 1
678
- }, rn = {
679
- endEvent: V,
680
- exclusiveGateway: V,
681
- parallelGateway: V,
682
- serviceTask: V,
683
- startEvent: V,
684
- userTask: V
700
+ }, pn = {
701
+ endEvent: B,
702
+ exclusiveGateway: B,
703
+ parallelGateway: B,
704
+ serviceTask: B,
705
+ startEvent: B,
706
+ userTask: B
685
707
  };
686
- function an(e, t) {
708
+ function z(e, t) {
687
709
  return typeof e == "function" ? e(t) : e;
688
710
  }
689
- function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride: c, initialInitiatorPolicyCel: le, initialWorkflowDefinition: de, onInitiatorPolicyChange: fe, onWorkflowChange: he, showAiAssistant: ge = !1, showDryRun: _e = !0, templateId: ve }) {
690
- let ye = e(), be = t(), [C, xe] = p(null), [Se, Ce] = p(null), [Ae, Me] = p(""), [w, Fe] = p(null), [Ie, Ke] = p(null), Je = f(null), [Ye, Xe] = p(void 0), Ze = f([]), Qe = f([]), T = qe({
711
+ function mn({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride: c, initialInitiatorPolicyCel: ce, initialWorkflowDefinition: ue, onInitiatorPolicyChange: de, onWorkflowChange: me, showAiAssistant: he = !1, showDryRun: ge = !0, templateId: _e }) {
712
+ let ve = e(), ye = t(), [w, be] = p(null), [xe, Se] = p(null), [T, Ae] = p(""), [E, Ne] = p(null), [Pe, We] = p(null), Ye = f(null), [Qe, $e] = p(void 0), et = f([]), tt = f([]), D = Ze({
691
713
  directory: d(() => ({
692
- listOrgUnits: async () => Ze.current.map((e) => ({
714
+ listOrgUnits: async () => et.current.map((e) => ({
693
715
  id: e.id,
694
716
  name: e.name
695
717
  })),
696
- listPositions: async () => Qe.current.map((e) => ({
718
+ listPositions: async () => tt.current.map((e) => ({
697
719
  id: e.id,
698
720
  name: e.name
699
721
  })),
700
- searchMembers: async (e) => $n(await Ue(e)).map((e) => ({
722
+ searchMembers: async (e) => gr(await Ve(e)).map((e) => ({
701
723
  email: e.email,
702
724
  id: e.memberId,
703
725
  name: e.name
704
726
  }))
705
727
  }), []),
706
728
  initialState: {
707
- definition: i && de != null ? de : bn(),
729
+ definition: i && ue != null ? ue : On(),
708
730
  editingEdgeId: null,
709
731
  formDefinitionVersionId: null,
710
732
  formSchema: null,
711
- initiatorPolicyCel: i && le !== void 0 ? le : null,
733
+ initiatorPolicyCel: i && ce !== void 0 ? ce : null,
712
734
  selectedEdgeIds: [],
713
- selectedNodeId: i && de != null ? de.nodes[0]?.id ?? "start" : "start"
735
+ selectedNodeId: i && ue != null ? ue.nodes[0]?.id ?? "start" : "start"
714
736
  },
715
- layout: Sn,
737
+ layout: An,
716
738
  onLayout: (e) => {
717
- let t = vr(e, Je.current);
718
- t && Xe(t);
739
+ let t = Nr(e, Ye.current);
740
+ t && $e(t);
719
741
  }
720
- }), E = T.state.definition, D = T.state.formDefinitionVersionId, O = T.state.initiatorPolicyCel, $e = T.state.selectedNodeId, k = T.state.selectedEdgeIds, et = T.state.editingEdgeId, tt = (e) => T.replaceState((t) => ({
742
+ }), O = D.state.definition, k = D.state.formDefinitionVersionId, A = D.state.initiatorPolicyCel, nt = D.state.selectedNodeId, j = D.state.selectedEdgeIds, rt = D.state.editingEdgeId, it = (e) => D.replaceState((t) => ({
721
743
  ...t,
722
- definition: an(e, t.definition)
723
- })), nt = (e) => T.replaceState((t) => ({
744
+ definition: z(e, t.definition)
745
+ })), at = (e) => D.replaceState((t) => ({
724
746
  ...t,
725
- formDefinitionVersionId: an(e, t.formDefinitionVersionId)
726
- })), rt = (e) => T.replaceState((t) => ({
747
+ formDefinitionVersionId: z(e, t.formDefinitionVersionId)
748
+ })), ot = (e) => D.replaceState((t) => ({
727
749
  ...t,
728
- initiatorPolicyCel: an(e, t.initiatorPolicyCel)
729
- })), A = (e) => T.replaceState((t) => ({
750
+ initiatorPolicyCel: z(e, t.initiatorPolicyCel)
751
+ })), st = (e) => D.replaceState((t) => ({
730
752
  ...t,
731
- selectedNodeId: an(e, t.selectedNodeId)
732
- })), it = (e) => T.replaceState((t) => ({
753
+ selectedNodeId: z(e, t.selectedNodeId)
754
+ })), ct = (e) => D.replaceState((t) => ({
733
755
  ...t,
734
- selectedEdgeIds: an(e, t.selectedEdgeIds)
735
- })), at = (e) => T.replaceState((t) => ({
756
+ selectedEdgeIds: z(e, t.selectedEdgeIds)
757
+ })), lt = (e) => D.replaceState((t) => ({
736
758
  ...t,
737
- editingEdgeId: an(e, t.editingEdgeId)
738
- })), [ot, j] = p(null), [ct, M] = p(!0), [gt, N] = p(!1), [vt, F] = p(!1), [Ot, kt] = p([]), At = d(() => JSON.stringify({
739
- formDefinitionVersionId: D,
740
- initiatorPolicyCel: O,
741
- workflowDefinition: E
759
+ editingEdgeId: z(e, t.editingEdgeId)
760
+ })), [ut, M] = p(null), [dt, pt] = p(!0), [bt, St] = p(!1), [Ct, Tt] = p(!1), [N, It] = p([]), Lt = d(() => JSON.stringify({
761
+ formDefinitionVersionId: k,
762
+ initiatorPolicyCel: A,
763
+ workflowDefinition: O
742
764
  }), [
743
- D,
744
- O,
745
- E
746
- ]), I = !!Ae && At !== Ae, [jt, Mt] = p(!1), [L, Nt] = p([]), [R, Pt] = p([]), [z, Ft] = p([]), [It, Lt] = p([]);
747
- Ze.current = R, Qe.current = z;
748
- let [Rt, B] = p(!1), [qt, Jt] = p(!1), [on, V] = p("{}"), [cn, ln] = p(null), [un, dn] = p(null), [H, pn] = p(!1), [mn, hn] = p(!1), [U, vn] = p(null), [yn, Mn] = p(!1), [Fn, Ln] = p(!1), Hn = I || yn ? "保存並發布" : Se ? "發布草稿" : "已發布";
765
+ k,
766
+ A,
767
+ O
768
+ ]), P = !!T && Lt !== T, [Rt, zt] = p(!1), [F, Bt] = p([]), [I, Vt] = p([]), [L, Ht] = p([]), [Ut, Wt] = p([]);
769
+ et.current = I, tt.current = L;
770
+ let [Gt, Kt] = p(!1), [qt, nn] = p(!1), [rn, mn] = p("{}"), [B, gn] = p(null), [_n, vn] = p(null), [yn, V] = p(!1), [xn, Sn] = p(!1), [H, wn] = p(null), [En, Dn] = p(!1), [Vn, Yn] = p(!1), Qn = P || En ? "保存並發布" : xe ? "發布草稿" : "已發布";
749
771
  u(() => {
750
- i ? Or() : Ar();
751
- }, [i, ve]), u(() => {
772
+ i ? Fr() : Vr();
773
+ }, [i, _e]), u(() => {
752
774
  function e(e) {
753
- I && (e.preventDefault(), e.returnValue = "");
775
+ P && (e.preventDefault(), e.returnValue = "");
754
776
  }
755
777
  return window.addEventListener("beforeunload", e), () => {
756
778
  window.removeEventListener("beforeunload", e);
757
779
  };
758
- }, [I]), u(() => {
759
- Nr(E);
760
- }, [E, L]), u(() => {
761
- tt((e) => _n(e));
762
- }, [E.edges, E.nodes]);
763
- function Un() {
764
- I && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || ye.push(be.templates());
780
+ }, [P]), u(() => {
781
+ Jr(O);
782
+ }, [O, F]), u(() => {
783
+ it((e) => Tn(e));
784
+ }, [O.edges, O.nodes]);
785
+ function er() {
786
+ P && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || ve.push(ye.templates());
765
787
  }
766
- let G = d(() => E.nodes.find((e) => e.id === $e) ?? null, [$e, E.nodes]), qn = G ? Vn(G) : !1, Yn = k.length > 0 || qn, K = l(() => {
767
- T.getState().selectedEdgeIds.forEach((e) => T.dispatch({
788
+ let W = d(() => O.nodes.find((e) => e.id === nt) ?? null, [nt, O.nodes]), ar = W ? ir(W) : !1, or = j.length > 0 || ar, ur = l(() => {
789
+ D.getState().selectedEdgeIds.forEach((e) => D.dispatch({
768
790
  edgeId: e,
769
791
  type: "deleteEdge"
770
- })), G && Vn(G) && T.dispatch({
771
- nodeId: G.id,
792
+ })), W && ir(W) && D.dispatch({
793
+ nodeId: W.id,
772
794
  type: "deleteNode"
773
795
  });
774
- }, [T, G]);
796
+ }, [D, W]);
775
797
  u(() => {
776
- if (!Yn) return;
798
+ if (!or) return;
777
799
  function e(e) {
778
- e.key !== "Delete" && e.key !== "Backspace" || Wn(e.target) || (e.preventDefault(), K());
800
+ e.key !== "Delete" && e.key !== "Backspace" || sr(e.target) || (e.preventDefault(), ur());
779
801
  }
780
802
  return window.addEventListener("keydown", e), () => {
781
803
  window.removeEventListener("keydown", e);
782
804
  };
783
- }, [Yn, K]);
784
- let ar = d(() => E.edges.find((e) => e.id === et) ?? null, [et, E.edges]), sr = d(() => k.length === 1 ? E.edges.find((e) => e.id === k[0]) ?? null : null, [k, E.edges]), cr = d(() => k.map((e) => E.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [k, E.edges]), q = d(() => Ie ?? Nn(O, w), [
785
- O,
786
- Ie,
787
- w
788
- ]), lr = d(() => E.nodes.map((e) => fn(e, L, R, z, e.id === $e, q)), [
805
+ }, [or, ur]);
806
+ let fr = d(() => O.edges.find((e) => e.id === rt) ?? null, [rt, O.edges]), G = d(() => j.length === 1 ? O.edges.find((e) => e.id === j[0]) ?? null : null, [j, O.edges]), K = d(() => j.map((e) => O.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [j, O.edges]), q = d(() => Pe ?? Xn(A, E), [
807
+ A,
808
+ Pe,
809
+ E
810
+ ]), Cr = d(() => O.nodes.map((e) => bn(e, F, I, L, e.id === nt, q)), [
789
811
  q,
812
+ F,
813
+ I,
790
814
  L,
791
- R,
792
- z,
793
- $e,
794
- E.nodes
795
- ]), dr = d(() => E.edges.map((e) => gn(e, E.nodes, k.includes(e.id))), [
815
+ nt,
816
+ O.nodes
817
+ ]), wr = d(() => O.edges.map((e) => Cn(e, O.nodes, j.includes(e.id))), [
818
+ j,
819
+ O.edges,
820
+ O.nodes
821
+ ]), J = d(() => U(N, k) ?? U(cr(w?.formVersions ?? []), k), [
796
822
  k,
797
- E.edges,
798
- E.nodes
799
- ]), J = d(() => W(Ot, D) ?? W(Gn(C?.formVersions ?? []), D), [
800
- D,
801
- Ot,
802
- C?.formVersions
803
- ]), mr = d(() => Qn(Ot, J), [Ot, J]), hr = J?.schema ?? null, gr = i ? c ?? null : hr;
823
+ N,
824
+ w?.formVersions
825
+ ]), Er = d(() => hr(N, J), [N, J]), kr = J?.schema ?? null, Ar = i ? c ?? null : kr;
804
826
  u(() => {
805
- T.getState().formSchema !== gr && T.replaceState((e) => ({
827
+ D.getState().formSchema !== Ar && D.replaceState((e) => ({
806
828
  ...e,
807
- formSchema: gr
829
+ formSchema: Ar
808
830
  }));
809
- }, [T, gr]);
810
- let _r = d(() => yr(E), [E]), Y = d(() => br(E), [E]), X = d(() => Pn(q), [q]);
831
+ }, [D, Ar]);
832
+ let jr = d(() => Pr(O), [O]), Y = d(() => Ir(O), [O]), Mr = d(() => Zn(q), [q]);
811
833
  u(() => {
812
- i && he?.(E);
813
- }, [i, E]), u(() => {
814
- i && fe?.(O);
815
- }, [i, O]);
816
- async function Or() {
817
- M(!0), j(null);
834
+ i && me?.(O);
835
+ }, [i, O]), u(() => {
836
+ i && de?.(A);
837
+ }, [i, A]);
838
+ async function Fr() {
839
+ pt(!0), M(null);
818
840
  try {
819
- let e = await Te();
820
- Pt(e.orgUnits), Ft(e.positions), Lt(e.memberships);
841
+ let e = await we();
842
+ Vt(e.orgUnits), Ht(e.positions), Wt(e.memberships);
821
843
  } catch (e) {
822
- j(Z(e));
844
+ M(Z(e));
823
845
  } finally {
824
- M(!1);
846
+ pt(!1);
825
847
  }
826
848
  }
827
- async function Ar() {
828
- M(!0), j(null);
849
+ async function Vr() {
850
+ pt(!0), M(null);
829
851
  try {
830
- let [e, t] = await Promise.all([Ve(ve), Te()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
831
- xe(e), Ce(n), Pt(t.orgUnits), Ft(t.positions), Lt(t.memberships), kt(Gn(e.formVersions));
832
- let i = r?.workflowDefinition ?? bn(), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
833
- tt(i), nt(a), rt(o), Me(JSON.stringify({
852
+ let [e, t] = await Promise.all([ze(_e), we()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
853
+ be(e), Se(n), Vt(t.orgUnits), Ht(t.positions), Wt(t.memberships), It(cr(e.formVersions));
854
+ let i = r?.workflowDefinition ?? On(), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
855
+ it(i), at(a), ot(o), Ae(JSON.stringify({
834
856
  formDefinitionVersionId: a,
835
857
  initiatorPolicyCel: o,
836
858
  workflowDefinition: i
837
- })), Fe(r && !e.template.currentVersionId && !r.initiatorPolicyCel && xn(r.workflowDefinition) ? "NONE" : null), Ke(null), A(r?.workflowDefinition.nodes[0]?.id ?? "start"), it([]), at(null), vn(null), Mn(!1);
859
+ })), Ne(r && !e.template.currentVersionId && !r.initiatorPolicyCel && kn(r.workflowDefinition) ? "NONE" : null), We(null), st(r?.workflowDefinition.nodes[0]?.id ?? "start"), ct([]), lt(null), wn(null), Dn(!1);
838
860
  } catch (e) {
839
- j(Z(e));
861
+ M(Z(e));
840
862
  } finally {
841
- M(!1);
863
+ pt(!1);
842
864
  }
843
865
  }
844
- async function Mr(e) {
845
- F(!0), j(null);
866
+ async function Gr(e) {
867
+ Tt(!0), M(null);
846
868
  try {
847
- kt(Qn(Gn(await We(e)), J));
869
+ It(hr(cr(await He(e)), J));
848
870
  } catch (e) {
849
- j(Z(e));
871
+ M(Z(e));
850
872
  } finally {
851
- F(!1);
873
+ Tt(!1);
852
874
  }
853
875
  }
854
- async function Q(e) {
855
- Mt(!0), j(null);
876
+ async function X(e) {
877
+ zt(!0), M(null);
856
878
  try {
857
- let t = await Ue(e);
858
- Nt((e) => fr(e, $n(t)));
879
+ let t = await Ve(e);
880
+ Bt((e) => Dr(e, gr(t)));
859
881
  } catch (e) {
860
- j(Z(e));
882
+ M(Z(e));
861
883
  } finally {
862
- Mt(!1);
884
+ zt(!1);
863
885
  }
864
886
  }
865
- async function Nr(e) {
866
- let t = pr(e).filter((e) => !L.some((t) => t.memberId === e));
887
+ async function Jr(e) {
888
+ let t = Or(e).filter((e) => !F.some((t) => t.memberId === e));
867
889
  if (t.length !== 0) try {
868
- let e = await He(t);
869
- Nt((t) => fr(t, $n(e)));
890
+ let e = await Be(t);
891
+ Bt((t) => Dr(t, gr(e)));
870
892
  } catch {
871
- Nt((e) => fr(e, t.map(er)));
893
+ Bt((e) => Dr(e, t.map(_r)));
872
894
  }
873
895
  }
874
- async function Pr(e) {
875
- N(!0), j(null);
896
+ async function Yr(e) {
897
+ St(!0), M(null);
876
898
  try {
877
- let t = yr(E), n = Pn(q);
899
+ let t = Pr(O), n = Zn(q);
878
900
  if (t || n) {
879
901
  let e = t ?? n ?? "流程設定未完成";
880
- throw j(e), Error(e);
902
+ throw M(e), Error(e);
881
903
  }
882
- if (yn && U !== null) await Le({
883
- category: C?.template.category ?? null,
884
- categoryId: C?.template.categoryId ?? null,
904
+ if (En && H !== null) await Fe({
905
+ category: w?.template.category ?? null,
906
+ categoryId: w?.template.categoryId ?? null,
885
907
  formDefinitionId: J?.formDefinitionId ?? null,
886
908
  formDescription: null,
887
- formName: J?.formName ?? C?.template.name ?? "表單",
888
- initiatorPolicyCel: O,
909
+ formName: J?.formName ?? w?.template.name ?? "表單",
910
+ initiatorPolicyCel: A,
889
911
  notificationConfig: null,
890
912
  publish: e,
891
- schema: U.schema,
913
+ schema: H.schema,
892
914
  slaDefaults: null,
893
915
  templateDescription: null,
894
- templateId: ve ?? null,
895
- templateName: C?.template.name ?? "模板",
896
- uiSchema: U.uiSchema,
897
- workflowDefinition: E
898
- }), Mn(!1), vn(null), await Ar();
916
+ templateId: _e ?? null,
917
+ templateName: w?.template.name ?? "模板",
918
+ uiSchema: H.uiSchema,
919
+ workflowDefinition: O
920
+ }), Dn(!1), wn(null), await Vr();
899
921
  else {
900
- let t = await Ge({
901
- formDefinitionVersionId: D,
902
- initiatorPolicyCel: O,
903
- versionId: (Se ?? await ze(ve)).id,
904
- workflowDefinition: E
922
+ let t = await Ue({
923
+ formDefinitionVersionId: k,
924
+ initiatorPolicyCel: A,
925
+ versionId: (xe ?? await Le(_e)).id,
926
+ workflowDefinition: O
905
927
  });
906
- Ce(t), e && await Be(t.id), await Ar();
928
+ Se(t), e && await Re(t.id), await Vr();
907
929
  }
908
930
  } catch (e) {
909
- throw j(Z(e)), e;
931
+ throw M(Z(e)), e;
910
932
  } finally {
911
- N(!1);
933
+ St(!1);
912
934
  }
913
935
  }
914
- async function Fr() {
915
- await Pr(!1);
936
+ async function Xr() {
937
+ await Yr(!1);
916
938
  }
917
- async function Ir() {
918
- await Pr(!0);
939
+ async function Zr() {
940
+ await Yr(!0);
919
941
  }
920
- function Lr() {
921
- V(JSON.stringify(Kn(J), null, 2)), ln(null), dn(null), B(!0);
942
+ function Qr() {
943
+ mn(JSON.stringify(lr(J), null, 2)), gn(null), vn(null), Kt(!0);
922
944
  }
923
- function Rr() {
924
- qt || B(!1);
945
+ function $r() {
946
+ qt || Kt(!1);
925
947
  }
926
- async function zr() {
927
- Jt(!0), dn(null), ln(null);
948
+ async function ei() {
949
+ nn(!0), vn(null), gn(null);
928
950
  try {
929
- ln(await Re({
930
- formData: Jn(on),
931
- initiatorMemberId: Zt,
932
- initiatorMetadataSnapshot: or(Zt, It),
933
- workflowDefinition: E
951
+ gn(await Ie({
952
+ formData: dr(rn),
953
+ initiatorMemberId: sn,
954
+ initiatorMetadataSnapshot: Sr(sn, Ut),
955
+ workflowDefinition: O
934
956
  }));
935
957
  } catch (e) {
936
- dn(Z(e));
958
+ vn(Z(e));
937
959
  } finally {
938
- Jt(!1);
960
+ nn(!1);
939
961
  }
940
962
  }
941
- async function Br() {
942
- if (hn(!0), U !== null) return;
963
+ async function ti() {
964
+ if (Sn(!0), H !== null) return;
943
965
  let e = J?.formDefinitionId ?? null;
944
966
  if (!e) {
945
- vn({
946
- schema: tn,
947
- uiSchema: nn
967
+ wn({
968
+ schema: dn,
969
+ uiSchema: fn
948
970
  });
949
971
  return;
950
972
  }
951
- Ln(!0);
973
+ Yn(!0);
952
974
  try {
953
- let t = await we(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
954
- vn({
955
- schema: n?.schema ?? tn,
956
- uiSchema: n?.uiSchema ?? nn
975
+ let t = await Ce(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
976
+ wn({
977
+ schema: n?.schema ?? dn,
978
+ uiSchema: n?.uiSchema ?? fn
957
979
  });
958
980
  } catch (e) {
959
- j(Z(e));
981
+ M(Z(e));
960
982
  } finally {
961
- Ln(!1);
983
+ Yn(!1);
962
984
  }
963
985
  }
964
- function Vr(e) {
965
- let t = Pe(e, lr);
966
- tt((e) => ({
986
+ function ni(e) {
987
+ let t = Me(e, Cr);
988
+ it((e) => ({
967
989
  ...e,
968
990
  nodes: e.nodes.map((e) => {
969
991
  let n = t.find((t) => t.id === e.id);
@@ -974,72 +996,86 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
974
996
  })
975
997
  }));
976
998
  }
977
- function Hr(e) {
978
- !zn(e, E.nodes) || !e.source || !e.target || T.dispatch({
999
+ function ri(e) {
1000
+ !nr(e, O.nodes) || !e.source || !e.target || D.dispatch({
979
1001
  source: e.source,
980
1002
  target: e.target,
981
1003
  type: "connectEdge"
982
1004
  });
983
1005
  }
984
- function Ur(e, t) {
985
- e.stopPropagation(), it((n) => e.shiftKey || e.metaKey || e.ctrlKey ? Bn(n, t.id) : [t.id]), A(null);
1006
+ function ii(e, t) {
1007
+ e.stopPropagation(), ct((n) => e.shiftKey || e.metaKey || e.ctrlKey ? rr(n, t.id) : [t.id]), st(null);
986
1008
  }
987
- function Wr() {
988
- at(null);
1009
+ function ai() {
1010
+ lt(null);
989
1011
  }
990
- function Gr(e) {
991
- T.dispatch({
1012
+ function oi(e) {
1013
+ D.dispatch({
992
1014
  nodeType: e,
993
1015
  type: "addNode"
994
1016
  });
995
1017
  }
996
- function Kr(e) {
997
- G && T.dispatch({
1018
+ function si(e) {
1019
+ W && D.dispatch({
998
1020
  label: e,
999
- nodeId: G.id,
1021
+ nodeId: W.id,
1000
1022
  type: "renameNode"
1001
1023
  });
1002
1024
  }
1003
- function $(e) {
1004
- !G || G.type !== "userTask" || T.dispatch({
1025
+ function Q(e) {
1026
+ !W || W.type !== "userTask" || D.dispatch({
1005
1027
  approverResolver: e,
1006
- nodeId: G.id,
1028
+ nodeId: W.id,
1007
1029
  type: "setUserTaskApprover"
1008
1030
  });
1009
1031
  }
1010
- function qr(e) {
1011
- !G || G.type !== "userTask" || T.dispatch({
1012
- nodeId: G.id,
1032
+ function ci(e) {
1033
+ !W || W.type !== "userTask" || D.dispatch({
1034
+ nodeId: W.id,
1013
1035
  resubmitStrategy: e,
1014
1036
  type: "setUserTaskReturnResubmitStrategy"
1015
1037
  });
1016
1038
  }
1017
- function Jr(e) {
1018
- !G || G.type !== "serviceTask" || T.dispatch({
1039
+ function li(e) {
1040
+ !W || W.type !== "userTask" || D.dispatch({
1041
+ nodeId: W.id,
1042
+ requireComment: e,
1043
+ type: "setUserTaskReturnRequireComment"
1044
+ });
1045
+ }
1046
+ function $(e) {
1047
+ !W || W.type !== "userTask" || D.dispatch({
1048
+ nodeId: W.id,
1049
+ sla: e,
1050
+ type: "setUserTaskSla"
1051
+ });
1052
+ }
1053
+ function ui(e) {
1054
+ !W || W.type !== "serviceTask" || D.dispatch({
1019
1055
  action: e,
1020
- nodeId: G.id,
1056
+ nodeId: W.id,
1021
1057
  type: "setServiceAction"
1022
1058
  });
1023
1059
  }
1024
- function Yr(e) {
1025
- Ke(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), Fe(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), rt(In(e, R));
1060
+ function di(e) {
1061
+ We(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), Ne(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), ot($n(e, I));
1026
1062
  }
1027
- function Xr(e) {
1028
- !G || G.type === "startEvent" || T.dispatch({
1029
- nodeId: G.id,
1063
+ function fi(e) {
1064
+ !W || W.type === "startEvent" || D.dispatch({
1065
+ nodeId: W.id,
1030
1066
  triggerMode: e,
1031
1067
  type: "setNodeTriggerMode"
1032
1068
  });
1033
1069
  }
1034
- function Zr(e, t) {
1035
- T.dispatch({
1070
+ function pi(e, t) {
1071
+ D.dispatch({
1036
1072
  edgeId: e,
1037
1073
  isDefault: t,
1038
1074
  type: "setEdgeDefault"
1039
1075
  });
1040
1076
  }
1041
- function Qr({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1042
- T.dispatch({
1077
+ function mi({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1078
+ D.dispatch({
1043
1079
  edgeId: e,
1044
1080
  fieldKey: t,
1045
1081
  operator: n,
@@ -1047,279 +1083,279 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1047
1083
  value: r
1048
1084
  });
1049
1085
  }
1050
- function $r() {
1051
- T.dispatch({ type: "autoLayout" });
1086
+ function hi() {
1087
+ D.dispatch({ type: "autoLayout" });
1052
1088
  }
1053
- return /* @__PURE__ */ S(b, { children: [
1054
- /* @__PURE__ */ x("style", { children: ht }),
1055
- i ? null : /* @__PURE__ */ x(te, { children: /* @__PURE__ */ S(se, {
1056
- description: `${Se ? `草稿 v${Se.version}` : "尚未建立草稿"} ·${C?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
1057
- onBackClick: Un,
1058
- title: C?.template.name ?? "流程設計器",
1089
+ return /* @__PURE__ */ C(x, { children: [
1090
+ /* @__PURE__ */ S("style", { children: xt }),
1091
+ i ? null : /* @__PURE__ */ S(ee, { children: /* @__PURE__ */ C(oe, {
1092
+ description: `${xe ? `草稿 v${xe.version}` : "尚未建立草稿"} ·${w?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
1093
+ onBackClick: er,
1094
+ title: w?.template.name ?? "流程設計器",
1059
1095
  children: [
1060
- ge ? /* @__PURE__ */ x(h, {
1096
+ he ? /* @__PURE__ */ S(h, {
1061
1097
  disabled: !n,
1062
- onClick: () => pn((e) => !e),
1063
- variant: H ? "base-primary" : "base-secondary",
1098
+ onClick: () => V((e) => !e),
1099
+ variant: yn ? "base-primary" : "base-secondary",
1064
1100
  children: n ? "AI 助理" : "AI 助理(未設定)"
1065
1101
  }) : null,
1066
- /* @__PURE__ */ x(h, {
1102
+ /* @__PURE__ */ S(h, {
1067
1103
  "aria-label": "儲存草稿",
1068
- disabled: gt || !!_r || !!X,
1069
- icon: pe,
1104
+ disabled: bt || !!jr || !!Mr,
1105
+ icon: fe,
1070
1106
  iconType: "icon-only",
1071
- onClick: () => void Fr(),
1107
+ onClick: () => void Xr(),
1072
1108
  variant: "base-secondary",
1073
1109
  children: "儲存草稿"
1074
1110
  }),
1075
- _e ? /* @__PURE__ */ x(h, {
1076
- disabled: ct || !!_r || !!X,
1077
- icon: ue,
1111
+ ge ? /* @__PURE__ */ S(h, {
1112
+ disabled: dt || !!jr || !!Mr,
1113
+ icon: le,
1078
1114
  iconType: "leading",
1079
- onClick: Lr,
1115
+ onClick: Qr,
1080
1116
  variant: "base-secondary",
1081
1117
  children: "試跑流程"
1082
1118
  }) : null,
1083
- /* @__PURE__ */ x(h, {
1084
- disabled: gt || !Se && !I && !yn || !!_r || !!X,
1085
- icon: ce,
1119
+ /* @__PURE__ */ S(h, {
1120
+ disabled: bt || !xe && !P && !En || !!jr || !!Mr,
1121
+ icon: se,
1086
1122
  iconType: "leading",
1087
- onClick: () => void Ir(),
1123
+ onClick: () => void Zr(),
1088
1124
  variant: "base-primary",
1089
- children: Hn
1125
+ children: Qn
1090
1126
  })
1091
1127
  ]
1092
1128
  }) }),
1093
- /* @__PURE__ */ x(re, { children: /* @__PURE__ */ x(ne, { children: /* @__PURE__ */ S("div", {
1094
- style: lt,
1129
+ /* @__PURE__ */ S(ne, { children: /* @__PURE__ */ S(te, { children: /* @__PURE__ */ C("div", {
1130
+ style: mt,
1095
1131
  children: [
1096
- ot ? /* @__PURE__ */ x(y, {
1132
+ ut ? /* @__PURE__ */ S(b, {
1097
1133
  color: "text-error",
1098
1134
  variant: "body",
1099
- children: ot
1135
+ children: ut
1100
1136
  }) : null,
1101
- _r ? /* @__PURE__ */ x(y, {
1137
+ jr ? /* @__PURE__ */ S(b, {
1102
1138
  color: "text-error",
1103
1139
  variant: "body",
1104
- children: _r
1140
+ children: jr
1105
1141
  }) : null,
1106
- X ? /* @__PURE__ */ x(y, {
1142
+ Mr ? /* @__PURE__ */ S(b, {
1107
1143
  color: "text-error",
1108
1144
  variant: "body",
1109
- children: X
1145
+ children: Mr
1110
1146
  }) : null,
1111
- i ? null : /* @__PURE__ */ x("div", {
1112
- style: P,
1113
- children: /* @__PURE__ */ x(o, {
1147
+ i ? null : /* @__PURE__ */ S("div", {
1148
+ style: Ot,
1149
+ children: /* @__PURE__ */ S(o, {
1114
1150
  hintText: Y ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
1115
1151
  label: "綁定表單版本",
1116
1152
  name: "formDefinitionVersionId",
1117
1153
  required: !0,
1118
- children: /* @__PURE__ */ S("div", {
1119
- style: wt,
1120
- children: [/* @__PURE__ */ x("div", {
1121
- style: Tt,
1122
- children: /* @__PURE__ */ x(m, {
1154
+ children: /* @__PURE__ */ C("div", {
1155
+ style: Mt,
1156
+ children: [/* @__PURE__ */ S("div", {
1157
+ style: Nt,
1158
+ children: /* @__PURE__ */ S(m, {
1123
1159
  asyncData: !0,
1124
- disabled: ct || Y,
1160
+ disabled: dt || Y,
1125
1161
  disabledOptionsFilter: !0,
1126
1162
  emptyText: "沒有符合的已發布表單版本",
1127
- isForceClearable: !!D && !Y,
1128
- loading: vt,
1163
+ isForceClearable: !!k && !Y,
1164
+ loading: Ct,
1129
1165
  loadingText: "搜尋表單版本中...",
1130
1166
  mode: "single",
1131
1167
  onChange: (e) => {
1132
- Y || nt(e?.id ?? null);
1168
+ Y || at(e?.id ?? null);
1133
1169
  },
1134
1170
  onClear: () => {
1135
- Y || nt(null);
1171
+ Y || at(null);
1136
1172
  },
1137
- onSearch: Mr,
1173
+ onSearch: Gr,
1138
1174
  onVisibilityChange: (e) => {
1139
- e && !Y && Mr("");
1175
+ e && !Y && Gr("");
1140
1176
  },
1141
- options: [...mr],
1177
+ options: [...Er],
1142
1178
  placeholder: "選擇已發布表單版本",
1143
1179
  searchDebounceTime: 300,
1144
1180
  value: J
1145
1181
  })
1146
- }), /* @__PURE__ */ x(h, {
1147
- disabled: ct,
1182
+ }), /* @__PURE__ */ S(h, {
1183
+ disabled: dt,
1148
1184
  onClick: () => {
1149
- Br();
1185
+ ti();
1150
1186
  },
1151
- style: Et,
1187
+ style: Pt,
1152
1188
  variant: "base-secondary",
1153
1189
  children: "編輯表單"
1154
1190
  })]
1155
1191
  })
1156
1192
  })
1157
1193
  }),
1158
- /* @__PURE__ */ S("div", {
1159
- style: ut,
1160
- children: [/* @__PURE__ */ x("div", {
1161
- ref: Je,
1162
- style: dt,
1163
- children: /* @__PURE__ */ S(Ne, {
1164
- connectionMode: De.Strict,
1165
- edges: dr,
1194
+ /* @__PURE__ */ C("div", {
1195
+ style: ht,
1196
+ children: [/* @__PURE__ */ S("div", {
1197
+ ref: Ye,
1198
+ style: gt,
1199
+ children: /* @__PURE__ */ C(je, {
1200
+ connectionMode: Ee.Strict,
1201
+ edges: wr,
1166
1202
  fitView: !0,
1167
- isValidConnection: (e) => zn(e, E.nodes),
1168
- nodeTypes: rn,
1169
- nodes: lr,
1203
+ isValidConnection: (e) => nr(e, O.nodes),
1204
+ nodeTypes: pn,
1205
+ nodes: Cr,
1170
1206
  deleteKeyCode: null,
1171
1207
  multiSelectionKeyCode: [
1172
1208
  "Shift",
1173
1209
  "Meta",
1174
1210
  "Control"
1175
1211
  ],
1176
- onConnect: Hr,
1177
- onEdgeClick: Ur,
1212
+ onConnect: ri,
1213
+ onEdgeClick: ii,
1178
1214
  onNodeClick: (e, t) => {
1179
- A(t.id), it([]);
1215
+ st(t.id), ct([]);
1180
1216
  },
1181
- onNodesChange: Vr,
1217
+ onNodesChange: ni,
1182
1218
  onPaneClick: () => {
1183
- A(null), it([]);
1219
+ st(null), ct([]);
1184
1220
  },
1185
- onViewportChange: Xe,
1186
- viewport: Ye,
1221
+ onViewportChange: $e,
1222
+ viewport: Qe,
1187
1223
  children: [
1188
- /* @__PURE__ */ x(Ee, {}),
1189
- /* @__PURE__ */ x("style", { children: yt }),
1190
- /* @__PURE__ */ x(ke, { children: Yn ? /* @__PURE__ */ x(Oe, {
1224
+ /* @__PURE__ */ S(Te, {}),
1225
+ /* @__PURE__ */ S("style", { children: Et }),
1226
+ /* @__PURE__ */ S(Oe, { children: or ? /* @__PURE__ */ S(De, {
1191
1227
  "aria-label": "刪除選取項目",
1192
1228
  className: "workflow-selection-delete-control",
1193
- onClick: K,
1194
- style: ft,
1229
+ onClick: ur,
1230
+ style: _t,
1195
1231
  title: "刪除選取項目",
1196
- children: /* @__PURE__ */ x("span", {
1197
- style: pt,
1198
- children: /* @__PURE__ */ x(ee, {
1232
+ children: /* @__PURE__ */ S("span", {
1233
+ style: vt,
1234
+ children: /* @__PURE__ */ S(g, {
1199
1235
  color: "error",
1200
- icon: me,
1236
+ icon: pe,
1201
1237
  size: 16
1202
1238
  })
1203
1239
  })
1204
1240
  }) : null }),
1205
- /* @__PURE__ */ x(sn, { onApplyAutoLayout: $r }),
1206
- /* @__PURE__ */ x(je, {})
1241
+ /* @__PURE__ */ S(hn, { onApplyAutoLayout: hi }),
1242
+ /* @__PURE__ */ S(ke, {})
1207
1243
  ]
1208
1244
  })
1209
- }), /* @__PURE__ */ S("div", {
1210
- className: mt,
1211
- style: bt,
1245
+ }), /* @__PURE__ */ C("div", {
1246
+ className: yt,
1247
+ style: Dt,
1212
1248
  children: [
1213
- /* @__PURE__ */ x(y, {
1249
+ /* @__PURE__ */ S(b, {
1214
1250
  component: "h2",
1215
1251
  variant: "h3",
1216
1252
  children: "流程工具"
1217
1253
  }),
1218
- i && ge ? /* @__PURE__ */ S("div", {
1219
- style: Dt,
1220
- children: [/* @__PURE__ */ x(y, {
1254
+ i && he ? /* @__PURE__ */ C("div", {
1255
+ style: Ft,
1256
+ children: [/* @__PURE__ */ S(b, {
1221
1257
  color: "text-neutral",
1222
1258
  variant: "caption",
1223
1259
  children: "AI 協助"
1224
- }), /* @__PURE__ */ x("div", {
1225
- style: Ct,
1226
- children: /* @__PURE__ */ x(h, {
1260
+ }), /* @__PURE__ */ S("div", {
1261
+ style: jt,
1262
+ children: /* @__PURE__ */ S(h, {
1227
1263
  disabled: !n,
1228
- onClick: () => pn((e) => !e),
1264
+ onClick: () => V((e) => !e),
1229
1265
  size: "sub",
1230
- variant: H ? "base-primary" : "base-secondary",
1266
+ variant: yn ? "base-primary" : "base-secondary",
1231
1267
  children: n ? "AI 助理" : "AI 助理(未設定)"
1232
1268
  })
1233
1269
  })]
1234
1270
  }) : null,
1235
- /* @__PURE__ */ S("div", {
1236
- style: Dt,
1237
- children: [/* @__PURE__ */ x(y, {
1271
+ /* @__PURE__ */ C("div", {
1272
+ style: Ft,
1273
+ children: [/* @__PURE__ */ S(b, {
1238
1274
  color: "text-neutral",
1239
1275
  variant: "caption",
1240
1276
  children: "動作節點"
1241
- }), /* @__PURE__ */ x("div", {
1242
- style: Ct,
1243
- children: Bt.map((e) => /* @__PURE__ */ x(h, {
1277
+ }), /* @__PURE__ */ S("div", {
1278
+ style: jt,
1279
+ children: Yt.map((e) => /* @__PURE__ */ S(h, {
1244
1280
  icon: e.icon,
1245
1281
  iconType: "leading",
1246
- onClick: () => Gr(e.type),
1282
+ onClick: () => oi(e.type),
1247
1283
  size: "sub",
1248
1284
  variant: "base-secondary",
1249
1285
  children: e.label
1250
1286
  }, e.type))
1251
1287
  })]
1252
1288
  }),
1253
- /* @__PURE__ */ S("div", {
1254
- style: Dt,
1255
- children: [/* @__PURE__ */ x(y, {
1289
+ /* @__PURE__ */ C("div", {
1290
+ style: Ft,
1291
+ children: [/* @__PURE__ */ S(b, {
1256
1292
  color: "text-neutral",
1257
1293
  variant: "caption",
1258
1294
  children: "流程控制"
1259
- }), /* @__PURE__ */ x("div", {
1260
- style: Ct,
1261
- children: Vt.map((e) => /* @__PURE__ */ x(h, {
1295
+ }), /* @__PURE__ */ S("div", {
1296
+ style: jt,
1297
+ children: Xt.map((e) => /* @__PURE__ */ S(h, {
1262
1298
  icon: e.icon,
1263
1299
  iconType: "leading",
1264
- onClick: () => Gr(e.type),
1300
+ onClick: () => oi(e.type),
1265
1301
  size: "sub",
1266
1302
  variant: "base-secondary",
1267
1303
  children: e.label
1268
1304
  }, e.type))
1269
1305
  })]
1270
1306
  }),
1271
- cr.length > 1 ? oi(cr) : null,
1272
- cr.length === 1 && sr ? si(sr) : null,
1273
- cr.length === 0 && G ? ti(G) : null
1307
+ K.length > 1 ? Si(K) : null,
1308
+ K.length === 1 && G ? Ci(G) : null,
1309
+ K.length === 0 && W ? _i(W) : null
1274
1310
  ]
1275
1311
  })]
1276
1312
  })
1277
1313
  ]
1278
1314
  }) }) }),
1279
- ci(ar),
1280
- !i && _e ? ei() : null,
1281
- ge && n ? /* @__PURE__ */ x(st, {
1282
- controller: T,
1283
- onClose: () => pn(!1),
1284
- open: H
1315
+ wi(fr),
1316
+ !i && ge ? gi() : null,
1317
+ he && n ? /* @__PURE__ */ S(ft, {
1318
+ controller: D,
1319
+ onClose: () => V(!1),
1320
+ open: yn
1285
1321
  }) : null,
1286
- i ? null : /* @__PURE__ */ x(oe, {
1322
+ i ? null : /* @__PURE__ */ S(ae, {
1287
1323
  headerTitle: "編輯表單",
1288
1324
  isHeaderDisplay: !0,
1289
- onClose: () => hn(!1),
1290
- open: mn,
1325
+ onClose: () => Sn(!1),
1326
+ open: xn,
1291
1327
  size: "wide",
1292
- children: /* @__PURE__ */ S("div", {
1293
- style: Qt,
1294
- children: [/* @__PURE__ */ x("div", {
1295
- style: $t,
1296
- children: Fn ? /* @__PURE__ */ x(y, {
1328
+ children: /* @__PURE__ */ C("div", {
1329
+ style: cn,
1330
+ children: [/* @__PURE__ */ S("div", {
1331
+ style: ln,
1332
+ children: Vn ? /* @__PURE__ */ S(b, {
1297
1333
  color: "text-neutral",
1298
1334
  variant: "body",
1299
1335
  children: "載入中…"
1300
- }) : /* @__PURE__ */ x(s, {
1336
+ }) : /* @__PURE__ */ S(s, {
1301
1337
  onChange: (e) => {
1302
- vn(e);
1338
+ wn(e);
1303
1339
  },
1304
- value: U ?? {
1305
- schema: tn,
1306
- uiSchema: nn
1340
+ value: H ?? {
1341
+ schema: dn,
1342
+ uiSchema: fn
1307
1343
  }
1308
1344
  })
1309
- }), /* @__PURE__ */ S("div", {
1310
- style: en,
1311
- children: [/* @__PURE__ */ x(h, {
1312
- disabled: Fn,
1345
+ }), /* @__PURE__ */ C("div", {
1346
+ style: un,
1347
+ children: [/* @__PURE__ */ S(h, {
1348
+ disabled: Vn,
1313
1349
  onClick: () => {
1314
- U !== null && (Mn(!0), T.replaceState((e) => ({
1350
+ H !== null && (Dn(!0), D.replaceState((e) => ({
1315
1351
  ...e,
1316
- formSchema: U.schema
1317
- }))), hn(!1);
1352
+ formSchema: H.schema
1353
+ }))), Sn(!1);
1318
1354
  },
1319
1355
  variant: "base-primary",
1320
1356
  children: "套用"
1321
- }), /* @__PURE__ */ x(h, {
1322
- onClick: () => hn(!1),
1357
+ }), /* @__PURE__ */ S(h, {
1358
+ onClick: () => Sn(!1),
1323
1359
  variant: "base-secondary",
1324
1360
  children: "取消"
1325
1361
  })]
@@ -1327,79 +1363,79 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1327
1363
  })
1328
1364
  })
1329
1365
  ] });
1330
- function ei() {
1331
- return /* @__PURE__ */ x(_, {
1366
+ function gi() {
1367
+ return /* @__PURE__ */ S(v, {
1332
1368
  cancelText: "關閉",
1333
1369
  confirmText: "執行試跑",
1334
1370
  loading: qt,
1335
1371
  modalType: "standard",
1336
- onCancel: Rr,
1337
- onClose: Rr,
1338
- onConfirm: () => void zr(),
1339
- open: Rt,
1372
+ onCancel: $r,
1373
+ onClose: $r,
1374
+ onConfirm: () => void ei(),
1375
+ open: Gt,
1340
1376
  showModalFooter: !0,
1341
1377
  showModalHeader: !0,
1342
1378
  size: "wide",
1343
- supportingText: `使用 ${Zt} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
1379
+ supportingText: `使用 ${sn} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
1344
1380
  title: "試跑流程",
1345
- children: /* @__PURE__ */ S("div", {
1346
- style: P,
1381
+ children: /* @__PURE__ */ C("div", {
1382
+ style: Ot,
1347
1383
  children: [
1348
- /* @__PURE__ */ x(o, {
1384
+ /* @__PURE__ */ S(o, {
1349
1385
  label: "表單資料 JSON",
1350
1386
  name: "dryRunFormDataJson",
1351
1387
  required: !0,
1352
- children: /* @__PURE__ */ x(ie, {
1353
- onChange: (e) => V(e.target.value),
1388
+ children: /* @__PURE__ */ S(re, {
1389
+ onChange: (e) => mn(e.target.value),
1354
1390
  resize: "vertical",
1355
1391
  rows: 8,
1356
- value: on
1392
+ value: rn
1357
1393
  })
1358
1394
  }),
1359
- un ? /* @__PURE__ */ x(y, {
1395
+ _n ? /* @__PURE__ */ S(b, {
1360
1396
  color: "text-error",
1361
1397
  variant: "body",
1362
- children: un
1398
+ children: _n
1363
1399
  }) : null,
1364
- cn ? /* @__PURE__ */ S("div", {
1365
- style: xt,
1400
+ B ? /* @__PURE__ */ C("div", {
1401
+ style: kt,
1366
1402
  children: [
1367
- /* @__PURE__ */ x(y, {
1368
- color: cn.valid ? "text-success" : "text-error",
1403
+ /* @__PURE__ */ S(b, {
1404
+ color: B.valid ? "text-success" : "text-error",
1369
1405
  variant: "label-primary-highlight",
1370
- children: cn.valid ? "試跑通過" : "試跑失敗"
1406
+ children: B.valid ? "試跑通過" : "試跑失敗"
1371
1407
  }),
1372
- cn.errors.map((e) => /* @__PURE__ */ x(y, {
1408
+ B.errors.map((e) => /* @__PURE__ */ S(b, {
1373
1409
  color: "text-error",
1374
1410
  variant: "body",
1375
1411
  children: e
1376
1412
  }, e)),
1377
- cn.steps.map((e) => /* @__PURE__ */ S("div", {
1378
- style: St,
1413
+ B.steps.map((e) => /* @__PURE__ */ C("div", {
1414
+ style: At,
1379
1415
  children: [
1380
- /* @__PURE__ */ S(y, {
1416
+ /* @__PURE__ */ C(b, {
1381
1417
  variant: "label-primary-highlight",
1382
1418
  children: [
1383
1419
  e.nodeLabel,
1384
1420
  " · ",
1385
- Xn(e.status)
1421
+ pr(e.status)
1386
1422
  ]
1387
1423
  }),
1388
- /* @__PURE__ */ S(y, {
1424
+ /* @__PURE__ */ C(b, {
1389
1425
  color: "text-neutral",
1390
1426
  variant: "caption",
1391
1427
  children: [
1392
- Zn(e.nodeType),
1428
+ mr(e.nodeType),
1393
1429
  e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
1394
1430
  e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
1395
1431
  ]
1396
1432
  }),
1397
- e.edgeReason ? /* @__PURE__ */ x(y, {
1433
+ e.edgeReason ? /* @__PURE__ */ S(b, {
1398
1434
  color: "text-neutral",
1399
1435
  variant: "caption",
1400
1436
  children: e.edgeReason
1401
1437
  }) : null,
1402
- e.entryCondition ? /* @__PURE__ */ S(y, {
1438
+ e.entryCondition ? /* @__PURE__ */ C(b, {
1403
1439
  color: "text-neutral",
1404
1440
  variant: "caption",
1405
1441
  children: [
@@ -1410,7 +1446,7 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1410
1446
  e.entryCondition
1411
1447
  ]
1412
1448
  }) : null,
1413
- /* @__PURE__ */ x(y, {
1449
+ /* @__PURE__ */ S(b, {
1414
1450
  color: "text-neutral",
1415
1451
  variant: "body",
1416
1452
  children: e.message
@@ -1423,107 +1459,107 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1423
1459
  })
1424
1460
  });
1425
1461
  }
1426
- function ti(e) {
1427
- return /* @__PURE__ */ S("div", {
1428
- style: P,
1462
+ function _i(e) {
1463
+ return /* @__PURE__ */ C("div", {
1464
+ style: Ot,
1429
1465
  children: [
1430
- /* @__PURE__ */ x(y, {
1466
+ /* @__PURE__ */ S(b, {
1431
1467
  component: "h2",
1432
1468
  variant: "h3",
1433
1469
  children: "節點屬性"
1434
1470
  }),
1435
- /* @__PURE__ */ S(y, {
1471
+ /* @__PURE__ */ C(b, {
1436
1472
  color: "text-neutral",
1437
1473
  variant: "body",
1438
1474
  children: [
1439
- zt[e.type],
1475
+ Jt[e.type],
1440
1476
  " · ",
1441
1477
  e.id
1442
1478
  ]
1443
1479
  }),
1444
- /* @__PURE__ */ x(o, {
1480
+ /* @__PURE__ */ S(o, {
1445
1481
  label: "顯示名稱",
1446
1482
  name: "nodeLabel",
1447
1483
  required: !0,
1448
- children: /* @__PURE__ */ x(g, {
1449
- onChange: (e) => Kr(e.target.value),
1484
+ children: /* @__PURE__ */ S(_, {
1485
+ onChange: (e) => si(e.target.value),
1450
1486
  value: e.data.label,
1451
1487
  variant: "base"
1452
1488
  })
1453
1489
  }),
1454
- e.type === "startEvent" ? ni() : null,
1455
- e.type === "startEvent" ? null : ri(e),
1456
- e.type === "userTask" ? ii(e) : null,
1457
- e.type === "serviceTask" ? ai(e) : null
1490
+ e.type === "startEvent" ? vi() : null,
1491
+ e.type === "startEvent" ? null : yi(e),
1492
+ e.type === "userTask" ? bi(e) : null,
1493
+ e.type === "serviceTask" ? xi(e) : null
1458
1494
  ]
1459
1495
  });
1460
1496
  }
1461
- function ni() {
1462
- let e = q.mode === "CUSTOM" ? [...Yt, Xt] : [...Yt], t = q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? rr(R, q.orgUnitId ?? "") : null, n = q.mode === "ORG_UNIT_POSITION" ? ir(z, q.positionId ?? "") : null, i = q.mode === "ORG_UNIT_POSITION" ? ur({
1497
+ function vi() {
1498
+ let e = q.mode === "CUSTOM" ? [...an, on] : [...an], t = q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? br(I, q.orgUnitId ?? "") : null, n = q.mode === "ORG_UNIT_POSITION" ? xr(L, q.positionId ?? "") : null, i = q.mode === "ORG_UNIT_POSITION" ? Tr({
1463
1499
  includeDescendants: !!q.includeDescendants,
1464
- memberships: It,
1500
+ memberships: Ut,
1465
1501
  orgUnitId: q.orgUnitId ?? "",
1466
- orgUnits: R,
1467
- positions: z
1502
+ orgUnits: I,
1503
+ positions: L
1468
1504
  }) : [];
1469
- return /* @__PURE__ */ S(b, { children: [
1470
- /* @__PURE__ */ x(o, {
1505
+ return /* @__PURE__ */ C(x, { children: [
1506
+ /* @__PURE__ */ S(o, {
1471
1507
  hintText: q.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
1472
1508
  label: "發起權限",
1473
1509
  name: "initiatorPolicyMode",
1474
1510
  required: !0,
1475
- children: /* @__PURE__ */ x(v, {
1511
+ children: /* @__PURE__ */ S(y, {
1476
1512
  clearable: !1,
1477
1513
  onChange: (e) => {
1478
1514
  if (e?.id === "CUSTOM") {
1479
- Fe(null), Ke(null);
1515
+ Ne(null), We(null);
1480
1516
  return;
1481
1517
  }
1482
- let t = jn(e?.id ?? null), n = Rn(t);
1483
- Fe(t === "ALL" ? null : t), Ke(t === "ALL" ? null : n), rt(In(n, R));
1518
+ let t = Jn(e?.id ?? null), n = tr(t);
1519
+ Ne(t === "ALL" ? null : t), We(t === "ALL" ? null : n), ot($n(n, I));
1484
1520
  },
1485
1521
  options: e,
1486
1522
  placeholder: "選擇誰可以發起",
1487
- value: W(e, q.mode)
1523
+ value: U(e, q.mode)
1488
1524
  })
1489
1525
  }),
1490
- q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1526
+ q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1491
1527
  label: "組織",
1492
1528
  name: "initiatorOrgUnitId",
1493
1529
  required: !0,
1494
- children: /* @__PURE__ */ x(r, {
1530
+ children: /* @__PURE__ */ S(r, {
1495
1531
  name: "initiatorOrgUnitId",
1496
- onChange: (e) => Yr({
1532
+ onChange: (e) => di({
1497
1533
  ...q,
1498
1534
  orgUnitId: e?.id ?? "",
1499
1535
  positionId: "",
1500
1536
  value: e?.id ?? ""
1501
1537
  }),
1502
- orgUnits: R,
1538
+ orgUnits: I,
1503
1539
  placeholder: "選擇組織",
1504
1540
  value: t
1505
1541
  })
1506
1542
  }) : null,
1507
- q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1543
+ q.mode === "ORG_UNIT" || q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1508
1544
  label: "包含下層",
1509
1545
  name: "initiatorIncludeDescendants",
1510
- children: /* @__PURE__ */ x(ae, {
1546
+ children: /* @__PURE__ */ S(ie, {
1511
1547
  checked: !!q.includeDescendants,
1512
- onChange: (e) => Yr({
1548
+ onChange: (e) => di({
1513
1549
  ...q,
1514
1550
  includeDescendants: e.target.checked,
1515
1551
  ...q.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
1516
1552
  })
1517
1553
  })
1518
1554
  }) : null,
1519
- q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1555
+ q.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1520
1556
  label: "職位",
1521
1557
  name: "initiatorPositionId",
1522
1558
  required: !0,
1523
- children: /* @__PURE__ */ x(a, {
1559
+ children: /* @__PURE__ */ S(a, {
1524
1560
  disabled: !q.orgUnitId?.trim(),
1525
1561
  name: "initiatorPositionId",
1526
- onChange: (e) => Yr({
1562
+ onChange: (e) => di({
1527
1563
  ...q,
1528
1564
  positionId: e?.id ?? ""
1529
1565
  }),
@@ -1534,47 +1570,47 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1534
1570
  }) : null
1535
1571
  ] });
1536
1572
  }
1537
- function ri(e) {
1538
- let t = E.edges.filter((t) => t.target === e.id).length, n = t < 2, r = n ? "AND" : e.data.triggerMode ?? "AND";
1539
- return /* @__PURE__ */ x(o, {
1573
+ function yi(e) {
1574
+ let t = O.edges.filter((t) => t.target === e.id).length, n = t < 2, r = n ? "AND" : e.data.triggerMode ?? "AND";
1575
+ return /* @__PURE__ */ S(o, {
1540
1576
  hintText: n ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
1541
1577
  label: "前置條件",
1542
1578
  name: "triggerMode",
1543
1579
  required: !0,
1544
- children: /* @__PURE__ */ x(v, {
1580
+ children: /* @__PURE__ */ S(y, {
1545
1581
  clearable: !1,
1546
- onChange: (e) => n ? void 0 : Xr(Cn(e?.id ?? null)),
1547
- options: [...Ht],
1582
+ onChange: (e) => n ? void 0 : fi(jn(e?.id ?? null)),
1583
+ options: [...Zt],
1548
1584
  readOnly: n,
1549
- value: W(Ht, r)
1585
+ value: U(Zt, r)
1550
1586
  })
1551
1587
  });
1552
1588
  }
1553
- function ii(e) {
1554
- let t = e.data.approverResolver, n = Tn(t.type), i = t.type === "DIRECT" ? nr(t.memberIds, L) : null, s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? rr(R, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? ir(z, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? ur({
1589
+ function bi(e) {
1590
+ let t = e.data.approverResolver, n = Hn(t.type), i = t.type === "DIRECT" ? yr(t.memberIds, F) : null, s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? br(I, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? xr(L, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? Tr({
1555
1591
  includeDescendants: !!t.includeDescendants,
1556
- memberships: It,
1592
+ memberships: Ut,
1557
1593
  orgUnitId: t.orgUnitId,
1558
- orgUnits: R,
1559
- positions: z
1560
- }) : [], u = t.type === "ORG_MANAGER" ? kn(t.levelsUp) : Gt[0], d = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, f = d.type === "DIRECT" ? tr(L, d.memberId) : null, p = e.data.returnBehavior.resubmitStrategy ?? "RESTART";
1561
- return /* @__PURE__ */ S(b, { children: [
1562
- /* @__PURE__ */ x(o, {
1594
+ orgUnits: I,
1595
+ positions: L
1596
+ }) : [], u = t.type === "ORG_MANAGER" ? Kn(t.levelsUp) : R[0], d = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, f = d.type === "DIRECT" ? vr(F, d.memberId) : null, p = e.data.returnBehavior.resubmitStrategy ?? "RESTART", h = e.data.sla ?? null, g = h ? Xe(h.duration) : null, v = g?.unit ?? "DAY", ee = In(h?.warningAt ?? null), te = Kn(h?.escalateLevelsUp ?? 1);
1597
+ return /* @__PURE__ */ C(x, { children: [
1598
+ /* @__PURE__ */ S(o, {
1563
1599
  label: "簽核來源",
1564
1600
  name: "approverResolverType",
1565
1601
  required: !0,
1566
- children: /* @__PURE__ */ x(v, {
1602
+ children: /* @__PURE__ */ S(y, {
1567
1603
  clearable: !1,
1568
- onChange: (e) => $(En(e?.id ?? null)),
1569
- options: [...Wt],
1570
- value: W(Wt, n)
1604
+ onChange: (e) => Q(Un(e?.id ?? null)),
1605
+ options: [...en],
1606
+ value: U(en, n)
1571
1607
  })
1572
1608
  }),
1573
- t.type === "DIRECT" ? /* @__PURE__ */ x(o, {
1609
+ t.type === "DIRECT" ? /* @__PURE__ */ S(o, {
1574
1610
  label: "簽核者",
1575
1611
  name: "memberId",
1576
1612
  required: !0,
1577
- children: /* @__PURE__ */ x(m, {
1613
+ children: /* @__PURE__ */ S(m, {
1578
1614
  asyncData: !0,
1579
1615
  disabledOptionsFilter: !0,
1580
1616
  emptyText: "沒有符合的成員",
@@ -1584,47 +1620,47 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1584
1620
  name: "workflow-approver-search",
1585
1621
  spellCheck: !1
1586
1622
  },
1587
- loading: jt,
1623
+ loading: Rt,
1588
1624
  loadingText: "搜尋成員中...",
1589
1625
  mode: "single",
1590
- onChange: (e) => $({
1626
+ onChange: (e) => Q({
1591
1627
  memberIds: e?.id ? [e.id] : [],
1592
1628
  type: "DIRECT"
1593
1629
  }),
1594
- onSearch: Q,
1630
+ onSearch: X,
1595
1631
  onVisibilityChange: (e) => {
1596
- e && Q("");
1632
+ e && X("");
1597
1633
  },
1598
- options: [...L],
1634
+ options: [...F],
1599
1635
  placeholder: "搜尋姓名或信箱",
1600
1636
  searchDebounceTime: 300,
1601
1637
  value: i
1602
1638
  })
1603
1639
  }) : null,
1604
- t.type === "ORG_MANAGER" ? /* @__PURE__ */ x(o, {
1640
+ t.type === "ORG_MANAGER" ? /* @__PURE__ */ S(o, {
1605
1641
  hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
1606
1642
  label: "主管層級",
1607
1643
  name: "managerLevelsUp",
1608
1644
  required: !0,
1609
- children: /* @__PURE__ */ x(v, {
1645
+ children: /* @__PURE__ */ S(y, {
1610
1646
  clearable: !1,
1611
- onChange: (e) => $({
1647
+ onChange: (e) => Q({
1612
1648
  baseFromInitiator: !0,
1613
- levelsUp: An(e?.id ?? null).value,
1649
+ levelsUp: qn(e?.id ?? null).value,
1614
1650
  type: "ORG_MANAGER"
1615
1651
  }),
1616
- options: [...Gt],
1652
+ options: [...R],
1617
1653
  value: u
1618
1654
  })
1619
1655
  }) : null,
1620
- t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1656
+ t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1621
1657
  hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
1622
1658
  label: "組織",
1623
1659
  name: "orgUnitId",
1624
1660
  required: !0,
1625
- children: /* @__PURE__ */ x(r, {
1661
+ children: /* @__PURE__ */ S(r, {
1626
1662
  name: "orgUnitId",
1627
- onChange: (e) => $(t.type === "ORG_UNIT_MEMBER" ? {
1663
+ onChange: (e) => Q(t.type === "ORG_UNIT_MEMBER" ? {
1628
1664
  includeDescendants: t.includeDescendants,
1629
1665
  orgUnitId: e?.id ?? "",
1630
1666
  type: "ORG_UNIT_MEMBER"
@@ -1638,30 +1674,30 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1638
1674
  orgUnitId: e?.id ?? "",
1639
1675
  type: "ORG_UNIT_MANAGER"
1640
1676
  }),
1641
- orgUnits: R,
1677
+ orgUnits: I,
1642
1678
  placeholder: "選擇組織",
1643
1679
  value: s
1644
1680
  })
1645
1681
  }) : null,
1646
- t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
1682
+ t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(o, {
1647
1683
  hintText: "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
1648
1684
  label: "無主管時",
1649
1685
  name: "approverFallbackMode",
1650
1686
  required: !0,
1651
- children: /* @__PURE__ */ x(v, {
1687
+ children: /* @__PURE__ */ S(y, {
1652
1688
  clearable: !1,
1653
- onChange: (e) => $(On(t, Dn(e?.id ?? null) === "DIRECT" ? {
1689
+ onChange: (e) => Q(Gn(t, Wn(e?.id ?? null) === "DIRECT" ? {
1654
1690
  memberId: "",
1655
1691
  type: "DIRECT"
1656
1692
  } : { type: "NONE" })),
1657
- options: [...Kt],
1658
- value: W(Kt, d.type)
1693
+ options: [...tn],
1694
+ value: U(tn, d.type)
1659
1695
  })
1660
- }), d.type === "DIRECT" ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
1696
+ }), d.type === "DIRECT" ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(o, {
1661
1697
  label: "改派人員",
1662
1698
  name: "approverFallbackMemberId",
1663
1699
  required: !0,
1664
- children: /* @__PURE__ */ x(m, {
1700
+ children: /* @__PURE__ */ S(m, {
1665
1701
  asyncData: !0,
1666
1702
  disabledOptionsFilter: !0,
1667
1703
  emptyText: "沒有符合的成員",
@@ -1671,73 +1707,81 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1671
1707
  name: "workflow-approver-fallback-search",
1672
1708
  spellCheck: !1
1673
1709
  },
1674
- loading: jt,
1710
+ loading: Rt,
1675
1711
  loadingText: "搜尋成員中...",
1676
1712
  mode: "single",
1677
- onChange: (e) => $(On(t, {
1713
+ onChange: (e) => Q(Gn(t, {
1678
1714
  allowInitiatorSelfApproval: d.allowInitiatorSelfApproval,
1679
1715
  memberId: e?.id ?? "",
1680
1716
  type: "DIRECT"
1681
1717
  })),
1682
- onSearch: Q,
1718
+ onSearch: X,
1683
1719
  onVisibilityChange: (e) => {
1684
- e && Q("");
1720
+ e && X("");
1685
1721
  },
1686
- options: [...L],
1722
+ options: [...F],
1687
1723
  placeholder: "搜尋姓名或信箱",
1688
1724
  searchDebounceTime: 300,
1689
1725
  value: f
1690
1726
  })
1691
- }), /* @__PURE__ */ x(o, {
1727
+ }), /* @__PURE__ */ S(o, {
1692
1728
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
1693
1729
  label: "允許自簽",
1694
1730
  name: "allowInitiatorSelfApproval",
1695
- children: /* @__PURE__ */ x(ae, {
1731
+ children: /* @__PURE__ */ S(ie, {
1696
1732
  checked: !!d.allowInitiatorSelfApproval,
1697
- onChange: (e) => $(On(t, {
1733
+ inputProps: {
1734
+ id: "allowInitiatorSelfApproval",
1735
+ name: "allowInitiatorSelfApproval"
1736
+ },
1737
+ onChange: (e) => Q(Gn(t, {
1698
1738
  allowInitiatorSelfApproval: e.target.checked,
1699
1739
  memberId: d.memberId,
1700
1740
  type: "DIRECT"
1701
1741
  }))
1702
1742
  })
1703
1743
  })] }) : null] }) : null,
1704
- t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1744
+ t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1705
1745
  label: "包含下層",
1706
1746
  name: "includeDescendants",
1707
- children: /* @__PURE__ */ x(ae, {
1747
+ children: /* @__PURE__ */ S(ie, {
1708
1748
  checked: !!t.includeDescendants,
1709
- onChange: (e) => $({
1749
+ inputProps: {
1750
+ id: "includeDescendants",
1751
+ name: "includeDescendants"
1752
+ },
1753
+ onChange: (e) => Q({
1710
1754
  ...t,
1711
1755
  includeDescendants: e.target.checked,
1712
1756
  ...t.type === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
1713
1757
  })
1714
1758
  })
1715
1759
  }) : null,
1716
- t.type === "POSITION" ? /* @__PURE__ */ x(o, {
1760
+ t.type === "POSITION" ? /* @__PURE__ */ S(o, {
1717
1761
  hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
1718
1762
  label: "職位",
1719
1763
  name: "positionId",
1720
1764
  required: !0,
1721
- children: /* @__PURE__ */ x(a, {
1765
+ children: /* @__PURE__ */ S(a, {
1722
1766
  name: "positionId",
1723
- onChange: (e) => $({
1767
+ onChange: (e) => Q({
1724
1768
  positionId: e?.id ?? "",
1725
1769
  type: "POSITION"
1726
1770
  }),
1727
1771
  placeholder: "選擇職位",
1728
- positions: z,
1772
+ positions: L,
1729
1773
  value: c
1730
1774
  })
1731
1775
  }) : null,
1732
- t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ x(o, {
1776
+ t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ S(o, {
1733
1777
  hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
1734
1778
  label: "職位",
1735
1779
  name: "orgUnitPositionId",
1736
1780
  required: !0,
1737
- children: /* @__PURE__ */ x(a, {
1781
+ children: /* @__PURE__ */ S(a, {
1738
1782
  disabled: !t.orgUnitId.trim(),
1739
1783
  name: "orgUnitPositionId",
1740
- onChange: (e) => $({
1784
+ onChange: (e) => Q({
1741
1785
  includeDescendants: t.includeDescendants,
1742
1786
  orgUnitId: t.orgUnitId,
1743
1787
  positionId: e?.id ?? "",
@@ -1748,34 +1792,152 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1748
1792
  value: c
1749
1793
  })
1750
1794
  }) : null,
1751
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ x(o, {
1795
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ S(o, {
1752
1796
  hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
1753
1797
  label: "重送策略",
1754
1798
  name: "returnResubmitStrategy",
1755
1799
  required: !0,
1756
- children: /* @__PURE__ */ x(v, {
1800
+ children: /* @__PURE__ */ S(y, {
1757
1801
  clearable: !1,
1758
- onChange: (e) => qr(wn(e?.id ?? null)),
1759
- options: [...Ut],
1760
- value: W(Ut, p)
1802
+ onChange: (e) => ci(Mn(e?.id ?? null)),
1803
+ options: [...Qt],
1804
+ value: U(Qt, p)
1805
+ })
1806
+ }) : null,
1807
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ S(o, {
1808
+ hintText: "開啟後,簽核者按下退回時必須填寫意見,未填寫會被擋下。",
1809
+ label: "退回時意見必填",
1810
+ name: "returnRequireComment",
1811
+ children: /* @__PURE__ */ S(ie, {
1812
+ checked: e.data.returnBehavior.requireComment === !0,
1813
+ inputProps: {
1814
+ id: "returnRequireComment",
1815
+ name: "returnRequireComment"
1816
+ },
1817
+ onChange: (e) => li(e.target.checked)
1818
+ })
1819
+ }) : null,
1820
+ /* @__PURE__ */ S(o, {
1821
+ hintText: "開啟後可設定簽核期限,逾時將依下方設定處理。",
1822
+ label: "啟用時效",
1823
+ name: "slaEnabled",
1824
+ children: /* @__PURE__ */ S(ie, {
1825
+ checked: !!h,
1826
+ inputProps: {
1827
+ id: "slaEnabled",
1828
+ name: "slaEnabled"
1829
+ },
1830
+ onChange: (e) => $(e.target.checked ? Ge : null)
1831
+ })
1832
+ }),
1833
+ h && !g ? /* @__PURE__ */ S(o, {
1834
+ hintText: "此期限混用了日與時,無法在表單中編輯。請改以單一單位設定,或透過 API 維護。",
1835
+ label: "時效期限",
1836
+ name: "slaDurationRaw",
1837
+ children: /* @__PURE__ */ S(_, {
1838
+ disabled: !0,
1839
+ value: h.duration,
1840
+ variant: "base"
1841
+ })
1842
+ }) : null,
1843
+ h && g ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(o, {
1844
+ label: "時效期限",
1845
+ name: "slaDurationValue",
1846
+ required: !0,
1847
+ children: /* @__PURE__ */ S(_, {
1848
+ id: "slaDurationValue",
1849
+ inputProps: { min: 1 },
1850
+ inputType: "number",
1851
+ name: "slaDurationValue",
1852
+ onChange: (e) => $(Rn(h, {
1853
+ unit: v,
1854
+ value: Number(e.target.value)
1855
+ })),
1856
+ value: String(g.value),
1857
+ variant: "base"
1858
+ })
1859
+ }), /* @__PURE__ */ S(o, {
1860
+ label: "期限單位",
1861
+ name: "slaDurationUnit",
1862
+ required: !0,
1863
+ children: /* @__PURE__ */ S(y, {
1864
+ clearable: !1,
1865
+ onChange: (e) => $(Rn(h, {
1866
+ unit: Nn(e?.id ?? null),
1867
+ value: g.value
1868
+ })),
1869
+ options: [...qe],
1870
+ value: U(qe, v)
1871
+ })
1872
+ })] }) : null,
1873
+ h && v === "DAY" ? /* @__PURE__ */ S(o, {
1874
+ hintText: "工作日會跳過週末與行事曆上的假日,補班日仍計為工作日;行事曆由系統管理者設定。",
1875
+ label: "計算方式",
1876
+ name: "slaCalendar",
1877
+ required: !0,
1878
+ children: /* @__PURE__ */ S(y, {
1879
+ clearable: !1,
1880
+ onChange: (e) => $({
1881
+ ...h,
1882
+ calendar: Pn(e?.id ?? null)
1883
+ }),
1884
+ options: [...Ke],
1885
+ value: U(Ke, h.calendar ?? "CALENDAR")
1886
+ })
1887
+ }) : null,
1888
+ h ? /* @__PURE__ */ S(o, {
1889
+ label: "逾時處理",
1890
+ name: "slaOnTimeout",
1891
+ required: !0,
1892
+ children: /* @__PURE__ */ S(y, {
1893
+ clearable: !1,
1894
+ onChange: (e) => $(zn(h, Fn(e?.id ?? null))),
1895
+ options: [...Je],
1896
+ value: U(Je, h.onTimeout)
1897
+ })
1898
+ }) : null,
1899
+ h?.onTimeout === "ESCALATE" ? /* @__PURE__ */ S(o, {
1900
+ hintText: "逾時後改派給簽核者的上層主管,只會升級一次。",
1901
+ label: "升級層級",
1902
+ name: "slaEscalateLevelsUp",
1903
+ required: !0,
1904
+ children: /* @__PURE__ */ S(y, {
1905
+ clearable: !1,
1906
+ onChange: (e) => $({
1907
+ ...h,
1908
+ escalateLevelsUp: qn(e?.id ?? null).value
1909
+ }),
1910
+ options: [...R],
1911
+ value: te
1912
+ })
1913
+ }) : null,
1914
+ h ? /* @__PURE__ */ S(o, {
1915
+ hintText: "在期限到達前先送出一次提醒。",
1916
+ label: "預警提醒",
1917
+ name: "slaWarningAt",
1918
+ children: /* @__PURE__ */ S(y, {
1919
+ clearable: !1,
1920
+ onChange: (e) => $(Bn(h, Ln(e?.id ?? null).value)),
1921
+ options: [...$t],
1922
+ value: ee
1761
1923
  })
1762
1924
  }) : null
1763
1925
  ] });
1764
1926
  }
1765
- function ai(e) {
1766
- let t = jr(e.data.action).map((e) => tr(L, e));
1767
- return /* @__PURE__ */ x(o, {
1927
+ function xi(e) {
1928
+ let t = qr(e.data.action).map((e) => vr(F, e));
1929
+ return /* @__PURE__ */ S(o, {
1768
1930
  label: "知會對象",
1769
1931
  name: "notifyMemberIds",
1770
1932
  required: !0,
1771
- children: /* @__PURE__ */ x(m, {
1933
+ children: /* @__PURE__ */ S(m, {
1772
1934
  asyncData: !0,
1773
1935
  disabledOptionsFilter: !0,
1774
1936
  emptyText: "沒有符合的成員",
1775
- loading: jt,
1937
+ loading: Rt,
1776
1938
  loadingText: "搜尋成員中...",
1777
1939
  mode: "multiple",
1778
- onChange: (e) => Jr({
1940
+ onChange: (e) => ui({
1779
1941
  channels: ["IN_APP"],
1780
1942
  recipients: {
1781
1943
  memberIds: e.map((e) => e.id),
@@ -1783,11 +1945,11 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1783
1945
  },
1784
1946
  type: "NOTIFY"
1785
1947
  }),
1786
- onSearch: Q,
1948
+ onSearch: X,
1787
1949
  onVisibilityChange: (e) => {
1788
- e && Q("");
1950
+ e && X("");
1789
1951
  },
1790
- options: [...L],
1952
+ options: [...F],
1791
1953
  overflowStrategy: "wrap",
1792
1954
  placeholder: "搜尋姓名或信箱",
1793
1955
  searchDebounceTime: 300,
@@ -1795,14 +1957,14 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1795
1957
  })
1796
1958
  });
1797
1959
  }
1798
- function oi(e) {
1799
- return /* @__PURE__ */ S("div", {
1800
- style: P,
1801
- children: [/* @__PURE__ */ x(y, {
1960
+ function Si(e) {
1961
+ return /* @__PURE__ */ C("div", {
1962
+ style: Ot,
1963
+ children: [/* @__PURE__ */ S(b, {
1802
1964
  component: "h2",
1803
1965
  variant: "h3",
1804
1966
  children: "已選取線段"
1805
- }), /* @__PURE__ */ S(y, {
1967
+ }), /* @__PURE__ */ C(b, {
1806
1968
  color: "text-neutral",
1807
1969
  variant: "body",
1808
1970
  children: [
@@ -1813,17 +1975,17 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1813
1975
  })]
1814
1976
  });
1815
1977
  }
1816
- function si(e) {
1817
- let t = kr(e, E.nodes);
1818
- return /* @__PURE__ */ S("div", {
1819
- style: P,
1978
+ function Ci(e) {
1979
+ let t = Kr(e, O.nodes);
1980
+ return /* @__PURE__ */ C("div", {
1981
+ style: Ot,
1820
1982
  children: [
1821
- /* @__PURE__ */ x(y, {
1983
+ /* @__PURE__ */ S(b, {
1822
1984
  component: "h2",
1823
1985
  variant: "h3",
1824
1986
  children: t ? "條件設定" : "線段屬性"
1825
1987
  }),
1826
- /* @__PURE__ */ S(y, {
1988
+ /* @__PURE__ */ C(b, {
1827
1989
  color: "text-neutral",
1828
1990
  variant: "body",
1829
1991
  children: [
@@ -1832,7 +1994,7 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1832
1994
  e.target
1833
1995
  ]
1834
1996
  }),
1835
- t ? li(e) : /* @__PURE__ */ x(y, {
1997
+ t ? Ti(e) : /* @__PURE__ */ S(b, {
1836
1998
  color: "text-neutral",
1837
1999
  variant: "body",
1838
2000
  children: "這條線會直接把流程送到下一個節點。"
@@ -1840,63 +2002,63 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1840
2002
  ]
1841
2003
  });
1842
2004
  }
1843
- function ci(e) {
1844
- return !e || !kr(e, E.nodes) ? null : /* @__PURE__ */ x(_, {
2005
+ function wi(e) {
2006
+ return !e || !Kr(e, O.nodes) ? null : /* @__PURE__ */ S(v, {
1845
2007
  cancelText: "取消",
1846
2008
  confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
1847
2009
  confirmText: "完成",
1848
2010
  modalType: "standard",
1849
- onCancel: Wr,
1850
- onClose: Wr,
1851
- onConfirm: Wr,
1852
- open: !!et,
2011
+ onCancel: ai,
2012
+ onClose: ai,
2013
+ onConfirm: ai,
2014
+ open: !!rt,
1853
2015
  showModalFooter: !0,
1854
2016
  showModalHeader: !0,
1855
2017
  size: "regular",
1856
2018
  supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
1857
2019
  title: "條件設定",
1858
- children: li(e)
2020
+ children: Ti(e)
1859
2021
  });
1860
2022
  }
1861
- function li(e) {
1862
- let t = Dr(e, E.nodes), n = xr(J?.schema ?? null), r = Sr(J?.schema ?? null, e.data.conditionFieldKey ?? null), i = Cr(r), a = Tr(r), s = W(i, e.data.conditionOperator ?? null);
1863
- return /* @__PURE__ */ S("div", {
1864
- style: P,
2023
+ function Ti(e) {
2024
+ let t = Wr(e, O.nodes), n = Lr(J?.schema ?? null), r = Rr(J?.schema ?? null, e.data.conditionFieldKey ?? null), i = zr(r), a = Hr(r), s = U(i, e.data.conditionOperator ?? null);
2025
+ return /* @__PURE__ */ C("div", {
2026
+ style: Ot,
1865
2027
  children: [
1866
- /* @__PURE__ */ S(y, {
2028
+ /* @__PURE__ */ C(b, {
1867
2029
  color: "text-neutral",
1868
2030
  variant: "body",
1869
2031
  children: [
1870
2032
  "畫布上的這條線目前會顯示「",
1871
- /* @__PURE__ */ x("span", {
1872
- style: { color: !e.data.isDefault && !e.data.condition ? _t : void 0 },
2033
+ /* @__PURE__ */ S("span", {
2034
+ style: { color: !e.data.isDefault && !e.data.condition ? wt : void 0 },
1873
2035
  children: t ?? "請設定條件"
1874
2036
  }),
1875
2037
  "」。"
1876
2038
  ]
1877
2039
  }),
1878
- /* @__PURE__ */ x(ae, {
2040
+ /* @__PURE__ */ S(ie, {
1879
2041
  checked: !!e.data.isDefault,
1880
2042
  label: "其他情況走這條",
1881
- onChange: (t) => Zr(e.id, t.target.checked)
2043
+ onChange: (t) => pi(e.id, t.target.checked)
1882
2044
  }),
1883
- e.data.isDefault ? /* @__PURE__ */ x(y, {
2045
+ e.data.isDefault ? /* @__PURE__ */ S(b, {
1884
2046
  color: "text-neutral",
1885
2047
  variant: "body",
1886
2048
  children: "其他條件都不符合時,流程會走這條線。"
1887
- }) : /* @__PURE__ */ S(b, { children: [
1888
- J ? null : /* @__PURE__ */ x(y, {
2049
+ }) : /* @__PURE__ */ C(x, { children: [
2050
+ J ? null : /* @__PURE__ */ S(b, {
1889
2051
  color: "text-neutral",
1890
2052
  variant: "body",
1891
2053
  children: "請先綁定表單版本,才能選擇條件欄位。"
1892
2054
  }),
1893
- /* @__PURE__ */ x(o, {
2055
+ /* @__PURE__ */ S(o, {
1894
2056
  label: "條件欄位",
1895
2057
  name: "edgeConditionField",
1896
2058
  required: !0,
1897
- children: /* @__PURE__ */ x(v, {
2059
+ children: /* @__PURE__ */ S(y, {
1898
2060
  clearable: !1,
1899
- onChange: (t) => Qr({
2061
+ onChange: (t) => mi({
1900
2062
  edgeId: e.id,
1901
2063
  fieldKey: t?.id ?? null,
1902
2064
  operator: null,
@@ -1904,18 +2066,18 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1904
2066
  }),
1905
2067
  options: [...n],
1906
2068
  placeholder: "選擇條件欄位",
1907
- value: W(n, e.data.conditionFieldKey ?? null)
2069
+ value: U(n, e.data.conditionFieldKey ?? null)
1908
2070
  })
1909
2071
  }),
1910
- /* @__PURE__ */ x(o, {
2072
+ /* @__PURE__ */ S(o, {
1911
2073
  label: "條件判斷",
1912
2074
  name: "edgeConditionOperator",
1913
2075
  required: !0,
1914
- children: /* @__PURE__ */ x(v, {
2076
+ children: /* @__PURE__ */ S(y, {
1915
2077
  clearable: !1,
1916
- onChange: (t) => Qr({
2078
+ onChange: (t) => mi({
1917
2079
  edgeId: e.id,
1918
- operator: wr(t?.id ?? null),
2080
+ operator: Br(t?.id ?? null),
1919
2081
  value: null
1920
2082
  }),
1921
2083
  options: [...i],
@@ -1923,21 +2085,21 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1923
2085
  value: s
1924
2086
  })
1925
2087
  }),
1926
- s && Er(s.id) ? /* @__PURE__ */ x(o, {
2088
+ s && Ur(s.id) ? /* @__PURE__ */ S(o, {
1927
2089
  label: "條件值",
1928
2090
  name: "edgeConditionValue",
1929
2091
  required: !0,
1930
- children: a.length > 0 ? /* @__PURE__ */ x(v, {
2092
+ children: a.length > 0 ? /* @__PURE__ */ S(y, {
1931
2093
  clearable: !1,
1932
- onChange: (t) => Qr({
2094
+ onChange: (t) => mi({
1933
2095
  edgeId: e.id,
1934
2096
  value: t?.id ?? null
1935
2097
  }),
1936
2098
  options: [...a],
1937
2099
  placeholder: "選擇條件值",
1938
- value: W(a, e.data.conditionValue ?? null)
1939
- }) : /* @__PURE__ */ x(g, {
1940
- onChange: (t) => Qr({
2100
+ value: U(a, e.data.conditionValue ?? null)
2101
+ }) : /* @__PURE__ */ S(_, {
2102
+ onChange: (t) => mi({
1941
2103
  edgeId: e.id,
1942
2104
  value: t.target.value
1943
2105
  }),
@@ -1951,14 +2113,14 @@ function on({ aiAssistantAvailable: n = !0, embedded: i = !1, formSchemaOverride
1951
2113
  });
1952
2114
  }
1953
2115
  }
1954
- function sn({ onApplyAutoLayout: e }) {
2116
+ function hn({ onApplyAutoLayout: e }) {
1955
2117
  function t() {
1956
2118
  e();
1957
2119
  }
1958
- return /* @__PURE__ */ x(Me, {
2120
+ return /* @__PURE__ */ S(Ae, {
1959
2121
  position: "top-right",
1960
- children: /* @__PURE__ */ x(h, {
1961
- icon: le,
2122
+ children: /* @__PURE__ */ S(h, {
2123
+ icon: ce,
1962
2124
  iconType: "leading",
1963
2125
  onClick: t,
1964
2126
  size: "sub",
@@ -1967,28 +2129,28 @@ function sn({ onApplyAutoLayout: e }) {
1967
2129
  })
1968
2130
  });
1969
2131
  }
1970
- function V({ data: e, selected: t, type: n }) {
1971
- let r = e.approverLines ?? [e.approverSummary ?? e.label], i = cn(e);
1972
- return /* @__PURE__ */ S("div", {
1973
- style: ln(n, t),
2132
+ function B({ data: e, selected: t, type: n }) {
2133
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = gn(e);
2134
+ return /* @__PURE__ */ C("div", {
2135
+ style: _n(n, t),
1974
2136
  children: [
1975
- dn(e),
1976
- /* @__PURE__ */ x("div", {
1977
- style: Lt,
1978
- children: r.map((e, t) => /* @__PURE__ */ x(y, {
2137
+ yn(e),
2138
+ /* @__PURE__ */ S("div", {
2139
+ style: Gt,
2140
+ children: r.map((e, t) => /* @__PURE__ */ S(b, {
1979
2141
  component: "span",
1980
2142
  ellipsis: !0,
1981
- style: It,
2143
+ style: Wt,
1982
2144
  title: e,
1983
2145
  variant: "label-primary",
1984
2146
  children: e
1985
2147
  }, `${e}_${t}`))
1986
2148
  }),
1987
- /* @__PURE__ */ x(y, {
2149
+ /* @__PURE__ */ S(b, {
1988
2150
  color: "text-neutral",
1989
2151
  component: "span",
1990
2152
  ellipsis: !0,
1991
- style: It,
2153
+ style: Wt,
1992
2154
  title: i,
1993
2155
  variant: "caption",
1994
2156
  children: i
@@ -1996,106 +2158,106 @@ function V({ data: e, selected: t, type: n }) {
1996
2158
  ]
1997
2159
  });
1998
2160
  }
1999
- function cn(e) {
2000
- return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : zt[e.nodeKind];
2161
+ function gn(e) {
2162
+ return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : Jt[e.nodeKind];
2001
2163
  }
2002
- function ln(e, t) {
2003
- let n = un(e);
2164
+ function _n(e, t) {
2165
+ let n = vn(e);
2004
2166
  return t ? {
2005
2167
  ...n,
2006
2168
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2007
- boxShadow: Ot
2169
+ boxShadow: It
2008
2170
  } : n;
2009
2171
  }
2010
- function un(e) {
2011
- return e === "exclusiveGateway" ? Nt : e === "parallelGateway" ? R : e === "startEvent" ? z : e === "endEvent" ? Ft : e === "userTask" ? Pt : F;
2172
+ function vn(e) {
2173
+ return e === "exclusiveGateway" ? I : e === "parallelGateway" ? Vt : e === "startEvent" ? Ht : e === "endEvent" ? Ut : e === "userTask" ? L : N;
2012
2174
  }
2013
- function dn(e) {
2014
- return !e.hasInput && e.hasOutput ? /* @__PURE__ */ x(Ae, {
2015
- id: B,
2016
- position: w.Right,
2175
+ function yn(e) {
2176
+ return !e.hasInput && e.hasOutput ? /* @__PURE__ */ S(T, {
2177
+ id: qt,
2178
+ position: E.Right,
2017
2179
  type: "source"
2018
- }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ x(Ae, {
2019
- id: Rt,
2020
- position: w.Left,
2180
+ }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ S(T, {
2181
+ id: Kt,
2182
+ position: E.Left,
2021
2183
  type: "target"
2022
- }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ x(Ae, {
2023
- id: Rt,
2024
- position: w.Left,
2184
+ }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ S(T, {
2185
+ id: Kt,
2186
+ position: E.Left,
2025
2187
  type: "target"
2026
- }, "target"), /* @__PURE__ */ x(Ae, {
2027
- id: B,
2028
- position: w.Right,
2188
+ }, "target"), /* @__PURE__ */ S(T, {
2189
+ id: qt,
2190
+ position: E.Right,
2029
2191
  type: "source"
2030
2192
  }, "source")];
2031
2193
  }
2032
- function fn(e, t, n, r, i, a) {
2033
- let o = H(e);
2194
+ function bn(e, t, n, r, i, a) {
2195
+ let o = V(e);
2034
2196
  return {
2035
2197
  data: {
2036
- approverLines: hr(e, t),
2037
- approverSummary: J(e, t, n, r),
2038
- hasInput: Hn(e),
2039
- hasOutput: Un(e),
2040
- initiatorPolicySummary: e.type === "startEvent" ? Ln(a, n, r) : null,
2198
+ approverLines: jr(e, t),
2199
+ approverSummary: kr(e, t, n, r),
2200
+ hasInput: W(e),
2201
+ hasOutput: ar(e),
2202
+ initiatorPolicySummary: e.type === "startEvent" ? er(a, n, r) : null,
2041
2203
  label: e.data.label,
2042
2204
  nodeKind: e.type
2043
2205
  },
2044
2206
  height: o.height,
2045
- handles: pn(e),
2207
+ handles: xn(e),
2046
2208
  id: e.id,
2047
2209
  initialHeight: o.height,
2048
2210
  initialWidth: o.width,
2049
2211
  position: e.position,
2050
2212
  selected: i,
2051
- sourcePosition: w.Right,
2052
- targetPosition: w.Left,
2213
+ sourcePosition: E.Right,
2214
+ targetPosition: E.Left,
2053
2215
  type: e.type,
2054
2216
  width: o.width
2055
2217
  };
2056
2218
  }
2057
- function H(e) {
2219
+ function V(e) {
2058
2220
  return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
2059
- height: jt,
2060
- width: Mt
2221
+ height: zt,
2222
+ width: F
2061
2223
  } : e.type === "serviceTask" ? {
2062
- height: kt + (Math.max(1, jr(e.data.action).length) - 1) * I,
2063
- width: At
2224
+ height: Lt + (Math.max(1, qr(e.data.action).length) - 1) * Rt,
2225
+ width: P
2064
2226
  } : {
2065
- height: kt,
2066
- width: At
2227
+ height: Lt,
2228
+ width: P
2067
2229
  };
2068
2230
  }
2069
- function pn(e) {
2070
- let t = H(e);
2071
- return [...Hn(e) ? [mn(t)] : [], ...Un(e) ? [hn(t)] : []];
2231
+ function xn(e) {
2232
+ let t = V(e);
2233
+ return [...W(e) ? [Sn(t)] : [], ...ar(e) ? [H(t)] : []];
2072
2234
  }
2073
- function mn({ height: e }) {
2235
+ function Sn({ height: e }) {
2074
2236
  let t = e / 2 - 9 / 2;
2075
2237
  return {
2076
2238
  height: 9,
2077
- id: Rt,
2078
- position: w.Left,
2239
+ id: Kt,
2240
+ position: E.Left,
2079
2241
  type: "target",
2080
2242
  width: 9,
2081
2243
  x: -9 / 2,
2082
2244
  y: t
2083
2245
  };
2084
2246
  }
2085
- function hn({ height: e, width: t }) {
2247
+ function H({ height: e, width: t }) {
2086
2248
  let n = e / 2 - 9 / 2;
2087
2249
  return {
2088
2250
  height: 9,
2089
- id: B,
2090
- position: w.Right,
2251
+ id: qt,
2252
+ position: E.Right,
2091
2253
  type: "source",
2092
2254
  width: 9,
2093
2255
  x: t - 9 / 2,
2094
2256
  y: n
2095
2257
  };
2096
2258
  }
2097
- function gn(e, t, n) {
2098
- let r = Dr(e, t), i = kr(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? _t : i ? gt : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? _t : i ? gt : N;
2259
+ function Cn(e, t, n) {
2260
+ let r = Wr(e, t), i = Kr(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? wt : i ? St : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? wt : i ? St : Ct;
2099
2261
  return {
2100
2262
  className: n ? "workflow-edge--selected" : void 0,
2101
2263
  data: e.data,
@@ -2118,9 +2280,9 @@ function gn(e, t, n) {
2118
2280
  source: e.source,
2119
2281
  sourceHandle: e.sourceHandle,
2120
2282
  style: {
2121
- filter: n ? vt : void 0,
2283
+ filter: n ? Tt : void 0,
2122
2284
  opacity: 1,
2123
- stroke: N,
2285
+ stroke: Ct,
2124
2286
  strokeOpacity: 1,
2125
2287
  strokeWidth: 1.5
2126
2288
  },
@@ -2129,7 +2291,7 @@ function gn(e, t, n) {
2129
2291
  type: e.type ?? "smoothstep"
2130
2292
  };
2131
2293
  }
2132
- function U(e, t) {
2294
+ function wn(e, t) {
2133
2295
  return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
2134
2296
  ...e,
2135
2297
  data: {
@@ -2138,27 +2300,27 @@ function U(e, t) {
2138
2300
  }
2139
2301
  });
2140
2302
  }
2141
- function _n(e) {
2142
- return yn(vn(e));
2303
+ function Tn(e) {
2304
+ return Dn(En(e));
2143
2305
  }
2144
- function vn(e) {
2145
- let t = new Set(e.nodes.filter((e) => G(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
2306
+ function En(e) {
2307
+ let t = new Set(e.nodes.filter((e) => or(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
2146
2308
  return n.length === e.edges.length ? e : {
2147
2309
  ...e,
2148
2310
  edges: n
2149
2311
  };
2150
2312
  }
2151
- function yn(e) {
2313
+ function Dn(e) {
2152
2314
  let t = e.edges.reduce((e, t) => ({
2153
2315
  ...e,
2154
2316
  [t.target]: (e[t.target] ?? 0) + 1
2155
- }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? U(e, "AND") : e);
2317
+ }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? wn(e, "AND") : e);
2156
2318
  return n.some((t, n) => t !== e.nodes[n]) ? {
2157
2319
  ...e,
2158
2320
  nodes: n
2159
2321
  } : e;
2160
2322
  }
2161
- function bn() {
2323
+ function On() {
2162
2324
  return {
2163
2325
  edges: [],
2164
2326
  meta: { schemaVersion: 1 },
@@ -2185,46 +2347,91 @@ function bn() {
2185
2347
  }]
2186
2348
  };
2187
2349
  }
2188
- function xn(e) {
2350
+ function kn(e) {
2189
2351
  return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
2190
2352
  }
2191
- function Sn(e) {
2192
- let t = new Ie.graphlib.Graph();
2353
+ function An(e) {
2354
+ let t = new Pe.graphlib.Graph();
2193
2355
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2194
2356
  rankdir: "LR",
2195
2357
  ranksep: 120
2196
2358
  }), e.nodes.forEach((e) => {
2197
- t.setNode(e.id, H(e));
2359
+ t.setNode(e.id, V(e));
2198
2360
  }), e.edges.forEach((e) => {
2199
2361
  t.setEdge(e.source, e.target);
2200
- }), Ie.layout(t), {
2362
+ }), Pe.layout(t), {
2201
2363
  ...e,
2202
2364
  nodes: e.nodes.map((e) => {
2203
2365
  let n = t.node(e.id);
2204
2366
  return n ? {
2205
2367
  ...e,
2206
2368
  position: {
2207
- x: n.x - H(e).width / 2,
2208
- y: n.y - H(e).height / 2
2369
+ x: n.x - V(e).width / 2,
2370
+ y: n.y - V(e).height / 2
2209
2371
  }
2210
2372
  } : e;
2211
2373
  })
2212
2374
  };
2213
2375
  }
2214
- function W(e, t) {
2376
+ function U(e, t) {
2215
2377
  return t ? e.find((e) => e.id === t) ?? null : null;
2216
2378
  }
2217
- function Cn(e) {
2379
+ function jn(e) {
2218
2380
  return e === "OR" ? "OR" : "AND";
2219
2381
  }
2220
- function wn(e) {
2382
+ function Mn(e) {
2221
2383
  return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
2222
2384
  }
2223
- function Tn(e) {
2385
+ function Nn(e) {
2386
+ return e === "HOUR" ? "HOUR" : "DAY";
2387
+ }
2388
+ function Pn(e) {
2389
+ return e === "BUSINESS_DAY" ? "BUSINESS_DAY" : "CALENDAR";
2390
+ }
2391
+ function Fn(e) {
2392
+ return Je.find((t) => t.id === e)?.id ?? "REMIND";
2393
+ }
2394
+ function In(e) {
2395
+ return $t.find((t) => t.value === e) ?? $t[0];
2396
+ }
2397
+ function Ln(e) {
2398
+ return $t.find((t) => t.id === e) ?? $t[0];
2399
+ }
2400
+ function Rn(e, t) {
2401
+ let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = Ye({
2402
+ unit: t.unit,
2403
+ value: n
2404
+ });
2405
+ return {
2406
+ ...e,
2407
+ calendar: t.unit === "DAY" ? e.calendar ?? "CALENDAR" : "CALENDAR",
2408
+ duration: r
2409
+ };
2410
+ }
2411
+ function zn(e, t) {
2412
+ return t === "ESCALATE" ? {
2413
+ ...e,
2414
+ escalateLevelsUp: e.escalateLevelsUp ?? 1,
2415
+ onTimeout: t
2416
+ } : {
2417
+ ...Vn(e, "escalateLevelsUp"),
2418
+ onTimeout: t
2419
+ };
2420
+ }
2421
+ function Bn(e, t) {
2422
+ return t === null ? Vn(e, "warningAt") : {
2423
+ ...e,
2424
+ warningAt: t
2425
+ };
2426
+ }
2427
+ function Vn(e, t) {
2428
+ return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
2429
+ }
2430
+ function Hn(e) {
2224
2431
  return e === "ORG_MANAGER" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
2225
2432
  }
2226
- function En(e) {
2227
- let t = Tn(e ?? "DIRECT");
2433
+ function Un(e) {
2434
+ let t = Hn(e ?? "DIRECT");
2228
2435
  return t === "ORG_MANAGER" ? {
2229
2436
  baseFromInitiator: !0,
2230
2437
  levelsUp: 1,
@@ -2249,31 +2456,31 @@ function En(e) {
2249
2456
  type: "DIRECT"
2250
2457
  };
2251
2458
  }
2252
- function Dn(e) {
2459
+ function Wn(e) {
2253
2460
  return e === "DIRECT" ? "DIRECT" : "NONE";
2254
2461
  }
2255
- function On(e, t) {
2462
+ function Gn(e, t) {
2256
2463
  return e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER" ? {
2257
2464
  ...e,
2258
2465
  fallback: t
2259
2466
  } : e;
2260
2467
  }
2261
- function kn(e) {
2262
- return Gt.find((t) => t.value === e) ?? Gt[0];
2468
+ function Kn(e) {
2469
+ return R.find((t) => t.value === e) ?? R[0];
2263
2470
  }
2264
- function An(e) {
2265
- return Gt.find((t) => t.id === e) ?? Gt[0];
2471
+ function qn(e) {
2472
+ return R.find((t) => t.id === e) ?? R[0];
2266
2473
  }
2267
- function jn(e) {
2474
+ function Jn(e) {
2268
2475
  return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
2269
2476
  }
2270
- function Mn(e) {
2477
+ function Yn(e) {
2271
2478
  let t = e?.trim();
2272
2479
  if (!t) return {
2273
2480
  mode: "ALL",
2274
2481
  value: ""
2275
2482
  };
2276
- let n = Fn(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = Fn(t, /"([^"]+)" in subject\.positionIds/gu);
2483
+ let n = Qn(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = Qn(t, /"([^"]+)" in subject\.positionIds/gu);
2277
2484
  return n.length > 0 && r.length > 0 ? {
2278
2485
  includeDescendants: n.length > 1,
2279
2486
  mode: "ORG_UNIT_POSITION",
@@ -2290,32 +2497,32 @@ function Mn(e) {
2290
2497
  value: t
2291
2498
  };
2292
2499
  }
2293
- function Nn(e, t) {
2294
- let n = Mn(e);
2500
+ function Xn(e, t) {
2501
+ let n = Yn(e);
2295
2502
  return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
2296
2503
  mode: t,
2297
2504
  value: ""
2298
- } : n : n.mode === t ? n : Rn(t);
2505
+ } : n : n.mode === t ? n : tr(t);
2299
2506
  }
2300
- function Pn(e) {
2507
+ function Zn(e) {
2301
2508
  return e.mode === "NONE" ? "發起權限需要選擇誰可以發起。" : (e.mode === "ORG_UNIT" || e.mode === "ORG_UNIT_POSITION") && !e.orgUnitId?.trim() ? "指定組織發起時,需要選擇組織。" : e.mode === "ORG_UNIT_POSITION" && !e.positionId?.trim() ? "指定組織職位發起時,需要選擇職位。" : null;
2302
2509
  }
2303
- function Fn(e, t) {
2510
+ function Qn(e, t) {
2304
2511
  return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
2305
2512
  }
2306
- function In(e, t) {
2513
+ function $n(e, t) {
2307
2514
  if (e.mode === "ALL" || e.mode === "NONE") return null;
2308
2515
  let n = e.orgUnitId?.trim() ?? "";
2309
2516
  if (!n) return null;
2310
- let r = dr(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
2517
+ let r = Er(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
2311
2518
  if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
2312
2519
  let i = e.positionId?.trim() ?? "";
2313
2520
  return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
2314
2521
  }
2315
- function Ln(e, t, n) {
2316
- return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${K(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${K(t, e.orgUnitId)} / ${ar(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
2522
+ function er(e, t, n) {
2523
+ return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${G(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${G(t, e.orgUnitId)} / ${K(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
2317
2524
  }
2318
- function Rn(e) {
2525
+ function tr(e) {
2319
2526
  return {
2320
2527
  includeDescendants: !0,
2321
2528
  mode: e,
@@ -2324,29 +2531,29 @@ function Rn(e) {
2324
2531
  value: ""
2325
2532
  };
2326
2533
  }
2327
- function zn(e, t) {
2534
+ function nr(e, t) {
2328
2535
  let n = e.source ? t.find((t) => t.id === e.source) ?? null : null, r = e.target ? t.find((t) => t.id === e.target) ?? null : null;
2329
- return !!n && !!r && e.source !== e.target && e.sourceHandle === B && e.targetHandle === Rt && !!(n && Un(n)) && !!(r && Hn(r));
2536
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === qt && e.targetHandle === Kt && !!(n && ar(n)) && !!(r && W(r));
2330
2537
  }
2331
- function Bn(e, t) {
2538
+ function rr(e, t) {
2332
2539
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
2333
2540
  }
2334
- function Vn(e) {
2541
+ function ir(e) {
2335
2542
  return e.type !== "startEvent" && e.type !== "endEvent";
2336
2543
  }
2337
- function Hn(e) {
2544
+ function W(e) {
2338
2545
  return e.type !== "startEvent";
2339
2546
  }
2340
- function Un(e) {
2341
- return e.type !== "endEvent" && !G(e);
2547
+ function ar(e) {
2548
+ return e.type !== "endEvent" && !or(e);
2342
2549
  }
2343
- function G(e) {
2550
+ function or(e) {
2344
2551
  return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
2345
2552
  }
2346
- function Wn(e) {
2553
+ function sr(e) {
2347
2554
  return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
2348
2555
  }
2349
- function Gn(e) {
2556
+ function cr(e) {
2350
2557
  return e.map((e) => ({
2351
2558
  formDefinitionId: e.formDefinitionId,
2352
2559
  formName: e.formName,
@@ -2355,42 +2562,42 @@ function Gn(e) {
2355
2562
  schema: e.schema
2356
2563
  }));
2357
2564
  }
2358
- function Kn(e) {
2565
+ function lr(e) {
2359
2566
  return (e?.schema.fields ?? []).reduce((e, t) => ({
2360
2567
  ...e,
2361
- [t.fieldKey]: qn(t)
2568
+ [t.fieldKey]: ur(t)
2362
2569
  }), {});
2363
2570
  }
2364
- function qn(e) {
2571
+ function ur(e) {
2365
2572
  return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : e.type === "select" ? e.options[0]?.value ?? "" : e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
2366
2573
  }
2367
- function Jn(e) {
2574
+ function dr(e) {
2368
2575
  let t = JSON.parse(e);
2369
- if (!Yn(t)) throw Error("表單資料 JSON 必須是物件。");
2576
+ if (!fr(t)) throw Error("表單資料 JSON 必須是物件。");
2370
2577
  return t;
2371
2578
  }
2372
- function Yn(e) {
2579
+ function fr(e) {
2373
2580
  return typeof e == "object" && !!e && !Array.isArray(e);
2374
2581
  }
2375
- function Xn(e) {
2582
+ function pr(e) {
2376
2583
  return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
2377
2584
  }
2378
- function Zn(e) {
2379
- return e in zt ? zt[e] : e;
2585
+ function mr(e) {
2586
+ return e in Jt ? Jt[e] : e;
2380
2587
  }
2381
- function Qn(e, t) {
2588
+ function hr(e, t) {
2382
2589
  return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
2383
2590
  }
2384
- function $n(e) {
2591
+ function gr(e) {
2385
2592
  return e.map((e) => ({
2386
2593
  displayName: e.name,
2387
2594
  email: e.email,
2388
2595
  id: e.memberId,
2389
2596
  memberId: e.memberId,
2390
- name: _r(e.name, e.email)
2597
+ name: Mr(e.name, e.email)
2391
2598
  }));
2392
2599
  }
2393
- function er(e) {
2600
+ function _r(e) {
2394
2601
  return {
2395
2602
  displayName: "未知會員",
2396
2603
  email: "",
@@ -2399,91 +2606,91 @@ function er(e) {
2399
2606
  name: "未知會員"
2400
2607
  };
2401
2608
  }
2402
- function tr(e, t) {
2403
- return e.find((e) => e.memberId === t) ?? er(t);
2609
+ function vr(e, t) {
2610
+ return e.find((e) => e.memberId === t) ?? _r(t);
2404
2611
  }
2405
- function nr(e, t) {
2612
+ function yr(e, t) {
2406
2613
  let n = e[0];
2407
- return n ? tr(t, n) : null;
2614
+ return n ? vr(t, n) : null;
2408
2615
  }
2409
- function rr(e, t) {
2616
+ function br(e, t) {
2410
2617
  let r = e.find((e) => e.id === t);
2411
2618
  return r ? n(r) : null;
2412
2619
  }
2413
- function ir(e, t) {
2620
+ function xr(e, t) {
2414
2621
  let n = e.find((e) => e.id === t);
2415
2622
  return n ? i(n) : null;
2416
2623
  }
2417
- function K(e, t) {
2418
- return rr(e, t)?.name ?? "未指定組織";
2624
+ function G(e, t) {
2625
+ return br(e, t)?.name ?? "未指定組織";
2419
2626
  }
2420
- function ar(e, t) {
2421
- return ir(e, t)?.name ?? "未指定職位";
2627
+ function K(e, t) {
2628
+ return xr(e, t)?.name ?? "未指定職位";
2422
2629
  }
2423
- function or(e, t) {
2424
- let n = sr(), r = t.filter((t) => t.memberId === e && cr(t, n)), i = r.reduce((e, t) => e && q(e, t) <= 0 ? e : t, null);
2630
+ function Sr(e, t) {
2631
+ let n = q(), r = t.filter((t) => t.memberId === e && Cr(t, n)), i = r.reduce((e, t) => e && wr(e, t) <= 0 ? e : t, null);
2425
2632
  return {
2426
2633
  customFields: {},
2427
2634
  managerMemberId: "member-002",
2428
2635
  memberId: e,
2429
2636
  orgCode: "HQ",
2430
- orgUnitIds: lr(r.map((e) => e.orgUnitId)),
2637
+ orgUnitIds: J(r.map((e) => e.orgUnitId)),
2431
2638
  positionId: i?.positionId ?? null,
2432
- positionIds: lr(r.map((e) => e.positionId)),
2639
+ positionIds: J(r.map((e) => e.positionId)),
2433
2640
  primaryOrgUnitId: i?.orgUnitId ?? null,
2434
2641
  roles: ["manager"]
2435
2642
  };
2436
2643
  }
2437
- function sr() {
2644
+ function q() {
2438
2645
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2439
2646
  }
2440
- function cr(e, t) {
2647
+ function Cr(e, t) {
2441
2648
  return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
2442
2649
  }
2443
- function q(e, t) {
2650
+ function wr(e, t) {
2444
2651
  return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
2445
2652
  }
2446
- function lr(e) {
2653
+ function J(e) {
2447
2654
  return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
2448
2655
  }
2449
- function ur({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
2450
- let a = new Set(dr(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
2656
+ function Tr({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
2657
+ let a = new Set(Er(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
2451
2658
  return i.filter((e) => o.has(e.id));
2452
2659
  }
2453
- function dr(e, t, n) {
2660
+ function Er(e, t, n) {
2454
2661
  let r = e.find((e) => e.id === t);
2455
2662
  return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
2456
2663
  }
2457
- function fr(e, t) {
2664
+ function Dr(e, t) {
2458
2665
  let n = new Set(e.map((e) => e.memberId)), r = t.filter((e) => !n.has(e.memberId));
2459
2666
  return [...e, ...r];
2460
2667
  }
2461
- function pr(e) {
2462
- return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? e.data.approverResolver.type === "DIRECT" ? e.data.approverResolver.memberIds : [] : e.type === "serviceTask" ? jr(e.data.action) : []))];
2668
+ function Or(e) {
2669
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? e.data.approverResolver.type === "DIRECT" ? e.data.approverResolver.memberIds : [] : e.type === "serviceTask" ? qr(e.data.action) : []))];
2463
2670
  }
2464
- function J(e, t, n, r) {
2465
- return e.type === "userTask" ? mr(e.data.approverResolver, t, n, r) : null;
2671
+ function kr(e, t, n, r) {
2672
+ return e.type === "userTask" ? Ar(e.data.approverResolver, t, n, r) : null;
2466
2673
  }
2467
- function mr(e, t, n, r) {
2468
- return e.type === "DIRECT" ? gr(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? kn(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${K(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${K(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${K(n, e.orgUnitId)} / ${ar(r, e.positionId)}` : e.type === "POSITION" ? `職位:${ar(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
2674
+ function Ar(e, t, n, r) {
2675
+ return e.type === "DIRECT" ? Y(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Kn(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${G(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${G(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${G(n, e.orgUnitId)} / ${K(r, e.positionId)}` : e.type === "POSITION" ? `職位:${K(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
2469
2676
  }
2470
- function hr(e, t) {
2677
+ function jr(e, t) {
2471
2678
  if (e.type !== "serviceTask") return null;
2472
- let n = jr(e.data.action);
2473
- return n.length === 0 ? ["未指定知會對象"] : n.map((e) => tr(t, e).name);
2679
+ let n = qr(e.data.action);
2680
+ return n.length === 0 ? ["未指定知會對象"] : n.map((e) => vr(t, e).name);
2474
2681
  }
2475
- function gr(e, t, n) {
2476
- let r = e.map((e) => tr(t, e).name);
2682
+ function Y(e, t, n) {
2683
+ let r = e.map((e) => vr(t, e).name);
2477
2684
  return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
2478
2685
  }
2479
- function _r(e, t) {
2686
+ function Mr(e, t) {
2480
2687
  return `${e} (${t})`;
2481
2688
  }
2482
- function vr(e, t) {
2689
+ function Nr(e, t) {
2483
2690
  let n = t?.getBoundingClientRect();
2484
2691
  if (!n || e.nodes.length === 0) return null;
2485
2692
  let r = e.nodes.reduce((e, t) => {
2486
- let n = H(t);
2693
+ let n = V(t);
2487
2694
  return {
2488
2695
  maxX: Math.max(e.maxX, t.position.x + n.width),
2489
2696
  maxY: Math.max(e.maxY, t.position.y + n.height),
@@ -2496,42 +2703,42 @@ function vr(e, t) {
2496
2703
  minX: Infinity,
2497
2704
  minY: Infinity
2498
2705
  });
2499
- return Fe({
2706
+ return Ne({
2500
2707
  height: r.maxY - r.minY,
2501
2708
  width: r.maxX - r.minX,
2502
2709
  x: r.minX,
2503
2710
  y: r.minY
2504
2711
  }, n.width, n.height, .1, 1, .2);
2505
2712
  }
2506
- function yr(e) {
2507
- let t = e.nodes.find((e) => e.type === "userTask" && !!Y(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && jr(e.data.action).length === 0), r = e.edges.find((t) => kr(t, e.nodes) && !t.data.isDefault && !t.data.condition);
2508
- return t && t.type === "userTask" ? Y(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
2713
+ function Pr(e) {
2714
+ let t = e.nodes.find((e) => e.type === "userTask" && !!Fr(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && qr(e.data.action).length === 0), r = e.edges.find((t) => Kr(t, e.nodes) && !t.data.isDefault && !t.data.condition);
2715
+ return t && t.type === "userTask" ? Fr(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
2509
2716
  }
2510
- function Y(e) {
2717
+ function Fr(e) {
2511
2718
  return e.type === "DIRECT" && e.memberIds.length === 0 ? "簽核節點需要指定簽核會員。" : e.type === "ORG_MANAGER" && e.levelsUp < 1 ? "簽核節點需要指定有效的主管層級。" : e.type === "ORG_UNIT_MANAGER" && !e.orgUnitId.trim() || e.type === "ORG_UNIT_MEMBER" && !e.orgUnitId.trim() ? "簽核節點需要指定組織。" : e.type === "ORG_UNIT_POSITION" && (!e.orgUnitId.trim() || !e.positionId.trim()) ? "簽核節點需要指定組織與職位。" : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && !e.fallback.memberId.trim() ? "簽核節點需要指定改派固定人。" : e.type === "POSITION" && !e.positionId.trim() ? "簽核節點需要指定職位。" : null;
2512
2719
  }
2513
- function br(e) {
2514
- return e.edges.some((t) => kr(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
2720
+ function Ir(e) {
2721
+ return e.edges.some((t) => Kr(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
2515
2722
  }
2516
- function xr(e) {
2723
+ function Lr(e) {
2517
2724
  return e?.fields.map((e) => ({
2518
2725
  fieldType: e.type,
2519
2726
  id: e.fieldKey,
2520
2727
  name: `${e.label} (${e.fieldKey})`
2521
2728
  })) ?? [];
2522
2729
  }
2523
- function Sr(e, t) {
2730
+ function Rr(e, t) {
2524
2731
  return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
2525
2732
  }
2526
- function Cr(e) {
2733
+ function zr(e) {
2527
2734
  if (!e) return [];
2528
- let t = X(e);
2529
- return qt.filter((e) => t.includes(e.id));
2735
+ let t = Vr(e);
2736
+ return nn.filter((e) => t.includes(e.id));
2530
2737
  }
2531
- function wr(e) {
2532
- return qt.some((t) => t.id === e) ? e : null;
2738
+ function Br(e) {
2739
+ return nn.some((t) => t.id === e) ? e : null;
2533
2740
  }
2534
- function X(e) {
2741
+ function Vr(e) {
2535
2742
  return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
2536
2743
  "EQUALS",
2537
2744
  "NOT_EQUALS",
@@ -2553,7 +2760,7 @@ function X(e) {
2553
2760
  "IS_EMPTY"
2554
2761
  ];
2555
2762
  }
2556
- function Tr(e) {
2763
+ function Hr(e) {
2557
2764
  return e ? e.type === "boolean" ? [{
2558
2765
  id: "true",
2559
2766
  name: "是"
@@ -2565,30 +2772,30 @@ function Tr(e) {
2565
2772
  name: e.label
2566
2773
  })) : [] : [];
2567
2774
  }
2568
- function Er(e) {
2569
- return Jt.includes(e);
2775
+ function Ur(e) {
2776
+ return rn.includes(e);
2570
2777
  }
2571
- function Dr(e, t) {
2778
+ function Wr(e, t) {
2572
2779
  if (e.data.label) return e.data.label;
2573
- if (kr(e, t)) return Or(e);
2574
- if (Ar(e, t)) return "同時進行";
2780
+ if (Kr(e, t)) return Gr(e);
2781
+ if (X(e, t)) return "同時進行";
2575
2782
  }
2576
- function Or(e) {
2783
+ function Gr(e) {
2577
2784
  return e.data.isDefault ? "其他情況" : "請設定條件";
2578
2785
  }
2579
- function kr(e, t) {
2786
+ function Kr(e, t) {
2580
2787
  return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
2581
2788
  }
2582
- function Ar(e, t) {
2789
+ function X(e, t) {
2583
2790
  return t.some((t) => t.id === e.source && t.type === "parallelGateway");
2584
2791
  }
2585
- function jr(e) {
2792
+ function qr(e) {
2586
2793
  return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
2587
2794
  }
2588
2795
  function Z(e) {
2589
2796
  return e instanceof Error ? e.message : "發生未知錯誤";
2590
2797
  }
2591
2798
  //#endregion
2592
- export { on as t };
2799
+ export { mn as t };
2593
2800
 
2594
- //# sourceMappingURL=designer-BLfz5Dk9.js.map
2801
+ //# sourceMappingURL=designer-CUbVXEtS.js.map