@rytass/bpm-core-react 0.14.0 → 0.15.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 (83) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs +3 -0
  3. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs.map +1 -0
  4. package/dist/chunks/{FormBuilderView-BYLN6W-P.js → FormBuilderView-CLg-JYmu.js} +495 -452
  5. package/dist/chunks/FormBuilderView-CLg-JYmu.js.map +1 -0
  6. package/dist/chunks/FormRendererView-DU9LLrOF.js +999 -0
  7. package/dist/chunks/FormRendererView-DU9LLrOF.js.map +1 -0
  8. package/dist/chunks/FormRendererView-gctFIqwC.cjs +4 -0
  9. package/dist/chunks/FormRendererView-gctFIqwC.cjs.map +1 -0
  10. package/dist/chunks/{compose-CSWbRgJJ.js → compose-BtQPBd1Q.js} +5 -5
  11. package/dist/chunks/compose-BtQPBd1Q.js.map +1 -0
  12. package/dist/chunks/compose-DZhTQOt4.cjs +2 -0
  13. package/dist/chunks/compose-DZhTQOt4.cjs.map +1 -0
  14. package/dist/chunks/{designer-BtsIL0BB.js → designer-CrbBRPUU.js} +1285 -1197
  15. package/dist/chunks/designer-CrbBRPUU.js.map +1 -0
  16. package/dist/chunks/designer-D3_lWmfa.cjs +65 -0
  17. package/dist/chunks/designer-D3_lWmfa.cjs.map +1 -0
  18. package/dist/chunks/detail-CVXb5Vy8.cjs +2 -0
  19. package/dist/chunks/detail-CVXb5Vy8.cjs.map +1 -0
  20. package/dist/chunks/{detail-C8NOqY0p.js → detail-_c21WQla.js} +655 -630
  21. package/dist/chunks/detail-_c21WQla.js.map +1 -0
  22. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
  23. package/dist/chunks/routes-config-yZbESPlw.js.map +1 -1
  24. package/dist/chunks/task-node-label-BF6UllxP.cjs +2 -0
  25. package/dist/chunks/task-node-label-BF6UllxP.cjs.map +1 -0
  26. package/dist/chunks/task-node-label-CWZgOBj0.js +9 -0
  27. package/dist/chunks/task-node-label-CWZgOBj0.js.map +1 -0
  28. package/dist/lib/member-profile-resolution.d.ts +48 -0
  29. package/dist/lib/routes-config.d.ts +1 -1
  30. package/dist/lib/task-node-label.d.ts +10 -0
  31. package/dist/pages/instances/detail/index.cjs +1 -1
  32. package/dist/pages/instances/detail/index.js +1 -1
  33. package/dist/pages/templates/compose/index.cjs +1 -1
  34. package/dist/pages/templates/compose/index.js +1 -1
  35. package/dist/pages/templates/designer/index.cjs +1 -1
  36. package/dist/pages/templates/designer/index.js +1 -1
  37. package/dist/views/forms/builder/index.cjs +1 -1
  38. package/dist/views/forms/builder/index.js +1 -1
  39. package/dist/views/forms/renderer/form-field-link.d.ts +16 -0
  40. package/dist/views/forms/renderer/index.cjs +1 -1
  41. package/dist/views/forms/renderer/index.js +2 -2
  42. package/dist/views/forms/renderer/member-field-options.d.ts +39 -0
  43. package/dist/views/forms/renderer/member-field.d.ts +21 -0
  44. package/dist/views/inbox/index.cjs +1 -1
  45. package/dist/views/inbox/index.cjs.map +1 -1
  46. package/dist/views/inbox/index.js +100 -97
  47. package/dist/views/inbox/index.js.map +1 -1
  48. package/dist/views/instances/detail/index.cjs +1 -1
  49. package/dist/views/instances/detail/index.js +1 -1
  50. package/dist/views/instances/detail/sections/container-helpers.d.ts +3 -2
  51. package/dist/views/instances/detail/submitted-by.d.ts +23 -0
  52. package/dist/views/instances/new/index.cjs +1 -1
  53. package/dist/views/instances/new/index.js +1 -1
  54. package/dist/views/sent/SentView.d.ts +1 -1
  55. package/dist/views/sent/index.cjs +1 -1
  56. package/dist/views/sent/index.cjs.map +1 -1
  57. package/dist/views/sent/index.js +2 -2
  58. package/dist/views/sent/index.js.map +1 -1
  59. package/dist/views/templates/compose/index.cjs +1 -1
  60. package/dist/views/templates/compose/index.js +1 -1
  61. package/dist/views/templates/designer/designer-version-labels.d.ts +12 -0
  62. package/dist/views/templates/designer/dry-run-assignee-label.d.ts +28 -0
  63. package/dist/views/templates/designer/dry-run-sample-data.d.ts +9 -0
  64. package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +35 -0
  65. package/dist/views/templates/designer/index.cjs +1 -1
  66. package/dist/views/templates/designer/index.js +1 -1
  67. package/package.json +3 -3
  68. package/dist/chunks/FormBuilderView-BYLN6W-P.js.map +0 -1
  69. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs +0 -3
  70. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs.map +0 -1
  71. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs +0 -2
  72. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs.map +0 -1
  73. package/dist/chunks/FormRendererView-UPowZZgw.js +0 -798
  74. package/dist/chunks/FormRendererView-UPowZZgw.js.map +0 -1
  75. package/dist/chunks/compose-CHZoX-H0.cjs +0 -2
  76. package/dist/chunks/compose-CHZoX-H0.cjs.map +0 -1
  77. package/dist/chunks/compose-CSWbRgJJ.js.map +0 -1
  78. package/dist/chunks/designer-BtsIL0BB.js.map +0 -1
  79. package/dist/chunks/designer-Dm6cX2kZ.cjs +0 -65
  80. package/dist/chunks/designer-Dm6cX2kZ.cjs.map +0 -1
  81. package/dist/chunks/detail-C8NOqY0p.js.map +0 -1
  82. package/dist/chunks/detail-CX-3hZoL.cjs +0 -2
  83. package/dist/chunks/detail-CX-3hZoL.cjs.map +0 -1
@@ -3,26 +3,27 @@ import { r as e } from "./router-adapter-DftlFTOd.js";
3
3
  import { r as t } from "./routes-config-yZbESPlw.js";
4
4
  import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
5
  import { a as r, n as i, o as a, r as o } from "./admin-pickers-DLlG_1du.js";
6
+ import { n as s, r as c } from "./FormRendererView-DU9LLrOF.js";
6
7
  import '../style.css';/* empty css */
7
- import { t as s } from "./FormBuilderView-BYLN6W-P.js";
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 g, Input as _, Modal as v, PageHeader as ee, Section as te, SectionGroup as ne, Select as y, Textarea as re, Toggle as b, Typography as x } from "@mezzanine-ui/react";
10
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
11
- import T from "@mezzanine-ui/react/Drawer";
12
- import ie from "@mezzanine-ui/react/ContentHeader";
13
- import { CheckedIcon as ae, DotGridIcon as oe, EyeIcon as se, FilterIcon as ce, MailIcon as le, PlusIcon as ue, SaveIcon as de, TrashIcon as fe, UserIcon as pe } from "@mezzanine-ui/icons";
14
- import { DefaultChatTransport as me, getToolName as he, isToolUIPart as ge, lastAssistantMessageIsCompleteWithToolCalls as _e } from "ai";
15
- import { WORKFLOW_TOOLSET as E, applyWorkflowCommand as ve, applyWorkflowMacroCommand as ye, executeWorkflowTool as be, readWorkflowSnapshot as xe } from "@rytass/bpm-core-shared";
16
- import { readFormBuilder as Se, readFormSchemaLintMessage as Ce } from "@rytass/bpm-core-client/form";
17
- import { isFormStaticOptionFieldDefinition as we } from "@rytass/bpm-core-shared/form";
18
- import { readOrganizationDashboard as Te } from "@rytass/bpm-core-client/organization";
19
- import { Background as Ee, ConnectionMode as De, ControlButton as Oe, Controls as ke, Handle as D, MiniMap as Ae, Panel as je, Position as O, ReactFlow as Me, applyNodeChanges as Ne, getViewportForBounds as Pe } from "@xyflow/react";
20
- import * as Fe from "dagre";
21
- import { composeApprovalTemplateWithForm as Ie, dryRunApprovalWorkflow as Le, forkApprovalTemplate as Re, listWorkflowWebhookEndpoints 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";
22
- import { useChat as Ke } from "@ai-sdk/react";
23
- import { DEFAULT_QUORUM_THRESHOLD as qe, DEFAULT_SLA_CONFIG as Je, NOTIFY_WEBHOOK_CONTEXT_PATHS as Ye, NOTIFY_WEBHOOK_TARGET_LIMIT as k, SLA_CALENDAR_MODE_OPTIONS as Xe, SLA_DURATION_UNIT_OPTIONS as Ze, SLA_TIMEOUT_ACTION_OPTIONS as Qe, composeQuorumThreshold as $e, composeSlaDuration as A, createNotifyWebhookTarget as j, hasConfiguredConditionEdges as et, isDecisionPolicyUnsatisfiable as tt, isFormFieldCompatibleWithWebhookParameter as M, isNotifyWebhookContextPath as nt, isOrgManagerChainDecisionPolicyInvalid as rt, readApproverResolverIssue as N, readDesignTimeApproverCount as it, readExcludeInitiatorIssue as at, readNotifyServiceTaskIssue as ot, readNotifyWebhookCatalogIssueMessage as st, readNotifyWebhookStructureIssues as ct, readNotifyWebhookTargetCatalogIssues as lt, readNotifyWebhookTargets as ut, readSlaDurationParts as dt } from "@rytass/bpm-core-shared/workflow-graph";
8
+ import { t as l } from "./FormBuilderView-CLg-JYmu.js";
9
+ import { Fragment as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
10
+ import { AutoComplete as g, Button as _, Icon as v, Input as y, Modal as b, PageHeader as ee, Section as te, SectionGroup as ne, Select as x, Textarea as re, Toggle as S, Typography as C } from "@mezzanine-ui/react";
11
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
12
+ import ie from "@mezzanine-ui/react/Drawer";
13
+ import ae from "@mezzanine-ui/react/ContentHeader";
14
+ import { CheckedIcon as oe, DotGridIcon as se, EyeIcon as ce, FilterIcon as le, MailIcon as ue, PlusIcon as de, SaveIcon as fe, TrashIcon as pe, UserIcon as me } from "@mezzanine-ui/icons";
15
+ import { DefaultChatTransport as he, getToolName as ge, isToolUIPart as _e, lastAssistantMessageIsCompleteWithToolCalls as ve } from "ai";
16
+ import { WORKFLOW_TOOLSET as D, applyWorkflowCommand as ye, applyWorkflowMacroCommand as be, executeWorkflowTool as xe, readWorkflowSnapshot as Se } from "@rytass/bpm-core-shared";
17
+ import { readFormBuilder as Ce, readFormSchemaLintMessage as we } from "@rytass/bpm-core-client/form";
18
+ import { isFormStaticOptionFieldDefinition as Te, isMemberFieldDefinition as Ee } from "@rytass/bpm-core-shared/form";
19
+ import { readOrganizationDashboard as De } from "@rytass/bpm-core-client/organization";
20
+ import { Background as Oe, ConnectionMode as ke, ControlButton as Ae, Controls as je, Handle as Me, MiniMap as Ne, Panel as Pe, Position as O, ReactFlow as Fe, applyNodeChanges as Ie, getViewportForBounds as Le } from "@xyflow/react";
21
+ import * as Re from "dagre";
22
+ import { composeApprovalTemplateWithForm as ze, dryRunApprovalWorkflow as Be, forkApprovalTemplate as Ve, listWorkflowWebhookEndpoints as He, publishApprovalTemplateVersion as Ue, readTemplateDesigner as We, resolveMemberOptions as Ge, searchMemberOptions as Ke, searchPublishedFormVersionOptions as qe, updateApprovalTemplateDraft as Je } from "@rytass/bpm-core-client/template";
23
+ import { useChat as Ye } from "@ai-sdk/react";
24
+ import { DEFAULT_QUORUM_THRESHOLD as Xe, DEFAULT_SLA_CONFIG as Ze, NOTIFY_WEBHOOK_CONTEXT_PATHS as k, NOTIFY_WEBHOOK_TARGET_LIMIT as A, SLA_CALENDAR_MODE_OPTIONS as Qe, SLA_DURATION_UNIT_OPTIONS as $e, SLA_TIMEOUT_ACTION_OPTIONS as et, composeQuorumThreshold as tt, composeSlaDuration as j, createNotifyWebhookTarget as M, hasConfiguredConditionEdges as nt, isDecisionPolicyUnsatisfiable as rt, isFormFieldCompatibleWithWebhookParameter as it, isNotifyWebhookContextPath as N, isOrgManagerChainDecisionPolicyInvalid as at, readApproverResolverIssue as ot, readConditionOperatorIds as st, readDesignTimeApproverCount as ct, readExcludeInitiatorIssue as lt, readNotifyServiceTaskIssue as ut, readNotifyWebhookCatalogIssueMessage as dt, readNotifyWebhookStructureIssues as ft, readNotifyWebhookTargetCatalogIssues as pt, readNotifyWebhookTargets as mt, readSlaDurationParts as ht } from "@rytass/bpm-core-shared/workflow-graph";
24
25
  //#region src/views/templates/designer/decision-policy-options.ts
25
- var ft = [
26
+ var gt = [
26
27
  {
27
28
  id: "SINGLE",
28
29
  name: "單人簽核"
@@ -44,25 +45,25 @@ var ft = [
44
45
  name: "達到指定門檻"
45
46
  }
46
47
  ];
47
- function pt(e) {
48
+ function _t(e) {
48
49
  if (!e || e.type === "SINGLE" || e.type === "PARALLEL_ANY") return "可指定多位;多位時所有人都會收到待辦,任一人同意即可通過。";
49
50
  if (e.type === "PARALLEL_ALL") return "可指定多位;多位時所有人都會收到待辦,全部同意後才會通過。";
50
51
  if (e.type === "SEQUENTIAL") return "依簽核人順序一次開放一位,前一位核准後才輪到下一位;任一位拒絕或退回即結束此關。";
51
52
  let t = e.thresholdType === "PERCENTAGE" ? "%" : " 位簽核者";
52
53
  return `可指定多位;需達到 ${e.threshold}${t} 才會通過。`;
53
54
  }
54
- function mt(e) {
55
- return ft.find((t) => t.id === e) || {
55
+ function vt(e) {
56
+ return gt.find((t) => t.id === e) || {
56
57
  id: e,
57
58
  name: `未知決策方式(${e})`
58
59
  };
59
60
  }
60
61
  //#endregion
61
62
  //#region src/views/templates/designer/use-workflow-designer-controller.ts
62
- function ht({ directory: e, initialState: t, layout: n, onLayout: r }) {
63
- let [i, a] = p(t), o = f(t), s = f(e);
63
+ function yt({ directory: e, initialState: t, layout: n, onLayout: r }) {
64
+ let [i, a] = h(t), o = m(t), s = m(e);
64
65
  s.current = e;
65
- let c = l((e) => {
66
+ let c = d((e) => {
66
67
  if (!e.changed && !e.error) return e;
67
68
  let t = e.effects.layout ? n(e.state.definition) : e.state.definition, i = {
68
69
  ...e.state,
@@ -72,34 +73,34 @@ function ht({ directory: e, initialState: t, layout: n, onLayout: r }) {
72
73
  ...e,
73
74
  state: i
74
75
  };
75
- }, [n, r]), u = l((e) => c(ve(o.current, e)), [c]), m = l((e) => c(ye(o.current, e)), [c]), h = l(async (e, t) => {
76
- let n = await be(o.current, e, t, { directory: s.current });
76
+ }, [n, r]), l = d((e) => c(ye(o.current, e)), [c]), u = d((e) => c(be(o.current, e)), [c]), f = d(async (e, t) => {
77
+ let n = await xe(o.current, e, t, { directory: s.current });
77
78
  if (n.ok && (n.kind === "mutation" || n.kind === "macro")) {
78
79
  let e = c(n.result);
79
80
  return {
80
81
  ...n,
81
82
  result: e,
82
- snapshot: xe(e.state)
83
+ snapshot: Se(e.state)
83
84
  };
84
85
  }
85
86
  return n;
86
- }, [c]), g = l((e) => {
87
+ }, [c]), g = d((e) => {
87
88
  let t = typeof e == "function" ? e(o.current) : e;
88
89
  o.current = t, a(t);
89
- }, []), _ = l(() => o.current, []), v = d(() => xe(i), [i]);
90
- return d(() => ({
91
- dispatch: u,
92
- dispatchMacro: m,
93
- executeTool: h,
90
+ }, []), _ = d(() => o.current, []), v = p(() => Se(i), [i]);
91
+ return p(() => ({
92
+ dispatch: l,
93
+ dispatchMacro: u,
94
+ executeTool: f,
94
95
  getState: _,
95
96
  replaceState: g,
96
97
  snapshot: v,
97
98
  state: i,
98
- tools: E
99
+ tools: D
99
100
  }), [
101
+ l,
100
102
  u,
101
- m,
102
- h,
103
+ f,
103
104
  _,
104
105
  g,
105
106
  v,
@@ -108,10 +109,10 @@ function ht({ directory: e, initialState: t, layout: n, onLayout: r }) {
108
109
  }
109
110
  //#endregion
110
111
  //#region src/views/templates/designer/use-workflow-chat.ts
111
- function gt({ controller: e, api: t = "/api/chat" }) {
112
- let n = d(() => new me({ api: t }), [t]), r = Ke({
112
+ function bt({ controller: e, api: t = "/api/chat" }) {
113
+ let n = p(() => new he({ api: t }), [t]), r = Ye({
113
114
  transport: n,
114
- sendAutomaticallyWhen: _e,
115
+ sendAutomaticallyWhen: ve,
115
116
  async onToolCall({ toolCall: t }) {
116
117
  let n = await e.executeTool(t.toolName, t.input);
117
118
  if (n.ok) {
@@ -134,12 +135,12 @@ function gt({ controller: e, api: t = "/api/chat" }) {
134
135
  }
135
136
  //#endregion
136
137
  //#region src/views/templates/designer/chrome-workflow-chat.ts
137
- var _t = 12;
138
- function vt() {
138
+ var P = 12;
139
+ function xt() {
139
140
  let e = globalThis.LanguageModel;
140
141
  return e && typeof e == "object" ? e : null;
141
142
  }
142
- var P = {
143
+ var F = {
143
144
  additionalProperties: !1,
144
145
  properties: {
145
146
  action: {
@@ -153,7 +154,7 @@ var P = {
153
154
  required: ["action"],
154
155
  type: "object"
155
156
  };
156
- function yt() {
157
+ function St() {
157
158
  return `你是「簽核流程設計器」頁面的離線 AI 助理。只能透過下列工具操作這個流程畫布,其他請求一律婉拒並引導回流程設計。
158
159
 
159
160
  每一步只輸出一個 JSON 決策物件:
@@ -163,17 +164,17 @@ function yt() {
163
164
  規則:先用 get_workflow_snapshot 了解現況再規劃;完成後用 validate_workflow 檢查並以 message 說明做了什麼。
164
165
 
165
166
  可用工具:
166
- ${E.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
167
+ ${D.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
167
168
  }
168
- function bt({ controller: e }) {
169
- let [t, n] = p(!1), [r, i] = p([]), [a, o] = p("ready"), s = f(0);
170
- u(() => {
171
- let e = vt();
169
+ function Ct({ controller: e }) {
170
+ let [t, n] = h(!1), [r, i] = h([]), [a, o] = h("ready"), s = m(0);
171
+ f(() => {
172
+ let e = xt();
172
173
  e && e.availability().then((e) => {
173
174
  n(e !== "unavailable");
174
175
  }).catch(() => n(!1));
175
176
  }, []);
176
- let c = l((e, t) => {
177
+ let c = d((e, t) => {
177
178
  s.current += 1, i((n) => [...n, {
178
179
  id: `chrome-${s.current}`,
179
180
  parts: [{
@@ -186,15 +187,15 @@ function bt({ controller: e }) {
186
187
  return {
187
188
  available: t,
188
189
  messages: r,
189
- send: l((t) => {
190
- let n = vt();
191
- n && a === "ready" && (c("user", t), o("submitted"), xt({
190
+ send: d((t) => {
191
+ let n = xt();
192
+ n && a === "ready" && (c("user", t), o("submitted"), wt({
192
193
  appendMessage: c,
193
194
  controller: e,
194
195
  model: n,
195
196
  userText: t
196
197
  }).then(() => o("ready")).catch((e) => {
197
- c("assistant", Ct(e)), o("error");
198
+ c("assistant", Et(e)), o("error");
198
199
  }));
199
200
  }, [
200
201
  c,
@@ -204,15 +205,15 @@ function bt({ controller: e }) {
204
205
  status: a
205
206
  };
206
207
  }
207
- async function xt({ appendMessage: e, controller: t, model: n, userText: r }) {
208
+ async function wt({ appendMessage: e, controller: t, model: n, userText: r }) {
208
209
  let i = await n.create({ initialPrompts: [{
209
- content: yt(),
210
+ content: St(),
210
211
  role: "system"
211
212
  }] });
212
213
  try {
213
214
  let n = `使用者需求:${r}\n目前流程:${JSON.stringify(t.snapshot)}`;
214
- for (let r = 0; r < _t; r += 1) {
215
- let r = St(await i.prompt(n, { responseConstraint: P }));
215
+ for (let r = 0; r < P; r += 1) {
216
+ let r = Tt(await i.prompt(n, { responseConstraint: F }));
216
217
  if (!r || r.action === "message") {
217
218
  e("assistant", r?.text ?? "我已完成可處理的部分。");
218
219
  return;
@@ -232,7 +233,7 @@ async function xt({ appendMessage: e, controller: t, model: n, userText: r }) {
232
233
  i.destroy();
233
234
  }
234
235
  }
235
- function St(e) {
236
+ function Tt(e) {
236
237
  try {
237
238
  let t = JSON.parse(e);
238
239
  return typeof t == "object" && t && t.action !== void 0 ? t : null;
@@ -240,51 +241,51 @@ function St(e) {
240
241
  return null;
241
242
  }
242
243
  }
243
- function Ct(e) {
244
+ function Et(e) {
244
245
  return e instanceof Error ? `離線模式發生錯誤:${e.message}` : "離線模式發生未知錯誤。";
245
246
  }
246
247
  //#endregion
247
248
  //#region src/views/templates/designer/workflow-chat-drawer.tsx
248
- var wt = {
249
+ var Dt = {
249
250
  display: "flex",
250
251
  flexDirection: "column",
251
252
  gap: 12,
252
253
  height: "100%"
253
- }, Tt = {
254
+ }, Ot = {
254
255
  display: "flex",
255
256
  flex: 1,
256
257
  flexDirection: "column",
257
258
  gap: 12,
258
259
  minHeight: 0,
259
260
  overflowY: "auto"
260
- }, Et = {
261
+ }, kt = {
261
262
  display: "flex",
262
263
  gap: 8,
263
264
  paddingBottom: 4
264
- }, Dt = {
265
+ }, At = {
265
266
  borderTop: "1px solid var(--mzn-color-border-neutral, #e5e7eb)",
266
267
  display: "flex",
267
268
  flexDirection: "column",
268
269
  gap: 8,
269
270
  paddingTop: 12
270
- }, Ot = {
271
+ }, jt = {
271
272
  display: "flex",
272
273
  justifyContent: "flex-end"
273
- }, kt = { width: "100%" }, F = "workflow-chat-input-field", At = `
274
- .${F}.mzn-text-field {
274
+ }, Mt = { width: "100%" }, Nt = "workflow-chat-input-field", I = `
275
+ .${Nt}.mzn-text-field {
275
276
  width: 100%;
276
277
  }
277
- `, jt = {
278
+ `, Pt = {
278
279
  color: "var(--mzn-color-text-secondary, #6b7280)",
279
280
  fontSize: 12,
280
281
  padding: "2px 0"
281
- }, I = {
282
+ }, Ft = {
282
283
  "input-available": "執行中…",
283
284
  "input-streaming": "準備中…",
284
285
  "output-available": "完成",
285
286
  "output-error": "失敗"
286
287
  };
287
- function Mt(e) {
288
+ function It(e) {
288
289
  let t = e === "user";
289
290
  return {
290
291
  alignSelf: t ? "flex-end" : "flex-start",
@@ -297,11 +298,11 @@ function Mt(e) {
297
298
  wordBreak: "break-word"
298
299
  };
299
300
  }
300
- function Nt({ api: e, controller: t, onClose: n, open: r }) {
301
- let i = gt({
301
+ function Lt({ api: e, controller: t, onClose: n, open: r }) {
302
+ let i = bt({
302
303
  api: e,
303
304
  controller: t
304
- }), a = bt({ controller: t }), [o, s] = p("online"), [u, d] = p(""), f = o === "offline" ? {
305
+ }), a = Ct({ controller: t }), [o, s] = h("online"), [c, l] = h(""), f = o === "offline" ? {
305
306
  messages: a.messages,
306
307
  send: a.send,
307
308
  status: a.status
@@ -311,71 +312,71 @@ function Nt({ api: e, controller: t, onClose: n, open: r }) {
311
312
  i.sendMessage({ text: e });
312
313
  },
313
314
  status: i.status
314
- }, { messages: m, send: g } = f, _ = f.status === "submitted" || f.status === "streaming", v = l(() => {
315
- let e = u.trim();
316
- e && !_ && (d(""), g(e));
315
+ }, { messages: p, send: m } = f, g = f.status === "submitted" || f.status === "streaming", v = d(() => {
316
+ let e = c.trim();
317
+ e && !g && (l(""), m(e));
317
318
  }, [
318
- _,
319
- u,
320
- g
321
- ]), ee = l((e) => {
319
+ g,
320
+ c,
321
+ m
322
+ ]), y = d((e) => {
322
323
  e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), v());
323
324
  }, [v]);
324
- return /* @__PURE__ */ w(T, {
325
+ return /* @__PURE__ */ E(ie, {
325
326
  headerTitle: "AI 流程助理",
326
327
  isHeaderDisplay: !0,
327
328
  onClose: n,
328
329
  open: r,
329
330
  size: "medium",
330
- children: [/* @__PURE__ */ C("style", { children: At }), /* @__PURE__ */ w("div", {
331
- style: wt,
331
+ children: [/* @__PURE__ */ T("style", { children: I }), /* @__PURE__ */ E("div", {
332
+ style: Dt,
332
333
  children: [
333
- a.available ? /* @__PURE__ */ w("div", {
334
- style: Et,
335
- children: [/* @__PURE__ */ C(h, {
334
+ a.available ? /* @__PURE__ */ E("div", {
335
+ style: kt,
336
+ children: [/* @__PURE__ */ T(_, {
336
337
  onClick: () => s("online"),
337
338
  variant: o === "online" ? "base-primary" : "base-tertiary",
338
339
  children: "線上"
339
- }), /* @__PURE__ */ C(h, {
340
+ }), /* @__PURE__ */ T(_, {
340
341
  onClick: () => s("offline"),
341
342
  variant: o === "offline" ? "base-primary" : "base-tertiary",
342
343
  children: "離線(裝置內,實驗)"
343
344
  })]
344
345
  }) : null,
345
- /* @__PURE__ */ w("div", {
346
+ /* @__PURE__ */ E("div", {
346
347
  role: "log",
347
- style: Tt,
348
+ style: Ot,
348
349
  children: [
349
- m.length === 0 ? /* @__PURE__ */ C(x, {
350
+ p.length === 0 ? /* @__PURE__ */ T(C, {
350
351
  color: "text-neutral",
351
352
  variant: "body",
352
353
  children: "用一句話描述你想要的流程,例如:「建立三關簽核:部門主管 → 經理 → 財務,金額大於十萬走財務複核」。我會直接在畫布上幫你繪製。"
353
354
  }) : null,
354
- m.map((e) => /* @__PURE__ */ C(c, { children: Pt(e) }, e.id)),
355
- _ ? /* @__PURE__ */ C(x, {
355
+ p.map((e) => /* @__PURE__ */ T(u, { children: Rt(e) }, e.id)),
356
+ g ? /* @__PURE__ */ T(C, {
356
357
  color: "text-neutral",
357
358
  variant: "body",
358
359
  children: "思考中…"
359
360
  }) : null
360
361
  ]
361
362
  }),
362
- /* @__PURE__ */ w("div", {
363
- style: Dt,
364
- children: [/* @__PURE__ */ C(re, {
365
- className: F,
366
- disabled: _,
363
+ /* @__PURE__ */ E("div", {
364
+ style: At,
365
+ children: [/* @__PURE__ */ T(re, {
366
+ className: Nt,
367
+ disabled: g,
367
368
  maxLength: 2e3,
368
- onChange: (e) => d(e.target.value),
369
- onKeyDown: ee,
369
+ onChange: (e) => l(e.target.value),
370
+ onKeyDown: y,
370
371
  placeholder: "描述你想要的流程…(Enter 送出,Shift + Enter 換行)",
371
372
  rows: 3,
372
- style: kt,
373
- value: u
374
- }), /* @__PURE__ */ C("div", {
375
- style: Ot,
376
- children: /* @__PURE__ */ C(h, {
377
- disabled: _ || u.trim().length === 0,
378
- loading: _,
373
+ style: Mt,
374
+ value: c
375
+ }), /* @__PURE__ */ T("div", {
376
+ style: jt,
377
+ children: /* @__PURE__ */ T(_, {
378
+ disabled: g || c.trim().length === 0,
379
+ loading: g,
379
380
  onClick: v,
380
381
  type: "button",
381
382
  variant: "base-primary",
@@ -387,16 +388,16 @@ function Nt({ api: e, controller: t, onClose: n, open: r }) {
387
388
  })]
388
389
  });
389
390
  }
390
- function Pt(e) {
391
+ function Rt(e) {
391
392
  return e.parts.map((t, n) => {
392
- if (t.type === "text") return /* @__PURE__ */ C("div", {
393
- style: Mt(e.role),
393
+ if (t.type === "text") return /* @__PURE__ */ T("div", {
394
+ style: It(e.role),
394
395
  children: t.text
395
396
  }, `${e.id}-${n}`);
396
- if (t.type === "dynamic-tool" || ge(t)) {
397
- let r = he(t), i = I[t.state] ?? t.state;
398
- return /* @__PURE__ */ C("div", {
399
- style: jt,
397
+ if (t.type === "dynamic-tool" || _e(t)) {
398
+ let r = ge(t), i = Ft[t.state] ?? t.state;
399
+ return /* @__PURE__ */ T("div", {
400
+ style: Pt,
400
401
  children: `⚙ ${r} · ${i}`
401
402
  }, `${e.id}-${n}`);
402
403
  }
@@ -405,7 +406,7 @@ function Pt(e) {
405
406
  }
406
407
  //#endregion
407
408
  //#region src/views/templates/designer/position-level-options.ts
408
- function Ft(e, t) {
409
+ function zt(e, t) {
409
410
  let n = [...new Set(e.map((e) => e.level))];
410
411
  return [...n.includes(t) ? n : [...n, t]].sort((e, t) => t - e).map((t) => {
411
412
  let n = e.filter((e) => e.level === t).map((e) => e.name);
@@ -416,12 +417,12 @@ function Ft(e, t) {
416
417
  };
417
418
  });
418
419
  }
419
- function It(e) {
420
+ function Bt(e) {
420
421
  return e.reduce((e, t) => Math.max(e, t.level), 1);
421
422
  }
422
423
  //#endregion
423
424
  //#region src/views/templates/designer/notify-webhook-designer.ts
424
- var Lt = {
425
+ var L = {
425
426
  "initiator.memberId": "發起人會員編號",
426
427
  "instance.id": "案件編號",
427
428
  "instance.templateId": "模板編號",
@@ -429,32 +430,32 @@ var Lt = {
429
430
  "instance.title": "案件主旨",
430
431
  "node.id": "節點編號",
431
432
  "node.label": "節點名稱"
432
- }, L = {
433
+ }, Vt = {
433
434
  boolean: "是/否",
434
435
  json: "JSON",
435
436
  number: "數字",
436
437
  string: "文字",
437
438
  stringArray: "文字清單"
438
439
  };
439
- function Rt(e) {
440
+ function R(e) {
440
441
  return `${e.key}@${e.version}`;
441
442
  }
442
- function R(e, t) {
443
+ function Ht(e, t) {
443
444
  return e.find((e) => e.key === t.key && e.version === t.version) ?? null;
444
445
  }
445
- function zt(e) {
446
+ function Ut(e) {
446
447
  return [
447
448
  "FIELD",
448
449
  ...e === "stringArray" ? [] : ["CONSTANT"],
449
450
  ...e === "string" || e === "json" ? ["CONTEXT"] : []
450
451
  ];
451
452
  }
452
- function Bt(e, t) {
453
- return e.filter((e) => M(e, t));
453
+ function Wt(e, t) {
454
+ return e.filter((e) => it(e, t));
454
455
  }
455
- function Vt(e, t, n) {
456
+ function Gt(e, t, n) {
456
457
  return e === "FIELD" ? {
457
- fieldKey: Bt(n, t.type)[0]?.fieldKey ?? "",
458
+ fieldKey: Wt(n, t.type)[0]?.fieldKey ?? "",
458
459
  kind: "FIELD"
459
460
  } : e === "CONTEXT" ? {
460
461
  kind: "CONTEXT",
@@ -464,16 +465,16 @@ function Vt(e, t, n) {
464
465
  value: t.type === "boolean" ? !0 : t.type === "number" ? null : ""
465
466
  };
466
467
  }
467
- var Ht = /^-?\d+(\.\d+)?$/;
468
- function Ut(e, t) {
468
+ var Kt = /^-?\d+(\.\d+)?$/;
469
+ function qt(e, t) {
469
470
  if (e !== "number") return t;
470
471
  let n = t.trim();
471
- return n ? Ht.test(n) ? Number(n) : t : null;
472
+ return n ? Kt.test(n) ? Number(n) : t : null;
472
473
  }
473
- function Wt(e) {
474
- return !ct(e).some((e) => Gt.has(e.code));
474
+ function Jt(e) {
475
+ return !ft(e).some((e) => Yt.has(e.code));
475
476
  }
476
- var Gt = /* @__PURE__ */ new Set([
477
+ var Yt = /* @__PURE__ */ new Set([
477
478
  "BINDING_INVALID",
478
479
  "BINDING_SOURCE_INVALID",
479
480
  "BINDINGS_NOT_ARRAY",
@@ -483,7 +484,7 @@ var Gt = /* @__PURE__ */ new Set([
483
484
  "TARGET_INVALID",
484
485
  "WEBHOOKS_NOT_ARRAY"
485
486
  ]);
486
- function Kt(e, t, n) {
487
+ function Xt(e, t, n) {
487
488
  let r = e.bindings.filter((e) => e.parameter !== t), i = e.bindings.findIndex((e) => e.parameter === t);
488
489
  if (!n) return {
489
490
  ...e,
@@ -498,11 +499,11 @@ function Kt(e, t, n) {
498
499
  bindings: i === -1 ? [...e.bindings, a] : e.bindings.map((e, t) => t === i ? a : e)
499
500
  };
500
501
  }
501
- function qt(e, t, n) {
502
+ function Zt(e, t, n) {
502
503
  return {
503
504
  bindings: e.bindings.filter((r) => {
504
505
  let i = t.parameters.find((e) => e.key === r.parameter);
505
- return i !== void 0 && !lt({
506
+ return i !== void 0 && !pt({
506
507
  endpoint: { parameters: [{
507
508
  ...i,
508
509
  required: !1
@@ -521,15 +522,15 @@ function qt(e, t, n) {
521
522
  id: e.id
522
523
  };
523
524
  }
524
- function Jt({ definition: e, endpoints: t, formFields: n }) {
525
- return e.nodes.flatMap((e) => e.type !== "serviceTask" || e.data.action.type !== "NOTIFY" || ct(e.data.action.webhooks).length ? [] : ut(e.data.action).flatMap((r, i) => {
526
- let a = R(t, r.endpoint);
527
- return lt({
525
+ function Qt({ definition: e, endpoints: t, formFields: n }) {
526
+ return e.nodes.flatMap((e) => e.type !== "serviceTask" || e.data.action.type !== "NOTIFY" || ft(e.data.action.webhooks).length ? [] : mt(e.data.action).flatMap((r, i) => {
527
+ let a = Ht(t, r.endpoint);
528
+ return pt({
528
529
  endpoint: a,
529
530
  formFields: n,
530
531
  target: r
531
- }).map((t) => st({
532
- endpointLabel: a?.label ?? Rt(r.endpoint),
532
+ }).map((t) => dt({
533
+ endpointLabel: a?.label ?? R(r.endpoint),
533
534
  issue: t,
534
535
  nodeLabel: e.data.label,
535
536
  targetIndex: i
@@ -538,10 +539,10 @@ function Jt({ definition: e, endpoints: t, formFields: n }) {
538
539
  }
539
540
  //#endregion
540
541
  //#region src/views/templates/designer/NotifyWebhookTargetsEditor.tsx
541
- var Yt = {
542
+ var $t = {
542
543
  display: "grid",
543
544
  gap: "var(--mzn-spacing-gap-base)"
544
- }, Xt = {
545
+ }, en = {
545
546
  borderColor: "var(--mzn-color-border-neutral)",
546
547
  borderRadius: "var(--mzn-radius-base)",
547
548
  borderStyle: "solid",
@@ -549,19 +550,19 @@ var Yt = {
549
550
  display: "grid",
550
551
  gap: "var(--mzn-spacing-gap-base)",
551
552
  padding: "var(--mzn-spacing-padding-horizontal-base)"
552
- }, Zt = {
553
+ }, tn = {
553
554
  alignItems: "center",
554
555
  display: "flex",
555
556
  gap: "var(--mzn-spacing-gap-base)",
556
557
  justifyContent: "space-between"
557
- }, Qt = {
558
+ }, nn = {
558
559
  display: "grid",
559
560
  gap: "var(--mzn-spacing-gap-base)",
560
561
  gridTemplateColumns: "minmax(0, 2fr) minmax(0, 3fr)"
561
- }, $t = {
562
+ }, rn = {
562
563
  id: "NONE",
563
564
  name: "不傳送"
564
- }, en = {
565
+ }, an = {
565
566
  CONSTANT: {
566
567
  id: "CONSTANT",
567
568
  name: "固定值"
@@ -574,17 +575,17 @@ var Yt = {
574
575
  id: "FIELD",
575
576
  name: "表單欄位"
576
577
  }
577
- }, tn = [{
578
+ }, on = [{
578
579
  id: "true",
579
580
  name: "是"
580
581
  }, {
581
582
  id: "false",
582
583
  name: "否"
583
- }], nn = Ye.map((e) => ({
584
+ }], sn = k.map((e) => ({
584
585
  id: e,
585
- name: Lt[e]
586
+ name: L[e]
586
587
  }));
587
- function rn({ catalog: e, catalogState: t, formFields: n, onChange: r, targets: i }) {
588
+ function cn({ catalog: e, catalogState: t, formFields: n, onChange: r, targets: i }) {
588
589
  let a = e.filter((e) => !e.deprecated);
589
590
  if (!i.length && (t === "unavailable" || t === "ready" && !a.length)) return null;
590
591
  function o(e, t) {
@@ -592,34 +593,34 @@ function rn({ catalog: e, catalogState: t, formFields: n, onChange: r, targets:
592
593
  }
593
594
  function s() {
594
595
  let [e] = a;
595
- e && r([...i, j({
596
+ e && r([...i, M({
596
597
  key: e.key,
597
598
  version: e.version
598
599
  })]);
599
600
  }
600
- return /* @__PURE__ */ w("div", {
601
- style: Yt,
601
+ return /* @__PURE__ */ E("div", {
602
+ style: $t,
602
603
  children: [
603
- /* @__PURE__ */ C(x, {
604
+ /* @__PURE__ */ T(C, {
604
605
  variant: "label-primary-highlight",
605
606
  children: "Webhook"
606
607
  }),
607
- /* @__PURE__ */ C(x, {
608
+ /* @__PURE__ */ T(C, {
608
609
  color: "text-neutral",
609
610
  variant: "caption",
610
611
  children: "知會節點抵達時,將指定的表單欄位或案件資訊送到外部系統。"
611
612
  }),
612
- t === "loading" ? /* @__PURE__ */ C(x, {
613
+ t === "loading" ? /* @__PURE__ */ T(C, {
613
614
  color: "text-neutral",
614
615
  variant: "body",
615
616
  children: "正在載入可用的 Webhook 端點…"
616
617
  }) : null,
617
- t === "unavailable" ? /* @__PURE__ */ C(x, {
618
+ t === "unavailable" ? /* @__PURE__ */ T(C, {
618
619
  color: "text-error",
619
620
  variant: "body",
620
621
  children: "目前無法載入 Webhook 端點,已設定的內容會保留,請稍後重試。"
621
622
  }) : null,
622
- i.map((s, c) => /* @__PURE__ */ C(an, {
623
+ i.map((s, c) => /* @__PURE__ */ T(ln, {
623
624
  activeEndpoints: a,
624
625
  catalog: e,
625
626
  catalogState: t,
@@ -629,104 +630,104 @@ function rn({ catalog: e, catalogState: t, formFields: n, onChange: r, targets:
629
630
  onRemove: () => r(i.filter((e, t) => t !== c)),
630
631
  target: s
631
632
  }, s.id)),
632
- /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(h, {
633
- disabled: t !== "ready" || !a.length || i.length >= k,
634
- icon: ue,
633
+ /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(_, {
634
+ disabled: t !== "ready" || !a.length || i.length >= A,
635
+ icon: de,
635
636
  iconType: "leading",
636
637
  onClick: s,
637
638
  variant: "base-dashed",
638
639
  children: "新增 Webhook"
639
640
  }) }),
640
- i.length >= k ? /* @__PURE__ */ w(x, {
641
+ i.length >= A ? /* @__PURE__ */ E(C, {
641
642
  color: "text-neutral",
642
643
  variant: "caption",
643
644
  children: [
644
645
  "每個知會節點最多 ",
645
- k,
646
+ A,
646
647
  " 個 Webhook。"
647
648
  ]
648
649
  }) : null
649
650
  ]
650
651
  });
651
652
  }
652
- function an({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, index: a, onChange: o, onRemove: s, target: c }) {
653
- let l = R(t, c.endpoint), u = Rt(c.endpoint), d = [...e.map((e) => ({
654
- id: Rt(e),
655
- name: ln(e)
653
+ function ln({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, index: a, onChange: o, onRemove: s, target: c }) {
654
+ let l = Ht(t, c.endpoint), u = R(c.endpoint), d = [...e.map((e) => ({
655
+ id: R(e),
656
+ name: z(e)
656
657
  })), ...l && !l.deprecated ? [] : [{
657
658
  id: u,
658
- name: l ? ln(l) : `${u}(找不到端點)`
659
+ name: l ? z(l) : `${u}(找不到端點)`
659
660
  }]], f = new Set((l?.parameters ?? []).map((e) => e.key)), p = l ? c.bindings.filter((e) => !f.has(e.parameter)) : [];
660
- return /* @__PURE__ */ w("div", {
661
- style: Xt,
661
+ return /* @__PURE__ */ E("div", {
662
+ style: en,
662
663
  children: [
663
- /* @__PURE__ */ w("div", {
664
- style: Zt,
665
- children: [/* @__PURE__ */ w(x, {
664
+ /* @__PURE__ */ E("div", {
665
+ style: tn,
666
+ children: [/* @__PURE__ */ E(C, {
666
667
  variant: "label-primary",
667
668
  children: [
668
669
  "第 ",
669
670
  a + 1,
670
671
  " 個 Webhook"
671
672
  ]
672
- }), /* @__PURE__ */ C(h, {
673
- icon: fe,
673
+ }), /* @__PURE__ */ T(_, {
674
+ icon: pe,
674
675
  iconType: "leading",
675
676
  onClick: s,
676
677
  variant: "destructive-text-link",
677
678
  children: "移除"
678
679
  })]
679
680
  }),
680
- /* @__PURE__ */ C(n, {
681
+ /* @__PURE__ */ T(n, {
681
682
  label: "端點",
682
683
  name: `webhookEndpoint-${c.id}`,
683
684
  required: !0,
684
- children: /* @__PURE__ */ C(y, {
685
+ children: /* @__PURE__ */ T(x, {
685
686
  clearable: !1,
686
687
  disabled: r !== "ready",
687
688
  onChange: (t) => {
688
- let n = e.find((e) => Rt(e) === t?.id);
689
- n && o(qt(c, n, i ?? []));
689
+ let n = e.find((e) => R(e) === t?.id);
690
+ n && o(Zt(c, n, i ?? []));
690
691
  },
691
692
  options: [...d],
692
693
  placeholder: "選擇端點",
693
694
  value: d.find((e) => e.id === u) ?? null
694
695
  })
695
696
  }),
696
- r === "ready" && !l ? /* @__PURE__ */ C(x, {
697
+ r === "ready" && !l ? /* @__PURE__ */ T(C, {
697
698
  color: "text-warning",
698
699
  variant: "body",
699
700
  children: "找不到這個端點,設定會保留;請改選其他端點或移除,否則無法發布。"
700
701
  }) : null,
701
- l?.disabled ? /* @__PURE__ */ C(x, {
702
+ l?.disabled ? /* @__PURE__ */ T(C, {
702
703
  color: "text-warning",
703
704
  variant: "body",
704
705
  children: "這個端點已被管理者停用,不會再送出;設定會保留,請改選其他端點,否則無法發布。"
705
- }) : l?.deprecated ? /* @__PURE__ */ C(x, {
706
+ }) : l?.deprecated ? /* @__PURE__ */ T(C, {
706
707
  color: "text-warning",
707
708
  variant: "body",
708
709
  children: "這個端點不建議再使用,設定會保留;請改選其他端點,否則無法發布。"
709
710
  }) : null,
710
- l?.description ? /* @__PURE__ */ C(x, {
711
+ l?.description ? /* @__PURE__ */ T(C, {
711
712
  color: "text-neutral",
712
713
  variant: "caption",
713
714
  children: l.description
714
715
  }) : null,
715
- l && !l.parameters.length ? /* @__PURE__ */ C(x, {
716
+ l && !l.parameters.length ? /* @__PURE__ */ T(C, {
716
717
  color: "text-neutral",
717
718
  variant: "caption",
718
719
  children: "這個端點不需要參數。"
719
720
  }) : null,
720
- (l?.parameters ?? []).map((e) => /* @__PURE__ */ C(on, {
721
+ (l?.parameters ?? []).map((e) => /* @__PURE__ */ T(un, {
721
722
  formFields: i,
722
- onChange: (t) => o(Kt(c, e.key, t)),
723
+ onChange: (t) => o(Xt(c, e.key, t)),
723
724
  parameter: e,
724
725
  source: c.bindings.find((t) => t.parameter === e.key)?.from ?? null,
725
726
  targetId: c.id
726
727
  }, e.key)),
727
- p.map((e) => /* @__PURE__ */ w("div", {
728
- style: Zt,
729
- children: [/* @__PURE__ */ w(x, {
728
+ p.map((e) => /* @__PURE__ */ E("div", {
729
+ style: tn,
730
+ children: [/* @__PURE__ */ E(C, {
730
731
  color: "text-warning",
731
732
  variant: "body",
732
733
  children: [
@@ -734,8 +735,8 @@ function an({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, in
734
735
  e.parameter,
735
736
  "」已不在端點定義中。"
736
737
  ]
737
- }), /* @__PURE__ */ C(h, {
738
- onClick: () => o(Kt(c, e.parameter, null)),
738
+ }), /* @__PURE__ */ T(_, {
739
+ onClick: () => o(Xt(c, e.parameter, null)),
739
740
  variant: "base-text-link",
740
741
  children: "移除設定"
741
742
  })]
@@ -743,9 +744,9 @@ function an({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, in
743
744
  ]
744
745
  });
745
746
  }
746
- function on({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }) {
747
- let o = i?.kind === "FIELD" || Bt(e ?? [], r.type).length > 0, s = [...r.required ? [] : [$t], ...zt(r.type).filter((e) => e !== "FIELD" || o).map((e) => en[e])], c = L[r.type];
748
- return /* @__PURE__ */ C(n, {
747
+ function un({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }) {
748
+ let o = i?.kind === "FIELD" || Wt(e ?? [], r.type).length > 0, s = [...r.required ? [] : [rn], ...Ut(r.type).filter((e) => e !== "FIELD" || o).map((e) => an[e])], c = Vt[r.type];
749
+ return /* @__PURE__ */ T(n, {
749
750
  hintText: [
750
751
  r.key,
751
752
  c,
@@ -754,18 +755,18 @@ function on({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }
754
755
  label: r.label,
755
756
  name: `webhookBinding-${a}-${r.key}`,
756
757
  required: r.required,
757
- children: /* @__PURE__ */ w("div", {
758
- style: Qt,
759
- children: [/* @__PURE__ */ C(y, {
758
+ children: /* @__PURE__ */ E("div", {
759
+ style: nn,
760
+ children: [/* @__PURE__ */ T(x, {
760
761
  clearable: !1,
761
762
  onChange: (n) => {
762
- let i = z(n?.id ?? null);
763
- t(i ? Vt(i, r, e ?? []) : null);
763
+ let i = pn(n?.id ?? null);
764
+ t(i ? Gt(i, r, e ?? []) : null);
764
765
  },
765
766
  options: [...s],
766
767
  placeholder: "選擇來源",
767
- value: i ? en[i.kind] : r.required ? null : $t
768
- }), i ? /* @__PURE__ */ C(sn, {
768
+ value: i ? an[i.kind] : r.required ? null : rn
769
+ }), i ? /* @__PURE__ */ T(dn, {
769
770
  formFields: e,
770
771
  onChange: t,
771
772
  parameter: r,
@@ -774,21 +775,21 @@ function on({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }
774
775
  })
775
776
  });
776
777
  }
777
- function sn({ formFields: e, onChange: t, parameter: n, source: r }) {
778
+ function dn({ formFields: e, onChange: t, parameter: n, source: r }) {
778
779
  if (r.kind === "FIELD") {
779
- if (!e) return /* @__PURE__ */ C(x, {
780
+ if (!e) return /* @__PURE__ */ T(C, {
780
781
  color: "text-neutral",
781
782
  variant: "caption",
782
783
  children: "請先綁定表單版本,才能選擇表單欄位。"
783
784
  });
784
- let i = Bt(e, n.type).map((e) => ({
785
+ let i = Wt(e, n.type).map((e) => ({
785
786
  id: e.fieldKey,
786
787
  name: `${e.label}(${e.fieldKey})`
787
788
  })), a = r.fieldKey && !i.some((e) => e.id === r.fieldKey) ? [...i, {
788
789
  id: r.fieldKey,
789
790
  name: `${r.fieldKey}(找不到相容欄位)`
790
791
  }] : i;
791
- return /* @__PURE__ */ C(y, {
792
+ return /* @__PURE__ */ T(x, {
792
793
  clearable: !1,
793
794
  onChange: (e) => t({
794
795
  fieldKey: e?.id ?? "",
@@ -799,25 +800,25 @@ function sn({ formFields: e, onChange: t, parameter: n, source: r }) {
799
800
  value: a.find((e) => e.id === r.fieldKey) ?? null
800
801
  });
801
802
  }
802
- return r.kind === "CONTEXT" ? /* @__PURE__ */ C(y, {
803
+ return r.kind === "CONTEXT" ? /* @__PURE__ */ T(x, {
803
804
  clearable: !1,
804
805
  onChange: (e) => {
805
- nt(e?.id) && t({
806
+ N(e?.id) && t({
806
807
  kind: "CONTEXT",
807
808
  path: e.id
808
809
  });
809
810
  },
810
- options: [...nn],
811
- value: nn.find((e) => e.id === r.path) ?? null
812
- }) : n.type === "boolean" ? /* @__PURE__ */ C(y, {
811
+ options: [...sn],
812
+ value: sn.find((e) => e.id === r.path) ?? null
813
+ }) : n.type === "boolean" ? /* @__PURE__ */ T(x, {
813
814
  clearable: !1,
814
815
  onChange: (e) => t({
815
816
  kind: "CONSTANT",
816
817
  value: e?.id === "true"
817
818
  }),
818
- options: [...tn],
819
- value: typeof r.value == "boolean" ? tn.find((e) => e.id === String(r.value)) ?? null : null
820
- }) : /* @__PURE__ */ C(cn, {
819
+ options: [...on],
820
+ value: typeof r.value == "boolean" ? on.find((e) => e.id === String(r.value)) ?? null : null
821
+ }) : /* @__PURE__ */ T(fn, {
821
822
  onChange: (e) => t({
822
823
  kind: "CONSTANT",
823
824
  value: e
@@ -826,21 +827,21 @@ function sn({ formFields: e, onChange: t, parameter: n, source: r }) {
826
827
  value: r.value
827
828
  });
828
829
  }
829
- function cn({ onChange: e, type: t, value: n }) {
830
- let [r, i] = p(n === null ? "" : String(n));
831
- return u(() => {
832
- i((e) => Ut(t, e) === n ? e : n === null ? "" : String(n));
833
- }, [t, n]), /* @__PURE__ */ C(_, {
830
+ function fn({ onChange: e, type: t, value: n }) {
831
+ let [r, i] = h(n === null ? "" : String(n));
832
+ return f(() => {
833
+ i((e) => qt(t, e) === n ? e : n === null ? "" : String(n));
834
+ }, [t, n]), /* @__PURE__ */ T(y, {
834
835
  inputProps: { inputMode: t === "number" ? "decimal" : void 0 },
835
836
  onChange: (n) => {
836
- i(n.target.value), e(Ut(t, n.target.value));
837
+ i(n.target.value), e(qt(t, n.target.value));
837
838
  },
838
839
  placeholder: t === "number" ? "輸入數字" : "輸入固定值",
839
840
  value: r,
840
841
  variant: "base"
841
842
  });
842
843
  }
843
- function ln(e) {
844
+ function z(e) {
844
845
  let t = [
845
846
  `v${e.version}`,
846
847
  ...e.source === "DATABASE" ? ["後台維護"] : [],
@@ -848,26 +849,113 @@ function ln(e) {
848
849
  ];
849
850
  return `${e.label}(${t.join(",")})`;
850
851
  }
851
- function z(e) {
852
+ function pn(e) {
852
853
  return e === "FIELD" || e === "CONSTANT" || e === "CONTEXT" ? e : null;
853
854
  }
854
855
  //#endregion
856
+ //#region src/views/templates/designer/dry-run-sample-data.ts
857
+ function mn(e) {
858
+ return (e?.fields ?? []).reduce((e, t) => ({
859
+ ...e,
860
+ [t.fieldKey]: gn(t)
861
+ }), {});
862
+ }
863
+ function hn(e) {
864
+ return `formMember:${e}`;
865
+ }
866
+ function gn(e) {
867
+ if (e.type === "number") return 1e3;
868
+ if (e.type === "boolean") return !0;
869
+ if (e.type === "member") {
870
+ let t = hn(e.fieldKey);
871
+ return e.multiple ? [t] : t;
872
+ }
873
+ return Te(e) ? e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.options[0]?.value ?? "" : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
874
+ }
875
+ //#endregion
876
+ //#region src/views/templates/designer/dry-run-assignee-label.ts
877
+ function _n(e, t) {
878
+ let [n, ...r] = e.split(":"), i = (e) => t.orgUnits.find((t) => t.id === e)?.name ?? e, a = (e) => t.positions.find((t) => t.id === e)?.name ?? e;
879
+ return n === "position" && r.length === 1 && r[0] ? `職位:${a(r[0])}(送出時依當下人員決定)` : n === "orgUnitMember" && r.length === 1 && r[0] ? `組織任一人:${i(r[0])}` : n === "orgUnitPosition" && r.length === 2 && r[0] && r[1] ? `組織職位:${i(r[0])}/${a(r[1])}` : n === "orgUnitManager" && r.length === 1 && r[0] ? `組織主管:${i(r[0])}` : n === "formMember" && r.length === 1 && r[0] ? `表單欄位「${((e) => t.formFields.find((t) => t.fieldKey === e)?.label || e)(r[0])}」選的人(送出時依填寫內容決定)` : n === "orgManagerChain" && r.length === 1 && r[0] ? `主管鏈:簽到職等 ${r[0]}(送出時依組織決定實際主管)` : t.memberName(e) ?? e;
880
+ }
881
+ //#endregion
882
+ //#region src/views/templates/designer/dynamic-form-resolver-options.ts
883
+ var vn = "表單中沒有「人員選擇」欄位,請先到表單設計加入", yn = "原本指定的欄位已不在表單中,或已不是「人員選擇」欄位,請重新選擇。", bn = "此欄位非必填", xn = "此欄位可能被條件隱藏", B = "此欄位為隱藏欄位,申請人無法填寫", Sn = ",空白時此關會找不到人員,發佈時會被拒絕;請在表單設計將它設為必填且不隱藏";
884
+ function Cn(e) {
885
+ let t = [
886
+ ...e.required ? [] : [bn],
887
+ ...e.visibleWhen?.trim() ? [xn] : [],
888
+ ...e.hidden ? [B] : []
889
+ ];
890
+ return t.length > 0 ? `${t.join("、")}${Sn}` : void 0;
891
+ }
892
+ function wn(e) {
893
+ return `${e.required ? "" : "(非必填)"}${e.visibleWhen?.trim() ? "(可能被條件隱藏)" : ""}${e.hidden ? "(隱藏欄位)" : ""}`;
894
+ }
895
+ function Tn(e) {
896
+ return (e?.fields ?? []).filter(Ee).map((e) => {
897
+ let t = Cn(e);
898
+ return {
899
+ id: e.fieldKey,
900
+ name: `${e.label} (${e.fieldKey})${wn(e)}`,
901
+ ...t ? { warning: t } : {}
902
+ };
903
+ });
904
+ }
905
+ function En(e, t) {
906
+ let n = Tn(e), r = n.find((e) => e.id === t) ?? null;
907
+ if (r) return {
908
+ options: n,
909
+ problem: r.warning ?? null,
910
+ selected: r
911
+ };
912
+ if (t.trim()) {
913
+ let e = {
914
+ id: t,
915
+ name: `${t}(無效欄位)`
916
+ };
917
+ return {
918
+ options: [...n, e],
919
+ problem: yn,
920
+ selected: e
921
+ };
922
+ }
923
+ return {
924
+ options: n,
925
+ problem: n.length === 0 ? vn : null,
926
+ selected: null
927
+ };
928
+ }
929
+ function Dn(e, t) {
930
+ if (!t.trim()) return "依表單欄位:未設定";
931
+ let n = e?.fields.find((e) => e.fieldKey === t);
932
+ return n && !Ee(n) ? `依表單欄位:${n.label || t}(非人員選擇欄位)` : `依表單欄位:${n?.label || t}`;
933
+ }
934
+ //#endregion
935
+ //#region src/views/templates/designer/designer-version-labels.ts
936
+ function On(e) {
937
+ return `${e.draftVersion === null ? "尚未建立草稿" : `草稿 v${e.draftVersion}`} · ${e.publishedVersion === null ? e.hasPublishedVersion ? "已發布版本" : "尚未發布" : `已發布 v${e.publishedVersion}`}`;
938
+ }
939
+ function kn(e, t) {
940
+ return `表單:${e} v${t}`;
941
+ }
942
+ //#endregion
855
943
  //#region src/views/templates/designer/TemplateDesignerView.tsx
856
- var un = {
944
+ var An = {
857
945
  display: "grid",
858
946
  gap: 16
859
- }, dn = {
947
+ }, jn = {
860
948
  alignItems: "start",
861
949
  display: "grid",
862
950
  gap: 16,
863
951
  gridTemplateColumns: "minmax(0, 1fr) 420px"
864
- }, fn = {
952
+ }, Mn = {
865
953
  border: "1px solid var(--mzn-color-border-neutral)",
866
954
  borderRadius: 6,
867
955
  height: 620,
868
956
  minWidth: 0,
869
957
  overflow: "hidden"
870
- }, pn = {
958
+ }, Nn = {
871
959
  alignItems: "center",
872
960
  boxSizing: "border-box",
873
961
  color: "var(--mzn-color-text-error)",
@@ -877,24 +965,24 @@ var un = {
877
965
  lineHeight: 0,
878
966
  padding: 0,
879
967
  width: 26
880
- }, mn = {
968
+ }, Pn = {
881
969
  alignItems: "center",
882
970
  display: "flex",
883
971
  height: "100%",
884
972
  justifyContent: "center",
885
973
  width: "100%"
886
- }, hn = "workflow-designer-side-panel", B = 96, gn = `
887
- .${hn} .mzn-form-field--stretch .mzn-form-field__label-area,
888
- .${hn} .mzn-form-field--horizontal .mzn-form-field__label-area {
889
- flex: 0 0 ${B}px;
890
- width: ${B}px;
974
+ }, Fn = "workflow-designer-side-panel", V = 96, In = `
975
+ .${Fn} .mzn-form-field--stretch .mzn-form-field__label-area,
976
+ .${Fn} .mzn-form-field--horizontal .mzn-form-field__label-area {
977
+ flex: 0 0 ${V}px;
978
+ width: ${V}px;
891
979
  }
892
980
 
893
- .${hn} .mzn-form-field--stretch .mzn-form-field__data-entry,
894
- .${hn} .mzn-form-field--horizontal .mzn-form-field__data-entry {
981
+ .${Fn} .mzn-form-field--stretch .mzn-form-field__data-entry,
982
+ .${Fn} .mzn-form-field--horizontal .mzn-form-field__data-entry {
895
983
  min-width: 0;
896
984
  }
897
- `, _n = "#2563eb", V = "#64748b", vn = "var(--mzn-color-text-error, #dc2626)", yn = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", bn = `
985
+ `, Ln = "#2563eb", H = "#64748b", Rn = "var(--mzn-color-text-error, #dc2626)", zn = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", Bn = `
898
986
  .workflow-selection-delete-control.react-flow__controls-button {
899
987
  align-items: center !important;
900
988
  display: flex !important;
@@ -919,26 +1007,26 @@ var un = {
919
1007
 
920
1008
  .workflow-edge--selected .react-flow__edge-path,
921
1009
  .react-flow__edge-path.workflow-edge--selected {
922
- filter: ${yn};
1010
+ filter: ${zn};
923
1011
  opacity: 1 !important;
924
- stroke: ${V} !important;
1012
+ stroke: ${H} !important;
925
1013
  stroke-opacity: 1 !important;
926
1014
  stroke-width: 1.5px !important;
927
1015
  }
928
1016
 
929
1017
  .workflow-edge--selected {
930
- --xy-edge-stroke: ${V};
931
- --xy-edge-stroke-selected: ${V};
1018
+ --xy-edge-stroke: ${H};
1019
+ --xy-edge-stroke-selected: ${H};
932
1020
  --xy-edge-stroke-width: 1.5px;
933
1021
  }
934
1022
 
935
- `, xn = {
1023
+ `, Vn = {
936
1024
  display: "grid",
937
1025
  gap: 12
938
- }, H = {
1026
+ }, U = {
939
1027
  display: "grid",
940
1028
  gap: 12
941
- }, Sn = {
1029
+ }, Hn = {
942
1030
  border: "1px solid var(--mzn-color-border-neutral)",
943
1031
  borderRadius: 6,
944
1032
  display: "grid",
@@ -946,26 +1034,26 @@ var un = {
946
1034
  maxHeight: 360,
947
1035
  overflow: "auto",
948
1036
  padding: 12
949
- }, Cn = {
1037
+ }, Un = {
950
1038
  borderBottom: "1px solid var(--mzn-color-border-neutral)",
951
1039
  display: "grid",
952
1040
  gap: 4,
953
1041
  padding: "0 0 8px"
954
- }, wn = {
1042
+ }, Wn = {
955
1043
  display: "flex",
956
1044
  flexWrap: "wrap",
957
1045
  gap: 8
958
- }, Tn = {
1046
+ }, Gn = {
959
1047
  alignItems: "center",
960
1048
  display: "flex",
961
1049
  gap: 8
962
- }, En = {
1050
+ }, Kn = {
963
1051
  flex: "1 1 auto",
964
1052
  minWidth: 0
965
- }, Dn = { flex: "0 0 auto" }, On = {
1053
+ }, qn = { flex: "0 0 auto" }, Jn = {
966
1054
  display: "grid",
967
1055
  gap: 8
968
- }, U = {
1056
+ }, Yn = {
969
1057
  alignContent: "center",
970
1058
  background: "var(--mzn-color-bg-surface)",
971
1059
  border: "1px solid var(--mzn-color-border-neutral)",
@@ -980,70 +1068,70 @@ var un = {
980
1068
  padding: "10px 12px",
981
1069
  textAlign: "center",
982
1070
  width: "100%"
983
- }, kn = "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)", An = 64, W = 160, jn = 20, Mn = 64, Nn = 180, Pn = {
984
- ...U,
1071
+ }, Xn = "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)", W = 64, G = 160, Zn = 20, Qn = 64, K = 180, q = {
1072
+ ...Yn,
985
1073
  display: "grid",
986
1074
  gap: 8,
987
1075
  padding: "10px 12px"
988
- }, Fn = {
989
- ...Pn,
1076
+ }, $n = {
1077
+ ...q,
990
1078
  background: "#eff6ff",
991
1079
  border: "1px solid #2563eb"
992
- }, In = {
993
- ...Pn,
1080
+ }, er = {
1081
+ ...q,
994
1082
  background: "#f0fdfa",
995
1083
  border: "1px solid #0f766e"
996
- }, G = {
997
- ...U,
1084
+ }, tr = {
1085
+ ...Yn,
998
1086
  background: "#ffffff"
999
- }, Ln = {
1000
- ...U,
1087
+ }, J = {
1088
+ ...Yn,
1001
1089
  background: "#ecfdf3",
1002
1090
  border: "1px solid #2f855a"
1003
- }, Rn = {
1004
- ...U,
1091
+ }, nr = {
1092
+ ...Yn,
1005
1093
  background: "#fff4ed",
1006
1094
  border: "1px solid #c2410c"
1007
- }, K = {
1095
+ }, rr = {
1008
1096
  display: "block",
1009
1097
  maxWidth: "100%",
1010
1098
  minWidth: 0
1011
- }, zn = {
1099
+ }, ir = {
1012
1100
  display: "grid",
1013
1101
  gap: 2,
1014
1102
  minWidth: 0
1015
- }, Bn = "input", q = "output", Vn = {
1103
+ }, ar = "input", or = "output", sr = {
1016
1104
  endEvent: "結束",
1017
1105
  exclusiveGateway: "條件分流",
1018
1106
  parallelGateway: "並行處理",
1019
1107
  serviceTask: "系統",
1020
1108
  startEvent: "開始",
1021
1109
  userTask: "簽核"
1022
- }, Hn = [{
1023
- icon: pe,
1110
+ }, cr = [{
1111
+ icon: me,
1024
1112
  label: "簽核節點",
1025
1113
  type: "userTask"
1026
1114
  }, {
1027
- icon: le,
1115
+ icon: ue,
1028
1116
  label: "知會節點",
1029
1117
  type: "serviceTask"
1030
- }], Un = [{
1031
- icon: ce,
1118
+ }], lr = [{
1119
+ icon: le,
1032
1120
  label: "條件分流",
1033
1121
  type: "exclusiveGateway"
1034
- }], Wn = [{
1122
+ }], ur = [{
1035
1123
  id: "AND",
1036
1124
  name: "全部前置完成"
1037
1125
  }, {
1038
1126
  id: "OR",
1039
1127
  name: "任一前置完成"
1040
- }], Gn = [{
1128
+ }], dr = [{
1041
1129
  id: "RESTART",
1042
1130
  name: "重新送出後從開始重跑"
1043
1131
  }, {
1044
1132
  id: "FROM_RETURN_POINT",
1045
1133
  name: "重新送出後回到退回節點"
1046
- }], Kn = [
1134
+ }], fr = [
1047
1135
  {
1048
1136
  id: "NONE",
1049
1137
  name: "不提醒",
@@ -1064,11 +1152,15 @@ var un = {
1064
1152
  name: "剩十分之一時提醒",
1065
1153
  value: .9
1066
1154
  }
1067
- ], qn = [
1155
+ ], pr = [
1068
1156
  {
1069
1157
  id: "DIRECT",
1070
1158
  name: "指定會員"
1071
1159
  },
1160
+ {
1161
+ id: "DYNAMIC_FORM",
1162
+ name: "依表單欄位指定"
1163
+ },
1072
1164
  {
1073
1165
  id: "ORG_MANAGER",
1074
1166
  name: "發起人主管"
@@ -1093,13 +1185,13 @@ var un = {
1093
1185
  id: "POSITION",
1094
1186
  name: "指定職位"
1095
1187
  }
1096
- ], Jn = [{
1188
+ ], mr = [{
1097
1189
  id: "COUNT",
1098
1190
  name: "人數"
1099
1191
  }, {
1100
1192
  id: "PERCENTAGE",
1101
1193
  name: "百分比"
1102
- }], Yn = [
1194
+ }], Y = [
1103
1195
  {
1104
1196
  id: "1",
1105
1197
  name: "直屬主管",
@@ -1115,13 +1207,13 @@ var un = {
1115
1207
  name: "第三層主管",
1116
1208
  value: 3
1117
1209
  }
1118
- ], Xn = [{
1210
+ ], hr = [{
1119
1211
  id: "NONE",
1120
1212
  name: "停止流程並提示"
1121
1213
  }, {
1122
1214
  id: "DIRECT",
1123
1215
  name: "固定改派"
1124
- }], Zn = [
1216
+ }], gr = [
1125
1217
  {
1126
1218
  id: "INITIATOR_MANAGER",
1127
1219
  name: "改由申請人的直屬主管簽核"
@@ -1134,7 +1226,7 @@ var un = {
1134
1226
  id: "FAIL",
1135
1227
  name: "停止流程並提示"
1136
1228
  }
1137
- ], Qn = { whenEmpty: "INITIATOR_MANAGER" }, J = [
1229
+ ], _r = { whenEmpty: "INITIATOR_MANAGER" }, vr = [
1138
1230
  {
1139
1231
  id: "EQUALS",
1140
1232
  name: "等於"
@@ -1167,14 +1259,14 @@ var un = {
1167
1259
  id: "IS_EMPTY",
1168
1260
  name: "未填寫"
1169
1261
  }
1170
- ], $n = [
1262
+ ], yr = [
1171
1263
  "EQUALS",
1172
1264
  "GREATER_THAN",
1173
1265
  "GREATER_THAN_OR_EQUALS",
1174
1266
  "LESS_THAN",
1175
1267
  "LESS_THAN_OR_EQUALS",
1176
1268
  "NOT_EQUALS"
1177
- ], er = [
1269
+ ], br = [
1178
1270
  {
1179
1271
  id: "NONE",
1180
1272
  name: "未設定"
@@ -1191,93 +1283,93 @@ var un = {
1191
1283
  id: "ORG_UNIT_POSITION",
1192
1284
  name: "指定組織職位"
1193
1285
  }
1194
- ], tr = {
1286
+ ], xr = {
1195
1287
  id: "CUSTOM",
1196
1288
  name: "既有自訂規則"
1197
- }, nr = "member-001", rr = {
1289
+ }, Sr = "member-001", Cr = {
1198
1290
  display: "flex",
1199
1291
  flexDirection: "column",
1200
1292
  height: "100%"
1201
- }, ir = {
1293
+ }, wr = {
1202
1294
  flex: 1,
1203
1295
  minHeight: 0,
1204
1296
  overflowY: "auto"
1205
- }, ar = {
1297
+ }, Tr = {
1206
1298
  borderTop: "1px solid var(--mzn-color-border-neutral)",
1207
1299
  display: "flex",
1208
1300
  gap: 8,
1209
1301
  paddingTop: 12
1210
- }, or = {
1302
+ }, Er = {
1211
1303
  fields: [],
1212
1304
  schemaVersion: 1
1213
- }, sr = {
1305
+ }, Dr = {
1214
1306
  layout: [],
1215
1307
  schemaVersion: 1
1216
- }, cr = {
1217
- endEvent: Y,
1218
- exclusiveGateway: Y,
1219
- parallelGateway: Y,
1220
- serviceTask: Y,
1221
- startEvent: Y,
1222
- userTask: Y
1308
+ }, Or = {
1309
+ endEvent: X,
1310
+ exclusiveGateway: X,
1311
+ parallelGateway: X,
1312
+ serviceTask: X,
1313
+ startEvent: X,
1314
+ userTask: X
1223
1315
  };
1224
- function lr(e, t) {
1316
+ function kr(e, t) {
1225
1317
  return typeof e == "function" ? e(t) : e;
1226
1318
  }
1227
- function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride: c, initialInitiatorPolicyCel: oe, initialWorkflowDefinition: ce, onInitiatorPolicyChange: le, onWorkflowChange: ue, showAiAssistant: pe = !1, showDryRun: me = !0, templateId: he }) {
1228
- let ge = e(), _e = t(), [E, ve] = p(null), [ye, be] = p(null), [xe, Ce] = p(""), [we, D] = p(null), [je, O] = p(null), Pe = f(null), [Fe, Ke] = p(void 0), qe = f([]), Ye = f([]), k = ht({
1229
- directory: d(() => ({
1230
- listOrgUnits: async () => qe.current.map((e) => ({
1319
+ function Ar({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride: u, initialInitiatorPolicyCel: se, initialWorkflowDefinition: le, onInitiatorPolicyChange: ue, onWorkflowChange: de, showAiAssistant: me = !1, showDryRun: he = !0, templateId: ge }) {
1320
+ let _e = e(), ve = t(), [D, ye] = h(null), [be, xe] = h(null), [Se, we] = h(""), [Te, Ee] = h(null), [Me, Pe] = h(null), O = m(null), [Le, Re] = h(void 0), Ye = m([]), Xe = m([]), k = yt({
1321
+ directory: p(() => ({
1322
+ listOrgUnits: async () => Ye.current.map((e) => ({
1231
1323
  id: e.id,
1232
1324
  name: e.name
1233
1325
  })),
1234
- listPositions: async () => Ye.current.map((e) => ({
1326
+ listPositions: async () => Xe.current.map((e) => ({
1235
1327
  id: e.id,
1236
1328
  name: e.name
1237
1329
  })),
1238
- searchMembers: async (e) => yi(await Ue(e)).map((e) => ({
1330
+ searchMembers: async (e) => Li(await Ke(e)).map((e) => ({
1239
1331
  email: e.email,
1240
1332
  id: e.memberId,
1241
1333
  name: e.name
1242
1334
  }))
1243
1335
  }), []),
1244
1336
  initialState: {
1245
- definition: a && ce != null ? Sr(ce) : Dr(),
1337
+ definition: a && le != null ? Vr(le) : Kr(),
1246
1338
  editingEdgeId: null,
1247
1339
  formDefinitionVersionId: null,
1248
1340
  formSchema: null,
1249
- initiatorPolicyCel: a && oe !== void 0 ? oe : null,
1341
+ initiatorPolicyCel: a && se !== void 0 ? se : null,
1250
1342
  selectedEdgeIds: [],
1251
- selectedNodeId: a && ce != null ? ce.nodes[0]?.id ?? "start" : "start"
1343
+ selectedNodeId: a && le != null ? le.nodes[0]?.id ?? "start" : "start"
1252
1344
  },
1253
- layout: kr,
1345
+ layout: Jr,
1254
1346
  onLayout: (e) => {
1255
- let t = Hi(e, Pe.current);
1256
- t && Ke(t);
1347
+ let t = sa(e, O.current);
1348
+ t && Re(t);
1257
1349
  }
1258
- }), A = k.state.definition, j = k.state.formDefinitionVersionId, M = k.state.initiatorPolicyCel, nt = k.state.selectedNodeId, N = k.state.selectedEdgeIds, at = k.state.editingEdgeId, ot = (e) => k.replaceState((t) => ({
1350
+ }), A = k.state.definition, j = k.state.formDefinitionVersionId, M = k.state.initiatorPolicyCel, it = k.state.selectedNodeId, N = k.state.selectedEdgeIds, ot = k.state.editingEdgeId, st = (e) => k.replaceState((t) => ({
1259
1351
  ...t,
1260
- definition: lr(e, t.definition)
1261
- })), st = (e) => k.replaceState((t) => ({
1352
+ definition: kr(e, t.definition)
1353
+ })), lt = (e) => k.replaceState((t) => ({
1262
1354
  ...t,
1263
- formDefinitionVersionId: lr(e, t.formDefinitionVersionId)
1264
- })), ct = (e) => k.replaceState((t) => ({
1355
+ formDefinitionVersionId: kr(e, t.formDefinitionVersionId)
1356
+ })), ut = (e) => k.replaceState((t) => ({
1265
1357
  ...t,
1266
- initiatorPolicyCel: lr(e, t.initiatorPolicyCel)
1267
- })), lt = (e) => k.replaceState((t) => ({
1358
+ initiatorPolicyCel: kr(e, t.initiatorPolicyCel)
1359
+ })), dt = (e) => k.replaceState((t) => ({
1268
1360
  ...t,
1269
- selectedNodeId: lr(e, t.selectedNodeId)
1270
- })), gt = (e) => k.replaceState((t) => ({
1361
+ selectedNodeId: kr(e, t.selectedNodeId)
1362
+ })), ft = (e) => k.replaceState((t) => ({
1271
1363
  ...t,
1272
- selectedEdgeIds: lr(e, t.selectedEdgeIds)
1273
- })), _t = (e) => k.replaceState((t) => ({
1364
+ selectedEdgeIds: kr(e, t.selectedEdgeIds)
1365
+ })), pt = (e) => k.replaceState((t) => ({
1274
1366
  ...t,
1275
- editingEdgeId: lr(e, t.editingEdgeId)
1276
- })), [vt, P] = p(null), [yt, bt] = p(null);
1277
- u(() => {
1278
- bt(null);
1279
- }, [nt]);
1280
- let [xt, St] = p(!0), [Ct, wt] = p(!1), [Tt, Et] = p(!1), [Dt, Ot] = p([]), kt = d(() => JSON.stringify({
1367
+ editingEdgeId: kr(e, t.editingEdgeId)
1368
+ })), [bt, P] = h(null), [xt, F] = h(null);
1369
+ f(() => {
1370
+ F(null);
1371
+ }, [it]);
1372
+ let [St, Ct] = h(!0), [wt, Tt] = h(!1), [Et, Dt] = h(!1), [Ot, kt] = h([]), At = p(() => JSON.stringify({
1281
1373
  formDefinitionVersionId: j,
1282
1374
  initiatorPolicyCel: M,
1283
1375
  workflowDefinition: A
@@ -1285,250 +1377,248 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1285
1377
  j,
1286
1378
  M,
1287
1379
  A
1288
- ]), F = !!xe && kt !== xe, [At, jt] = p(!1), [I, Mt] = p([]), [Pt, It] = p([]), Lt = f(0), [L, Rt] = p([]), [R, zt] = p([]), [Bt, Vt] = p([]);
1289
- qe.current = L, Ye.current = R;
1290
- let [Ht, Ut] = p(!1), [Gt, Kt] = p(!1), [qt, Yt] = p("{}"), [Xt, Zt] = p(null), [Qt, $t] = p(null), [en, tn] = p([]), [nn, an] = p("loading"), [on, sn] = p(!1), [cn, ln] = p(!1), [z, B] = p(null), [_n, V] = p(!1), [yn, U] = p(!1), kn = F || _n ? "保存並發布" : ye ? "發布草稿" : "已發布";
1291
- u(() => {
1292
- a ? pr() : mr();
1293
- }, [a, he]), u(() => {
1380
+ ]), jt = !!Se && At !== Se, [Mt, Nt] = h(!1), [I, Pt] = h([]), [Ft, It] = h([]), Rt = m(0), Bt = m(/* @__PURE__ */ new Set()), [L, Vt] = h([]), [R, Ht] = h([]), [Ut, Wt] = h([]);
1381
+ Ye.current = L, Xe.current = R;
1382
+ let [Gt, Kt] = h(!1), [qt, Yt] = h(!1), [Xt, Zt] = h("{}"), [$t, en] = h(null), [tn, nn] = h(null), [rn, an] = h([]), [on, sn] = h("loading"), [ln, un] = h(!1), [dn, fn] = h(!1), [z, pn] = h(null), [hn, gn] = h(!1), [vn, yn] = h(!1), bn = jt || hn ? "保存並發布" : be ? "發布草稿" : "已發布";
1383
+ f(() => {
1384
+ a ? $n() : er();
1385
+ }, [a, ge]), f(() => {
1294
1386
  function e(e) {
1295
- F && (e.preventDefault(), e.returnValue = "");
1387
+ jt && (e.preventDefault(), e.returnValue = "");
1296
1388
  }
1297
1389
  return window.addEventListener("beforeunload", e), () => {
1298
1390
  window.removeEventListener("beforeunload", e);
1299
1391
  };
1300
- }, [F]), u(() => {
1301
- _r(A);
1302
- }, [A, I]), u(() => {
1303
- ot((e) => Sr(e));
1392
+ }, [jt]), f(() => {
1393
+ nr(A);
1394
+ }, [A, I]), f(() => {
1395
+ st((e) => Vr(e));
1304
1396
  }, [A.edges, A.nodes]);
1305
- function An() {
1306
- (!F || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && ge.push(_e.templates());
1397
+ function xn() {
1398
+ (!jt || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && _e.push(ve.templates());
1307
1399
  }
1308
- let W = d(() => A.nodes.find((e) => e.id === nt) ?? null, [nt, A.nodes]), jn = W ? si(W) : !1, Mn = N.length > 0 || jn, Nn = l(() => {
1400
+ let B = p(() => A.nodes.find((e) => e.id === it) ?? null, [it, A.nodes]), Sn = B ? Ei(B) : !1, Cn = N.length > 0 || Sn, wn = d(() => {
1309
1401
  k.getState().selectedEdgeIds.forEach((e) => k.dispatch({
1310
1402
  edgeId: e,
1311
1403
  type: "deleteEdge"
1312
- })), W && si(W) && k.dispatch({
1313
- nodeId: W.id,
1404
+ })), B && Ei(B) && k.dispatch({
1405
+ nodeId: B.id,
1314
1406
  type: "deleteNode"
1315
1407
  });
1316
- }, [k, W]);
1317
- u(() => {
1318
- if (!Mn) return;
1408
+ }, [k, B]);
1409
+ f(() => {
1410
+ if (!Cn) return;
1319
1411
  function e(e) {
1320
- (e.key === "Delete" || e.key === "Backspace") && (ui(e.target) || (e.preventDefault(), Nn()));
1412
+ (e.key === "Delete" || e.key === "Backspace") && (Ai(e.target) || (e.preventDefault(), wn()));
1321
1413
  }
1322
1414
  return window.addEventListener("keydown", e), () => {
1323
1415
  window.removeEventListener("keydown", e);
1324
1416
  };
1325
- }, [Mn, Nn]);
1326
- let Pn = d(() => A.edges.find((e) => e.id === at) ?? null, [at, A.edges]), Fn = d(() => N.length === 1 ? A.edges.find((e) => e.id === N[0]) ?? null : null, [N, A.edges]), In = d(() => N.map((e) => A.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [N, A.edges]), G = d(() => je ?? $r(M, we), [
1417
+ }, [Cn, wn]);
1418
+ let Tn = p(() => A.edges.find((e) => e.id === ot) ?? null, [ot, A.edges]), Dn = p(() => N.length === 1 ? A.edges.find((e) => e.id === N[0]) ?? null : null, [N, A.edges]), kn = p(() => N.map((e) => A.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [N, A.edges]), V = p(() => Me ?? vi(M, Te), [
1327
1419
  M,
1328
- je,
1329
- we
1330
- ]), Ln = d(() => A.nodes.map((e) => gr(e, I, L, R, e.id === nt, G)), [
1331
- G,
1332
- I,
1333
- L,
1334
- R,
1335
- nt,
1336
- A.nodes
1337
- ]), Rn = d(() => A.edges.map((e) => br(e, A.nodes, N.includes(e.id))), [
1420
+ Me,
1421
+ Te
1422
+ ]), Ln = p(() => A.edges.map((e) => Br(e, A.nodes, N.includes(e.id))), [
1338
1423
  N,
1339
1424
  A.edges,
1340
1425
  A.nodes
1341
- ]), K = d(() => Z(Dt, j) ?? Z(di(E?.formVersions ?? []), j), [
1426
+ ]), H = p(() => $(Ot, j) ?? $(ji(D?.formVersions ?? []), j), [
1342
1427
  j,
1343
- Dt,
1344
- E?.formVersions
1345
- ]), zn = d(() => vi(Dt, K), [Dt, K]), Bn = K?.schema ?? null, q = a ? c ?? null : Bn;
1346
- u(() => {
1347
- k.getState().formSchema !== q && k.replaceState((e) => ({
1428
+ Ot,
1429
+ D?.formVersions
1430
+ ]), zn = p(() => Ii(Ot, H), [Ot, H]), Yn = H?.schema ?? null, Xn = a ? u ?? null : Yn;
1431
+ f(() => {
1432
+ k.getState().formSchema !== Xn && k.replaceState((e) => ({
1348
1433
  ...e,
1349
- formSchema: q
1434
+ formSchema: Xn
1350
1435
  }));
1351
- }, [k, q]);
1352
- let J = d(() => Ui(A), [A]);
1353
- u(() => {
1436
+ }, [k, Xn]);
1437
+ let W = p(() => ca(A), [A]);
1438
+ f(() => {
1354
1439
  let e = !0;
1355
- return ze({ includeDeprecated: !0 }).then((t) => {
1356
- e && (tn(t), an("ready"));
1440
+ return He({ includeDeprecated: !0 }).then((t) => {
1441
+ e && (an(t), sn("ready"));
1357
1442
  }).catch(() => {
1358
- e && an("unavailable");
1443
+ e && sn("unavailable");
1359
1444
  }), () => {
1360
1445
  e = !1;
1361
1446
  };
1362
1447
  }, []);
1363
- let $n = _n && z ? z.schema : q, ur = d(() => nn === "ready" ? Jt({
1448
+ let G = hn && z ? z.schema : Xn, Zn = p(() => on === "ready" ? Qt({
1364
1449
  definition: A,
1365
- endpoints: en,
1366
- formFields: $n?.fields ?? []
1450
+ endpoints: rn,
1451
+ formFields: G?.fields ?? []
1367
1452
  })[0] ?? null : null, [
1368
- en,
1369
- nn,
1370
- $n,
1453
+ rn,
1454
+ on,
1455
+ G,
1371
1456
  A
1372
- ]), Y = d(() => et(A), [A]), fr = d(() => ei(G), [G]);
1373
- u(() => {
1374
- a && ue?.(A);
1375
- }, [a, A]), u(() => {
1376
- a && le?.(M);
1457
+ ]), Qn = p(() => A.nodes.map((e) => Ir(e, I, L, R, e.id === it, V, G)), [
1458
+ V,
1459
+ I,
1460
+ L,
1461
+ R,
1462
+ it,
1463
+ G,
1464
+ A.nodes
1465
+ ]), K = p(() => nt(A), [A]), q = p(() => yi(V), [V]);
1466
+ f(() => {
1467
+ a && de?.(A);
1468
+ }, [a, A]), f(() => {
1469
+ a && ue?.(M);
1377
1470
  }, [a, M]);
1378
- async function pr() {
1379
- St(!0), P(null);
1471
+ async function $n() {
1472
+ Ct(!0), P(null);
1380
1473
  try {
1381
- let e = await Te();
1382
- Rt(e.orgUnits), zt(e.positions), Vt(e.memberships);
1474
+ let e = await De();
1475
+ Vt(e.orgUnits), Ht(e.positions), Wt(e.memberships);
1383
1476
  } catch (e) {
1384
- P(na(e));
1477
+ P(ba(e));
1385
1478
  } finally {
1386
- St(!1);
1479
+ Ct(!1);
1387
1480
  }
1388
1481
  }
1389
- async function mr() {
1390
- St(!0), P(null), bt(null);
1482
+ async function er() {
1483
+ Ct(!0), P(null), F(null);
1391
1484
  try {
1392
- let [e, t] = await Promise.all([Ve(he), Te()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
1393
- ve(e), be(n), Rt(t.orgUnits), zt(t.positions), Vt(t.memberships), Ot(di(e.formVersions));
1394
- let i = Sr(r?.workflowDefinition ?? Dr()), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
1395
- ot(i), st(a), ct(o), Ce(JSON.stringify({
1485
+ let [e, t] = await Promise.all([We(ge), De()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
1486
+ ye(e), xe(n), Vt(t.orgUnits), Ht(t.positions), Wt(t.memberships), kt(ji(e.formVersions));
1487
+ let i = Vr(r?.workflowDefinition ?? Kr()), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
1488
+ st(i), lt(a), ut(o), we(JSON.stringify({
1396
1489
  formDefinitionVersionId: a,
1397
1490
  initiatorPolicyCel: o,
1398
1491
  workflowDefinition: i
1399
- })), D(r && !e.template.currentVersionId && !r.initiatorPolicyCel && Or(r.workflowDefinition) ? "NONE" : null), O(null), lt(r?.workflowDefinition.nodes[0]?.id ?? "start"), gt([]), _t(null), B(null), V(!1);
1492
+ })), Ee(r && !e.template.currentVersionId && !r.initiatorPolicyCel && qr(r.workflowDefinition) ? "NONE" : null), Pe(null), dt(r?.workflowDefinition.nodes[0]?.id ?? "start"), ft([]), pt(null), pn(null), gn(!1);
1400
1493
  } catch (e) {
1401
- P(na(e));
1494
+ P(ba(e));
1402
1495
  } finally {
1403
- St(!1);
1496
+ Ct(!1);
1404
1497
  }
1405
1498
  }
1406
- async function hr(e) {
1407
- Et(!0), P(null);
1499
+ async function tr(e) {
1500
+ Dt(!0), P(null);
1408
1501
  try {
1409
- let t = await We(e);
1410
- Ot(vi(di(t), K));
1502
+ let t = await qe(e);
1503
+ kt(Ii(ji(t), H));
1411
1504
  } catch (e) {
1412
- P(na(e));
1505
+ P(ba(e));
1413
1506
  } finally {
1414
- Et(!1);
1507
+ Dt(!1);
1415
1508
  }
1416
1509
  }
1417
- async function X(e) {
1418
- jt(!0), P(null);
1419
- let t = ++Lt.current;
1510
+ async function J(e) {
1511
+ Nt(!0), P(null);
1512
+ let t = ++Rt.current;
1420
1513
  try {
1421
- let n = yi(await Ue(e));
1422
- Mt((e) => Mi(e, n)), t === Lt.current && It(n);
1514
+ let n = Li(await Ke(e));
1515
+ Pt((e) => Zi(e, n)), t === Rt.current && It(n);
1423
1516
  } catch (e) {
1424
- t === Lt.current && P(na(e));
1517
+ t === Rt.current && P(ba(e));
1425
1518
  } finally {
1426
- t === Lt.current && jt(!1);
1519
+ t === Rt.current && Nt(!1);
1427
1520
  }
1428
1521
  }
1429
- async function _r(e) {
1430
- let t = Pi(e).filter((e) => !I.some((t) => t.memberId === e && !t.unresolved));
1431
- if (t.length !== 0) try {
1432
- let e = await He(t);
1433
- Mt((t) => Mi(t, yi(e)));
1434
- } catch {
1435
- Mt((e) => Mi(e, t.map(bi)));
1436
- }
1522
+ async function nr(e) {
1523
+ let t = $i(e), n = s(t.filter((e) => !I.some((t) => t.memberId === e && !t.unresolved)), Bt.current);
1524
+ if (n.length === 0) return;
1525
+ let { profiles: r, skippedIds: i } = await c(n, Ge), a = new Set(r.map((e) => e.memberId)), o = n.filter((e) => !a.has(e) && !i.includes(e));
1526
+ o.forEach((e) => Bt.current.add(e)), Pt((e) => Zi(e, [...Li(r), ...[...o, ...i].map(Ri)]));
1437
1527
  }
1438
- async function vr(e) {
1439
- wt(!0), P(null);
1528
+ async function rr(e) {
1529
+ Tt(!0), P(null);
1440
1530
  try {
1441
- let t = Ui(A), n = ei(G), r = e ? ur : null;
1531
+ let t = ca(A), n = yi(V), r = e ? Zn : null;
1442
1532
  if (t || n || r) {
1443
1533
  let e = t ?? n ?? r ?? "流程設定未完成";
1444
1534
  throw P(e), Error(e);
1445
1535
  }
1446
- if (_n && z !== null) await Ie({
1447
- category: E?.template.category ?? null,
1448
- categoryId: E?.template.categoryId ?? null,
1449
- formDefinitionId: K?.formDefinitionId ?? null,
1536
+ if (hn && z !== null) await ze({
1537
+ category: D?.template.category ?? null,
1538
+ categoryId: D?.template.categoryId ?? null,
1539
+ formDefinitionId: H?.formDefinitionId ?? null,
1450
1540
  formDescription: null,
1451
- formName: K?.formName ?? E?.template.name ?? "表單",
1541
+ formName: H?.formName ?? D?.template.name ?? "表單",
1452
1542
  initiatorPolicyCel: M,
1453
1543
  notificationConfig: null,
1454
1544
  publish: e,
1455
1545
  schema: z.schema,
1456
1546
  slaDefaults: null,
1457
1547
  templateDescription: null,
1458
- templateId: he ?? null,
1459
- templateName: E?.template.name ?? "模板",
1548
+ templateId: ge ?? null,
1549
+ templateName: D?.template.name ?? "模板",
1460
1550
  uiSchema: z.uiSchema,
1461
1551
  workflowDefinition: A
1462
- }), V(!1), B(null), await mr();
1552
+ }), gn(!1), pn(null), await er();
1463
1553
  else {
1464
- let t = ye ?? await Re(he), n = await Ge({
1554
+ let t = be ?? await Ve(ge), n = await Je({
1465
1555
  formDefinitionVersionId: j,
1466
1556
  initiatorPolicyCel: M,
1467
1557
  versionId: t.id,
1468
1558
  workflowDefinition: A
1469
1559
  });
1470
- be(n), e && await Be(n.id), await mr();
1560
+ xe(n), e && await Ue(n.id), await er();
1471
1561
  }
1472
1562
  } catch (e) {
1473
- throw P(na(e)), e;
1563
+ throw P(ba(e)), e;
1474
1564
  } finally {
1475
- wt(!1);
1565
+ Tt(!1);
1476
1566
  }
1477
1567
  }
1478
- async function yr() {
1479
- await vr(!1);
1568
+ async function ir() {
1569
+ await rr(!1);
1480
1570
  }
1481
- async function xr() {
1482
- await vr(!0);
1571
+ async function ar() {
1572
+ await rr(!0);
1483
1573
  }
1484
- function Cr() {
1485
- Yt(JSON.stringify(fi(K), null, 2)), Zt(null), $t(null), Ut(!0);
1574
+ function or() {
1575
+ Zt(JSON.stringify(mn(G), null, 2)), en(null), nn(null), Kt(!0);
1486
1576
  }
1487
- function wr() {
1488
- Gt || Ut(!1);
1577
+ function vr() {
1578
+ qt || Kt(!1);
1489
1579
  }
1490
- async function Tr() {
1491
- Kt(!0), $t(null), Zt(null);
1580
+ async function yr() {
1581
+ Yt(!0), nn(null), en(null);
1492
1582
  try {
1493
- let e = mi(qt), t = await Le({
1583
+ let e = Mi(Xt), t = await Be({
1494
1584
  formData: e,
1495
- initiatorMemberId: nr,
1496
- initiatorMetadataSnapshot: Ti(nr, Bt),
1585
+ initiatorMemberId: Sr,
1586
+ initiatorMetadataSnapshot: Wi(Sr, Ut),
1497
1587
  workflowDefinition: A
1498
1588
  });
1499
- Zt(t);
1589
+ en(t);
1500
1590
  } catch (e) {
1501
- $t(na(e));
1591
+ nn(ba(e));
1502
1592
  } finally {
1503
- Kt(!1);
1593
+ Yt(!1);
1504
1594
  }
1505
1595
  }
1506
- async function Er() {
1507
- if (ln(!0), z !== null) return;
1508
- let e = K?.formDefinitionId ?? null;
1596
+ async function Ar() {
1597
+ if (fn(!0), z !== null) return;
1598
+ let e = H?.formDefinitionId ?? null;
1509
1599
  if (!e) {
1510
- B({
1511
- schema: or,
1512
- uiSchema: sr
1600
+ pn({
1601
+ schema: Er,
1602
+ uiSchema: Dr
1513
1603
  });
1514
1604
  return;
1515
1605
  }
1516
- U(!0);
1606
+ yn(!0);
1517
1607
  try {
1518
- let t = await Se(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
1519
- B({
1520
- schema: n?.schema ?? or,
1521
- uiSchema: n?.uiSchema ?? sr
1608
+ 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;
1609
+ pn({
1610
+ schema: n?.schema ?? Er,
1611
+ uiSchema: n?.uiSchema ?? Dr
1522
1612
  });
1523
1613
  } catch (e) {
1524
- P(na(e));
1614
+ P(ba(e));
1525
1615
  } finally {
1526
- U(!1);
1616
+ yn(!1);
1527
1617
  }
1528
1618
  }
1529
- function Wr(e) {
1530
- let t = Ne(e, Ln);
1531
- ot((e) => ({
1619
+ function X(e) {
1620
+ let t = Ie(e, Qn);
1621
+ st((e) => ({
1532
1622
  ...e,
1533
1623
  nodes: e.nodes.map((e) => {
1534
1624
  let n = t.find((t) => t.id === e.id);
@@ -1539,126 +1629,126 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1539
1629
  })
1540
1630
  }));
1541
1631
  }
1542
- function Qr(e) {
1543
- ai(e, A.nodes) && e.source && e.target && k.dispatch({
1632
+ function Mr(e) {
1633
+ wi(e, A.nodes) && e.source && e.target && k.dispatch({
1544
1634
  source: e.source,
1545
1635
  target: e.target,
1546
1636
  type: "connectEdge"
1547
1637
  });
1548
1638
  }
1549
- function ti(e, t) {
1550
- e.stopPropagation(), gt((n) => e.shiftKey || e.metaKey || e.ctrlKey ? oi(n, t.id) : [t.id]), lt(null);
1639
+ function Nr(e, t) {
1640
+ e.stopPropagation(), ft((n) => e.shiftKey || e.metaKey || e.ctrlKey ? Ti(n, t.id) : [t.id]), dt(null);
1551
1641
  }
1552
- function ri() {
1553
- _t(null);
1642
+ function Pr() {
1643
+ pt(null);
1554
1644
  }
1555
- function ci(e) {
1645
+ function Fr(e) {
1556
1646
  k.dispatch({
1557
1647
  nodeType: e,
1558
1648
  type: "addNode"
1559
1649
  });
1560
1650
  }
1561
- function li(e) {
1562
- W && k.dispatch({
1651
+ function Lr(e) {
1652
+ B && k.dispatch({
1563
1653
  label: e,
1564
- nodeId: W.id,
1654
+ nodeId: B.id,
1565
1655
  type: "renameNode"
1566
1656
  });
1567
1657
  }
1568
- function Q(e) {
1569
- if (!W || W.type !== "userTask") return;
1570
- let t = W.id, n = W.data.decisionPolicy;
1658
+ function Z(e) {
1659
+ if (!B || B.type !== "userTask") return;
1660
+ let t = B.id, n = B.data.decisionPolicy;
1571
1661
  if (k.dispatch({
1572
1662
  approverResolver: e,
1573
1663
  nodeId: t,
1574
1664
  type: "setUserTaskApprover"
1575
- }), bt(null), rt(e, n)) {
1576
- bt({
1665
+ }), F(null), at(e, n)) {
1666
+ F({
1577
1667
  message: "主管鏈會依序加入多位主管,簽核方式已改為「依序簽核」。",
1578
1668
  nodeId: t,
1579
1669
  policyType: "SEQUENTIAL"
1580
1670
  });
1581
1671
  return;
1582
1672
  }
1583
- tt(n, e) && bt({
1584
- message: `簽核者已變更為 ${it(e)} 位,不足原本設定的 ${n?.type === "QUORUM" ? n.threshold : 0} 位門檻,簽核政策已重設為單人簽核,請重新設定。`,
1673
+ rt(n, e) && F({
1674
+ message: `簽核者已變更為 ${ct(e)} 位,不足原本設定的 ${n?.type === "QUORUM" ? n.threshold : 0} 位門檻,簽核政策已重設為單人簽核,請重新設定。`,
1585
1675
  nodeId: t,
1586
1676
  policyType: "SINGLE"
1587
1677
  });
1588
1678
  }
1589
- function pi(e) {
1590
- W && W.type === "userTask" && k.dispatch({
1591
- nodeId: W.id,
1679
+ function Rr(e) {
1680
+ B && B.type === "userTask" && k.dispatch({
1681
+ nodeId: B.id,
1592
1682
  resubmitStrategy: e,
1593
1683
  type: "setUserTaskReturnResubmitStrategy"
1594
1684
  });
1595
1685
  }
1596
- function hi(e) {
1597
- W && W.type === "userTask" && k.dispatch({
1598
- nodeId: W.id,
1686
+ function zr(e) {
1687
+ B && B.type === "userTask" && k.dispatch({
1688
+ nodeId: B.id,
1599
1689
  requireComment: e,
1600
1690
  type: "setUserTaskReturnRequireComment"
1601
1691
  });
1602
1692
  }
1603
- function $(e) {
1604
- W && W.type === "userTask" && k.dispatch({
1605
- nodeId: W.id,
1693
+ function Q(e) {
1694
+ B && B.type === "userTask" && k.dispatch({
1695
+ nodeId: B.id,
1606
1696
  sla: e,
1607
1697
  type: "setUserTaskSla"
1608
1698
  });
1609
1699
  }
1610
- function wi(e) {
1611
- W && W.type === "userTask" && k.dispatch({
1700
+ function Hr(e) {
1701
+ B && B.type === "userTask" && k.dispatch({
1612
1702
  excludeInitiator: e,
1613
- nodeId: W.id,
1703
+ nodeId: B.id,
1614
1704
  type: "setUserTaskExcludeInitiator"
1615
1705
  });
1616
1706
  }
1617
- function Ei(e) {
1618
- if (!W || W.type !== "userTask") return;
1619
- bt(null);
1707
+ function Ur(e) {
1708
+ if (!B || B.type !== "userTask") return;
1709
+ F(null);
1620
1710
  let t = e.type === "QUORUM" ? {
1621
1711
  ...e,
1622
- threshold: $e(e.threshold, e.thresholdType)
1712
+ threshold: tt(e.threshold, e.thresholdType)
1623
1713
  } : e;
1624
1714
  k.dispatch({
1625
1715
  decisionPolicy: t,
1626
- nodeId: W.id,
1716
+ nodeId: B.id,
1627
1717
  type: "setUserTaskDecisionPolicy"
1628
1718
  });
1629
1719
  }
1630
- function Di(e) {
1631
- W && W.type === "userTask" && k.dispatch({
1720
+ function Wr(e) {
1721
+ B && B.type === "userTask" && k.dispatch({
1632
1722
  ...e,
1633
- nodeId: W.id,
1723
+ nodeId: B.id,
1634
1724
  type: "setUserTaskOptions"
1635
1725
  });
1636
1726
  }
1637
- function Oi(e) {
1638
- W && W.type === "serviceTask" && k.dispatch({
1727
+ function Gr(e) {
1728
+ B && B.type === "serviceTask" && k.dispatch({
1639
1729
  action: e,
1640
- nodeId: W.id,
1730
+ nodeId: B.id,
1641
1731
  type: "setServiceAction"
1642
1732
  });
1643
1733
  }
1644
- function ki(e) {
1645
- O(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), D(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), ct(ni(e, L));
1734
+ function li(e) {
1735
+ Pe(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), Ee(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), ut(xi(e, L));
1646
1736
  }
1647
- function ji(e) {
1648
- W && W.type !== "startEvent" && k.dispatch({
1649
- nodeId: W.id,
1737
+ function _i(e) {
1738
+ B && B.type !== "startEvent" && k.dispatch({
1739
+ nodeId: B.id,
1650
1740
  triggerMode: e,
1651
1741
  type: "setNodeTriggerMode"
1652
1742
  });
1653
1743
  }
1654
- function Ni(e, t) {
1744
+ function bi(e, t) {
1655
1745
  k.dispatch({
1656
1746
  edgeId: e,
1657
1747
  isDefault: t,
1658
1748
  type: "setEdgeDefault"
1659
1749
  });
1660
1750
  }
1661
- function Fi({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1751
+ function Si({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1662
1752
  k.dispatch({
1663
1753
  edgeId: e,
1664
1754
  fieldKey: t,
@@ -1667,289 +1757,293 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1667
1757
  value: r
1668
1758
  });
1669
1759
  }
1670
- function Li() {
1760
+ function Di() {
1671
1761
  k.dispatch({ type: "autoLayout" });
1672
1762
  }
1673
- return /* @__PURE__ */ w(S, { children: [
1674
- /* @__PURE__ */ C("style", { children: gn }),
1675
- a ? null : /* @__PURE__ */ C(ee, { children: /* @__PURE__ */ w(ie, {
1676
- description: `${ye ? `草稿 v${ye.version}` : "尚未建立草稿"} ·${E?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
1677
- onBackClick: An,
1678
- title: E?.template.name ?? "流程設計器",
1763
+ return /* @__PURE__ */ E(w, { children: [
1764
+ /* @__PURE__ */ T("style", { children: In }),
1765
+ a ? null : /* @__PURE__ */ T(ee, { children: /* @__PURE__ */ E(ae, {
1766
+ description: On({
1767
+ draftVersion: be?.version ?? null,
1768
+ hasPublishedVersion: !!D?.template.currentVersionId,
1769
+ publishedVersion: D?.versions.find((e) => e.id === D.template.currentVersionId)?.version ?? null
1770
+ }),
1771
+ onBackClick: xn,
1772
+ title: D?.template.name ?? "流程設計器",
1679
1773
  children: [
1680
- pe ? /* @__PURE__ */ C(h, {
1774
+ me ? /* @__PURE__ */ T(_, {
1681
1775
  disabled: !r,
1682
- onClick: () => sn((e) => !e),
1683
- variant: on ? "base-primary" : "base-secondary",
1776
+ onClick: () => un((e) => !e),
1777
+ variant: ln ? "base-primary" : "base-secondary",
1684
1778
  children: r ? "AI 助理" : "AI 助理(未設定)"
1685
1779
  }) : null,
1686
- /* @__PURE__ */ C(h, {
1780
+ /* @__PURE__ */ T(_, {
1687
1781
  "aria-label": "儲存草稿",
1688
- disabled: Ct || !!J || !!fr,
1689
- icon: de,
1782
+ disabled: wt || !!W || !!q,
1783
+ icon: fe,
1690
1784
  iconType: "icon-only",
1691
- onClick: () => void yr(),
1785
+ onClick: () => void ir(),
1692
1786
  variant: "base-secondary",
1693
1787
  children: "儲存草稿"
1694
1788
  }),
1695
- me ? /* @__PURE__ */ C(h, {
1696
- disabled: xt || !!J || !!fr,
1697
- icon: se,
1789
+ he ? /* @__PURE__ */ T(_, {
1790
+ disabled: St || !!W || !!q,
1791
+ icon: ce,
1698
1792
  iconType: "leading",
1699
- onClick: Cr,
1793
+ onClick: or,
1700
1794
  variant: "base-secondary",
1701
1795
  children: "試跑流程"
1702
1796
  }) : null,
1703
- /* @__PURE__ */ C(h, {
1704
- disabled: Ct || !ye && !F && !_n || !!J || !!fr || !!ur,
1705
- icon: ae,
1797
+ /* @__PURE__ */ T(_, {
1798
+ disabled: wt || !be && !jt && !hn || !!W || !!q || !!Zn,
1799
+ icon: oe,
1706
1800
  iconType: "leading",
1707
- onClick: () => void xr(),
1801
+ onClick: () => void ar(),
1708
1802
  variant: "base-primary",
1709
- children: kn
1803
+ children: bn
1710
1804
  })
1711
1805
  ]
1712
1806
  }) }),
1713
- /* @__PURE__ */ C(ne, { children: /* @__PURE__ */ C(te, { children: /* @__PURE__ */ w("div", {
1714
- style: un,
1807
+ /* @__PURE__ */ T(ne, { children: /* @__PURE__ */ T(te, { children: /* @__PURE__ */ E("div", {
1808
+ style: An,
1715
1809
  children: [
1716
- vt ? /* @__PURE__ */ C(x, {
1810
+ bt ? /* @__PURE__ */ T(C, {
1717
1811
  color: "text-error",
1718
1812
  variant: "body",
1719
- children: vt
1813
+ children: bt
1720
1814
  }) : null,
1721
- yt && yt.nodeId === W?.id && W.type === "userTask" && (W.data.decisionPolicy?.type ?? "SINGLE") === yt.policyType ? /* @__PURE__ */ C(x, {
1815
+ xt && xt.nodeId === B?.id && B.type === "userTask" && (B.data.decisionPolicy?.type ?? "SINGLE") === xt.policyType ? /* @__PURE__ */ T(C, {
1722
1816
  color: "text-warning",
1723
1817
  variant: "body",
1724
- children: yt.message
1818
+ children: xt.message
1725
1819
  }) : null,
1726
- J ? /* @__PURE__ */ C(x, {
1820
+ W ? /* @__PURE__ */ T(C, {
1727
1821
  color: "text-error",
1728
1822
  variant: "body",
1729
- children: J
1823
+ children: W
1730
1824
  }) : null,
1731
- fr ? /* @__PURE__ */ C(x, {
1825
+ q ? /* @__PURE__ */ T(C, {
1732
1826
  color: "text-error",
1733
1827
  variant: "body",
1734
- children: fr
1828
+ children: q
1735
1829
  }) : null,
1736
- !J && ur ? /* @__PURE__ */ w(x, {
1830
+ !W && Zn ? /* @__PURE__ */ E(C, {
1737
1831
  color: "text-error",
1738
1832
  variant: "body",
1739
- children: ["發布前需修正:", ur]
1833
+ children: ["發布前需修正:", Zn]
1740
1834
  }) : null,
1741
- a ? null : /* @__PURE__ */ C("div", {
1742
- style: H,
1743
- children: /* @__PURE__ */ C(n, {
1744
- hintText: Y ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
1835
+ a ? null : /* @__PURE__ */ T("div", {
1836
+ style: U,
1837
+ children: /* @__PURE__ */ T(n, {
1838
+ hintText: K ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
1745
1839
  label: "綁定表單版本",
1746
1840
  name: "formDefinitionVersionId",
1747
1841
  required: !0,
1748
- children: /* @__PURE__ */ w("div", {
1749
- style: Tn,
1750
- children: [/* @__PURE__ */ C("div", {
1751
- style: En,
1752
- children: /* @__PURE__ */ C(m, {
1842
+ children: /* @__PURE__ */ E("div", {
1843
+ style: Gn,
1844
+ children: [/* @__PURE__ */ T("div", {
1845
+ style: Kn,
1846
+ children: /* @__PURE__ */ T(g, {
1753
1847
  asyncData: !0,
1754
- disabled: xt || Y,
1848
+ disabled: St || K,
1755
1849
  disabledOptionsFilter: !0,
1756
1850
  emptyText: "沒有符合的已發布表單版本",
1757
- isForceClearable: !!j && !Y,
1758
- loading: Tt,
1851
+ isForceClearable: !!j && !K,
1852
+ loading: Et,
1759
1853
  loadingText: "搜尋表單版本中...",
1760
1854
  mode: "single",
1761
1855
  onChange: (e) => {
1762
- Y || st(e?.id ?? null);
1856
+ K || lt(e?.id ?? null);
1763
1857
  },
1764
1858
  onClear: () => {
1765
- Y || st(null);
1859
+ K || lt(null);
1766
1860
  },
1767
- onSearch: hr,
1861
+ onSearch: tr,
1768
1862
  onVisibilityChange: (e) => {
1769
- e && !Y && hr("");
1863
+ e && !K && tr("");
1770
1864
  },
1771
1865
  options: [...zn],
1772
1866
  placeholder: "選擇已發布表單版本",
1773
1867
  searchDebounceTime: 300,
1774
- value: K
1868
+ value: H
1775
1869
  })
1776
- }), /* @__PURE__ */ C(h, {
1777
- disabled: xt,
1870
+ }), /* @__PURE__ */ T(_, {
1871
+ disabled: St,
1778
1872
  onClick: () => {
1779
- Er();
1873
+ Ar();
1780
1874
  },
1781
- style: Dn,
1875
+ style: qn,
1782
1876
  variant: "base-secondary",
1783
1877
  children: "編輯表單"
1784
1878
  })]
1785
1879
  })
1786
1880
  })
1787
1881
  }),
1788
- /* @__PURE__ */ w("div", {
1789
- style: dn,
1790
- children: [/* @__PURE__ */ C("div", {
1791
- ref: Pe,
1792
- style: fn,
1793
- children: /* @__PURE__ */ w(Me, {
1794
- connectionMode: De.Strict,
1795
- edges: Rn,
1882
+ /* @__PURE__ */ E("div", {
1883
+ style: jn,
1884
+ children: [/* @__PURE__ */ T("div", {
1885
+ ref: O,
1886
+ style: Mn,
1887
+ children: /* @__PURE__ */ E(Fe, {
1888
+ connectionMode: ke.Strict,
1889
+ edges: Ln,
1796
1890
  fitView: !0,
1797
- isValidConnection: (e) => ai(e, A.nodes),
1798
- nodeTypes: cr,
1799
- nodes: Ln,
1891
+ isValidConnection: (e) => wi(e, A.nodes),
1892
+ nodeTypes: Or,
1893
+ nodes: Qn,
1800
1894
  deleteKeyCode: null,
1801
1895
  multiSelectionKeyCode: [
1802
1896
  "Shift",
1803
1897
  "Meta",
1804
1898
  "Control"
1805
1899
  ],
1806
- onConnect: Qr,
1807
- onEdgeClick: ti,
1900
+ onConnect: Mr,
1901
+ onEdgeClick: Nr,
1808
1902
  onNodeClick: (e, t) => {
1809
- lt(t.id), gt([]);
1903
+ dt(t.id), ft([]);
1810
1904
  },
1811
- onNodesChange: Wr,
1905
+ onNodesChange: X,
1812
1906
  onPaneClick: () => {
1813
- lt(null), gt([]);
1907
+ dt(null), ft([]);
1814
1908
  },
1815
- onViewportChange: Ke,
1816
- viewport: Fe,
1909
+ onViewportChange: Re,
1910
+ viewport: Le,
1817
1911
  children: [
1818
- /* @__PURE__ */ C(Ee, {}),
1819
- /* @__PURE__ */ C("style", { children: bn }),
1820
- /* @__PURE__ */ C(ke, { children: Mn ? /* @__PURE__ */ C(Oe, {
1912
+ /* @__PURE__ */ T(Oe, {}),
1913
+ /* @__PURE__ */ T("style", { children: Bn }),
1914
+ /* @__PURE__ */ T(je, { children: Cn ? /* @__PURE__ */ T(Ae, {
1821
1915
  "aria-label": "刪除選取項目",
1822
1916
  className: "workflow-selection-delete-control",
1823
- onClick: Nn,
1824
- style: pn,
1917
+ onClick: wn,
1918
+ style: Nn,
1825
1919
  title: "刪除選取項目",
1826
- children: /* @__PURE__ */ C("span", {
1827
- style: mn,
1828
- children: /* @__PURE__ */ C(g, {
1920
+ children: /* @__PURE__ */ T("span", {
1921
+ style: Pn,
1922
+ children: /* @__PURE__ */ T(v, {
1829
1923
  color: "error",
1830
- icon: fe,
1924
+ icon: pe,
1831
1925
  size: 16
1832
1926
  })
1833
1927
  })
1834
1928
  }) : null }),
1835
- /* @__PURE__ */ C(dr, { onApplyAutoLayout: Li }),
1836
- /* @__PURE__ */ C(Ae, {})
1929
+ /* @__PURE__ */ T(jr, { onApplyAutoLayout: Di }),
1930
+ /* @__PURE__ */ T(Ne, {})
1837
1931
  ]
1838
1932
  })
1839
- }), /* @__PURE__ */ w("div", {
1840
- className: hn,
1841
- style: xn,
1933
+ }), /* @__PURE__ */ E("div", {
1934
+ className: Fn,
1935
+ style: Vn,
1842
1936
  children: [
1843
- /* @__PURE__ */ C(x, {
1937
+ /* @__PURE__ */ T(C, {
1844
1938
  component: "h2",
1845
1939
  variant: "h3",
1846
1940
  children: "流程工具"
1847
1941
  }),
1848
- a && pe ? /* @__PURE__ */ w("div", {
1849
- style: On,
1850
- children: [/* @__PURE__ */ C(x, {
1942
+ a && me ? /* @__PURE__ */ E("div", {
1943
+ style: Jn,
1944
+ children: [/* @__PURE__ */ T(C, {
1851
1945
  color: "text-neutral",
1852
1946
  variant: "caption",
1853
1947
  children: "AI 協助"
1854
- }), /* @__PURE__ */ C("div", {
1855
- style: wn,
1856
- children: /* @__PURE__ */ C(h, {
1948
+ }), /* @__PURE__ */ T("div", {
1949
+ style: Wn,
1950
+ children: /* @__PURE__ */ T(_, {
1857
1951
  disabled: !r,
1858
- onClick: () => sn((e) => !e),
1952
+ onClick: () => un((e) => !e),
1859
1953
  size: "sub",
1860
- variant: on ? "base-primary" : "base-secondary",
1954
+ variant: ln ? "base-primary" : "base-secondary",
1861
1955
  children: r ? "AI 助理" : "AI 助理(未設定)"
1862
1956
  })
1863
1957
  })]
1864
1958
  }) : null,
1865
- /* @__PURE__ */ w("div", {
1866
- style: On,
1867
- children: [/* @__PURE__ */ C(x, {
1959
+ /* @__PURE__ */ E("div", {
1960
+ style: Jn,
1961
+ children: [/* @__PURE__ */ T(C, {
1868
1962
  color: "text-neutral",
1869
1963
  variant: "caption",
1870
1964
  children: "動作節點"
1871
- }), /* @__PURE__ */ C("div", {
1872
- style: wn,
1873
- children: Hn.map((e) => /* @__PURE__ */ C(h, {
1965
+ }), /* @__PURE__ */ T("div", {
1966
+ style: Wn,
1967
+ children: cr.map((e) => /* @__PURE__ */ T(_, {
1874
1968
  icon: e.icon,
1875
1969
  iconType: "leading",
1876
- onClick: () => ci(e.type),
1970
+ onClick: () => Fr(e.type),
1877
1971
  size: "sub",
1878
1972
  variant: "base-secondary",
1879
1973
  children: e.label
1880
1974
  }, e.type))
1881
1975
  })]
1882
1976
  }),
1883
- /* @__PURE__ */ w("div", {
1884
- style: On,
1885
- children: [/* @__PURE__ */ C(x, {
1977
+ /* @__PURE__ */ E("div", {
1978
+ style: Jn,
1979
+ children: [/* @__PURE__ */ T(C, {
1886
1980
  color: "text-neutral",
1887
1981
  variant: "caption",
1888
1982
  children: "流程控制"
1889
- }), /* @__PURE__ */ C("div", {
1890
- style: wn,
1891
- children: Un.map((e) => /* @__PURE__ */ C(h, {
1983
+ }), /* @__PURE__ */ T("div", {
1984
+ style: Wn,
1985
+ children: lr.map((e) => /* @__PURE__ */ T(_, {
1892
1986
  icon: e.icon,
1893
1987
  iconType: "leading",
1894
- onClick: () => ci(e.type),
1988
+ onClick: () => Fr(e.type),
1895
1989
  size: "sub",
1896
1990
  variant: "base-secondary",
1897
1991
  children: e.label
1898
1992
  }, e.type))
1899
1993
  })]
1900
1994
  }),
1901
- In.length > 1 ? ra(In) : null,
1902
- In.length === 1 && Fn ? ia(Fn) : null,
1903
- In.length === 0 && W ? Bi(W) : null
1995
+ kn.length > 1 ? Ki(kn) : null,
1996
+ kn.length === 1 && Dn ? qi(Dn) : null,
1997
+ kn.length === 0 && B ? ki(B) : null
1904
1998
  ]
1905
1999
  })]
1906
2000
  })
1907
2001
  ]
1908
2002
  }) }) }),
1909
- aa(Pn),
1910
- !a && me ? Ri() : null,
1911
- pe && r ? /* @__PURE__ */ C(Nt, {
2003
+ Ji(Tn),
2004
+ !a && he ? Oi() : null,
2005
+ me && r ? /* @__PURE__ */ T(Lt, {
1912
2006
  controller: k,
1913
- onClose: () => sn(!1),
1914
- open: on
2007
+ onClose: () => un(!1),
2008
+ open: ln
1915
2009
  }) : null,
1916
- a ? null : /* @__PURE__ */ C(T, {
2010
+ a ? null : /* @__PURE__ */ T(ie, {
1917
2011
  headerTitle: "編輯表單",
1918
2012
  isHeaderDisplay: !0,
1919
- onClose: () => ln(!1),
1920
- open: cn,
2013
+ onClose: () => fn(!1),
2014
+ open: dn,
1921
2015
  size: "wide",
1922
- children: /* @__PURE__ */ w("div", {
1923
- style: rr,
1924
- children: [/* @__PURE__ */ C("div", {
1925
- style: ir,
1926
- children: yn ? /* @__PURE__ */ C(x, {
2016
+ children: /* @__PURE__ */ E("div", {
2017
+ style: Cr,
2018
+ children: [/* @__PURE__ */ T("div", {
2019
+ style: wr,
2020
+ children: vn ? /* @__PURE__ */ T(C, {
1927
2021
  color: "text-neutral",
1928
2022
  variant: "body",
1929
2023
  children: "載入中…"
1930
- }) : /* @__PURE__ */ C(s, {
2024
+ }) : /* @__PURE__ */ T(l, {
1931
2025
  onChange: (e) => {
1932
- B(e);
2026
+ pn(e);
1933
2027
  },
1934
2028
  value: z ?? {
1935
- schema: or,
1936
- uiSchema: sr
2029
+ schema: Er,
2030
+ uiSchema: Dr
1937
2031
  }
1938
2032
  })
1939
- }), /* @__PURE__ */ w("div", {
1940
- style: ar,
1941
- children: [/* @__PURE__ */ C(h, {
1942
- disabled: yn,
2033
+ }), /* @__PURE__ */ E("div", {
2034
+ style: Tr,
2035
+ children: [/* @__PURE__ */ T(_, {
2036
+ disabled: vn,
1943
2037
  onClick: () => {
1944
- z !== null && (V(!0), k.replaceState((e) => ({
2038
+ z !== null && (gn(!0), k.replaceState((e) => ({
1945
2039
  ...e,
1946
2040
  formSchema: z.schema
1947
- }))), ln(!1);
2041
+ }))), fn(!1);
1948
2042
  },
1949
2043
  variant: "base-primary",
1950
2044
  children: "套用"
1951
- }), /* @__PURE__ */ C(h, {
1952
- onClick: () => ln(!1),
2045
+ }), /* @__PURE__ */ T(_, {
2046
+ onClick: () => fn(!1),
1953
2047
  variant: "base-secondary",
1954
2048
  children: "取消"
1955
2049
  })]
@@ -1957,179 +2051,185 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1957
2051
  })
1958
2052
  })
1959
2053
  ] });
1960
- function Ri() {
1961
- return /* @__PURE__ */ C(v, {
2054
+ function Oi() {
2055
+ let e = {
2056
+ formFields: G?.fields ?? [],
2057
+ memberName: (e) => I.find((t) => t.memberId === e && !t.unresolved)?.displayName ?? null,
2058
+ orgUnits: L,
2059
+ positions: R
2060
+ };
2061
+ return /* @__PURE__ */ T(b, {
1962
2062
  cancelText: "關閉",
1963
2063
  confirmText: "執行試跑",
1964
- loading: Gt,
2064
+ loading: qt,
1965
2065
  modalType: "standard",
1966
- onCancel: wr,
1967
- onClose: wr,
1968
- onConfirm: () => void Tr(),
1969
- open: Ht,
2066
+ onCancel: vr,
2067
+ onClose: vr,
2068
+ onConfirm: () => void yr(),
2069
+ open: Gt,
1970
2070
  showModalFooter: !0,
1971
2071
  showModalHeader: !0,
1972
2072
  size: "wide",
1973
- supportingText: `使用 ${nr} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
2073
+ supportingText: `使用 ${Sr} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
1974
2074
  title: "試跑流程",
1975
- children: /* @__PURE__ */ w("div", {
1976
- style: H,
2075
+ children: /* @__PURE__ */ E("div", {
2076
+ style: U,
1977
2077
  children: [
1978
- /* @__PURE__ */ C(n, {
2078
+ /* @__PURE__ */ T(n, {
1979
2079
  label: "表單資料 JSON",
1980
2080
  name: "dryRunFormDataJson",
1981
2081
  required: !0,
1982
- children: /* @__PURE__ */ C(re, {
1983
- onChange: (e) => Yt(e.target.value),
2082
+ children: /* @__PURE__ */ T(re, {
2083
+ onChange: (e) => Zt(e.target.value),
1984
2084
  resize: "vertical",
1985
2085
  rows: 8,
1986
- value: qt
2086
+ value: Xt
1987
2087
  })
1988
2088
  }),
1989
- Qt ? /* @__PURE__ */ C(x, {
2089
+ tn ? /* @__PURE__ */ T(C, {
1990
2090
  color: "text-error",
1991
2091
  variant: "body",
1992
- children: Qt
2092
+ children: tn
1993
2093
  }) : null,
1994
- Xt ? /* @__PURE__ */ w("div", {
1995
- style: Sn,
2094
+ $t ? /* @__PURE__ */ E("div", {
2095
+ style: Hn,
1996
2096
  children: [
1997
- /* @__PURE__ */ C(x, {
1998
- color: Xt.valid ? "text-success" : "text-error",
2097
+ /* @__PURE__ */ T(C, {
2098
+ color: $t.valid ? "text-success" : "text-error",
1999
2099
  variant: "label-primary-highlight",
2000
- children: Xt.valid ? "試跑通過" : "試跑失敗"
2100
+ children: $t.valid ? "試跑通過" : "試跑失敗"
2001
2101
  }),
2002
- Xt.errors.map((e) => /* @__PURE__ */ C(x, {
2102
+ $t.errors.map((e) => /* @__PURE__ */ T(C, {
2003
2103
  color: "text-error",
2004
2104
  variant: "body",
2005
2105
  children: e
2006
2106
  }, e)),
2007
- Xt.steps.map((e) => /* @__PURE__ */ w("div", {
2008
- style: Cn,
2107
+ $t.steps.map((t) => /* @__PURE__ */ E("div", {
2108
+ style: Un,
2009
2109
  children: [
2010
- /* @__PURE__ */ w(x, {
2110
+ /* @__PURE__ */ E(C, {
2011
2111
  variant: "label-primary-highlight",
2012
2112
  children: [
2013
- e.nodeLabel,
2113
+ t.nodeLabel,
2014
2114
  " · ",
2015
- gi(e.status)
2115
+ Pi(t.status)
2016
2116
  ]
2017
2117
  }),
2018
- /* @__PURE__ */ w(x, {
2118
+ /* @__PURE__ */ E(C, {
2019
2119
  color: "text-neutral",
2020
2120
  variant: "caption",
2021
2121
  children: [
2022
- _i(e.nodeType),
2023
- e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
2024
- e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
2122
+ Fi(t.nodeType),
2123
+ t.assigneeMemberId ? ` · 處理者:${_n(t.assigneeMemberId, e)}` : "",
2124
+ t.edgeLabel ? ` · 來源線段:${t.edgeLabel}` : ""
2025
2125
  ]
2026
2126
  }),
2027
- e.edgeReason ? /* @__PURE__ */ C(x, {
2127
+ t.edgeReason ? /* @__PURE__ */ T(C, {
2028
2128
  color: "text-neutral",
2029
2129
  variant: "caption",
2030
- children: e.edgeReason
2130
+ children: t.edgeReason
2031
2131
  }) : null,
2032
- e.entryCondition ? /* @__PURE__ */ w(x, {
2132
+ t.entryCondition ? /* @__PURE__ */ E(C, {
2033
2133
  color: "text-neutral",
2034
2134
  variant: "caption",
2035
2135
  children: [
2036
2136
  "進入條件:",
2037
- e.entryConditionMatched ? "符合" : "不符合",
2137
+ t.entryConditionMatched ? "符合" : "不符合",
2038
2138
  " ·",
2039
2139
  " ",
2040
- e.entryCondition
2140
+ t.entryCondition
2041
2141
  ]
2042
2142
  }) : null,
2043
- /* @__PURE__ */ C(x, {
2143
+ /* @__PURE__ */ T(C, {
2044
2144
  color: "text-neutral",
2045
2145
  variant: "body",
2046
- children: e.message
2146
+ children: t.message
2047
2147
  }),
2048
- (e.status === "SKIPPED" ? [] : zi(A, e.nodeId, en)).map((e) => /* @__PURE__ */ w(x, {
2148
+ (t.status === "SKIPPED" ? [] : ia(A, t.nodeId, rn)).map((e) => /* @__PURE__ */ E(C, {
2049
2149
  color: "text-neutral",
2050
2150
  variant: "caption",
2051
2151
  children: ["將送出 Webhook:", e.label]
2052
2152
  }, e.key))
2053
2153
  ]
2054
- }, e.id))
2154
+ }, t.id))
2055
2155
  ]
2056
2156
  }) : null
2057
2157
  ]
2058
2158
  })
2059
2159
  });
2060
2160
  }
2061
- function Bi(e) {
2062
- return /* @__PURE__ */ w("div", {
2063
- style: H,
2161
+ function ki(e) {
2162
+ return /* @__PURE__ */ E("div", {
2163
+ style: U,
2064
2164
  children: [
2065
- /* @__PURE__ */ C(x, {
2165
+ /* @__PURE__ */ T(C, {
2066
2166
  component: "h2",
2067
2167
  variant: "h3",
2068
2168
  children: "節點屬性"
2069
2169
  }),
2070
- /* @__PURE__ */ w(x, {
2170
+ /* @__PURE__ */ E(C, {
2071
2171
  color: "text-neutral",
2072
2172
  variant: "body",
2073
2173
  children: [
2074
- Vn[e.type],
2174
+ sr[e.type],
2075
2175
  " · ",
2076
2176
  e.id
2077
2177
  ]
2078
2178
  }),
2079
- /* @__PURE__ */ C(n, {
2179
+ /* @__PURE__ */ T(n, {
2080
2180
  label: "顯示名稱",
2081
2181
  name: "nodeLabel",
2082
2182
  required: !0,
2083
- children: /* @__PURE__ */ C(_, {
2084
- onChange: (e) => li(e.target.value),
2183
+ children: /* @__PURE__ */ T(y, {
2184
+ onChange: (e) => Lr(e.target.value),
2085
2185
  value: e.data.label,
2086
2186
  variant: "base"
2087
2187
  })
2088
2188
  }),
2089
- e.type === "startEvent" ? Vi() : null,
2090
- e.type === "startEvent" ? null : Ji(e),
2091
- e.type === "userTask" ? Qi(e) : null,
2092
- e.type === "serviceTask" ? ea(e) : null
2189
+ e.type === "startEvent" ? Ni() : null,
2190
+ e.type === "startEvent" ? null : Hi(e),
2191
+ e.type === "userTask" ? Ui(e) : null,
2192
+ e.type === "serviceTask" ? Gi(e) : null
2093
2193
  ]
2094
2194
  });
2095
2195
  }
2096
- function Vi() {
2097
- let e = G.mode === "CUSTOM" ? [...er, tr] : [...er], t = G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? Si(L, G.orgUnitId ?? "") : null, r = G.mode === "ORG_UNIT_POSITION" ? Ci(R, G.positionId ?? "") : null, a = G.mode === "ORG_UNIT_POSITION" ? Ai({
2098
- includeDescendants: !!G.includeDescendants,
2099
- memberships: Bt,
2100
- orgUnitId: G.orgUnitId ?? "",
2196
+ function Ni() {
2197
+ let e = V.mode === "CUSTOM" ? [...br, xr] : [...br], t = V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? Bi(L, V.orgUnitId ?? "") : null, r = V.mode === "ORG_UNIT_POSITION" ? Vi(R, V.positionId ?? "") : null, a = V.mode === "ORG_UNIT_POSITION" ? Yi({
2198
+ includeDescendants: !!V.includeDescendants,
2199
+ memberships: Ut,
2200
+ orgUnitId: V.orgUnitId ?? "",
2101
2201
  orgUnits: L,
2102
2202
  positions: R
2103
2203
  }) : [];
2104
- return /* @__PURE__ */ w(S, { children: [
2105
- /* @__PURE__ */ C(n, {
2106
- hintText: G.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
2204
+ return /* @__PURE__ */ E(w, { children: [
2205
+ /* @__PURE__ */ T(n, {
2206
+ hintText: V.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
2107
2207
  label: "發起權限",
2108
2208
  name: "initiatorPolicyMode",
2109
2209
  required: !0,
2110
- children: /* @__PURE__ */ C(y, {
2210
+ children: /* @__PURE__ */ T(x, {
2111
2211
  clearable: !1,
2112
2212
  onChange: (e) => {
2113
2213
  if (e?.id === "CUSTOM") {
2114
- D(null), O(null);
2214
+ Ee(null), Pe(null);
2115
2215
  return;
2116
2216
  }
2117
- let t = Zr(e?.id ?? null), n = ii(t);
2118
- D(t === "ALL" ? null : t), O(t === "ALL" ? null : n), ct(ni(n, L));
2217
+ let t = gi(e?.id ?? null), n = Ci(t);
2218
+ Ee(t === "ALL" ? null : t), Pe(t === "ALL" ? null : n), ut(xi(n, L));
2119
2219
  },
2120
2220
  options: e,
2121
2221
  placeholder: "選擇誰可以發起",
2122
- value: Z(e, G.mode)
2222
+ value: $(e, V.mode)
2123
2223
  })
2124
2224
  }),
2125
- G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2225
+ V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2126
2226
  label: "組織",
2127
2227
  name: "initiatorOrgUnitId",
2128
2228
  required: !0,
2129
- children: /* @__PURE__ */ C(i, {
2229
+ children: /* @__PURE__ */ T(i, {
2130
2230
  name: "initiatorOrgUnitId",
2131
- onChange: (e) => ki({
2132
- ...G,
2231
+ onChange: (e) => li({
2232
+ ...V,
2133
2233
  orgUnitId: e?.id ?? "",
2134
2234
  positionId: "",
2135
2235
  value: e?.id ?? ""
@@ -2139,78 +2239,78 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2139
2239
  value: t
2140
2240
  })
2141
2241
  }) : null,
2142
- G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2242
+ V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2143
2243
  label: "包含下層",
2144
2244
  name: "initiatorIncludeDescendants",
2145
- children: /* @__PURE__ */ C(b, {
2146
- checked: !!G.includeDescendants,
2147
- onChange: (e) => ki({
2148
- ...G,
2245
+ children: /* @__PURE__ */ T(S, {
2246
+ checked: !!V.includeDescendants,
2247
+ onChange: (e) => li({
2248
+ ...V,
2149
2249
  includeDescendants: e.target.checked,
2150
- ...G.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
2250
+ ...V.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
2151
2251
  })
2152
2252
  })
2153
2253
  }) : null,
2154
- G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2254
+ V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2155
2255
  label: "職位",
2156
2256
  name: "initiatorPositionId",
2157
2257
  required: !0,
2158
- children: /* @__PURE__ */ C(o, {
2159
- disabled: !G.orgUnitId?.trim(),
2258
+ children: /* @__PURE__ */ T(o, {
2259
+ disabled: !V.orgUnitId?.trim(),
2160
2260
  name: "initiatorPositionId",
2161
- onChange: (e) => ki({
2162
- ...G,
2261
+ onChange: (e) => li({
2262
+ ...V,
2163
2263
  positionId: e?.id ?? ""
2164
2264
  }),
2165
- placeholder: G.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
2265
+ placeholder: V.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
2166
2266
  positions: a,
2167
2267
  value: r
2168
2268
  })
2169
2269
  }) : null
2170
2270
  ] });
2171
2271
  }
2172
- function Ji(e) {
2272
+ function Hi(e) {
2173
2273
  let t = A.edges.filter((t) => t.target === e.id).length, r = t < 2, i = r ? "AND" : e.data.triggerMode ?? "AND";
2174
- return /* @__PURE__ */ C(n, {
2274
+ return /* @__PURE__ */ T(n, {
2175
2275
  hintText: r ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
2176
2276
  label: "前置條件",
2177
2277
  name: "triggerMode",
2178
2278
  required: !0,
2179
- children: /* @__PURE__ */ C(y, {
2279
+ children: /* @__PURE__ */ T(x, {
2180
2280
  clearable: !1,
2181
- onChange: (e) => r ? void 0 : ji(Ar(e?.id ?? null)),
2182
- options: [...Wn],
2281
+ onChange: (e) => r ? void 0 : _i(Yr(e?.id ?? null)),
2282
+ options: [...ur],
2183
2283
  readOnly: r,
2184
- value: Z(Wn, i)
2284
+ value: $(ur, i)
2185
2285
  })
2186
2286
  });
2187
2287
  }
2188
- function Qi(e) {
2189
- let t = e.data.approverResolver, r = Gr(t.type), a = t.type === "DIRECT" ? t.memberIds.map((e) => xi(I, e)) : [], s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Si(L, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? Ci(R, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? Ai({
2288
+ function Ui(e) {
2289
+ let t = e.data.approverResolver, r = ui(t.type), a = t.type === "DIRECT" ? t.memberIds.map((e) => zi(I, e)) : [], s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Bi(L, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? Vi(R, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? Yi({
2190
2290
  includeDescendants: !!t.includeDescendants,
2191
- memberships: Bt,
2291
+ memberships: Ut,
2192
2292
  orgUnitId: t.orgUnitId,
2193
2293
  orgUnits: L,
2194
2294
  positions: R
2195
- }) : [], u = t.type === "ORG_MANAGER" ? Yr(t.levelsUp) : Yn[0], d = t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, f = t.type === "ORG_MANAGER_CHAIN" ? Ft(R, t.minPositionLevel) : [], p = d.type === "DIRECT" && d.memberId ? xi(I, d.memberId) : null, h = e.data.returnBehavior.resubmitStrategy ?? "RESTART", g = e.data.sla ?? null, v = e.data.excludeInitiator ?? null, ee = g ? dt(g.duration) : null, te = ee?.unit ?? "DAY", ne = zr(g?.warningAt ?? null), re = Yr(g?.escalateLevelsUp ?? 1), x = Mr(e.data.decisionPolicy), T = Pr(e.data.decisionPolicy);
2196
- return /* @__PURE__ */ w(S, { children: [
2197
- /* @__PURE__ */ C(n, {
2295
+ }) : [], u = t.type === "DYNAMIC_FORM" ? En(G, t.formPath) : null, d = t.type === "ORG_MANAGER" ? mi(t.levelsUp) : Y[0], f = t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, p = t.type === "ORG_MANAGER_CHAIN" ? zt(R, t.minPositionLevel) : [], m = f.type === "DIRECT" && f.memberId ? zi(I, f.memberId) : null, h = e.data.returnBehavior.resubmitStrategy ?? "RESTART", _ = e.data.sla ?? null, v = e.data.excludeInitiator ?? null, b = _ ? ht(_.duration) : null, ee = b?.unit ?? "DAY", te = ii(_?.warningAt ?? null), ne = mi(_?.escalateLevelsUp ?? 1), re = Zr(e.data.decisionPolicy), C = $r(e.data.decisionPolicy);
2296
+ return /* @__PURE__ */ E(w, { children: [
2297
+ /* @__PURE__ */ T(n, {
2198
2298
  label: "簽核來源",
2199
2299
  name: "approverResolverType",
2200
2300
  required: !0,
2201
- children: /* @__PURE__ */ C(y, {
2301
+ children: /* @__PURE__ */ T(x, {
2202
2302
  clearable: !1,
2203
- onChange: (e) => Q(Kr(e?.id ?? null, R)),
2204
- options: [...qn],
2205
- value: Z(qn, r)
2303
+ onChange: (e) => Z(di(e?.id ?? null, R)),
2304
+ options: [...pr],
2305
+ value: $(pr, r)
2206
2306
  })
2207
2307
  }),
2208
- t.type === "DIRECT" ? /* @__PURE__ */ C(n, {
2209
- hintText: pt(e.data.decisionPolicy),
2308
+ t.type === "DIRECT" ? /* @__PURE__ */ T(n, {
2309
+ hintText: _t(e.data.decisionPolicy),
2210
2310
  label: "簽核者",
2211
2311
  name: "memberId",
2212
2312
  required: !0,
2213
- children: /* @__PURE__ */ C(m, {
2313
+ children: /* @__PURE__ */ T(g, {
2214
2314
  asyncData: !0,
2215
2315
  disabledOptionsFilter: !0,
2216
2316
  emptyText: "沒有符合的成員",
@@ -2220,62 +2320,78 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2220
2320
  name: "workflow-approver-search",
2221
2321
  spellCheck: !1
2222
2322
  },
2223
- loading: At,
2323
+ loading: Mt,
2224
2324
  loadingText: "搜尋成員中...",
2225
2325
  mode: "multiple",
2226
- onChange: (e) => Q({
2326
+ onChange: (e) => Z({
2227
2327
  memberIds: e.map((e) => e.id),
2228
2328
  type: "DIRECT"
2229
2329
  }),
2230
- onSearch: X,
2330
+ onSearch: J,
2231
2331
  onVisibilityChange: (e) => {
2232
- e && (It([]), X(""));
2332
+ e && (It([]), J(""));
2233
2333
  },
2234
- options: [...Mi(a, Pt)],
2334
+ options: [...Zi(a, Ft)],
2235
2335
  placeholder: "搜尋姓名或信箱",
2236
2336
  searchDebounceTime: 300,
2237
2337
  value: a
2238
2338
  })
2239
2339
  }) : null,
2240
- t.type === "ORG_MANAGER" ? /* @__PURE__ */ C(n, {
2340
+ t.type === "DYNAMIC_FORM" ? /* @__PURE__ */ T(n, {
2341
+ hintText: u?.problem ?? "簽核人取自申請人送出表單時在該欄位選的人員。",
2342
+ label: "表單欄位",
2343
+ name: "approverFormPath",
2344
+ required: !0,
2345
+ children: /* @__PURE__ */ T(x, {
2346
+ clearable: !1,
2347
+ onChange: (e) => Z({
2348
+ formPath: e?.id ?? "",
2349
+ type: "DYNAMIC_FORM"
2350
+ }),
2351
+ options: [...u?.options ?? []],
2352
+ placeholder: "選擇人員選擇欄位",
2353
+ value: u?.selected ?? void 0
2354
+ })
2355
+ }) : null,
2356
+ t.type === "ORG_MANAGER" ? /* @__PURE__ */ T(n, {
2241
2357
  hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
2242
2358
  label: "主管層級",
2243
2359
  name: "managerLevelsUp",
2244
2360
  required: !0,
2245
- children: /* @__PURE__ */ C(y, {
2361
+ children: /* @__PURE__ */ T(x, {
2246
2362
  clearable: !1,
2247
- onChange: (e) => Q({
2363
+ onChange: (e) => Z({
2248
2364
  baseFromInitiator: !0,
2249
- levelsUp: Xr(e?.id ?? null).value,
2365
+ levelsUp: hi(e?.id ?? null).value,
2250
2366
  type: "ORG_MANAGER"
2251
2367
  }),
2252
- options: [...Yn],
2253
- value: u
2368
+ options: [...Y],
2369
+ value: d
2254
2370
  })
2255
2371
  }) : null,
2256
- t.type === "ORG_MANAGER_CHAIN" ? /* @__PURE__ */ C(n, {
2372
+ t.type === "ORG_MANAGER_CHAIN" ? /* @__PURE__ */ T(n, {
2257
2373
  hintText: "從發起人的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。",
2258
2374
  label: "簽到職等",
2259
2375
  name: "minPositionLevel",
2260
2376
  required: !0,
2261
- children: /* @__PURE__ */ C(y, {
2377
+ children: /* @__PURE__ */ T(x, {
2262
2378
  clearable: !1,
2263
- onChange: (e) => Q({
2379
+ onChange: (e) => Z({
2264
2380
  ...t,
2265
2381
  minPositionLevel: Number(e?.id ?? t.minPositionLevel)
2266
2382
  }),
2267
- options: [...f],
2268
- value: Z(f, String(t.minPositionLevel))
2383
+ options: [...p],
2384
+ value: $(p, String(t.minPositionLevel))
2269
2385
  })
2270
2386
  }) : null,
2271
- t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2387
+ t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2272
2388
  hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
2273
2389
  label: "組織",
2274
2390
  name: "orgUnitId",
2275
2391
  required: !0,
2276
- children: /* @__PURE__ */ C(i, {
2392
+ children: /* @__PURE__ */ T(i, {
2277
2393
  name: "orgUnitId",
2278
- onChange: (e) => Q(t.type === "ORG_UNIT_MEMBER" ? {
2394
+ onChange: (e) => Z(t.type === "ORG_UNIT_MEMBER" ? {
2279
2395
  includeDescendants: t.includeDescendants,
2280
2396
  orgUnitId: e?.id ?? "",
2281
2397
  type: "ORG_UNIT_MEMBER"
@@ -2294,43 +2410,43 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2294
2410
  value: s
2295
2411
  })
2296
2412
  }) : null,
2297
- t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ w(S, { children: [
2298
- t.type === "ORG_MANAGER_CHAIN" ? null : /* @__PURE__ */ C(n, {
2413
+ t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ E(w, { children: [
2414
+ t.type === "ORG_MANAGER_CHAIN" ? null : /* @__PURE__ */ T(n, {
2299
2415
  hintText: "開啟後只取離該員最近一層的主管規則;掛在上層單位、涵蓋範圍較大的規則不會再一併加入簽核人。",
2300
2416
  label: "只取最近一層主管",
2301
2417
  name: "preferClosestOrgUnit",
2302
- children: /* @__PURE__ */ C(b, {
2418
+ children: /* @__PURE__ */ T(S, {
2303
2419
  checked: !!t.preferClosestOrgUnit,
2304
2420
  inputProps: {
2305
2421
  id: "preferClosestOrgUnit",
2306
2422
  name: "preferClosestOrgUnit"
2307
2423
  },
2308
- onChange: (e) => Q({
2424
+ onChange: (e) => Z({
2309
2425
  ...t,
2310
2426
  preferClosestOrgUnit: e.target.checked
2311
2427
  })
2312
2428
  })
2313
2429
  }),
2314
- /* @__PURE__ */ C(n, {
2430
+ /* @__PURE__ */ T(n, {
2315
2431
  hintText: t.type === "ORG_MANAGER_CHAIN" ? "預設會停止流程並提示;若設定固定人,主管鏈在達到簽核職等前就結束時,會再加上該會員作為最後一關。" : "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
2316
2432
  label: "無主管時",
2317
2433
  name: "approverFallbackMode",
2318
2434
  required: !0,
2319
- children: /* @__PURE__ */ C(y, {
2435
+ children: /* @__PURE__ */ T(x, {
2320
2436
  clearable: !1,
2321
- onChange: (e) => Q(Jr(t, qr(e?.id ?? null) === "DIRECT" ? {
2437
+ onChange: (e) => Z(pi(t, fi(e?.id ?? null) === "DIRECT" ? {
2322
2438
  memberId: "",
2323
2439
  type: "DIRECT"
2324
2440
  } : { type: "NONE" })),
2325
- options: [...Xn],
2326
- value: Z(Xn, d.type)
2441
+ options: [...hr],
2442
+ value: $(hr, f.type)
2327
2443
  })
2328
2444
  }),
2329
- d.type === "DIRECT" ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(n, {
2445
+ f.type === "DIRECT" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2330
2446
  label: "改派人員",
2331
2447
  name: "approverFallbackMemberId",
2332
2448
  required: !0,
2333
- children: /* @__PURE__ */ C(m, {
2449
+ children: /* @__PURE__ */ T(g, {
2334
2450
  asyncData: !0,
2335
2451
  disabledOptionsFilter: !0,
2336
2452
  emptyText: "沒有符合的成員",
@@ -2340,65 +2456,65 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2340
2456
  name: "workflow-approver-fallback-search",
2341
2457
  spellCheck: !1
2342
2458
  },
2343
- loading: At,
2459
+ loading: Mt,
2344
2460
  loadingText: "搜尋成員中...",
2345
2461
  mode: "single",
2346
- onChange: (e) => Q(Jr(t, {
2347
- allowInitiatorSelfApproval: d.allowInitiatorSelfApproval,
2462
+ onChange: (e) => Z(pi(t, {
2463
+ allowInitiatorSelfApproval: f.allowInitiatorSelfApproval,
2348
2464
  memberId: e?.id ?? "",
2349
2465
  type: "DIRECT"
2350
2466
  })),
2351
- onSearch: X,
2467
+ onSearch: J,
2352
2468
  onVisibilityChange: (e) => {
2353
- e && (It([]), X(""));
2469
+ e && (It([]), J(""));
2354
2470
  },
2355
- options: [...Mi(Pt, p ? [p] : [])],
2471
+ options: [...Zi(Ft, m ? [m] : [])],
2356
2472
  placeholder: "搜尋姓名或信箱",
2357
2473
  searchDebounceTime: 300,
2358
- value: p
2474
+ value: m
2359
2475
  })
2360
- }), /* @__PURE__ */ C(n, {
2476
+ }), /* @__PURE__ */ T(n, {
2361
2477
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
2362
2478
  label: "允許自簽",
2363
2479
  name: "allowInitiatorSelfApproval",
2364
- children: /* @__PURE__ */ C(b, {
2365
- checked: !!d.allowInitiatorSelfApproval,
2480
+ children: /* @__PURE__ */ T(S, {
2481
+ checked: !!f.allowInitiatorSelfApproval,
2366
2482
  inputProps: {
2367
2483
  id: "allowInitiatorSelfApproval",
2368
2484
  name: "allowInitiatorSelfApproval"
2369
2485
  },
2370
- onChange: (e) => Q(Jr(t, {
2486
+ onChange: (e) => Z(pi(t, {
2371
2487
  allowInitiatorSelfApproval: e.target.checked,
2372
- memberId: d.memberId,
2488
+ memberId: f.memberId,
2373
2489
  type: "DIRECT"
2374
2490
  }))
2375
2491
  })
2376
2492
  })] }) : null
2377
2493
  ] }) : null,
2378
- t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2494
+ t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2379
2495
  label: "包含下層",
2380
2496
  name: "includeDescendants",
2381
- children: /* @__PURE__ */ C(b, {
2497
+ children: /* @__PURE__ */ T(S, {
2382
2498
  checked: !!t.includeDescendants,
2383
2499
  inputProps: {
2384
2500
  id: "includeDescendants",
2385
2501
  name: "includeDescendants"
2386
2502
  },
2387
- onChange: (e) => Q({
2503
+ onChange: (e) => Z({
2388
2504
  ...t,
2389
2505
  includeDescendants: e.target.checked,
2390
2506
  ...t.type === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
2391
2507
  })
2392
2508
  })
2393
2509
  }) : null,
2394
- t.type === "POSITION" ? /* @__PURE__ */ C(n, {
2510
+ t.type === "POSITION" ? /* @__PURE__ */ T(n, {
2395
2511
  hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
2396
2512
  label: "職位",
2397
2513
  name: "positionId",
2398
2514
  required: !0,
2399
- children: /* @__PURE__ */ C(o, {
2515
+ children: /* @__PURE__ */ T(o, {
2400
2516
  name: "positionId",
2401
- onChange: (e) => Q({
2517
+ onChange: (e) => Z({
2402
2518
  positionId: e?.id ?? "",
2403
2519
  type: "POSITION"
2404
2520
  }),
@@ -2407,15 +2523,15 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2407
2523
  value: c
2408
2524
  })
2409
2525
  }) : null,
2410
- t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ C(n, {
2526
+ t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2411
2527
  hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
2412
2528
  label: "職位",
2413
2529
  name: "orgUnitPositionId",
2414
2530
  required: !0,
2415
- children: /* @__PURE__ */ C(o, {
2531
+ children: /* @__PURE__ */ T(o, {
2416
2532
  disabled: !t.orgUnitId.trim(),
2417
2533
  name: "orgUnitPositionId",
2418
- onChange: (e) => Q({
2534
+ onChange: (e) => Z({
2419
2535
  includeDescendants: t.includeDescendants,
2420
2536
  orgUnitId: t.orgUnitId,
2421
2537
  positionId: e?.id ?? "",
@@ -2426,257 +2542,257 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2426
2542
  value: c
2427
2543
  })
2428
2544
  }) : null,
2429
- /* @__PURE__ */ C(n, {
2545
+ /* @__PURE__ */ T(n, {
2430
2546
  hintText: "決定這一關要幾位簽核者同意才會通過;單人簽核與任一人同意的效果完全相同,皆為其中一人同意即通過。",
2431
2547
  label: "決策方式",
2432
2548
  name: "decisionPolicy",
2433
2549
  required: !0,
2434
- children: /* @__PURE__ */ C(y, {
2550
+ children: /* @__PURE__ */ T(x, {
2435
2551
  clearable: !1,
2436
- onChange: (t) => Ei(Nr(t?.id ?? null, e.data.decisionPolicy)),
2437
- options: [...ft.filter((e) => t.type !== "ORG_MANAGER_CHAIN" || e.id === "SEQUENTIAL" || e.id === "PARALLEL_ALL")],
2438
- value: mt(x)
2552
+ onChange: (t) => Ur(Qr(t?.id ?? null, e.data.decisionPolicy)),
2553
+ options: [...gt.filter((e) => t.type !== "ORG_MANAGER_CHAIN" || e.id === "SEQUENTIAL" || e.id === "PARALLEL_ALL")],
2554
+ value: vt(re)
2439
2555
  })
2440
2556
  }),
2441
- x === "QUORUM" ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(n, {
2557
+ re === "QUORUM" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2442
2558
  label: "門檻計算方式",
2443
2559
  name: "quorumThresholdType",
2444
2560
  required: !0,
2445
- children: /* @__PURE__ */ C(y, {
2561
+ children: /* @__PURE__ */ T(x, {
2446
2562
  clearable: !1,
2447
- onChange: (e) => Ei({
2448
- threshold: T.threshold,
2449
- thresholdType: Fr(e?.id ?? null),
2563
+ onChange: (e) => Ur({
2564
+ threshold: C.threshold,
2565
+ thresholdType: ei(e?.id ?? null),
2450
2566
  type: "QUORUM"
2451
2567
  }),
2452
- options: [...Jn],
2453
- value: Z(Jn, T.thresholdType)
2568
+ options: [...mr],
2569
+ value: $(mr, C.thresholdType)
2454
2570
  })
2455
- }), /* @__PURE__ */ C(n, {
2456
- hintText: T.thresholdType === "PERCENTAGE" ? "達到簽核者總數的這個百分比即通過,換算人數時無條件進位;超過 100 的輸入會自動夾至 100。" : "達到這個同意人數即通過;門檻超過實際簽核者人數時,這一關將永遠無法通過,請勿設定超過實際簽核者人數。",
2457
- label: T.thresholdType === "PERCENTAGE" ? "門檻百分比" : "門檻人數",
2571
+ }), /* @__PURE__ */ T(n, {
2572
+ hintText: C.thresholdType === "PERCENTAGE" ? "達到簽核者總數的這個百分比即通過,換算人數時無條件進位;超過 100 的輸入會自動夾至 100。" : "達到這個同意人數即通過;門檻超過實際簽核者人數時,這一關將永遠無法通過,請勿設定超過實際簽核者人數。",
2573
+ label: C.thresholdType === "PERCENTAGE" ? "門檻百分比" : "門檻人數",
2458
2574
  name: "quorumThreshold",
2459
2575
  required: !0,
2460
- children: /* @__PURE__ */ C(_, {
2576
+ children: /* @__PURE__ */ T(y, {
2461
2577
  id: "quorumThreshold",
2462
- inputProps: T.thresholdType === "PERCENTAGE" ? {
2578
+ inputProps: C.thresholdType === "PERCENTAGE" ? {
2463
2579
  max: 100,
2464
2580
  min: 1
2465
2581
  } : { min: 1 },
2466
2582
  inputType: "number",
2467
2583
  name: "quorumThreshold",
2468
- onChange: (e) => Ei({
2469
- threshold: $e(Number(e.target.value), T.thresholdType),
2470
- thresholdType: T.thresholdType,
2584
+ onChange: (e) => Ur({
2585
+ threshold: tt(Number(e.target.value), C.thresholdType),
2586
+ thresholdType: C.thresholdType,
2471
2587
  type: "QUORUM"
2472
2588
  }),
2473
- value: String(T.threshold),
2589
+ value: String(C.threshold),
2474
2590
  variant: "base"
2475
2591
  })
2476
2592
  })] }) : null,
2477
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ C(n, {
2593
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ T(n, {
2478
2594
  hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
2479
2595
  label: "重送策略",
2480
2596
  name: "returnResubmitStrategy",
2481
2597
  required: !0,
2482
- children: /* @__PURE__ */ C(y, {
2598
+ children: /* @__PURE__ */ T(x, {
2483
2599
  clearable: !1,
2484
- onChange: (e) => pi(jr(e?.id ?? null)),
2485
- options: [...Gn],
2486
- value: Z(Gn, h)
2600
+ onChange: (e) => Rr(Xr(e?.id ?? null)),
2601
+ options: [...dr],
2602
+ value: $(dr, h)
2487
2603
  })
2488
2604
  }) : null,
2489
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ C(n, {
2605
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ T(n, {
2490
2606
  hintText: "開啟後,簽核者按下退回時必須填寫意見,未填寫會被擋下。",
2491
2607
  label: "退回時意見必填",
2492
2608
  name: "returnRequireComment",
2493
- children: /* @__PURE__ */ C(b, {
2609
+ children: /* @__PURE__ */ T(S, {
2494
2610
  checked: e.data.returnBehavior.requireComment === !0,
2495
2611
  inputProps: {
2496
2612
  id: "returnRequireComment",
2497
2613
  name: "returnRequireComment"
2498
2614
  },
2499
- onChange: (e) => hi(e.target.checked)
2615
+ onChange: (e) => zr(e.target.checked)
2500
2616
  })
2501
2617
  }) : null,
2502
- /* @__PURE__ */ C(n, {
2618
+ /* @__PURE__ */ T(n, {
2503
2619
  hintText: "開啟後可設定簽核期限,逾時將依下方設定處理。",
2504
2620
  label: "啟用時效",
2505
2621
  name: "slaEnabled",
2506
- children: /* @__PURE__ */ C(b, {
2507
- checked: !!g,
2622
+ children: /* @__PURE__ */ T(S, {
2623
+ checked: !!_,
2508
2624
  inputProps: {
2509
2625
  id: "slaEnabled",
2510
2626
  name: "slaEnabled"
2511
2627
  },
2512
- onChange: (e) => $(e.target.checked ? Je : null)
2628
+ onChange: (e) => Q(e.target.checked ? Ze : null)
2513
2629
  })
2514
2630
  }),
2515
- g && !ee ? /* @__PURE__ */ C(n, {
2631
+ _ && !b ? /* @__PURE__ */ T(n, {
2516
2632
  hintText: "此期限混用了日與時,無法在表單中編輯。請改以單一單位設定,或透過 API 維護。",
2517
2633
  label: "時效期限",
2518
2634
  name: "slaDurationRaw",
2519
- children: /* @__PURE__ */ C(_, {
2635
+ children: /* @__PURE__ */ T(y, {
2520
2636
  disabled: !0,
2521
- value: g.duration,
2637
+ value: _.duration,
2522
2638
  variant: "base"
2523
2639
  })
2524
2640
  }) : null,
2525
- g && ee ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(n, {
2641
+ _ && b ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2526
2642
  label: "時效期限",
2527
2643
  name: "slaDurationValue",
2528
2644
  required: !0,
2529
- children: /* @__PURE__ */ C(_, {
2645
+ children: /* @__PURE__ */ T(y, {
2530
2646
  id: "slaDurationValue",
2531
2647
  inputProps: { min: 1 },
2532
2648
  inputType: "number",
2533
2649
  name: "slaDurationValue",
2534
- onChange: (e) => $(Vr(g, {
2535
- unit: te,
2650
+ onChange: (e) => Q(oi(_, {
2651
+ unit: ee,
2536
2652
  value: Number(e.target.value)
2537
2653
  })),
2538
- value: String(ee.value),
2654
+ value: String(b.value),
2539
2655
  variant: "base"
2540
2656
  })
2541
- }), /* @__PURE__ */ C(n, {
2657
+ }), /* @__PURE__ */ T(n, {
2542
2658
  label: "期限單位",
2543
2659
  name: "slaDurationUnit",
2544
2660
  required: !0,
2545
- children: /* @__PURE__ */ C(y, {
2661
+ children: /* @__PURE__ */ T(x, {
2546
2662
  clearable: !1,
2547
- onChange: (e) => $(Vr(g, {
2548
- unit: Ir(e?.id ?? null),
2549
- value: ee.value
2663
+ onChange: (e) => Q(oi(_, {
2664
+ unit: ti(e?.id ?? null),
2665
+ value: b.value
2550
2666
  })),
2551
- options: [...Ze],
2552
- value: Z(Ze, te)
2667
+ options: [...$e],
2668
+ value: $($e, ee)
2553
2669
  })
2554
2670
  })] }) : null,
2555
- g && te === "DAY" ? /* @__PURE__ */ C(n, {
2671
+ _ && ee === "DAY" ? /* @__PURE__ */ T(n, {
2556
2672
  hintText: "工作日會跳過週末與行事曆上的假日,補班日仍計為工作日;行事曆由系統管理者設定。",
2557
2673
  label: "計算方式",
2558
2674
  name: "slaCalendar",
2559
2675
  required: !0,
2560
- children: /* @__PURE__ */ C(y, {
2676
+ children: /* @__PURE__ */ T(x, {
2561
2677
  clearable: !1,
2562
- onChange: (e) => $({
2563
- ...g,
2564
- calendar: Lr(e?.id ?? null)
2678
+ onChange: (e) => Q({
2679
+ ..._,
2680
+ calendar: ni(e?.id ?? null)
2565
2681
  }),
2566
- options: [...Xe],
2567
- value: Z(Xe, g.calendar ?? "CALENDAR")
2682
+ options: [...Qe],
2683
+ value: $(Qe, _.calendar ?? "CALENDAR")
2568
2684
  })
2569
2685
  }) : null,
2570
- g ? /* @__PURE__ */ C(n, {
2686
+ _ ? /* @__PURE__ */ T(n, {
2571
2687
  label: "逾時處理",
2572
2688
  name: "slaOnTimeout",
2573
2689
  required: !0,
2574
- children: /* @__PURE__ */ C(y, {
2690
+ children: /* @__PURE__ */ T(x, {
2575
2691
  clearable: !1,
2576
- onChange: (e) => $(Hr(g, Rr(e?.id ?? null))),
2577
- options: [...Qe],
2578
- value: Z(Qe, g.onTimeout)
2692
+ onChange: (e) => Q(si(_, ri(e?.id ?? null))),
2693
+ options: [...et],
2694
+ value: $(et, _.onTimeout)
2579
2695
  })
2580
2696
  }) : null,
2581
- g?.onTimeout === "ESCALATE" ? /* @__PURE__ */ C(n, {
2697
+ _?.onTimeout === "ESCALATE" ? /* @__PURE__ */ T(n, {
2582
2698
  hintText: "逾時後改派給簽核者的上層主管,只會升級一次。",
2583
2699
  label: "升級層級",
2584
2700
  name: "slaEscalateLevelsUp",
2585
2701
  required: !0,
2586
- children: /* @__PURE__ */ C(y, {
2702
+ children: /* @__PURE__ */ T(x, {
2587
2703
  clearable: !1,
2588
- onChange: (e) => $({
2589
- ...g,
2590
- escalateLevelsUp: Xr(e?.id ?? null).value
2704
+ onChange: (e) => Q({
2705
+ ..._,
2706
+ escalateLevelsUp: hi(e?.id ?? null).value
2591
2707
  }),
2592
- options: [...Yn],
2593
- value: re
2708
+ options: [...Y],
2709
+ value: ne
2594
2710
  })
2595
2711
  }) : null,
2596
- g ? /* @__PURE__ */ C(n, {
2712
+ _ ? /* @__PURE__ */ T(n, {
2597
2713
  hintText: "在期限到達前先送出一次提醒。",
2598
2714
  label: "預警提醒",
2599
2715
  name: "slaWarningAt",
2600
- children: /* @__PURE__ */ C(y, {
2716
+ children: /* @__PURE__ */ T(x, {
2601
2717
  clearable: !1,
2602
- onChange: (e) => $(Ur(g, Br(e?.id ?? null).value)),
2603
- options: [...Kn],
2604
- value: ne
2718
+ onChange: (e) => Q(ci(_, ai(e?.id ?? null).value)),
2719
+ options: [...fr],
2720
+ value: te
2605
2721
  })
2606
2722
  }) : null,
2607
- /* @__PURE__ */ C(n, {
2723
+ /* @__PURE__ */ T(n, {
2608
2724
  hintText: "關閉後,簽核者在此關卡看不到「拒絕」按鈕。",
2609
2725
  label: "允許拒絕",
2610
2726
  name: "allowReject",
2611
- children: /* @__PURE__ */ C(b, {
2727
+ children: /* @__PURE__ */ T(S, {
2612
2728
  checked: e.data.allowReject,
2613
2729
  inputProps: {
2614
2730
  id: "allowReject",
2615
2731
  name: "allowReject"
2616
2732
  },
2617
- onChange: (e) => Di({ allowReject: e.target.checked })
2733
+ onChange: (e) => Wr({ allowReject: e.target.checked })
2618
2734
  })
2619
2735
  }),
2620
- /* @__PURE__ */ C(n, {
2736
+ /* @__PURE__ */ T(n, {
2621
2737
  hintText: "關閉後,簽核者無法把此關卡的任務轉派給其他人。",
2622
2738
  label: "允許轉派",
2623
2739
  name: "allowTransfer",
2624
- children: /* @__PURE__ */ C(b, {
2740
+ children: /* @__PURE__ */ T(S, {
2625
2741
  checked: e.data.allowTransfer,
2626
2742
  inputProps: {
2627
2743
  id: "allowTransfer",
2628
2744
  name: "allowTransfer"
2629
2745
  },
2630
- onChange: (e) => Di({ allowTransfer: e.target.checked })
2746
+ onChange: (e) => Wr({ allowTransfer: e.target.checked })
2631
2747
  })
2632
2748
  }),
2633
- /* @__PURE__ */ C(n, {
2749
+ /* @__PURE__ */ T(n, {
2634
2750
  hintText: "開啟後,簽核者可在此關卡臨時加入其他簽核人;會簽為平行處理,加簽則需等加入者簽完才往下。",
2635
2751
  label: "允許加簽",
2636
2752
  name: "allowAddSigner",
2637
- children: /* @__PURE__ */ C(b, {
2753
+ children: /* @__PURE__ */ T(S, {
2638
2754
  checked: e.data.allowAddSigner,
2639
2755
  inputProps: {
2640
2756
  id: "allowAddSigner",
2641
2757
  name: "allowAddSigner"
2642
2758
  },
2643
- onChange: (e) => Di({ allowAddSigner: e.target.checked })
2759
+ onChange: (e) => Wr({ allowAddSigner: e.target.checked })
2644
2760
  })
2645
2761
  }),
2646
- /* @__PURE__ */ C(n, {
2762
+ /* @__PURE__ */ T(n, {
2647
2763
  hintText: "開啟後,申請人本人(含其代理人)不會成為此關的簽核人,也不能被轉簽或加簽到此關。",
2648
2764
  label: "申請人不可簽核自己的單",
2649
2765
  name: "excludeInitiator",
2650
- children: /* @__PURE__ */ C(b, {
2766
+ children: /* @__PURE__ */ T(S, {
2651
2767
  checked: !!v,
2652
2768
  inputProps: {
2653
2769
  id: "excludeInitiator",
2654
2770
  name: "excludeInitiator"
2655
2771
  },
2656
- onChange: (e) => wi(e.target.checked ? Qn : null)
2772
+ onChange: (e) => Hr(e.target.checked ? _r : null)
2657
2773
  })
2658
2774
  }),
2659
- v ? /* @__PURE__ */ C(n, {
2775
+ v ? /* @__PURE__ */ T(n, {
2660
2776
  label: "排除後沒有簽核人時",
2661
2777
  name: "excludeInitiatorWhenEmpty",
2662
2778
  required: !0,
2663
- children: /* @__PURE__ */ C(y, {
2779
+ children: /* @__PURE__ */ T(x, {
2664
2780
  clearable: !1,
2665
- onChange: (e) => wi({ whenEmpty: Z(Zn, e?.id ?? null)?.id ?? Qn.whenEmpty }),
2666
- options: [...Zn],
2667
- value: Z(Zn, v.whenEmpty)
2781
+ onChange: (e) => Hr({ whenEmpty: $(gr, e?.id ?? null)?.id ?? _r.whenEmpty }),
2782
+ options: [...gr],
2783
+ value: $(gr, v.whenEmpty)
2668
2784
  })
2669
2785
  }) : null
2670
2786
  ] });
2671
2787
  }
2672
- function ea(e) {
2673
- let t = e.data.action, r = ta(t).map((e) => xi(I, e)), i = t.type === "NOTIFY" && t.recipients.type !== "DIRECT" ? Ii(t.recipients, I, L, R) : null;
2788
+ function Gi(e) {
2789
+ let t = e.data.action, r = ya(t).map((e) => zi(I, e)), i = t.type === "NOTIFY" && t.recipients.type !== "DIRECT" ? ta(t.recipients, I, L, R, G) : null;
2674
2790
  function a(e) {
2675
2791
  let n = {
2676
2792
  memberIds: [...e],
2677
2793
  type: "DIRECT"
2678
2794
  };
2679
- Oi(t.type === "NOTIFY" ? {
2795
+ Gr(t.type === "NOTIFY" ? {
2680
2796
  ...t,
2681
2797
  recipients: n
2682
2798
  } : {
@@ -2686,64 +2802,64 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2686
2802
  });
2687
2803
  }
2688
2804
  function o(e) {
2689
- t.type === "NOTIFY" && Oi({
2805
+ t.type === "NOTIFY" && Gr({
2690
2806
  ...t,
2691
2807
  webhooks: e
2692
2808
  });
2693
2809
  }
2694
- return /* @__PURE__ */ w(S, { children: [
2695
- /* @__PURE__ */ C(n, {
2810
+ return /* @__PURE__ */ E(w, { children: [
2811
+ /* @__PURE__ */ T(n, {
2696
2812
  hintText: i ? `目前知會對象為「${i}」;在此選擇成員會改為指定成員。` : t.type === "NOTIFY" ? "可只設定 Webhook,不指定知會對象。" : void 0,
2697
2813
  label: "知會對象",
2698
2814
  name: "notifyMemberIds",
2699
- children: /* @__PURE__ */ C(m, {
2815
+ children: /* @__PURE__ */ T(g, {
2700
2816
  asyncData: !0,
2701
2817
  disabledOptionsFilter: !0,
2702
2818
  emptyText: "沒有符合的成員",
2703
- loading: At,
2819
+ loading: Mt,
2704
2820
  loadingText: "搜尋成員中...",
2705
2821
  mode: "multiple",
2706
2822
  onChange: (e) => a(e.map((e) => e.id)),
2707
- onSearch: X,
2823
+ onSearch: J,
2708
2824
  onVisibilityChange: (e) => {
2709
- e && (It([]), X(""));
2825
+ e && (It([]), J(""));
2710
2826
  },
2711
- options: [...Mi(r, Pt)],
2827
+ options: [...Zi(r, Ft)],
2712
2828
  overflowStrategy: "wrap",
2713
2829
  placeholder: "搜尋姓名或信箱",
2714
2830
  searchDebounceTime: 300,
2715
2831
  value: [...r]
2716
2832
  })
2717
2833
  }),
2718
- t.type === "NOTIFY" && !Wt(t.webhooks) ? /* @__PURE__ */ w("div", {
2719
- style: H,
2720
- children: [/* @__PURE__ */ C(x, {
2834
+ t.type === "NOTIFY" && !Jt(t.webhooks) ? /* @__PURE__ */ E("div", {
2835
+ style: U,
2836
+ children: [/* @__PURE__ */ T(C, {
2721
2837
  color: "text-warning",
2722
2838
  variant: "body",
2723
2839
  children: "這個節點的 Webhook 設定格式錯誤,無法在此編輯。清除後可重新新增。"
2724
- }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(h, {
2840
+ }), /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(_, {
2725
2841
  onClick: () => o([]),
2726
2842
  variant: "destructive-secondary",
2727
2843
  children: "清除 Webhook 設定"
2728
2844
  }) })]
2729
2845
  }) : null,
2730
- t.type === "NOTIFY" && Wt(t.webhooks) ? /* @__PURE__ */ C(rn, {
2731
- catalog: en,
2732
- catalogState: nn,
2733
- formFields: $n?.fields ?? null,
2846
+ t.type === "NOTIFY" && Jt(t.webhooks) ? /* @__PURE__ */ T(cn, {
2847
+ catalog: rn,
2848
+ catalogState: on,
2849
+ formFields: G?.fields ?? null,
2734
2850
  onChange: o,
2735
- targets: ut(t)
2851
+ targets: mt(t)
2736
2852
  }) : null
2737
2853
  ] });
2738
2854
  }
2739
- function ra(e) {
2740
- return /* @__PURE__ */ w("div", {
2741
- style: H,
2742
- children: [/* @__PURE__ */ C(x, {
2855
+ function Ki(e) {
2856
+ return /* @__PURE__ */ E("div", {
2857
+ style: U,
2858
+ children: [/* @__PURE__ */ T(C, {
2743
2859
  component: "h2",
2744
2860
  variant: "h3",
2745
2861
  children: "已選取線段"
2746
- }), /* @__PURE__ */ w(x, {
2862
+ }), /* @__PURE__ */ E(C, {
2747
2863
  color: "text-neutral",
2748
2864
  variant: "body",
2749
2865
  children: [
@@ -2754,17 +2870,17 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2754
2870
  })]
2755
2871
  });
2756
2872
  }
2757
- function ia(e) {
2758
- let t = $i(e, A.nodes);
2759
- return /* @__PURE__ */ w("div", {
2760
- style: H,
2873
+ function qi(e) {
2874
+ let t = _a(e, A.nodes);
2875
+ return /* @__PURE__ */ E("div", {
2876
+ style: U,
2761
2877
  children: [
2762
- /* @__PURE__ */ C(x, {
2878
+ /* @__PURE__ */ T(C, {
2763
2879
  component: "h2",
2764
2880
  variant: "h3",
2765
2881
  children: t ? "條件設定" : "線段屬性"
2766
2882
  }),
2767
- /* @__PURE__ */ w(x, {
2883
+ /* @__PURE__ */ E(C, {
2768
2884
  color: "text-neutral",
2769
2885
  variant: "body",
2770
2886
  children: [
@@ -2773,7 +2889,7 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2773
2889
  e.target
2774
2890
  ]
2775
2891
  }),
2776
- t ? oa(e) : /* @__PURE__ */ C(x, {
2892
+ t ? Xi(e) : /* @__PURE__ */ T(C, {
2777
2893
  color: "text-neutral",
2778
2894
  variant: "body",
2779
2895
  children: "這條線會直接把流程送到下一個節點。"
@@ -2781,63 +2897,63 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2781
2897
  ]
2782
2898
  });
2783
2899
  }
2784
- function aa(e) {
2785
- return !e || !$i(e, A.nodes) ? null : /* @__PURE__ */ C(v, {
2900
+ function Ji(e) {
2901
+ return !e || !_a(e, A.nodes) ? null : /* @__PURE__ */ T(b, {
2786
2902
  cancelText: "取消",
2787
2903
  confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
2788
2904
  confirmText: "完成",
2789
2905
  modalType: "standard",
2790
- onCancel: ri,
2791
- onClose: ri,
2792
- onConfirm: ri,
2793
- open: !!at,
2906
+ onCancel: Pr,
2907
+ onClose: Pr,
2908
+ onConfirm: Pr,
2909
+ open: !!ot,
2794
2910
  showModalFooter: !0,
2795
2911
  showModalHeader: !0,
2796
2912
  size: "regular",
2797
2913
  supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
2798
2914
  title: "條件設定",
2799
- children: oa(e)
2915
+ children: Xi(e)
2800
2916
  });
2801
2917
  }
2802
- function oa(e) {
2803
- let t = Zi(e, A.nodes), r = Wi(K?.schema ?? null), i = Gi(K?.schema ?? null, e.data.conditionFieldKey ?? null), a = Ki(i), o = Yi(i), s = Z(a, e.data.conditionOperator ?? null), c = !e.data.isDefault && !e.data.condition;
2804
- return /* @__PURE__ */ w("div", {
2805
- style: H,
2918
+ function Xi(e) {
2919
+ let t = ha(e, A.nodes), r = la(H?.schema ?? null), i = ua(H?.schema ?? null, e.data.conditionFieldKey ?? null), a = da(i), o = pa(i), s = $(a, e.data.conditionOperator ?? null), c = !e.data.isDefault && !e.data.condition;
2920
+ return /* @__PURE__ */ E("div", {
2921
+ style: U,
2806
2922
  children: [
2807
- /* @__PURE__ */ w(x, {
2923
+ /* @__PURE__ */ E(C, {
2808
2924
  color: "text-neutral",
2809
2925
  variant: "body",
2810
2926
  children: [
2811
2927
  "畫布上的這條線目前會顯示「",
2812
- /* @__PURE__ */ C("span", {
2813
- style: { color: c ? vn : void 0 },
2928
+ /* @__PURE__ */ T("span", {
2929
+ style: { color: c ? Rn : void 0 },
2814
2930
  children: t ?? "請設定條件"
2815
2931
  }),
2816
2932
  "」。"
2817
2933
  ]
2818
2934
  }),
2819
- /* @__PURE__ */ C(b, {
2935
+ /* @__PURE__ */ T(S, {
2820
2936
  checked: !!e.data.isDefault,
2821
2937
  label: "其他情況走這條",
2822
- onChange: (t) => Ni(e.id, t.target.checked)
2938
+ onChange: (t) => bi(e.id, t.target.checked)
2823
2939
  }),
2824
- e.data.isDefault ? /* @__PURE__ */ C(x, {
2940
+ e.data.isDefault ? /* @__PURE__ */ T(C, {
2825
2941
  color: "text-neutral",
2826
2942
  variant: "body",
2827
2943
  children: "其他條件都不符合時,流程會走這條線。"
2828
- }) : /* @__PURE__ */ w(S, { children: [
2829
- K ? null : /* @__PURE__ */ C(x, {
2944
+ }) : /* @__PURE__ */ E(w, { children: [
2945
+ H ? null : /* @__PURE__ */ T(C, {
2830
2946
  color: "text-neutral",
2831
2947
  variant: "body",
2832
2948
  children: "請先綁定表單版本,才能選擇條件欄位。"
2833
2949
  }),
2834
- /* @__PURE__ */ C(n, {
2950
+ /* @__PURE__ */ T(n, {
2835
2951
  label: "條件欄位",
2836
2952
  name: "edgeConditionField",
2837
2953
  required: !0,
2838
- children: /* @__PURE__ */ C(y, {
2954
+ children: /* @__PURE__ */ T(x, {
2839
2955
  clearable: !1,
2840
- onChange: (t) => Fi({
2956
+ onChange: (t) => Si({
2841
2957
  edgeId: e.id,
2842
2958
  fieldKey: t?.id ?? null,
2843
2959
  operator: null,
@@ -2845,18 +2961,18 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2845
2961
  }),
2846
2962
  options: [...r],
2847
2963
  placeholder: "選擇條件欄位",
2848
- value: Z(r, e.data.conditionFieldKey ?? null)
2964
+ value: $(r, e.data.conditionFieldKey ?? null)
2849
2965
  })
2850
2966
  }),
2851
- /* @__PURE__ */ C(n, {
2967
+ /* @__PURE__ */ T(n, {
2852
2968
  label: "條件判斷",
2853
2969
  name: "edgeConditionOperator",
2854
2970
  required: !0,
2855
- children: /* @__PURE__ */ C(y, {
2971
+ children: /* @__PURE__ */ T(x, {
2856
2972
  clearable: !1,
2857
- onChange: (t) => Fi({
2973
+ onChange: (t) => Si({
2858
2974
  edgeId: e.id,
2859
- operator: qi(t?.id ?? null),
2975
+ operator: fa(t?.id ?? null),
2860
2976
  value: null
2861
2977
  }),
2862
2978
  options: [...a],
@@ -2864,21 +2980,21 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2864
2980
  value: s
2865
2981
  })
2866
2982
  }),
2867
- s && Xi(s.id) ? /* @__PURE__ */ C(n, {
2983
+ s && ma(s.id) ? /* @__PURE__ */ T(n, {
2868
2984
  label: "條件值",
2869
2985
  name: "edgeConditionValue",
2870
2986
  required: !0,
2871
- children: o.length > 0 ? /* @__PURE__ */ C(y, {
2987
+ children: o.length > 0 ? /* @__PURE__ */ T(x, {
2872
2988
  clearable: !1,
2873
- onChange: (t) => Fi({
2989
+ onChange: (t) => Si({
2874
2990
  edgeId: e.id,
2875
2991
  value: t?.id ?? null
2876
2992
  }),
2877
2993
  options: [...o],
2878
2994
  placeholder: "選擇條件值",
2879
- value: Z(o, e.data.conditionValue ?? null)
2880
- }) : /* @__PURE__ */ C(_, {
2881
- onChange: (t) => Fi({
2995
+ value: $(o, e.data.conditionValue ?? null)
2996
+ }) : /* @__PURE__ */ T(y, {
2997
+ onChange: (t) => Si({
2882
2998
  edgeId: e.id,
2883
2999
  value: t.target.value
2884
3000
  }),
@@ -2892,14 +3008,14 @@ function ur({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2892
3008
  });
2893
3009
  }
2894
3010
  }
2895
- function dr({ onApplyAutoLayout: e }) {
3011
+ function jr({ onApplyAutoLayout: e }) {
2896
3012
  function t() {
2897
3013
  e();
2898
3014
  }
2899
- return /* @__PURE__ */ C(je, {
3015
+ return /* @__PURE__ */ T(Pe, {
2900
3016
  position: "top-right",
2901
- children: /* @__PURE__ */ C(h, {
2902
- icon: oe,
3017
+ children: /* @__PURE__ */ T(_, {
3018
+ icon: se,
2903
3019
  iconType: "leading",
2904
3020
  onClick: t,
2905
3021
  size: "sub",
@@ -2908,28 +3024,28 @@ function dr({ onApplyAutoLayout: e }) {
2908
3024
  })
2909
3025
  });
2910
3026
  }
2911
- function Y({ data: e, selected: t, type: n }) {
2912
- let r = e.approverLines ?? [e.approverSummary ?? e.label], i = fr(e), a = pr(n, t);
2913
- return /* @__PURE__ */ w("div", {
3027
+ function X({ data: e, selected: t, type: n }) {
3028
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = Mr(e), a = Nr(n, t);
3029
+ return /* @__PURE__ */ E("div", {
2914
3030
  style: a,
2915
3031
  children: [
2916
- hr(e),
2917
- /* @__PURE__ */ C("div", {
2918
- style: zn,
2919
- children: r.map((e, t) => /* @__PURE__ */ C(x, {
3032
+ Fr(e),
3033
+ /* @__PURE__ */ T("div", {
3034
+ style: ir,
3035
+ children: r.map((e, t) => /* @__PURE__ */ T(C, {
2920
3036
  component: "span",
2921
3037
  ellipsis: !0,
2922
- style: K,
3038
+ style: rr,
2923
3039
  title: e,
2924
3040
  variant: "label-primary",
2925
3041
  children: e
2926
3042
  }, `${e}_${t}`))
2927
3043
  }),
2928
- /* @__PURE__ */ C(x, {
3044
+ /* @__PURE__ */ T(C, {
2929
3045
  color: "text-neutral",
2930
3046
  component: "span",
2931
3047
  ellipsis: !0,
2932
- style: K,
3048
+ style: rr,
2933
3049
  title: i,
2934
3050
  variant: "caption",
2935
3051
  children: i
@@ -2937,85 +3053,85 @@ function Y({ data: e, selected: t, type: n }) {
2937
3053
  ]
2938
3054
  });
2939
3055
  }
2940
- function fr(e) {
2941
- return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : Vn[e.nodeKind];
3056
+ function Mr(e) {
3057
+ return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : sr[e.nodeKind];
2942
3058
  }
2943
- function pr(e, t) {
2944
- let n = mr(e);
3059
+ function Nr(e, t) {
3060
+ let n = Pr(e);
2945
3061
  return t ? {
2946
3062
  ...n,
2947
3063
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2948
- boxShadow: kn
3064
+ boxShadow: Xn
2949
3065
  } : n;
2950
3066
  }
2951
- function mr(e) {
2952
- return e === "exclusiveGateway" ? Fn : e === "parallelGateway" ? In : e === "startEvent" ? Ln : e === "endEvent" ? Rn : e === "userTask" ? G : U;
3067
+ function Pr(e) {
3068
+ return e === "exclusiveGateway" ? $n : e === "parallelGateway" ? er : e === "startEvent" ? J : e === "endEvent" ? nr : e === "userTask" ? tr : Yn;
2953
3069
  }
2954
- function hr(e) {
2955
- return !e.hasInput && e.hasOutput ? /* @__PURE__ */ C(D, {
2956
- id: q,
3070
+ function Fr(e) {
3071
+ return !e.hasInput && e.hasOutput ? /* @__PURE__ */ T(Me, {
3072
+ id: or,
2957
3073
  position: O.Right,
2958
3074
  type: "source"
2959
- }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ C(D, {
2960
- id: Bn,
3075
+ }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ T(Me, {
3076
+ id: ar,
2961
3077
  position: O.Left,
2962
3078
  type: "target"
2963
- }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ C(D, {
2964
- id: Bn,
3079
+ }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ T(Me, {
3080
+ id: ar,
2965
3081
  position: O.Left,
2966
3082
  type: "target"
2967
- }, "target"), /* @__PURE__ */ C(D, {
2968
- id: q,
3083
+ }, "target"), /* @__PURE__ */ T(Me, {
3084
+ id: or,
2969
3085
  position: O.Right,
2970
3086
  type: "source"
2971
3087
  }, "source")];
2972
3088
  }
2973
- function gr(e, t, n, r, i, a) {
2974
- let o = X(e);
3089
+ function Ir(e, t, n, r, i, a, o) {
3090
+ let s = Lr(e);
2975
3091
  return {
2976
3092
  data: {
2977
- approverLines: Li(e, t, n, r),
2978
- approverSummary: Fi(e, t, n, r),
2979
- hasInput: ci(e),
2980
- hasOutput: li(e),
2981
- initiatorPolicySummary: e.type === "startEvent" ? ri(a, n, r) : null,
3093
+ approverLines: na(e, t, n, r, o),
3094
+ approverSummary: ea(e, t, n, r, o),
3095
+ hasInput: Di(e),
3096
+ hasOutput: Oi(e),
3097
+ initiatorPolicySummary: e.type === "startEvent" ? Si(a, n, r) : null,
2982
3098
  label: e.data.label,
2983
3099
  nodeKind: e.type
2984
3100
  },
2985
- height: o.height,
2986
- handles: _r(e),
3101
+ height: s.height,
3102
+ handles: Z(e),
2987
3103
  id: e.id,
2988
- initialHeight: o.height,
2989
- initialWidth: o.width,
3104
+ initialHeight: s.height,
3105
+ initialWidth: s.width,
2990
3106
  position: e.position,
2991
3107
  selected: i,
2992
3108
  sourcePosition: O.Right,
2993
3109
  targetPosition: O.Left,
2994
3110
  type: e.type,
2995
- width: o.width
3111
+ width: s.width
2996
3112
  };
2997
3113
  }
2998
- function X(e) {
3114
+ function Lr(e) {
2999
3115
  return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
3000
- height: Mn,
3001
- width: Nn
3116
+ height: Qn,
3117
+ width: K
3002
3118
  } : e.type === "serviceTask" ? {
3003
- height: An + (Ri(e.data.action) - 1) * jn,
3004
- width: W
3119
+ height: W + (ra(e.data.action) - 1) * Zn,
3120
+ width: G
3005
3121
  } : {
3006
- height: An,
3007
- width: W
3122
+ height: W,
3123
+ width: G
3008
3124
  };
3009
3125
  }
3010
- function _r(e) {
3011
- let t = X(e);
3012
- return [...ci(e) ? [vr(t)] : [], ...li(e) ? [yr(t)] : []];
3126
+ function Z(e) {
3127
+ let t = Lr(e);
3128
+ return [...Di(e) ? [Rr(t)] : [], ...Oi(e) ? [zr(t)] : []];
3013
3129
  }
3014
- function vr({ height: e }) {
3130
+ function Rr({ height: e }) {
3015
3131
  let t = e / 2 - 9 / 2;
3016
3132
  return {
3017
3133
  height: 9,
3018
- id: Bn,
3134
+ id: ar,
3019
3135
  position: O.Left,
3020
3136
  type: "target",
3021
3137
  width: 9,
@@ -3023,11 +3139,11 @@ function vr({ height: e }) {
3023
3139
  y: t
3024
3140
  };
3025
3141
  }
3026
- function yr({ height: e, width: t }) {
3142
+ function zr({ height: e, width: t }) {
3027
3143
  let n = e / 2 - 9 / 2;
3028
3144
  return {
3029
3145
  height: 9,
3030
- id: q,
3146
+ id: or,
3031
3147
  position: O.Right,
3032
3148
  type: "source",
3033
3149
  width: 9,
@@ -3035,8 +3151,8 @@ function yr({ height: e, width: t }) {
3035
3151
  y: n
3036
3152
  };
3037
3153
  }
3038
- function br(e, t, n) {
3039
- let r = Zi(e, t), i = $i(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? vn : i ? _n : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? vn : i ? _n : V;
3154
+ function Br(e, t, n) {
3155
+ let r = ha(e, t), i = _a(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? Rn : i ? Ln : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? Rn : i ? Ln : H;
3040
3156
  return {
3041
3157
  className: n ? "workflow-edge--selected" : void 0,
3042
3158
  data: e.data,
@@ -3059,9 +3175,9 @@ function br(e, t, n) {
3059
3175
  source: e.source,
3060
3176
  sourceHandle: e.sourceHandle,
3061
3177
  style: {
3062
- filter: n ? yn : void 0,
3178
+ filter: n ? zn : void 0,
3063
3179
  opacity: 1,
3064
- stroke: V,
3180
+ stroke: H,
3065
3181
  strokeOpacity: 1,
3066
3182
  strokeWidth: 1.5
3067
3183
  },
@@ -3070,7 +3186,7 @@ function br(e, t, n) {
3070
3186
  type: e.type ?? "smoothstep"
3071
3187
  };
3072
3188
  }
3073
- function xr(e, t) {
3189
+ function Q(e, t) {
3074
3190
  return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
3075
3191
  ...e,
3076
3192
  data: {
@@ -3079,10 +3195,10 @@ function xr(e, t) {
3079
3195
  }
3080
3196
  });
3081
3197
  }
3082
- function Sr(e) {
3083
- return Er(wr(Tr(Cr(e))));
3198
+ function Vr(e) {
3199
+ return Gr(Ur(Wr(Hr(e))));
3084
3200
  }
3085
- function Cr(e) {
3201
+ function Hr(e) {
3086
3202
  let t = e.edges.map((e) => {
3087
3203
  let t = e.data ?? {};
3088
3204
  return e.data === t ? e : {
@@ -3095,7 +3211,7 @@ function Cr(e) {
3095
3211
  edges: t
3096
3212
  } : e;
3097
3213
  }
3098
- function wr(e) {
3214
+ function Ur(e) {
3099
3215
  let t = e.nodes.map((e) => {
3100
3216
  if (e.type !== "userTask") return e;
3101
3217
  let t = e.data.allowAddSigner ?? !1, n = e.data.allowReject ?? !0, r = e.data.allowTransfer ?? !0, i = !e.data.decisionPolicy;
@@ -3115,24 +3231,24 @@ function wr(e) {
3115
3231
  nodes: t
3116
3232
  } : e;
3117
3233
  }
3118
- function Tr(e) {
3119
- let t = new Set(e.nodes.filter((e) => Q(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
3234
+ function Wr(e) {
3235
+ let t = new Set(e.nodes.filter((e) => ki(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
3120
3236
  return n.length === e.edges.length ? e : {
3121
3237
  ...e,
3122
3238
  edges: n
3123
3239
  };
3124
3240
  }
3125
- function Er(e) {
3241
+ function Gr(e) {
3126
3242
  let t = e.edges.reduce((e, t) => ({
3127
3243
  ...e,
3128
3244
  [t.target]: (e[t.target] ?? 0) + 1
3129
- }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? xr(e, "AND") : e);
3245
+ }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? Q(e, "AND") : e);
3130
3246
  return n.some((t, n) => t !== e.nodes[n]) ? {
3131
3247
  ...e,
3132
3248
  nodes: n
3133
3249
  } : e;
3134
3250
  }
3135
- function Dr() {
3251
+ function Kr() {
3136
3252
  return {
3137
3253
  edges: [],
3138
3254
  meta: { schemaVersion: 1 },
@@ -3159,80 +3275,80 @@ function Dr() {
3159
3275
  }]
3160
3276
  };
3161
3277
  }
3162
- function Or(e) {
3278
+ function qr(e) {
3163
3279
  return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
3164
3280
  }
3165
- function kr(e) {
3166
- let t = new Fe.graphlib.Graph();
3281
+ function Jr(e) {
3282
+ let t = new Re.graphlib.Graph();
3167
3283
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
3168
3284
  rankdir: "LR",
3169
3285
  ranksep: 120
3170
3286
  }), e.nodes.forEach((e) => {
3171
- t.setNode(e.id, X(e));
3287
+ t.setNode(e.id, Lr(e));
3172
3288
  }), e.edges.forEach((e) => {
3173
3289
  t.setEdge(e.source, e.target);
3174
- }), Fe.layout(t), {
3290
+ }), Re.layout(t), {
3175
3291
  ...e,
3176
3292
  nodes: e.nodes.map((e) => {
3177
3293
  let n = t.node(e.id);
3178
3294
  return n ? {
3179
3295
  ...e,
3180
3296
  position: {
3181
- x: n.x - X(e).width / 2,
3182
- y: n.y - X(e).height / 2
3297
+ x: n.x - Lr(e).width / 2,
3298
+ y: n.y - Lr(e).height / 2
3183
3299
  }
3184
3300
  } : e;
3185
3301
  })
3186
3302
  };
3187
3303
  }
3188
- function Z(e, t) {
3304
+ function $(e, t) {
3189
3305
  return t ? e.find((e) => e.id === t) ?? null : null;
3190
3306
  }
3191
- function Ar(e) {
3307
+ function Yr(e) {
3192
3308
  return e === "OR" ? "OR" : "AND";
3193
3309
  }
3194
- function jr(e) {
3310
+ function Xr(e) {
3195
3311
  return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
3196
3312
  }
3197
- function Mr(e) {
3313
+ function Zr(e) {
3198
3314
  return e?.type ?? "SINGLE";
3199
3315
  }
3200
- function Nr(e, t) {
3316
+ function Qr(e, t) {
3201
3317
  return e === "QUORUM" ? t?.type === "QUORUM" ? t : {
3202
- threshold: qe,
3318
+ threshold: Xe,
3203
3319
  thresholdType: "COUNT",
3204
3320
  type: "QUORUM"
3205
3321
  } : e === "PARALLEL_ALL" || e === "PARALLEL_ANY" || e === "SEQUENTIAL" ? { type: e } : { type: "SINGLE" };
3206
3322
  }
3207
- function Pr(e) {
3323
+ function $r(e) {
3208
3324
  return e?.type === "QUORUM" ? {
3209
- threshold: Number.isFinite(e.threshold) ? e.threshold : qe,
3210
- thresholdType: Fr(e.thresholdType ?? null)
3325
+ threshold: Number.isFinite(e.threshold) ? e.threshold : Xe,
3326
+ thresholdType: ei(e.thresholdType ?? null)
3211
3327
  } : {
3212
- threshold: qe,
3328
+ threshold: Xe,
3213
3329
  thresholdType: "COUNT"
3214
3330
  };
3215
3331
  }
3216
- function Fr(e) {
3332
+ function ei(e) {
3217
3333
  return e === "PERCENTAGE" ? "PERCENTAGE" : "COUNT";
3218
3334
  }
3219
- function Ir(e) {
3335
+ function ti(e) {
3220
3336
  return e === "HOUR" ? "HOUR" : "DAY";
3221
3337
  }
3222
- function Lr(e) {
3338
+ function ni(e) {
3223
3339
  return e === "BUSINESS_DAY" ? "BUSINESS_DAY" : "CALENDAR";
3224
3340
  }
3225
- function Rr(e) {
3226
- return Qe.find((t) => t.id === e)?.id ?? "REMIND";
3341
+ function ri(e) {
3342
+ return et.find((t) => t.id === e)?.id ?? "REMIND";
3227
3343
  }
3228
- function zr(e) {
3229
- return Kn.find((t) => t.value === e) ?? Kn[0];
3344
+ function ii(e) {
3345
+ return fr.find((t) => t.value === e) ?? fr[0];
3230
3346
  }
3231
- function Br(e) {
3232
- return Kn.find((t) => t.id === e) ?? Kn[0];
3347
+ function ai(e) {
3348
+ return fr.find((t) => t.id === e) ?? fr[0];
3233
3349
  }
3234
- function Vr(e, t) {
3235
- let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = A({
3350
+ function oi(e, t) {
3351
+ let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = j({
3236
3352
  unit: t.unit,
3237
3353
  value: n
3238
3354
  });
@@ -3242,36 +3358,39 @@ function Vr(e, t) {
3242
3358
  duration: r
3243
3359
  };
3244
3360
  }
3245
- function Hr(e, t) {
3361
+ function si(e, t) {
3246
3362
  return t === "ESCALATE" ? {
3247
3363
  ...e,
3248
3364
  escalateLevelsUp: e.escalateLevelsUp ?? 1,
3249
3365
  onTimeout: t
3250
3366
  } : {
3251
- ...Wr(e, "escalateLevelsUp"),
3367
+ ...li(e, "escalateLevelsUp"),
3252
3368
  onTimeout: t
3253
3369
  };
3254
3370
  }
3255
- function Ur(e, t) {
3256
- return t === null ? Wr(e, "warningAt") : {
3371
+ function ci(e, t) {
3372
+ return t === null ? li(e, "warningAt") : {
3257
3373
  ...e,
3258
3374
  warningAt: t
3259
3375
  };
3260
3376
  }
3261
- function Wr(e, t) {
3377
+ function li(e, t) {
3262
3378
  return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
3263
3379
  }
3264
- function Gr(e) {
3265
- return e === "ORG_MANAGER" || e === "ORG_MANAGER_CHAIN" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
3266
- }
3267
- function Kr(e, t) {
3268
- let n = Gr(e ?? "DIRECT");
3269
- return n === "ORG_MANAGER" ? {
3380
+ function ui(e) {
3381
+ return e === "DYNAMIC_FORM" || e === "ORG_MANAGER" || e === "ORG_MANAGER_CHAIN" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
3382
+ }
3383
+ function di(e, t) {
3384
+ let n = ui(e ?? "DIRECT");
3385
+ return n === "DYNAMIC_FORM" ? {
3386
+ formPath: "",
3387
+ type: "DYNAMIC_FORM"
3388
+ } : n === "ORG_MANAGER" ? {
3270
3389
  baseFromInitiator: !0,
3271
3390
  levelsUp: 1,
3272
3391
  type: "ORG_MANAGER"
3273
3392
  } : n === "ORG_MANAGER_CHAIN" ? {
3274
- minPositionLevel: It(t),
3393
+ minPositionLevel: Bt(t),
3275
3394
  type: "ORG_MANAGER_CHAIN"
3276
3395
  } : n === "ORG_UNIT_MANAGER" ? {
3277
3396
  orgUnitId: "",
@@ -3293,31 +3412,31 @@ function Kr(e, t) {
3293
3412
  type: "DIRECT"
3294
3413
  };
3295
3414
  }
3296
- function qr(e) {
3415
+ function fi(e) {
3297
3416
  return e === "DIRECT" ? "DIRECT" : "NONE";
3298
3417
  }
3299
- function Jr(e, t) {
3418
+ function pi(e, t) {
3300
3419
  return e.type === "ORG_MANAGER" || e.type === "ORG_MANAGER_CHAIN" || e.type === "ORG_UNIT_MANAGER" ? {
3301
3420
  ...e,
3302
3421
  fallback: t
3303
3422
  } : e;
3304
3423
  }
3305
- function Yr(e) {
3306
- return Yn.find((t) => t.value === e) ?? Yn[0];
3424
+ function mi(e) {
3425
+ return Y.find((t) => t.value === e) ?? Y[0];
3307
3426
  }
3308
- function Xr(e) {
3309
- return Yn.find((t) => t.id === e) ?? Yn[0];
3427
+ function hi(e) {
3428
+ return Y.find((t) => t.id === e) ?? Y[0];
3310
3429
  }
3311
- function Zr(e) {
3430
+ function gi(e) {
3312
3431
  return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
3313
3432
  }
3314
- function Qr(e) {
3433
+ function _i(e) {
3315
3434
  let t = e?.trim();
3316
3435
  if (!t) return {
3317
3436
  mode: "ALL",
3318
3437
  value: ""
3319
3438
  };
3320
- let n = ti(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = ti(t, /"([^"]+)" in subject\.positionIds/gu);
3439
+ let n = bi(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = bi(t, /"([^"]+)" in subject\.positionIds/gu);
3321
3440
  return n.length > 0 && r.length > 0 ? {
3322
3441
  includeDescendants: n.length > 1,
3323
3442
  mode: "ORG_UNIT_POSITION",
@@ -3334,32 +3453,32 @@ function Qr(e) {
3334
3453
  value: t
3335
3454
  };
3336
3455
  }
3337
- function $r(e, t) {
3338
- let n = Qr(e);
3456
+ function vi(e, t) {
3457
+ let n = _i(e);
3339
3458
  return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
3340
3459
  mode: t,
3341
3460
  value: ""
3342
- } : n : n.mode === t ? n : ii(t);
3461
+ } : n : n.mode === t ? n : Ci(t);
3343
3462
  }
3344
- function ei(e) {
3463
+ function yi(e) {
3345
3464
  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;
3346
3465
  }
3347
- function ti(e, t) {
3466
+ function bi(e, t) {
3348
3467
  return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
3349
3468
  }
3350
- function ni(e, t) {
3469
+ function xi(e, t) {
3351
3470
  if (e.mode === "ALL" || e.mode === "NONE") return null;
3352
3471
  let n = e.orgUnitId?.trim() ?? "";
3353
3472
  if (!n) return null;
3354
- let r = ji(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
3473
+ let r = Xi(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
3355
3474
  if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
3356
3475
  let i = e.positionId?.trim() ?? "";
3357
3476
  return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
3358
3477
  }
3359
- function ri(e, t, n) {
3360
- return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${$(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${$(t, e.orgUnitId)} / ${wi(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
3478
+ function Si(e, t, n) {
3479
+ return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${Hi(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${Hi(t, e.orgUnitId)} / ${Ui(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
3361
3480
  }
3362
- function ii(e) {
3481
+ function Ci(e) {
3363
3482
  return {
3364
3483
  includeDescendants: !0,
3365
3484
  mode: e,
@@ -3368,73 +3487,64 @@ function ii(e) {
3368
3487
  value: ""
3369
3488
  };
3370
3489
  }
3371
- function ai(e, t) {
3490
+ function wi(e, t) {
3372
3491
  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;
3373
- return !!n && !!r && e.source !== e.target && e.sourceHandle === q && e.targetHandle === Bn && !!(n && li(n)) && !!(r && ci(r));
3492
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === or && e.targetHandle === ar && !!(n && Oi(n)) && !!(r && Di(r));
3374
3493
  }
3375
- function oi(e, t) {
3494
+ function Ti(e, t) {
3376
3495
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
3377
3496
  }
3378
- function si(e) {
3497
+ function Ei(e) {
3379
3498
  return e.type !== "startEvent" && e.type !== "endEvent";
3380
3499
  }
3381
- function ci(e) {
3500
+ function Di(e) {
3382
3501
  return e.type !== "startEvent";
3383
3502
  }
3384
- function li(e) {
3385
- return e.type !== "endEvent" && !Q(e);
3503
+ function Oi(e) {
3504
+ return e.type !== "endEvent" && !ki(e);
3386
3505
  }
3387
- function Q(e) {
3506
+ function ki(e) {
3388
3507
  return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
3389
3508
  }
3390
- function ui(e) {
3509
+ function Ai(e) {
3391
3510
  return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
3392
3511
  }
3393
- function di(e) {
3512
+ function ji(e) {
3394
3513
  return e.map((e) => ({
3395
3514
  formDefinitionId: e.formDefinitionId,
3396
3515
  formName: e.formName,
3397
3516
  id: e.id,
3398
- name: `${e.formName} | v${e.version}`,
3517
+ name: kn(e.formName, e.version),
3399
3518
  schema: e.schema
3400
3519
  }));
3401
3520
  }
3402
- function fi(e) {
3403
- return (e?.schema.fields ?? []).reduce((e, t) => ({
3404
- ...e,
3405
- [t.fieldKey]: pi(t)
3406
- }), {});
3407
- }
3408
- function pi(e) {
3409
- return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : we(e) ? e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.options[0]?.value ?? "" : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
3410
- }
3411
- function mi(e) {
3521
+ function Mi(e) {
3412
3522
  let t = JSON.parse(e);
3413
- if (!hi(t)) throw Error("表單資料 JSON 必須是物件。");
3523
+ if (!Ni(t)) throw Error("表單資料 JSON 必須是物件。");
3414
3524
  return t;
3415
3525
  }
3416
- function hi(e) {
3526
+ function Ni(e) {
3417
3527
  return typeof e == "object" && !!e && !Array.isArray(e);
3418
3528
  }
3419
- function gi(e) {
3529
+ function Pi(e) {
3420
3530
  return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
3421
3531
  }
3422
- function _i(e) {
3423
- return e in Vn ? Vn[e] : e;
3532
+ function Fi(e) {
3533
+ return e in sr ? sr[e] : e;
3424
3534
  }
3425
- function vi(e, t) {
3535
+ function Ii(e, t) {
3426
3536
  return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
3427
3537
  }
3428
- function yi(e) {
3538
+ function Li(e) {
3429
3539
  return e.map((e) => ({
3430
3540
  displayName: e.name,
3431
3541
  email: e.email,
3432
3542
  id: e.memberId,
3433
3543
  memberId: e.memberId,
3434
- name: Vi(e.name, e.email)
3544
+ name: oa(e.name, e.email)
3435
3545
  }));
3436
3546
  }
3437
- function bi(e) {
3547
+ function Ri(e) {
3438
3548
  return {
3439
3549
  displayName: "未知會員",
3440
3550
  email: "",
@@ -3444,101 +3554,101 @@ function bi(e) {
3444
3554
  unresolved: !0
3445
3555
  };
3446
3556
  }
3447
- function xi(e, t) {
3448
- return e.find((e) => e.memberId === t) ?? bi(t);
3557
+ function zi(e, t) {
3558
+ return e.find((e) => e.memberId === t) ?? Ri(t);
3449
3559
  }
3450
- function Si(e, t) {
3560
+ function Bi(e, t) {
3451
3561
  let n = e.find((e) => e.id === t);
3452
3562
  return n ? r(n) : null;
3453
3563
  }
3454
- function Ci(e, t) {
3564
+ function Vi(e, t) {
3455
3565
  let n = e.find((e) => e.id === t);
3456
3566
  return n ? a(n) : null;
3457
3567
  }
3458
- function $(e, t) {
3459
- return Si(e, t)?.name ?? "未指定組織";
3568
+ function Hi(e, t) {
3569
+ return Bi(e, t)?.name ?? "未指定組織";
3460
3570
  }
3461
- function wi(e, t) {
3462
- return Ci(e, t)?.name ?? "未指定職位";
3571
+ function Ui(e, t) {
3572
+ return Vi(e, t)?.name ?? "未指定職位";
3463
3573
  }
3464
- function Ti(e, t) {
3465
- let n = Ei(), r = t.filter((t) => t.memberId === e && Di(t, n)), i = r.reduce((e, t) => e && Oi(e, t) <= 0 ? e : t, null);
3574
+ function Wi(e, t) {
3575
+ let n = Gi(), r = t.filter((t) => t.memberId === e && Ki(t, n)), i = r.reduce((e, t) => e && qi(e, t) <= 0 ? e : t, null);
3466
3576
  return {
3467
3577
  customFields: {},
3468
3578
  managerMemberId: "member-002",
3469
3579
  memberId: e,
3470
3580
  orgCode: "HQ",
3471
- orgUnitIds: ki(r.map((e) => e.orgUnitId)),
3581
+ orgUnitIds: Ji(r.map((e) => e.orgUnitId)),
3472
3582
  positionId: i?.positionId ?? null,
3473
- positionIds: ki(r.map((e) => e.positionId)),
3583
+ positionIds: Ji(r.map((e) => e.positionId)),
3474
3584
  primaryOrgUnitId: i?.orgUnitId ?? null,
3475
3585
  roles: ["manager"]
3476
3586
  };
3477
3587
  }
3478
- function Ei() {
3588
+ function Gi() {
3479
3589
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
3480
3590
  }
3481
- function Di(e, t) {
3591
+ function Ki(e, t) {
3482
3592
  return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
3483
3593
  }
3484
- function Oi(e, t) {
3594
+ function qi(e, t) {
3485
3595
  return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
3486
3596
  }
3487
- function ki(e) {
3597
+ function Ji(e) {
3488
3598
  return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
3489
3599
  }
3490
- function Ai({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
3491
- let a = new Set(ji(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
3600
+ function Yi({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
3601
+ let a = new Set(Xi(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
3492
3602
  return i.filter((e) => o.has(e.id));
3493
3603
  }
3494
- function ji(e, t, n) {
3604
+ function Xi(e, t, n) {
3495
3605
  let r = e.find((e) => e.id === t);
3496
3606
  return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
3497
3607
  }
3498
- function Mi(e, t) {
3608
+ function Zi(e, t) {
3499
3609
  let n = new Map(t.filter((e) => !e.unresolved).map((e) => [e.memberId, e])), r = new Set(e.map((e) => e.memberId)), i = t.filter((e) => !r.has(e.memberId)), a = e.map((e) => (e.unresolved ? n.get(e.memberId) : null) ?? e);
3500
3610
  return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
3501
3611
  }
3502
- function Ni(e) {
3612
+ function Qi(e) {
3503
3613
  return e.type === "DIRECT" ? e.memberIds : (e.type === "ORG_MANAGER" || e.type === "ORG_MANAGER_CHAIN" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && e.fallback.memberId ? [e.fallback.memberId] : [];
3504
3614
  }
3505
- function Pi(e) {
3506
- return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Ni(e.data.approverResolver) : e.type === "serviceTask" ? ta(e.data.action) : []))];
3615
+ function $i(e) {
3616
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Qi(e.data.approverResolver) : e.type === "serviceTask" ? ya(e.data.action) : []))];
3507
3617
  }
3508
- function Fi(e, t, n, r) {
3509
- return e.type === "userTask" ? Ii(e.data.approverResolver, t, n, r) : null;
3618
+ function ea(e, t, n, r, i) {
3619
+ return e.type === "userTask" ? ta(e.data.approverResolver, t, n, r, i) : null;
3510
3620
  }
3511
- function Ii(e, t, n, r) {
3512
- return e.type === "DIRECT" ? Bi(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Yr(e.levelsUp).name : e.type === "ORG_MANAGER_CHAIN" ? `主管鏈:簽到職等 ${e.minPositionLevel}` : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${$(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${$(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${$(n, e.orgUnitId)} / ${wi(r, e.positionId)}` : e.type === "POSITION" ? `職位:${wi(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
3621
+ function ta(e, t, n, r, i) {
3622
+ return e.type === "DIRECT" ? aa(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? mi(e.levelsUp).name : e.type === "ORG_MANAGER_CHAIN" ? `主管鏈:簽到職等 ${e.minPositionLevel}` : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${Hi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${Hi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${Hi(n, e.orgUnitId)} / ${Ui(r, e.positionId)}` : e.type === "POSITION" ? `職位:${Ui(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? Dn(i, e.formPath) : "自訂表達式";
3513
3623
  }
3514
- function Li(e, t, n, r) {
3624
+ function na(e, t, n, r, i) {
3515
3625
  if (e.type !== "serviceTask") return null;
3516
- let i = e.data.action, a = i.type === "NOTIFY" && i.recipients.type !== "DIRECT" ? [Ii(i.recipients, t, n, r)] : ta(i).map((e) => xi(t, e).name), o = ut(i).length, s = [...a, ...o ? [`Webhook ${o} 個`] : []];
3517
- return s.length ? s : ["未指定知會對象"];
3626
+ let a = e.data.action, o = a.type === "NOTIFY" && a.recipients.type !== "DIRECT" ? [ta(a.recipients, t, n, r, i)] : ya(a).map((e) => zi(t, e).name), s = mt(a).length, c = [...o, ...s ? [`Webhook ${s} 個`] : []];
3627
+ return c.length ? c : ["未指定知會對象"];
3518
3628
  }
3519
- function Ri(e) {
3520
- let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : ta(e).length, n = +!!ut(e).length;
3629
+ function ra(e) {
3630
+ let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : ya(e).length, n = +!!mt(e).length;
3521
3631
  return Math.max(1, t + n);
3522
3632
  }
3523
- function zi(e, t, n) {
3633
+ function ia(e, t, n) {
3524
3634
  let r = e.nodes.find((e) => e.id === t);
3525
- return r?.type === "serviceTask" && r.data.action.type === "NOTIFY" && Wt(r.data.action.webhooks) ? ut(r.data.action).map((e) => ({
3635
+ return r?.type === "serviceTask" && r.data.action.type === "NOTIFY" && Jt(r.data.action.webhooks) ? mt(r.data.action).map((e) => ({
3526
3636
  key: e.id,
3527
- label: R(n, e.endpoint)?.label ?? Rt(e.endpoint)
3637
+ label: Ht(n, e.endpoint)?.label ?? R(e.endpoint)
3528
3638
  })) : [];
3529
3639
  }
3530
- function Bi(e, t, n) {
3531
- let r = e.map((e) => xi(t, e).name);
3640
+ function aa(e, t, n) {
3641
+ let r = e.map((e) => zi(t, e).name);
3532
3642
  return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
3533
3643
  }
3534
- function Vi(e, t) {
3644
+ function oa(e, t) {
3535
3645
  return `${e} (${t})`;
3536
3646
  }
3537
- function Hi(e, t) {
3647
+ function sa(e, t) {
3538
3648
  let n = t?.getBoundingClientRect();
3539
3649
  if (!n || e.nodes.length === 0) return null;
3540
3650
  let r = e.nodes.reduce((e, t) => {
3541
- let n = X(t);
3651
+ let n = Lr(t);
3542
3652
  return {
3543
3653
  maxX: Math.max(e.maxX, t.position.x + n.width),
3544
3654
  maxY: Math.max(e.maxY, t.position.y + n.height),
@@ -3551,93 +3661,71 @@ function Hi(e, t) {
3551
3661
  minX: Infinity,
3552
3662
  minY: Infinity
3553
3663
  });
3554
- return Pe({
3664
+ return Le({
3555
3665
  height: r.maxY - r.minY,
3556
3666
  width: r.maxX - r.minX,
3557
3667
  x: r.minX,
3558
3668
  y: r.minY
3559
3669
  }, n.width, n.height, .1, 1, .2);
3560
3670
  }
3561
- function Ui(e) {
3562
- let t = e.nodes.find((e) => e.type === "userTask" && !!N(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "userTask" && !!at(e.data.excludeInitiator)), r = e.nodes.map((e) => ot(e)).find((e) => e !== null) ?? null, i = e.edges.find((t) => $i(t, e.nodes) && !t.data.isDefault && !t.data.condition), a = e.nodes.find((e) => e.type === "userTask" && rt(e.data.approverResolver, e.data.decisionPolicy));
3563
- return t && t.type === "userTask" ? N(t.data.approverResolver) : a && a.type === "userTask" ? `簽核節點「${a.data.label}」使用「沿主管鏈簽核」時,決策方式必須是「依序簽核或全部同意」,否則任一位主管簽完就會結案。` : n && n.type === "userTask" ? at(n.data.excludeInitiator) : r || (i ? "條件分流的每條輸出連線都需要先設定條件。" : null);
3671
+ function ca(e) {
3672
+ let t = e.nodes.find((e) => e.type === "userTask" && !!ot(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "userTask" && !!lt(e.data.excludeInitiator)), r = e.nodes.map((e) => ut(e)).find((e) => e !== null) ?? null, i = e.edges.find((t) => _a(t, e.nodes) && !t.data.isDefault && !t.data.condition), a = e.nodes.find((e) => e.type === "userTask" && at(e.data.approverResolver, e.data.decisionPolicy));
3673
+ return t && t.type === "userTask" ? ot(t.data.approverResolver) : a && a.type === "userTask" ? `簽核節點「${a.data.label}」使用「沿主管鏈簽核」時,決策方式必須是「依序簽核或全部同意」,否則任一位主管簽完就會結案。` : n && n.type === "userTask" ? lt(n.data.excludeInitiator) : r || (i ? "條件分流的每條輸出連線都需要先設定條件。" : null);
3564
3674
  }
3565
- function Wi(e) {
3675
+ function la(e) {
3566
3676
  return e?.fields.map((e) => ({
3567
3677
  fieldType: e.type,
3568
3678
  id: e.fieldKey,
3569
3679
  name: `${e.label} (${e.fieldKey})`
3570
3680
  })) ?? [];
3571
3681
  }
3572
- function Gi(e, t) {
3682
+ function ua(e, t) {
3573
3683
  return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
3574
3684
  }
3575
- function Ki(e) {
3685
+ function da(e) {
3576
3686
  if (!e) return [];
3577
- let t = Ji(e);
3578
- return J.filter((e) => t.includes(e.id));
3687
+ let t = st(e);
3688
+ return vr.filter((e) => t.includes(e.id));
3579
3689
  }
3580
- function qi(e) {
3581
- return J.some((t) => t.id === e) ? e : null;
3690
+ function fa(e) {
3691
+ return vr.some((t) => t.id === e) ? e : null;
3582
3692
  }
3583
- function Ji(e) {
3584
- return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
3585
- "EQUALS",
3586
- "NOT_EQUALS",
3587
- "IS_FILLED",
3588
- "IS_EMPTY"
3589
- ] : e.type === "date" || e.type === "datetime" || e.type === "money" || e.type === "number" ? [
3590
- "EQUALS",
3591
- "NOT_EQUALS",
3592
- "GREATER_THAN",
3593
- "GREATER_THAN_OR_EQUALS",
3594
- "LESS_THAN",
3595
- "LESS_THAN_OR_EQUALS",
3596
- "IS_FILLED",
3597
- "IS_EMPTY"
3598
- ] : [
3599
- "EQUALS",
3600
- "NOT_EQUALS",
3601
- "IS_FILLED",
3602
- "IS_EMPTY"
3603
- ];
3604
- }
3605
- function Yi(e) {
3693
+ function pa(e) {
3606
3694
  return e ? e.type === "boolean" ? [{
3607
3695
  id: "true",
3608
3696
  name: "是"
3609
3697
  }, {
3610
3698
  id: "false",
3611
3699
  name: "否"
3612
- }] : we(e) ? e.options.map((e) => ({
3700
+ }] : Te(e) ? e.options.map((e) => ({
3613
3701
  id: e.value,
3614
3702
  name: e.label
3615
3703
  })) : [] : [];
3616
3704
  }
3617
- function Xi(e) {
3618
- return $n.includes(e);
3705
+ function ma(e) {
3706
+ return yr.includes(e);
3619
3707
  }
3620
- function Zi(e, t) {
3708
+ function ha(e, t) {
3621
3709
  if (e.data.label) return e.data.label;
3622
- if ($i(e, t)) return Qi(e);
3623
- if (ea(e, t)) return "同時進行";
3710
+ if (_a(e, t)) return ga(e);
3711
+ if (va(e, t)) return "同時進行";
3624
3712
  }
3625
- function Qi(e) {
3713
+ function ga(e) {
3626
3714
  return e.data.isDefault ? "其他情況" : "請設定條件";
3627
3715
  }
3628
- function $i(e, t) {
3716
+ function _a(e, t) {
3629
3717
  return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
3630
3718
  }
3631
- function ea(e, t) {
3719
+ function va(e, t) {
3632
3720
  return t.some((t) => t.id === e.source && t.type === "parallelGateway");
3633
3721
  }
3634
- function ta(e) {
3722
+ function ya(e) {
3635
3723
  return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
3636
3724
  }
3637
- function na(e) {
3638
- return e instanceof Error ? e.message.includes("WORKFLOW_WEBHOOK_") ? `Webhook 設定未通過發布檢查:${e.message}` : Ce(e.message) : "發生未知錯誤";
3725
+ function ba(e) {
3726
+ return e instanceof Error ? e.message.includes("WORKFLOW_WEBHOOK_") ? `Webhook 設定未通過發布檢查:${e.message}` : we(e.message) : "發生未知錯誤";
3639
3727
  }
3640
3728
  //#endregion
3641
- export { ur as t };
3729
+ export { Ar as t };
3642
3730
 
3643
- //# sourceMappingURL=designer-BtsIL0BB.js.map
3731
+ //# sourceMappingURL=designer-CrbBRPUU.js.map