@rytass/bpm-core-react 0.17.3 → 0.17.5

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