@rytass/bpm-core-react 0.17.8 → 0.17.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/chunks/{detail-D6X61pkg.js → detail-CExpbazF.js} +804 -756
  3. package/dist/chunks/detail-CExpbazF.js.map +1 -0
  4. package/dist/chunks/detail-DIY-L4i-.cjs +2 -0
  5. package/dist/chunks/detail-DIY-L4i-.cjs.map +1 -0
  6. package/dist/chunks/{orgs-Lg7tXv2u.js → orgs-8hje_l2n.js} +9 -4
  7. package/dist/chunks/orgs-8hje_l2n.js.map +1 -0
  8. package/dist/chunks/{orgs-C8usknWb.cjs → orgs-BeeDDWL1.cjs} +2 -2
  9. package/dist/chunks/orgs-BeeDDWL1.cjs.map +1 -0
  10. package/dist/chunks/users-O2L_M3BK.cjs +2 -0
  11. package/dist/chunks/users-O2L_M3BK.cjs.map +1 -0
  12. package/dist/chunks/{users-DRbuDYF1.js → users-Pl6hY5Y5.js} +160 -93
  13. package/dist/chunks/users-Pl6hY5Y5.js.map +1 -0
  14. package/dist/pages/admin/orgs/index.cjs +1 -1
  15. package/dist/pages/admin/orgs/index.js +1 -1
  16. package/dist/pages/admin/users/index.cjs +1 -1
  17. package/dist/pages/admin/users/index.js +1 -1
  18. package/dist/pages/instances/detail/index.cjs +1 -1
  19. package/dist/pages/instances/detail/index.js +1 -1
  20. package/dist/views/admin/index.cjs +1 -1
  21. package/dist/views/admin/index.js +2 -2
  22. package/dist/views/admin/orgs/index.cjs +1 -1
  23. package/dist/views/admin/orgs/index.js +1 -1
  24. package/dist/views/admin/users/index.cjs +1 -1
  25. package/dist/views/admin/users/index.js +1 -1
  26. package/dist/views/inbox/index.cjs +1 -1
  27. package/dist/views/inbox/index.cjs.map +1 -1
  28. package/dist/views/inbox/index.js +159 -78
  29. package/dist/views/inbox/index.js.map +1 -1
  30. package/dist/views/instances/detail/index.cjs +1 -1
  31. package/dist/views/instances/detail/index.js +1 -1
  32. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +9 -1
  33. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +9 -1
  34. package/dist/views/instances/detail/use-resubmit-comment-draft.d.cts +18 -0
  35. package/dist/views/instances/detail/use-resubmit-comment-draft.d.ts +18 -0
  36. package/package.json +3 -3
  37. package/dist/chunks/detail-COh5sjAt.cjs +0 -2
  38. package/dist/chunks/detail-COh5sjAt.cjs.map +0 -1
  39. package/dist/chunks/detail-D6X61pkg.js.map +0 -1
  40. package/dist/chunks/orgs-C8usknWb.cjs.map +0 -1
  41. package/dist/chunks/orgs-Lg7tXv2u.js.map +0 -1
  42. package/dist/chunks/users-DRbuDYF1.js.map +0 -1
  43. package/dist/chunks/users-DVQicZIo.cjs +0 -2
  44. package/dist/chunks/users-DVQicZIo.cjs.map +0 -1
@@ -8,19 +8,19 @@ import { t as a } from "./task-node-label-CWZgOBj0.js";
8
8
  import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as ee, u as te } from "./approver-filled-form-DuQGPtNB.js";
9
9
  import { o as m, t as ne } from "./FormRendererView-BsTwZkqU.js";
10
10
  import '../style.css';import '../detail.css';/* empty css */
11
- import { Fragment as h, forwardRef as re, useCallback as g, useEffect as ie, useImperativeHandle as ae, useMemo as _, useRef as oe, useState as v } from "react";
12
- import { AutoComplete as se, Badge as ce, Button as y, Description as b, DescriptionContent as le, InlineMessage as x, Input as ue, Message as de, Modal as S, PageHeader as fe, Section as pe, SectionGroup as me, Select as C, Stepper as he, Table as ge, Textarea as _e, Tooltip as ve, Typography as w } from "@mezzanine-ui/react";
13
- import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
11
+ import { Fragment as re, forwardRef as ie, useCallback as h, useEffect as g, useImperativeHandle as ae, useMemo as _, useRef as v, useState as y } from "react";
12
+ import { AutoComplete as oe, Badge as se, Button as b, Description as x, DescriptionContent as ce, InlineMessage as S, Input as le, Message as ue, Modal as C, PageHeader as de, Section as fe, SectionGroup as pe, Select as w, Stepper as me, Table as he, Textarea as ge, Tooltip as _e, Typography as T } from "@mezzanine-ui/react";
13
+ import { Fragment as ve, jsx as E, jsxs as D } from "react/jsx-runtime";
14
14
  import { cancelAdhocDirective as ye, cancelApprovalInstance as be, configureAdhocCompletionNotification as xe, configureAdhocStageNotification as Se, decideTask as Ce, listAdhocDirectives as we, listAttachments as Te, listTaskDecisions as O, listWorkflowWebhookDeliveries as Ee, readApprovalInstance as De, readAttachmentDownloadUrl as Oe, readAttachmentPreviewUrl as ke, readInstanceSignatures as Ae, requestAdhocCountersign as je, requestAdhocPreApproval as Me, resolveMemberProfiles as Ne, resubmitApprovalInstance as Pe, retryWorkflowWebhookDelivery as Fe, searchMembers as k, uploadAttachment as Ie } from "@rytass/bpm-core-client/workflow";
15
15
  import Le from "@mezzanine-ui/react/ContentHeader";
16
16
  import { CheckedIcon as Re, ChevronLeftIcon as ze, ChevronRightIcon as Be, DangerousOutlineIcon as Ve, DownloadIcon as He, FileSearchIcon as Ue, NotificationUnreadIcon as We, PlusIcon as Ge, RefreshCcwIcon as Ke, ResetIcon as qe, ShareIcon as A, UserIcon as Je, ZoomInIcon as Ye, ZoomOutIcon as j } from "@mezzanine-ui/icons";
17
- import { readNodeFillableFieldKeys as M, readRevealedFieldKeys as Xe, readTopLevelFieldKey as Ze, resolveFieldAccess as Qe } from "@rytass/bpm-core-shared";
18
- import { buildFormRendererValues as $e, focusFormRendererField as et, readFormDataSourceErrorMessage as N, validateFormRendererValues as tt } from "@rytass/bpm-core-client/form";
19
- import { Background as nt, Controls as P, Handle as F, Position as I, ReactFlow as rt } from "@xyflow/react";
20
- import * as L from "dagre";
21
- import { Document as it, Page as at } from "react-pdf";
22
- import { stepClasses as R } from "@mezzanine-ui/core/stepper";
23
- var z = {
17
+ import { readNodeFillableFieldKeys as Xe, readRevealedFieldKeys as Ze, readTopLevelFieldKey as Qe, resolveFieldAccess as $e } from "@rytass/bpm-core-shared";
18
+ import { buildFormRendererValues as et, focusFormRendererField as tt, readFormDataSourceErrorMessage as M, validateFormRendererValues as nt } from "@rytass/bpm-core-client/form";
19
+ import { Background as rt, Controls as N, Handle as P, Position as F, ReactFlow as it } from "@xyflow/react";
20
+ import * as I from "dagre";
21
+ import { Document as at, Page as ot } from "react-pdf";
22
+ import { stepClasses as L } from "@mezzanine-ui/core/stepper";
23
+ var R = {
24
24
  root: "bpm_root_ehm7w",
25
25
  toolbar: "bpm_toolbar_R-tis",
26
26
  pageControls: "bpm_pageControls_jM-rC",
@@ -29,10 +29,10 @@ var z = {
29
29
  viewport: "bpm_viewport_DQXms",
30
30
  page: "bpm_page_Cv5Rg",
31
31
  state: "bpm_state_bpgp3"
32
- }, ot = 760, st = 920, ct = 320, lt = 32, ut = .75, dt = 1.75, ft = .25;
33
- function pt({ filename: e, fileUrl: t, onDownload: n }) {
34
- let r = oe(null), [i, a] = v(null), [o, s] = v(1), [c, l] = v(1), [u, d] = v(ot);
35
- ie(() => {
32
+ }, st = 760, ct = 920, lt = 320, ut = 32, dt = .75, ft = 1.75, pt = .25;
33
+ function mt({ filename: e, fileUrl: t, onDownload: n }) {
34
+ let r = v(null), [i, a] = y(null), [o, s] = y(1), [c, l] = y(1), [u, d] = y(st);
35
+ g(() => {
36
36
  let e = r.current;
37
37
  if (!e || typeof ResizeObserver > "u") return;
38
38
  let t = new ResizeObserver((e) => {
@@ -40,26 +40,26 @@ function pt({ filename: e, fileUrl: t, onDownload: n }) {
40
40
  t && d(t);
41
41
  });
42
42
  return t.observe(e), () => t.disconnect();
43
- }, []), ie(() => {
43
+ }, []), g(() => {
44
44
  a(null), s(1), l(1);
45
45
  }, [t]);
46
46
  let f = _(() => {
47
- let e = Math.max(ct, u - lt);
48
- return Math.round(Math.min(st, e) * c);
49
- }, [c, u]), p = g((e) => {
47
+ let e = Math.max(lt, u - ut);
48
+ return Math.round(Math.min(ct, e) * c);
49
+ }, [c, u]), p = h((e) => {
50
50
  a(e.numPages), s(1);
51
- }, []), ee = o > 1, te = i !== null && o < i, m = c > ut, ne = c < dt, h = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, re = `${Math.round(c * 100)}%`;
51
+ }, []), ee = o > 1, te = i !== null && o < i, m = c > dt, ne = c < ft, re = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ie = `${Math.round(c * 100)}%`;
52
52
  return /* @__PURE__ */ D("section", {
53
53
  "aria-label": `${e} PDF 預覽`,
54
- className: z.root,
54
+ className: R.root,
55
55
  children: [/* @__PURE__ */ D("div", {
56
- className: z.toolbar,
56
+ className: R.toolbar,
57
57
  children: [
58
58
  /* @__PURE__ */ D("div", {
59
- className: z.pageControls,
59
+ className: R.pageControls,
60
60
  "aria-label": "頁面切換",
61
61
  children: [
62
- /* @__PURE__ */ E(y, {
62
+ /* @__PURE__ */ E(b, {
63
63
  "aria-label": "上一頁",
64
64
  disabled: !ee,
65
65
  icon: ze,
@@ -69,13 +69,13 @@ function pt({ filename: e, fileUrl: t, onDownload: n }) {
69
69
  size: "minor",
70
70
  variant: "base-secondary"
71
71
  }),
72
- /* @__PURE__ */ E(w, {
73
- className: z.counter,
72
+ /* @__PURE__ */ E(T, {
73
+ className: R.counter,
74
74
  component: "span",
75
75
  variant: "body",
76
- children: h
76
+ children: re
77
77
  }),
78
- /* @__PURE__ */ E(y, {
78
+ /* @__PURE__ */ E(b, {
79
79
  "aria-label": "下一頁",
80
80
  disabled: !te,
81
81
  icon: Be,
@@ -88,38 +88,38 @@ function pt({ filename: e, fileUrl: t, onDownload: n }) {
88
88
  ]
89
89
  }),
90
90
  /* @__PURE__ */ D("div", {
91
- className: z.zoomControls,
91
+ className: R.zoomControls,
92
92
  "aria-label": "縮放",
93
93
  children: [
94
- /* @__PURE__ */ E(y, {
94
+ /* @__PURE__ */ E(b, {
95
95
  "aria-label": "縮小",
96
96
  disabled: !m,
97
97
  icon: j,
98
98
  onClick: () => {
99
- l((e) => Math.max(ut, e - ft));
99
+ l((e) => Math.max(dt, e - pt));
100
100
  },
101
101
  size: "minor",
102
102
  variant: "base-secondary"
103
103
  }),
104
- /* @__PURE__ */ E(w, {
105
- className: z.counter,
104
+ /* @__PURE__ */ E(T, {
105
+ className: R.counter,
106
106
  component: "span",
107
107
  variant: "body",
108
- children: re
108
+ children: ie
109
109
  }),
110
- /* @__PURE__ */ E(y, {
110
+ /* @__PURE__ */ E(b, {
111
111
  "aria-label": "放大",
112
112
  disabled: !ne,
113
113
  icon: Ye,
114
114
  onClick: () => {
115
- l((e) => Math.min(dt, e + ft));
115
+ l((e) => Math.min(ft, e + pt));
116
116
  },
117
117
  size: "minor",
118
118
  variant: "base-secondary"
119
119
  })
120
120
  ]
121
121
  }),
122
- n ? /* @__PURE__ */ E(y, {
122
+ n ? /* @__PURE__ */ E(b, {
123
123
  icon: He,
124
124
  iconType: "leading",
125
125
  onClick: n,
@@ -129,18 +129,18 @@ function pt({ filename: e, fileUrl: t, onDownload: n }) {
129
129
  }) : null
130
130
  ]
131
131
  }), /* @__PURE__ */ E("div", {
132
- className: z.viewport,
132
+ className: R.viewport,
133
133
  ref: r,
134
- children: /* @__PURE__ */ E(it, {
135
- error: /* @__PURE__ */ E(B, { message: "PDF 無法載入。" }),
134
+ children: /* @__PURE__ */ E(at, {
135
+ error: /* @__PURE__ */ E(ht, { message: "PDF 無法載入。" }),
136
136
  file: t,
137
- loading: /* @__PURE__ */ E(B, { message: "正在載入 PDF..." }),
138
- noData: /* @__PURE__ */ E(B, { message: "沒有可預覽的 PDF。" }),
137
+ loading: /* @__PURE__ */ E(ht, { message: "正在載入 PDF..." }),
138
+ noData: /* @__PURE__ */ E(ht, { message: "沒有可預覽的 PDF。" }),
139
139
  onLoadSuccess: p,
140
140
  suspense: !1,
141
- children: /* @__PURE__ */ E(at, {
142
- className: z.page,
143
- loading: /* @__PURE__ */ E(B, { message: "正在載入頁面..." }),
141
+ children: /* @__PURE__ */ E(ot, {
142
+ className: R.page,
143
+ loading: /* @__PURE__ */ E(ht, { message: "正在載入頁面..." }),
144
144
  pageNumber: o,
145
145
  renderAnnotationLayer: !0,
146
146
  renderTextLayer: !0,
@@ -150,10 +150,10 @@ function pt({ filename: e, fileUrl: t, onDownload: n }) {
150
150
  })]
151
151
  });
152
152
  }
153
- function B({ message: e }) {
153
+ function ht({ message: e }) {
154
154
  return /* @__PURE__ */ E("div", {
155
- className: z.state,
156
- children: /* @__PURE__ */ E(w, {
155
+ className: R.state,
156
+ children: /* @__PURE__ */ E(T, {
157
157
  color: "text-neutral",
158
158
  variant: "body",
159
159
  children: e
@@ -162,39 +162,39 @@ function B({ message: e }) {
162
162
  }
163
163
  //#endregion
164
164
  //#region src/views/instances/detail/submitted-by.ts
165
- function mt({ initiatorMemberId: e, submittedByMemberId: t }) {
165
+ function gt({ initiatorMemberId: e, submittedByMemberId: t }) {
166
166
  return t && t !== e ? t : null;
167
167
  }
168
- function ht(e, t) {
169
- let n = mt(e);
168
+ function _t(e, t) {
169
+ let n = gt(e);
170
170
  if (!n || !e.initiatorMemberId) return null;
171
171
  let r = (e) => t.get(e)?.name ?? e;
172
172
  return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
173
173
  }
174
174
  //#endregion
175
175
  //#region src/views/instances/detail/sections/shared.ts
176
- function gt(e) {
177
- let t = V(e, "from"), n = V(e, "to"), r = V(e, "reason");
176
+ function vt(e) {
177
+ let t = B(e, "from"), n = B(e, "to"), r = B(e, "reason");
178
178
  return !t || !n || !r ? null : {
179
179
  from: t,
180
180
  reason: r,
181
- ruleId: V(e, "ruleId"),
181
+ ruleId: B(e, "ruleId"),
182
182
  to: n
183
183
  };
184
184
  }
185
- function _t(e) {
185
+ function z(e) {
186
186
  try {
187
187
  let t = JSON.parse(e);
188
- return Array.isArray(t) ? t.map((e) => U(e) ? gt(e) : null).filter((e) => e !== null) : [];
188
+ return Array.isArray(t) ? t.map((e) => bt(e) ? vt(e) : null).filter((e) => e !== null) : [];
189
189
  } catch {
190
190
  return [];
191
191
  }
192
192
  }
193
- function V(e, t) {
193
+ function B(e, t) {
194
194
  let n = e[t];
195
195
  return typeof n == "string" ? n : null;
196
196
  }
197
- function vt(e, t) {
197
+ function V(e, t) {
198
198
  let n = e[t];
199
199
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
200
200
  }
@@ -205,64 +205,64 @@ function yt(e, t) {
205
205
  function H(e) {
206
206
  return typeof e == "string" && e.trim().length > 0;
207
207
  }
208
- function U(e) {
208
+ function bt(e) {
209
209
  return typeof e == "object" && !!e;
210
210
  }
211
- function bt(e) {
211
+ function xt(e) {
212
212
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
213
213
  }
214
- function W(e) {
215
- return N(e) || (e instanceof Error ? e.message : "發生未知錯誤");
214
+ function U(e) {
215
+ return M(e) || (e instanceof Error ? e.message : "發生未知錯誤");
216
216
  }
217
- function xt(e) {
217
+ function St(e) {
218
218
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
219
219
  }
220
- function St(e) {
220
+ function W(e) {
221
221
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
222
222
  }
223
223
  function Ct(e) {
224
224
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
225
225
  }
226
- function G(e) {
226
+ function wt(e) {
227
227
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
228
228
  }
229
- function K(e) {
229
+ function Tt(e) {
230
230
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
231
231
  }
232
- function wt(e) {
232
+ function Et(e) {
233
233
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
234
234
  }
235
- function Tt(e, t) {
235
+ function Dt(e, t) {
236
236
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
237
237
  }
238
- function q(e, t) {
238
+ function G(e, t) {
239
239
  if (!e) return "-";
240
240
  let n = t.get(e);
241
241
  return n ? i(n.name, n.email, "fullwidth") : e;
242
242
  }
243
- function Et(e, t = /* @__PURE__ */ new Map()) {
244
- let n = _t(e.delegationChainJson);
245
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => q(e, t)).join("、")}` : "未指定";
246
- let r = q(e.assigneeMemberId, t), i = q(e.originalAssigneeMemberId, t);
243
+ function K(e, t = /* @__PURE__ */ new Map()) {
244
+ let n = z(e.delegationChainJson);
245
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => G(e, t)).join("、")}` : "未指定";
246
+ let r = G(e.assigneeMemberId, t), i = G(e.originalAssigneeMemberId, t);
247
247
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
248
248
  }
249
- function Dt(e, t) {
249
+ function q(e, t) {
250
250
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
251
251
  }
252
252
  function Ot(e, t) {
253
- let n = e.filter((e) => Dt(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
253
+ let n = e.filter((e) => q(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
254
254
  return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
255
255
  }
256
256
  function kt(e, t) {
257
257
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
258
258
  if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
259
259
  id: e.id,
260
- name: `${e.data.label}(${wt(e.type)})`
260
+ name: `${e.data.label}(${Et(e.type)})`
261
261
  }));
262
262
  let n = t.data.returnBehavior.allowedTargets === "INITIATOR" ? e.nodes.find((e) => e.type === "startEvent")?.id : e.edges.find((e) => e.target === t.id)?.source, r = e.nodes.find((e) => e.id === n);
263
263
  return r ? [{
264
264
  id: r.id,
265
- name: `${r.data.label}(${wt(r.type)})`
265
+ name: `${r.data.label}(${Et(r.type)})`
266
266
  }] : [];
267
267
  }
268
268
  function At(e) {
@@ -297,11 +297,11 @@ function jt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
297
297
  valid: !1
298
298
  };
299
299
  }
300
- function J(e) {
300
+ function Mt(e) {
301
301
  return !!e;
302
302
  }
303
- function Mt(e) {
304
- if (!U(e)) return null;
303
+ function Nt(e) {
304
+ if (!bt(e)) return null;
305
305
  let t = e.email, n = e.id, r = e.name;
306
306
  return typeof n == "string" && typeof r == "string" ? {
307
307
  email: typeof t == "string" ? t : null,
@@ -309,7 +309,7 @@ function Mt(e) {
309
309
  name: r
310
310
  } : null;
311
311
  }
312
- function Nt(e, t) {
312
+ function Pt(e, t) {
313
313
  let n = e.trim().toLocaleLowerCase();
314
314
  if (!n) return null;
315
315
  let r = t.filter((e) => [
@@ -319,13 +319,13 @@ function Nt(e, t) {
319
319
  ].some((e) => e.toLocaleLowerCase().includes(n)));
320
320
  return r.length === 1 ? r[0] ?? null : null;
321
321
  }
322
- function Y(e) {
322
+ function J(e) {
323
323
  return H(e) ? {
324
324
  text: e,
325
325
  type: "text"
326
326
  } : null;
327
327
  }
328
- function Pt(e, t, n = "neutral") {
328
+ function Ft(e, t, n = "neutral") {
329
329
  return H(t) ? {
330
330
  label: e,
331
331
  text: t,
@@ -333,7 +333,7 @@ function Pt(e, t, n = "neutral") {
333
333
  type: "comment"
334
334
  } : null;
335
335
  }
336
- function Ft(e, t, n, r) {
336
+ function It(e, t, n, r) {
337
337
  let i = t ? n.get(t) : null;
338
338
  return {
339
339
  email: i?.email ?? null,
@@ -343,38 +343,38 @@ function Ft(e, t, n, r) {
343
343
  type: "member"
344
344
  };
345
345
  }
346
- function It(e) {
346
+ function Y(e) {
347
347
  return !!e;
348
348
  }
349
349
  function Lt(e) {
350
350
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
351
351
  return t === -1 ? e.length : t;
352
352
  }
353
- function X(e) {
354
- return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Z(e) || zt(e.eventType, Ut(e));
353
+ function Rt(e) {
354
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "INSTANCE_RESUBMITTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || zt(e) || Z(e.eventType, Ut(e));
355
355
  }
356
- function Z(e) {
357
- return e.eventType === "TASK_CREATED" && vt(Ut(e), "sequentialCandidateMemberIds").length > 0;
356
+ function zt(e) {
357
+ return e.eventType === "TASK_CREATED" && V(Ut(e), "sequentialCandidateMemberIds").length > 0;
358
358
  }
359
- function Q(e) {
359
+ function Bt(e) {
360
360
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
361
361
  let t = Ut(e);
362
362
  return [
363
- ...vt(t, "sequentialCandidateMemberIds"),
364
- V(t, "candidateMemberId"),
365
- V(t, "previousMemberId")
363
+ ...V(t, "sequentialCandidateMemberIds"),
364
+ B(t, "candidateMemberId"),
365
+ B(t, "previousMemberId")
366
366
  ].filter(H);
367
367
  }
368
- var Rt = /* @__PURE__ */ new Set([
368
+ var X = /* @__PURE__ */ new Set([
369
369
  "SERVICE_TASK_EXECUTED",
370
370
  "SERVICE_TASK_FAILED",
371
371
  "WEBHOOK_DELIVERY_RETRIED"
372
372
  ]);
373
- function zt(e, t) {
374
- return Rt.has(e) && V(t, "action") === "NOTIFY_WEBHOOK";
373
+ function Z(e, t) {
374
+ return X.has(e) && B(t, "action") === "NOTIFY_WEBHOOK";
375
375
  }
376
- function Bt(e) {
377
- return V(e, "endpointLabel") ?? V(e, "endpointKey") ?? "外部系統";
376
+ function Q(e) {
377
+ return B(e, "endpointLabel") ?? B(e, "endpointKey") ?? "外部系統";
378
378
  }
379
379
  function Vt(e) {
380
380
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
@@ -383,16 +383,17 @@ function Ht(e, t) {
383
383
  if (e === "INSTANCE_STARTED") return "案件已發起";
384
384
  if (e === "INSTANCE_CANCELLED") return "案件已取消";
385
385
  if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
386
+ if (e === "INSTANCE_RESUBMITTED") return "申請人重新送出";
386
387
  if (e === "TOKEN_CREATED") return "流程路徑已建立";
387
388
  if (e === "ENGINE_PROCESS_REQUESTED") return "流程引擎已處理";
388
389
  if (e === "TOKEN_ADVANCED") return "流程已前進";
389
390
  if (e === "TASK_CREATED") return "待簽任務已建立";
390
391
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
391
- if (e === "TASK_DECIDED") return Vt(V(t, "action"));
392
+ if (e === "TASK_DECIDED") return Vt(B(t, "action"));
392
393
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
393
394
  if (e === "TASK_REASSIGNED") return "管理者改派待辦";
394
- if (zt(e, t)) {
395
- let n = Bt(t);
395
+ if (Z(e, t)) {
396
+ let n = Q(t);
396
397
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
397
398
  }
398
399
  return e;
@@ -400,70 +401,71 @@ function Ht(e, t) {
400
401
  function Ut(e) {
401
402
  try {
402
403
  let t = JSON.parse(e.payloadJson);
403
- return U(t) ? t : {};
404
+ return bt(t) ? t : {};
404
405
  } catch {
405
406
  return {};
406
407
  }
407
408
  }
408
409
  function Wt(e, t) {
409
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && zt(e.eventType, t) || V(t, "action") === "REJECTED" || V(t, "instanceState") === "REJECTED";
410
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Z(e.eventType, t) || B(t, "action") === "REJECTED" || B(t, "instanceState") === "REJECTED";
410
411
  }
411
412
  function Gt(e) {
412
413
  return t(e);
413
414
  }
414
415
  function Kt(e, t, n, r) {
415
- if (e.eventType === "INSTANCE_STARTED") return ht({
416
+ if (e.eventType === "INSTANCE_STARTED") return _t({
416
417
  initiatorMemberId: e.actorMemberId,
417
- submittedByMemberId: V(t, "submittedByMemberId")
418
+ submittedByMemberId: B(t, "submittedByMemberId")
418
419
  }, r);
419
420
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
420
- let e = V(t, "candidateMemberId"), n = V(t, "previousMemberId");
421
+ let e = B(t, "candidateMemberId"), n = B(t, "previousMemberId");
421
422
  if (!e) return null;
422
- let i = q(e, r);
423
- return n ? `輪到:${i}(前一位:${q(n, r)})` : `輪到:${i}`;
423
+ let i = G(e, r);
424
+ return n ? `輪到:${i}(前一位:${G(n, r)})` : `輪到:${i}`;
424
425
  }
425
426
  if (e.eventType === "TASK_CREATED") {
426
- let e = vt(t, "sequentialCandidateMemberIds");
427
- if (e.length) return `簽核順序:${e.map((e) => q(e, r)).join(" → ")}`;
428
- let n = V(t, "assigneeMemberId"), i = V(t, "originalAssigneeMemberId");
427
+ let e = V(t, "sequentialCandidateMemberIds");
428
+ if (e.length) return `簽核順序:${e.map((e) => G(e, r)).join(" → ")}`;
429
+ let n = B(t, "assigneeMemberId"), i = B(t, "originalAssigneeMemberId");
429
430
  if (!n) {
430
- let e = vt(t, "candidateMemberIds");
431
- return e.length ? `候選簽核人:${e.map((e) => q(e, r)).join("、")}` : null;
431
+ let e = V(t, "candidateMemberIds");
432
+ return e.length ? `候選簽核人:${e.map((e) => G(e, r)).join("、")}` : null;
432
433
  }
433
- let a = q(n, r), o = q(i, r);
434
+ let a = G(n, r), o = G(i, r);
434
435
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
435
436
  }
436
437
  if (e.eventType === "TASK_DECIDED") {
437
- let e = V(t, "action"), n = V(t, "comment"), i = e ? `決議:${K(e)}` : null, a = V(t, "transferToMemberId");
438
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(H).join(" · ") : i;
438
+ let e = B(t, "action"), n = B(t, "comment"), i = e ? `決議:${Tt(e)}` : null, a = B(t, "transferToMemberId");
439
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${G(a, r)}`].filter(H).join(" · ") : i;
439
440
  }
440
441
  if (e.eventType === "TOKEN_ADVANCED") {
441
- let e = V(t, "action");
442
- if (e) return `流程結果:${K(e)}`;
442
+ let e = B(t, "action");
443
+ if (e) return `流程結果:${Tt(e)}`;
443
444
  let r = yt(t, "arrivedCount"), i = yt(t, "requiredCount");
444
445
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
445
- let a = V(t, "fromNodeId"), o = V(t, "toNodeId");
446
- if (a && o) return `由 ${Tt(a, n)} 前進至 ${Tt(o, n)}`;
446
+ let a = B(t, "fromNodeId"), o = B(t, "toNodeId");
447
+ if (a && o) return `由 ${Dt(a, n)} 前進至 ${Dt(o, n)}`;
447
448
  }
448
449
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
449
- let e = V(t, "state");
450
+ let e = B(t, "state");
450
451
  return e ? `案件狀態:${Ct(e)}` : null;
451
452
  }
452
453
  return null;
453
454
  }
454
455
  function qt(e, t, n, r, i, a, o, s = null) {
455
- if (e.eventType !== "TASK_DECIDED") return [Y(Kt(e, t, n, o))].filter(It);
456
- let c = e.taskId ? r.get(e.taskId) : null, l = V(t, "action") ?? c?.action ?? null, u = V(t, "comment") ?? c?.comment ?? null, d = V(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = V(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
456
+ if (e.eventType === "INSTANCE_RESUBMITTED") return [Ft("簽核意見", B(t, "comment"))].filter(Y);
457
+ if (e.eventType !== "TASK_DECIDED") return [J(Kt(e, t, n, o))].filter(Y);
458
+ let c = e.taskId ? r.get(e.taskId) : null, l = B(t, "action") ?? c?.action ?? null, u = B(t, "comment") ?? c?.comment ?? null, d = B(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = B(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
457
459
  return [
458
- Y(l ? `決議:${K(l)}` : null),
459
- l === "REJECTED" ? Pt("拒絕原因", u ?? "-", "danger") : null,
460
- l === "APPROVED" ? Pt("同意說明", u) : null,
461
- l === "RETURNED" ? Pt("退回說明", u ?? "-") : null,
462
- l === "TRANSFERRED" ? Y(`轉派給:${q(d, o)}`) : null,
463
- l === "TRANSFERRED" ? Pt("轉派說明", u ?? "-") : null,
464
- Y(Jt(t, s)),
465
- p ? Y(a?.valid ? `簽章:已驗證(${St(p.signedPayloadHash)})` : `簽章:待檢查(${St(p.signedPayloadHash)})`) : null
466
- ].filter(It);
460
+ J(l ? `決議:${Tt(l)}` : null),
461
+ l === "REJECTED" ? Ft("拒絕原因", u ?? "-", "danger") : null,
462
+ l === "APPROVED" ? Ft("同意說明", u) : null,
463
+ l === "RETURNED" ? Ft("退回說明", u ?? "-") : null,
464
+ l === "TRANSFERRED" ? J(`轉派給:${G(d, o)}`) : null,
465
+ l === "TRANSFERRED" ? Ft("轉派說明", u ?? "-") : null,
466
+ J(Jt(t, s)),
467
+ p ? J(a?.valid ? `簽章:已驗證(${W(p.signedPayloadHash)})` : `簽章:待檢查(${W(p.signedPayloadHash)})`) : null
468
+ ].filter(Y);
467
469
  }
468
470
  function Jt(e, t) {
469
471
  let n = e.changedFieldKeys;
@@ -495,7 +497,7 @@ function Zt(e, t, n, r, i) {
495
497
  return Qt(e, n, r, i).reduce((e, t) => tn(e, $t(t, o, a)), /* @__PURE__ */ new Map());
496
498
  }
497
499
  function Qt(e, t, n, r) {
498
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(bt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
500
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(xt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
499
501
  ...i,
500
502
  ...a,
501
503
  ...o
@@ -525,30 +527,30 @@ function nn(e) {
525
527
  return e.type === "userTask" ? `未來簽核:${e.data.label}` : e.type === "serviceTask" ? `未來知會:${e.data.label}` : e.type === "exclusiveGateway" ? `未來分流:${e.data.label}` : e.type === "parallelGateway" ? `未來匯合:${e.data.label}` : e.type === "endEvent" ? `流程完成:${e.data.label}` : `未來節點:${e.data.label}`;
526
528
  }
527
529
  function rn(e, t, n, r, i, a, o, s, c, l = null) {
528
- let u = e.filter(X).map((e) => {
529
- let t = Ut(e), n = e.nodeId ? Tt(e.nodeId, r) : null;
530
+ let u = e.filter(Rt).map((e) => {
531
+ let t = Ut(e), n = e.nodeId ? Dt(e.nodeId, r) : null;
530
532
  return {
531
533
  descriptionParts: [
532
- Y(n ? `節點:${n}` : "節點:全流程"),
533
- Ft("操作者", e.actorMemberId, a, "系統"),
534
- Y(`時間:${Gt(e.createdAt)}`),
534
+ J(n ? `節點:${n}` : "節點:全流程"),
535
+ It("操作者", e.actorMemberId, a, "系統"),
536
+ J(`時間:${Gt(e.createdAt)}`),
535
537
  ...qt(e, t, r, o, s, c, a, l)
536
- ].filter(It),
538
+ ].filter(Y),
537
539
  error: Wt(e, t),
538
540
  id: e.id,
539
541
  title: Ht(e.eventType, t)
540
542
  };
541
- }), d = t.filter(bt).map((e) => ({
543
+ }), d = t.filter(xt).map((e) => ({
542
544
  descriptionParts: [
543
- Y(`節點:${Tt(e.nodeId, r)}`),
544
- Ft("處理者", e.assigneeMemberId, a, "未指定"),
545
- Y(`建立時間:${Gt(e.createdAt)}`)
546
- ].filter(It),
545
+ J(`節點:${Dt(e.nodeId, r)}`),
546
+ It("處理者", e.assigneeMemberId, a, "未指定"),
547
+ J(`建立時間:${Gt(e.createdAt)}`)
548
+ ].filter(Y),
547
549
  error: !1,
548
550
  id: `pending-task-${e.id}`,
549
551
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
550
- })), f = new Set([...e.filter(X).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), p = r ? Xt(r, t, n, i, f).map((e) => ({
551
- descriptionParts: [Y(`${wt(e.type)} · 尚未抵達`)].filter(It),
552
+ })), f = new Set([...e.filter(Rt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), p = r ? Xt(r, t, n, i, f).map((e) => ({
553
+ descriptionParts: [J(`${Et(e.type)} · 尚未抵達`)].filter(Y),
552
554
  error: !1,
553
555
  forcePending: !0,
554
556
  id: `future-node-${e.id}`,
@@ -581,17 +583,17 @@ var an = {
581
583
  function on(e, t, n, r) {
582
584
  let i = t.filter((t) => t.nodeId === e.id), a = i.find((e) => e.status === "PENDING" || e.status === "IN_PROGRESS"), o = i.find((e) => e.status === "CANCELLED"), s = i.find((e) => e.status === "COMPLETED"), c = n.filter((t) => t.currentNodeId === e.id), l = c.find((e) => e.status === "ACTIVE"), u = c.find((e) => e.status === "WAITING");
583
585
  if (a) return {
584
- secondaryLabel: `處理者 ${Et(a)}`,
586
+ secondaryLabel: `處理者 ${K(a)}`,
585
587
  statusLabel: "待處理",
586
588
  tone: "current"
587
589
  };
588
590
  if (o) return {
589
- secondaryLabel: `已取消 ${Et(o)}`,
591
+ secondaryLabel: `已取消 ${K(o)}`,
590
592
  statusLabel: "已取消",
591
593
  tone: "cancelled"
592
594
  };
593
595
  if (s) return {
594
- secondaryLabel: `已完成 ${Et(s)}`,
596
+ secondaryLabel: `已完成 ${K(s)}`,
595
597
  statusLabel: "已完成",
596
598
  tone: "completed"
597
599
  };
@@ -615,7 +617,7 @@ function on(e, t, n, r) {
615
617
  ...d,
616
618
  secondaryLabel: r
617
619
  } : {
618
- secondaryLabel: wt(e.type),
620
+ secondaryLabel: Et(e.type),
619
621
  statusLabel: "未抵達",
620
622
  tone: "neutral"
621
623
  };
@@ -627,11 +629,11 @@ async function sn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks
627
629
  n?.initiatorMemberId ?? null,
628
630
  n?.submittedByMemberId ?? null,
629
631
  ...e.map((e) => e.actorMemberId),
630
- ...e.flatMap(Q),
632
+ ...e.flatMap(Bt),
631
633
  ...r.map((e) => e.assigneeMemberId),
632
634
  ...r.map((e) => e.originalAssigneeMemberId),
633
635
  ...r.flatMap((e) => e.candidateMemberIds),
634
- ...r.flatMap((e) => _t(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
636
+ ...r.flatMap((e) => z(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
635
637
  ...t.flatMap((e) => [e.createdByMemberId, ...cn(e.targetValueJson)])
636
638
  ].filter(H))];
637
639
  try {
@@ -657,86 +659,129 @@ function un(e) {
657
659
  }, /* @__PURE__ */ new Map());
658
660
  }
659
661
  //#endregion
662
+ //#region src/views/instances/detail/use-resubmit-comment-draft.ts
663
+ function dn(e) {
664
+ let [t, n] = y({
665
+ instanceId: e,
666
+ text: ""
667
+ }), r = h((t) => n({
668
+ instanceId: e,
669
+ text: t
670
+ }), [e]);
671
+ return {
672
+ clearAfterResubmit: h((e) => n((t) => t.instanceId === e ? {
673
+ instanceId: e,
674
+ text: ""
675
+ } : t), []),
676
+ comment: t.instanceId === e ? t.text : "",
677
+ setComment: r
678
+ };
679
+ }
680
+ //#endregion
660
681
  //#region src/views/instances/detail/sections/InstanceFormSection.tsx
661
- var dn = {
682
+ var fn = {
662
683
  display: "grid",
663
684
  gap: 16
664
- }, $ = {
685
+ }, pn = {
665
686
  display: "flex",
666
687
  flexWrap: "wrap",
667
688
  gap: 8
689
+ }, mn = 2e3, hn = {
690
+ minWidth: "100%",
691
+ width: "100%"
668
692
  };
669
- function fn({ canResubmitInstance: e, deciding: t, error: n, fieldAccess: r, fieldLabelMarkers: i, fill: a = null, instance: o, loading: s, onDataSourceStateChange: c, onResubmitFormChange: l, onReloadAfterConflict: d = null, onResubmitInstance: f, onUploadAttachment: p, resubmitFormData: ee, resubmitFormErrors: te }) {
670
- let m = o?.formDefinitionSnapshot.schema, h = o?.workflowSnapshot, re = _(() => e && m && h ? u(m, h) : a?.schema ?? m, [
693
+ function $(e) {
694
+ e && (e.style.width = "100%");
695
+ }
696
+ function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fieldLabelMarkers: a, fill: o = null, instance: s, loading: c, onDataSourceStateChange: l, onResubmitFormChange: d, onReloadAfterConflict: f = null, onResubmitCommentChange: p = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: m = "", resubmitFormData: re, resubmitFormErrors: ie }) {
697
+ let h = s?.formDefinitionSnapshot.schema, g = s?.workflowSnapshot, ae = _(() => e && h && g ? u(h, g) : o?.schema ?? h, [
671
698
  e,
672
- a?.schema,
673
- m,
674
- h
675
- ]), g = !e && a !== null;
699
+ o?.schema,
700
+ h,
701
+ g
702
+ ]), v = !e && o !== null;
676
703
  return /* @__PURE__ */ D("div", {
677
- style: dn,
704
+ style: fn,
678
705
  children: [
679
- n ? /* @__PURE__ */ E(w, {
706
+ r ? /* @__PURE__ */ E(T, {
680
707
  color: "text-error",
681
708
  variant: "body",
682
- children: n
709
+ children: r
683
710
  }) : null,
684
- s ? /* @__PURE__ */ E(w, {
711
+ c ? /* @__PURE__ */ E(T, {
685
712
  color: "text-neutral",
686
713
  variant: "body",
687
714
  children: "載入中..."
688
715
  }) : null,
689
- d ? /* @__PURE__ */ D("div", {
690
- style: dn,
691
- children: [/* @__PURE__ */ E(x, {
716
+ f ? /* @__PURE__ */ D("div", {
717
+ style: fn,
718
+ children: [/* @__PURE__ */ E(S, {
692
719
  content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
693
720
  severity: "error"
694
721
  }), /* @__PURE__ */ E("div", {
695
- style: $,
696
- children: /* @__PURE__ */ E(y, {
697
- disabled: s,
722
+ style: pn,
723
+ children: /* @__PURE__ */ E(b, {
724
+ disabled: c,
698
725
  icon: Ke,
699
726
  iconType: "leading",
700
- onClick: d,
727
+ onClick: f,
701
728
  variant: "base-secondary",
702
729
  children: "重新載入"
703
730
  })
704
731
  })]
705
732
  }) : null,
706
- g && a.fieldCount > 0 ? /* @__PURE__ */ E(x, {
707
- content: `本關需要你補填 ${a.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
733
+ v && o.fieldCount > 0 ? /* @__PURE__ */ E(S, {
734
+ content: `本關需要你補填 ${o.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
708
735
  severity: "info"
709
736
  }) : null,
710
- re && o?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(ne, {
711
- dataSourceContext: e ? {
712
- instanceId: o.id,
713
- kind: "runtime"
714
- } : void 0,
715
- dataSourceInitialValues: o.formData,
716
- errors: g ? a.errors : te,
717
- ...!e && r ? { fieldAccess: r } : {},
718
- ...!e && i ? { fieldLabelMarkers: i } : {},
719
- onChange: (e) => {
720
- g ? a.onChange(e) : l(e);
721
- },
722
- onDataSourceStateChange: c,
723
- onUploadAttachment: e ? p : void 0,
724
- optionSnapshots: o.formDataOptionSnapshot,
725
- readonly: !e,
726
- schema: re,
727
- uiSchema: o.formDefinitionSnapshot.uiSchema,
728
- value: e ? ee : g ? a.value : o.formData
729
- }), e ? /* @__PURE__ */ E("div", {
730
- style: $,
731
- children: /* @__PURE__ */ E(y, {
732
- disabled: t,
733
- icon: Ke,
734
- iconType: "leading",
735
- onClick: f,
736
- variant: "base-primary",
737
- children: "重新送出"
738
- })
739
- }) : null] }) : /* @__PURE__ */ E(w, {
737
+ ae && s?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ D(ve, { children: [
738
+ /* @__PURE__ */ E(ne, {
739
+ dataSourceContext: e ? {
740
+ instanceId: s.id,
741
+ kind: "runtime"
742
+ } : void 0,
743
+ dataSourceInitialValues: s.formData,
744
+ errors: v ? o.errors : ie,
745
+ ...!e && i ? { fieldAccess: i } : {},
746
+ ...!e && a ? { fieldLabelMarkers: a } : {},
747
+ onChange: (e) => {
748
+ v ? o.onChange(e) : d(e);
749
+ },
750
+ onDataSourceStateChange: l,
751
+ onUploadAttachment: e ? te : void 0,
752
+ optionSnapshots: s.formDataOptionSnapshot,
753
+ readonly: !e,
754
+ schema: ae,
755
+ uiSchema: s.formDefinitionSnapshot.uiSchema,
756
+ value: e ? re : v ? o.value : s.formData
757
+ }),
758
+ e && p ? /* @__PURE__ */ E(n, {
759
+ label: "簽核意見",
760
+ name: "resubmitComment",
761
+ children: /* @__PURE__ */ E(ge, {
762
+ disabled: t,
763
+ onChange: (e) => p(e.target.value),
764
+ placeholder: "選填,例如說明這次補正或修改了哪些內容",
765
+ maxLength: mn,
766
+ ref: $,
767
+ resize: "vertical",
768
+ rows: 4,
769
+ style: hn,
770
+ value: m
771
+ })
772
+ }) : null,
773
+ e ? /* @__PURE__ */ E("div", {
774
+ style: pn,
775
+ children: /* @__PURE__ */ E(b, {
776
+ disabled: t,
777
+ icon: Ke,
778
+ iconType: "leading",
779
+ onClick: ee,
780
+ variant: "base-primary",
781
+ children: "重新送出"
782
+ })
783
+ }) : null
784
+ ] }) : /* @__PURE__ */ E(T, {
740
785
  color: "text-neutral",
741
786
  variant: "body",
742
787
  children: "此案件沒有可顯示的表單快照。"
@@ -746,11 +791,11 @@ function fn({ canResubmitInstance: e, deciding: t, error: n, fieldAccess: r, fie
746
791
  }
747
792
  //#endregion
748
793
  //#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
749
- var pn = {
794
+ var _n = {
750
795
  display: "grid",
751
796
  gap: 16
752
797
  };
753
- function mn({ attachments: e, onDownload: n, onPreview: r }) {
798
+ function vn({ attachments: e, onDownload: n, onPreview: r }) {
754
799
  let i = _(() => e.map((e) => ({
755
800
  attachment: e,
756
801
  createdAt: e.createdAt,
@@ -758,7 +803,7 @@ function mn({ attachments: e, onDownload: n, onPreview: r }) {
758
803
  id: e.id,
759
804
  key: e.id,
760
805
  mimeType: e.mimeType,
761
- sizeLabel: xt(Number(e.sizeBytes))
806
+ sizeLabel: St(Number(e.sizeBytes))
762
807
  })), [e]), a = _(() => [
763
808
  {
764
809
  dataIndex: "filename",
@@ -780,7 +825,7 @@ function mn({ attachments: e, onDownload: n, onPreview: r }) {
780
825
  },
781
826
  {
782
827
  key: "createdAt",
783
- render: (e) => /* @__PURE__ */ E(w, {
828
+ render: (e) => /* @__PURE__ */ E(T, {
784
829
  component: "span",
785
830
  variant: "body",
786
831
  children: t(e.createdAt)
@@ -808,17 +853,17 @@ function mn({ attachments: e, onDownload: n, onPreview: r }) {
808
853
  width: 160
809
854
  }), [n, r]);
810
855
  return /* @__PURE__ */ D("div", {
811
- style: pn,
812
- children: [/* @__PURE__ */ E(w, {
856
+ style: _n,
857
+ children: [/* @__PURE__ */ E(T, {
813
858
  component: "h2",
814
859
  variant: "h3",
815
860
  children: "附件"
816
- }), i.length > 0 ? /* @__PURE__ */ E(ge, {
861
+ }), i.length > 0 ? /* @__PURE__ */ E(he, {
817
862
  actions: o,
818
863
  columns: a,
819
864
  dataSource: i,
820
865
  fullWidth: !0
821
- }) : /* @__PURE__ */ E(w, {
866
+ }) : /* @__PURE__ */ E(T, {
822
867
  color: "text-neutral",
823
868
  variant: "body",
824
869
  children: "此案件沒有附件。"
@@ -827,63 +872,63 @@ function mn({ attachments: e, onDownload: n, onPreview: r }) {
827
872
  }
828
873
  //#endregion
829
874
  //#region src/views/instances/detail/sections/InstanceTasksSection.tsx
830
- var hn = {
875
+ var yn = {
831
876
  display: "grid",
832
877
  gap: 12,
833
878
  width: "100%"
834
- }, gn = {
879
+ }, bn = {
835
880
  minWidth: "100%",
836
881
  width: "100%"
837
- }, _n = {
882
+ }, xn = {
838
883
  display: "grid",
839
884
  gap: 12,
840
885
  width: "100%"
841
- }, vn = { marginTop: 12 }, yn = { marginTop: 24 };
842
- function bn(e) {
886
+ }, Sn = { marginTop: 12 }, Cn = { marginTop: 24 };
887
+ function wn(e) {
843
888
  e && (e.style.width = "100%");
844
889
  }
845
- var xn = {
890
+ var Tn = {
846
891
  COMPLETION_NOTIFY: "結案通知",
847
892
  COUNTERSIGN: "臨時會簽",
848
893
  PRE_APPROVAL: "臨時加簽",
849
894
  STAGE_NOTIFY: "階段完成通知"
850
- }, Sn = {
895
+ }, En = {
851
896
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
852
897
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
853
898
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
854
899
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
855
- }, Cn = [{
900
+ }, Dn = [{
856
901
  id: "REJECT_INSTANCE",
857
902
  name: "加簽拒絕時整單駁回"
858
903
  }, {
859
904
  id: "RETURN_TO_ORIGIN",
860
905
  name: "加簽拒絕時退回給我重新處理"
861
- }], wn = [{
906
+ }], On = [{
862
907
  id: "MEMBER",
863
908
  name: "指定成員"
864
909
  }, {
865
910
  id: "WEBHOOK",
866
911
  name: "Webhook"
867
- }], Tn = re(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onDecidingChange: l, onFillApproveError: u, tasks: d }, f) {
868
- let [p, ee] = v(!1), [te, m] = v(null);
869
- ie(() => {
912
+ }], kn = ie(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onDecidingChange: l, onFillApproveError: u, tasks: d }, f) {
913
+ let [p, ee] = y(!1), [te, m] = y(null);
914
+ g(() => {
870
915
  l?.(p);
871
916
  }, [p, l]);
872
- let [ne, h] = v(""), [re, g] = v(!1), [oe, x] = v(""), [de, fe] = v(null), [pe, me] = v(!1), [he, ve] = v(""), [be, we] = v(!1), [Te, O] = v(null), [Ee, De] = v(""), [Oe, ke] = v(null), [Ae, Ne] = v(!1), [Pe, Fe] = v([]), [Ie, Le] = v(!1), [Re, ze] = v(""), [Be, Ve] = v([]), [He, Ue] = v(!1), [We, Ge] = v([]), [Ke, qe] = v(!1), [A, Je] = v("COUNTERSIGN"), [Ye, j] = v("REJECT_INSTANCE"), [M, Xe] = v(!1), [Ze, Qe] = v("MEMBER"), [$e, et] = v(""), N = oe.trim(), tt = he.trim(), nt = Ee.trim(), P = _(() => Ot(d, r), [r, d]), F = _(() => P && o ? o.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, o]), I = _(() => F && o ? kt(o.workflowSnapshot, F) : [], [F, o]), rt = F?.type === "userTask" && F.data.returnBehavior.allowReturn, L = F?.type === "userTask" && F.data.allowReject !== !1, it = F?.type === "userTask" && F.data.allowTransfer !== !1, at = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, R = F?.type === "userTask" && F.data.allowAddSigner, z = _(() => e.filter((e) => e.status === "PENDING"), [e]), ot = I.find((e) => e.id === Te) ?? I[0] ?? null, st = _(() => d.map((e) => ({
917
+ let [ne, re] = y(""), [ie, h] = y(!1), [v, S] = y(""), [ue, de] = y(null), [fe, pe] = y(!1), [me, _e] = y(""), [be, we] = y(!1), [Te, O] = y(null), [Ee, De] = y(""), [Oe, ke] = y(null), [Ae, Ne] = y(!1), [Pe, Fe] = y([]), [Ie, Le] = y(!1), [Re, ze] = y(""), [Be, Ve] = y([]), [He, Ue] = y(!1), [We, Ge] = y([]), [Ke, qe] = y(!1), [A, Je] = y("COUNTERSIGN"), [Ye, j] = y("REJECT_INSTANCE"), [Xe, Ze] = y(!1), [Qe, $e] = y("MEMBER"), [et, tt] = y(""), M = v.trim(), nt = me.trim(), rt = Ee.trim(), N = _(() => Ot(d, r), [r, d]), P = _(() => N && o ? o.workflowSnapshot.nodes.find((e) => e.id === N.nodeId) ?? null : null, [N, o]), F = _(() => P && o ? kt(o.workflowSnapshot, P) : [], [P, o]), it = P?.type === "userTask" && P.data.returnBehavior.allowReturn, I = P?.type === "userTask" && P.data.allowReject !== !1, at = P?.type === "userTask" && P.data.allowTransfer !== !1, ot = P?.type === "userTask" && P.data.returnBehavior.requireComment === !0, L = P?.type === "userTask" && P.data.allowAddSigner, R = _(() => e.filter((e) => e.status === "PENDING"), [e]), st = F.find((e) => e.id === Te) ?? F[0] ?? null, ct = _(() => d.map((e) => ({
873
918
  ...e,
874
- assigneeLabel: Et(e, s),
875
- fillFieldCount: Dn(e, o?.workflowSnapshot ?? null),
919
+ assigneeLabel: K(e, s),
920
+ fillFieldCount: jn(e, o?.workflowSnapshot ?? null),
876
921
  key: e.id,
877
922
  nodeLabel: a({
878
923
  ...e,
879
- nodeLabel: Tt(e.nodeId, o?.workflowSnapshot ?? null)
924
+ nodeLabel: Dt(e.nodeId, o?.workflowSnapshot ?? null)
880
925
  }),
881
- statusLabel: G(e.status)
926
+ statusLabel: wt(e.status)
882
927
  })), [
883
928
  o,
884
929
  s,
885
930
  d
886
- ]), ct = _(() => [
931
+ ]), lt = _(() => [
887
932
  {
888
933
  dataIndex: "nodeLabel",
889
934
  key: "nodeLabel",
@@ -893,7 +938,7 @@ var xn = {
893
938
  {
894
939
  key: "assigneeMemberId",
895
940
  title: "處理者",
896
- render: (e) => /* @__PURE__ */ E(w, {
941
+ render: (e) => /* @__PURE__ */ E(T, {
897
942
  component: "span",
898
943
  variant: "body",
899
944
  children: e.assigneeLabel
@@ -908,7 +953,7 @@ var xn = {
908
953
  },
909
954
  {
910
955
  key: "fill",
911
- render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ E(ce, {
956
+ render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ E(se, {
912
957
  size: "sub",
913
958
  text: `需補填 ${e.fillFieldCount} 欄`,
914
959
  variant: "dot-warning"
@@ -918,7 +963,7 @@ var xn = {
918
963
  },
919
964
  {
920
965
  key: "createdAt",
921
- render: (e) => /* @__PURE__ */ E(w, {
966
+ render: (e) => /* @__PURE__ */ E(T, {
922
967
  component: "span",
923
968
  variant: "body",
924
969
  children: t(e.createdAt)
@@ -926,13 +971,13 @@ var xn = {
926
971
  title: "建立時間",
927
972
  width: 220
928
973
  }
929
- ], []), lt = _(() => z.map((e) => ({
974
+ ], []), ut = _(() => R.map((e) => ({
930
975
  ...e,
931
- createdByLabel: q(e.createdByMemberId, s),
976
+ createdByLabel: G(e.createdByMemberId, s),
932
977
  key: e.id,
933
- targetLabel: En(e, s),
934
- typeLabel: xn[e.type]
935
- })), [s, z]), ut = _(() => [
978
+ targetLabel: An(e, s),
979
+ typeLabel: Tn[e.type]
980
+ })), [s, R]), dt = _(() => [
936
981
  {
937
982
  dataIndex: "typeLabel",
938
983
  key: "typeLabel",
@@ -941,7 +986,7 @@ var xn = {
941
986
  },
942
987
  {
943
988
  key: "targetLabel",
944
- render: (e) => /* @__PURE__ */ E(w, {
989
+ render: (e) => /* @__PURE__ */ E(T, {
945
990
  component: "span",
946
991
  variant: "body",
947
992
  children: e.targetLabel
@@ -951,7 +996,7 @@ var xn = {
951
996
  },
952
997
  {
953
998
  key: "createdByLabel",
954
- render: (e) => /* @__PURE__ */ E(w, {
999
+ render: (e) => /* @__PURE__ */ E(T, {
955
1000
  component: "span",
956
1001
  variant: "body",
957
1002
  children: e.createdByLabel
@@ -961,7 +1006,7 @@ var xn = {
961
1006
  },
962
1007
  {
963
1008
  key: "createdAt",
964
- render: (e) => /* @__PURE__ */ E(w, {
1009
+ render: (e) => /* @__PURE__ */ E(T, {
965
1010
  component: "span",
966
1011
  variant: "body",
967
1012
  children: t(e.createdAt)
@@ -971,21 +1016,21 @@ var xn = {
971
1016
  },
972
1017
  {
973
1018
  key: "actions",
974
- render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ E(y, {
975
- disabled: M,
976
- onClick: () => void Dt(e.id),
1019
+ render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ E(b, {
1020
+ disabled: Xe,
1021
+ onClick: () => void q(e.id),
977
1022
  size: "minor",
978
1023
  variant: "destructive-secondary",
979
1024
  children: "撤回"
980
- }) : /* @__PURE__ */ E(T, {}),
1025
+ }) : /* @__PURE__ */ E(ve, {}),
981
1026
  title: "操作",
982
1027
  width: 100
983
1028
  }
984
- ], [M, r]);
985
- async function dt({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
986
- if (!r || !P || e === "REJECTED" && !L || e === "TRANSFERRED" && !it) return !1;
1029
+ ], [Xe, r]);
1030
+ async function ft({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1031
+ if (!r || !N || e === "REJECTED" && !I || e === "TRANSFERRED" && !at) return !1;
987
1032
  ee(!0), m(null);
988
- let o = e === "APPROVED" && i !== null && !P.isAdhoc ? {
1033
+ let o = e === "APPROVED" && i !== null && !N.isAdhoc ? {
989
1034
  expectedFormDataFingerprint: i.expectedFormDataFingerprint,
990
1035
  formData: i.formData
991
1036
  } : null;
@@ -996,49 +1041,49 @@ var xn = {
996
1041
  decidedByMemberId: r,
997
1042
  fill: o,
998
1043
  returnToNodeId: n,
999
- taskId: P.id,
1044
+ taskId: N.id,
1000
1045
  transferToMemberId: a
1001
- }), me(!1), we(!1), Le(!1), x(""), ve(""), De(""), ke(null), O(null), fe(null);
1046
+ }), pe(!1), we(!1), Le(!1), S(""), _e(""), De(""), ke(null), O(null), de(null);
1002
1047
  } catch (e) {
1003
- return ee(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (g(!1), !1) : (m(W(e)), !1);
1048
+ return ee(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (h(!1), !1) : (m(U(e)), !1);
1004
1049
  }
1005
1050
  try {
1006
1051
  await c();
1007
1052
  } catch (e) {
1008
- m(W(e));
1053
+ m(U(e));
1009
1054
  } finally {
1010
1055
  ee(!1);
1011
1056
  }
1012
1057
  return !0;
1013
1058
  }
1014
- function ft() {
1015
- r && P && (m(null), g(!0));
1016
- }
1017
1059
  function pt() {
1018
- p || (g(!1), h(""));
1019
- }
1020
- async function B() {
1021
- p || await dt({
1022
- action: "APPROVED",
1023
- comment: ne.trim() || null
1024
- }) && (g(!1), h(""));
1060
+ r && N && (m(null), h(!0));
1025
1061
  }
1026
1062
  function mt() {
1027
- L && (x(""), fe(null), me(!0));
1063
+ p || (h(!1), re(""));
1028
1064
  }
1029
- function ht() {
1030
- p || (me(!1), x(""), fe(null));
1065
+ async function ht() {
1066
+ p || await ft({
1067
+ action: "APPROVED",
1068
+ comment: ne.trim() || null
1069
+ }) && (h(!1), re(""));
1031
1070
  }
1032
1071
  function gt() {
1033
- ve(""), O(I[0]?.id ?? null), we(!0);
1072
+ I && (S(""), de(null), pe(!0));
1034
1073
  }
1035
1074
  function _t() {
1036
- p || (we(!1), ve(""), O(null));
1037
- }
1038
- function V() {
1039
- it && (De(""), ke(null), Le(!0), yt(""));
1075
+ p || (pe(!1), S(""), de(null));
1040
1076
  }
1041
1077
  function vt() {
1078
+ _e(""), O(F[0]?.id ?? null), we(!0);
1079
+ }
1080
+ function z() {
1081
+ p || (we(!1), _e(""), O(null));
1082
+ }
1083
+ function B() {
1084
+ at && (De(""), ke(null), Le(!0), yt(""));
1085
+ }
1086
+ function V() {
1042
1087
  p || (Le(!1), De(""), ke(null));
1043
1088
  }
1044
1089
  async function yt(e) {
@@ -1046,254 +1091,254 @@ var xn = {
1046
1091
  try {
1047
1092
  Fe((await k(e)).filter((e) => e.memberId !== r).map(At));
1048
1093
  } catch (e) {
1049
- m(W(e));
1094
+ m(U(e));
1050
1095
  } finally {
1051
1096
  Ne(!1);
1052
1097
  }
1053
1098
  }
1054
1099
  async function H() {
1055
- L && (N ? await dt({
1100
+ I && (M ? await ft({
1056
1101
  action: "REJECTED",
1057
- comment: N
1058
- }) : fe("請輸入拒絕原因"));
1102
+ comment: M
1103
+ }) : de("請輸入拒絕原因"));
1059
1104
  }
1060
- async function U() {
1061
- it && (Oe ? await dt({
1105
+ async function bt() {
1106
+ at && (Oe ? await ft({
1062
1107
  action: "TRANSFERRED",
1063
- comment: nt || null,
1108
+ comment: rt || null,
1064
1109
  transferToMemberId: Oe.id
1065
1110
  }) : m("請選擇轉派對象"));
1066
1111
  }
1067
- async function bt() {
1068
- await dt({
1112
+ async function xt() {
1113
+ await ft({
1069
1114
  action: "RETURNED",
1070
- comment: tt || null,
1071
- returnToNodeId: ot?.id ?? null
1115
+ comment: nt || null,
1116
+ returnToNodeId: st?.id ?? null
1072
1117
  });
1073
1118
  }
1074
- function xt() {
1075
- ze(""), Ve([]), j("REJECT_INSTANCE"), Qe("MEMBER"), et("");
1119
+ function St() {
1120
+ ze(""), Ve([]), j("REJECT_INSTANCE"), $e("MEMBER"), tt("");
1076
1121
  }
1077
- function St(e) {
1078
- Je(e), xt(), qe(!0), K("");
1122
+ function W(e) {
1123
+ Je(e), St(), qe(!0), Tt("");
1079
1124
  }
1080
1125
  function Ct() {
1081
- M || (qe(!1), xt());
1126
+ Xe || (qe(!1), St());
1082
1127
  }
1083
- async function K(e) {
1128
+ async function Tt(e) {
1084
1129
  Ue(!0);
1085
1130
  try {
1086
1131
  Ge((await k(e)).map(At));
1087
1132
  } catch (e) {
1088
- m(W(e));
1133
+ m(U(e));
1089
1134
  } finally {
1090
1135
  Ue(!1);
1091
1136
  }
1092
1137
  }
1093
- async function wt() {
1094
- if (!P) return;
1095
- let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && Ze === "WEBHOOK", t = jt({
1138
+ async function Et() {
1139
+ if (!N) return;
1140
+ let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && Qe === "WEBHOOK", t = jt({
1096
1141
  memberIds: Be.map((e) => e.id),
1097
1142
  useWebhookTarget: e,
1098
- webhookUrl: $e
1143
+ webhookUrl: et
1099
1144
  });
1100
1145
  if (!t.valid) {
1101
1146
  m(t.error);
1102
1147
  return;
1103
1148
  }
1104
1149
  let { target: n } = t, r = Re.trim() || null;
1105
- Xe(!0), m(null);
1150
+ Ze(!0), m(null);
1106
1151
  try {
1107
1152
  A === "COUNTERSIGN" ? await je({
1108
1153
  comment: r,
1109
1154
  target: n,
1110
- taskId: P.id
1155
+ taskId: N.id
1111
1156
  }) : A === "PRE_APPROVAL" ? await Me({
1112
1157
  comment: r,
1113
1158
  onReject: Ye,
1114
1159
  target: n,
1115
- taskId: P.id
1160
+ taskId: N.id
1116
1161
  }) : A === "STAGE_NOTIFY" ? await Se({
1117
1162
  target: n,
1118
- taskId: P.id
1163
+ taskId: N.id
1119
1164
  }) : await xe({
1120
1165
  target: n,
1121
- taskId: P.id
1122
- }), qe(!1), xt(), await c();
1166
+ taskId: N.id
1167
+ }), qe(!1), St(), await c();
1123
1168
  } catch (e) {
1124
- m(W(e));
1169
+ m(U(e));
1125
1170
  } finally {
1126
- Xe(!1);
1171
+ Ze(!1);
1127
1172
  }
1128
1173
  }
1129
- async function Dt(e) {
1130
- Xe(!0), m(null);
1174
+ async function q(e) {
1175
+ Ze(!0), m(null);
1131
1176
  try {
1132
1177
  await ye(e), await c();
1133
1178
  } catch (e) {
1134
- m(W(e));
1179
+ m(U(e));
1135
1180
  } finally {
1136
- Xe(!1);
1181
+ Ze(!1);
1137
1182
  }
1138
1183
  }
1139
1184
  ae(f, () => ({
1140
- canAddSignerCurrentTask: R,
1141
- canRejectCurrentTask: L,
1142
- canReturnCurrentTask: rt,
1143
- canTransferCurrentTask: it,
1185
+ canAddSignerCurrentTask: L,
1186
+ canRejectCurrentTask: I,
1187
+ canReturnCurrentTask: it,
1188
+ canTransferCurrentTask: at,
1144
1189
  deciding: p,
1145
- handleApprove: ft,
1146
- hasCurrentTask: P !== null,
1147
- openAdhocModal: St,
1148
- openRejectModal: mt,
1149
- openReturnModal: gt,
1150
- openTransferModal: V
1190
+ handleApprove: pt,
1191
+ hasCurrentTask: N !== null,
1192
+ openAdhocModal: W,
1193
+ openRejectModal: gt,
1194
+ openReturnModal: vt,
1195
+ openTransferModal: B
1151
1196
  }), [
1152
- R,
1153
1197
  L,
1154
- rt,
1198
+ I,
1155
1199
  it,
1200
+ at,
1156
1201
  r,
1157
- P,
1202
+ N,
1158
1203
  p
1159
1204
  ]);
1160
- let Y = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", Pt = Y && Ze === "WEBHOOK" ? !$e.trim() : Be.length === 0, Ft = Cn.find((e) => e.id === Ye) ?? Cn[0], It = wn.find((e) => e.id === Ze) ?? wn[0];
1161
- return /* @__PURE__ */ D(T, { children: [
1162
- /* @__PURE__ */ E(w, {
1205
+ let J = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", Ft = J && Qe === "WEBHOOK" ? !et.trim() : Be.length === 0, It = Dn.find((e) => e.id === Ye) ?? Dn[0], Y = On.find((e) => e.id === Qe) ?? On[0];
1206
+ return /* @__PURE__ */ D(ve, { children: [
1207
+ /* @__PURE__ */ E(T, {
1163
1208
  component: "h2",
1164
1209
  variant: "h3",
1165
1210
  children: "任務"
1166
1211
  }),
1167
- te ? /* @__PURE__ */ E(w, {
1212
+ te ? /* @__PURE__ */ E(T, {
1168
1213
  color: "text-error",
1169
1214
  variant: "body",
1170
1215
  children: te
1171
1216
  }) : null,
1172
1217
  /* @__PURE__ */ E("div", {
1173
- style: vn,
1174
- children: /* @__PURE__ */ E(ge, {
1175
- columns: ct,
1176
- dataSource: st,
1218
+ style: Sn,
1219
+ children: /* @__PURE__ */ E(he, {
1220
+ columns: lt,
1221
+ dataSource: ct,
1177
1222
  fullWidth: !0
1178
1223
  })
1179
1224
  }),
1180
- z.length > 0 ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(w, {
1225
+ R.length > 0 ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(T, {
1181
1226
  component: "h3",
1182
- style: yn,
1227
+ style: Cn,
1183
1228
  variant: "h3",
1184
1229
  children: "待生效的臨時設定"
1185
1230
  }), /* @__PURE__ */ E("div", {
1186
- style: vn,
1187
- children: /* @__PURE__ */ E(ge, {
1188
- columns: ut,
1189
- dataSource: lt,
1231
+ style: Sn,
1232
+ children: /* @__PURE__ */ E(he, {
1233
+ columns: dt,
1234
+ dataSource: ut,
1190
1235
  fullWidth: !0
1191
1236
  })
1192
1237
  })] }) : null,
1193
- /* @__PURE__ */ D(S, {
1238
+ /* @__PURE__ */ D(C, {
1194
1239
  cancelText: "取消",
1195
1240
  confirmText: "送出同意",
1196
1241
  loading: p,
1197
1242
  modalType: "standard",
1198
- onCancel: pt,
1199
- onClose: pt,
1200
- onConfirm: () => void B(),
1201
- open: re,
1243
+ onCancel: mt,
1244
+ onClose: mt,
1245
+ onConfirm: () => void ht(),
1246
+ open: ie,
1202
1247
  showModalFooter: !0,
1203
1248
  showModalHeader: !0,
1204
1249
  size: "regular",
1205
1250
  supportingText: "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1206
1251
  title: "簽核意見",
1207
1252
  children: [
1208
- te ? /* @__PURE__ */ E(w, {
1253
+ te ? /* @__PURE__ */ E(T, {
1209
1254
  color: "text-error",
1210
1255
  role: "alert",
1211
1256
  variant: "body",
1212
1257
  children: te
1213
1258
  }) : null,
1214
1259
  i !== null && i.summary.length > 0 ? /* @__PURE__ */ D("div", {
1215
- style: hn,
1216
- children: [/* @__PURE__ */ E(w, {
1260
+ style: yn,
1261
+ children: [/* @__PURE__ */ E(T, {
1217
1262
  variant: "body",
1218
1263
  children: "將一併送出的補填欄位:"
1219
- }), i.summary.map((e) => /* @__PURE__ */ E(b, {
1264
+ }), i.summary.map((e) => /* @__PURE__ */ E(x, {
1220
1265
  title: e.label,
1221
- children: /* @__PURE__ */ E(le, { children: e.text })
1266
+ children: /* @__PURE__ */ E(ce, { children: e.text })
1222
1267
  }, e.fieldKey))]
1223
1268
  }) : null,
1224
1269
  /* @__PURE__ */ E("div", {
1225
- style: hn,
1270
+ style: yn,
1226
1271
  children: /* @__PURE__ */ E(n, {
1227
1272
  label: "簽核意見",
1228
1273
  name: "approveComment",
1229
- children: /* @__PURE__ */ E(_e, {
1274
+ children: /* @__PURE__ */ E(ge, {
1230
1275
  autoFocus: !0,
1231
- onChange: (e) => h(e.target.value),
1276
+ onChange: (e) => re(e.target.value),
1232
1277
  placeholder: "選填,例如補充核准的條件或提醒事項",
1233
- ref: bn,
1278
+ ref: wn,
1234
1279
  resize: "vertical",
1235
1280
  rows: 4,
1236
- style: gn,
1281
+ style: bn,
1237
1282
  value: ne
1238
1283
  })
1239
1284
  })
1240
1285
  })
1241
1286
  ]
1242
1287
  }),
1243
- /* @__PURE__ */ E(S, {
1288
+ /* @__PURE__ */ E(C, {
1244
1289
  cancelText: "取消",
1245
1290
  confirmButtonProps: {
1246
- disabled: !N,
1291
+ disabled: !M,
1247
1292
  variant: "destructive-primary"
1248
1293
  },
1249
1294
  confirmText: "送出拒絕",
1250
1295
  loading: p,
1251
1296
  modalStatusType: "error",
1252
1297
  modalType: "standard",
1253
- onCancel: ht,
1254
- onClose: ht,
1298
+ onCancel: _t,
1299
+ onClose: _t,
1255
1300
  onConfirm: () => void H(),
1256
- open: pe,
1301
+ open: fe,
1257
1302
  showModalFooter: !0,
1258
1303
  showModalHeader: !0,
1259
1304
  size: "regular",
1260
1305
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1261
1306
  title: "拒絕原因",
1262
1307
  children: /* @__PURE__ */ D("div", {
1263
- style: hn,
1308
+ style: yn,
1264
1309
  children: [/* @__PURE__ */ E(n, {
1265
1310
  label: "拒絕原因",
1266
1311
  name: "rejectReason",
1267
1312
  required: !0,
1268
- children: /* @__PURE__ */ E(_e, {
1313
+ children: /* @__PURE__ */ E(ge, {
1269
1314
  autoFocus: !0,
1270
1315
  onChange: (e) => {
1271
- x(e.target.value), fe(null);
1316
+ S(e.target.value), de(null);
1272
1317
  },
1273
1318
  placeholder: "請說明拒絕原因",
1274
- ref: bn,
1319
+ ref: wn,
1275
1320
  resize: "vertical",
1276
1321
  rows: 4,
1277
- style: gn,
1278
- type: de ? "error" : "default",
1279
- value: oe
1322
+ style: bn,
1323
+ type: ue ? "error" : "default",
1324
+ value: v
1280
1325
  })
1281
- }), de ? /* @__PURE__ */ E(w, {
1326
+ }), ue ? /* @__PURE__ */ E(T, {
1282
1327
  color: "text-error",
1283
1328
  variant: "body",
1284
- children: de
1329
+ children: ue
1285
1330
  }) : null]
1286
1331
  })
1287
1332
  }),
1288
- /* @__PURE__ */ E(S, {
1333
+ /* @__PURE__ */ E(C, {
1289
1334
  cancelText: "取消",
1290
1335
  confirmButtonProps: { disabled: !Oe },
1291
1336
  confirmText: "送出轉派",
1292
1337
  loading: p,
1293
1338
  modalType: "standard",
1294
- onCancel: vt,
1295
- onClose: vt,
1296
- onConfirm: () => void U(),
1339
+ onCancel: V,
1340
+ onClose: V,
1341
+ onConfirm: () => void bt(),
1297
1342
  open: Ie,
1298
1343
  showModalFooter: !0,
1299
1344
  showModalHeader: !0,
@@ -1301,12 +1346,12 @@ var xn = {
1301
1346
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1302
1347
  title: "轉派簽核",
1303
1348
  children: /* @__PURE__ */ D("div", {
1304
- style: _n,
1349
+ style: xn,
1305
1350
  children: [/* @__PURE__ */ E(n, {
1306
1351
  label: "轉派對象",
1307
1352
  name: "transferToMemberId",
1308
1353
  required: !0,
1309
- children: /* @__PURE__ */ E(se, {
1354
+ children: /* @__PURE__ */ E(oe, {
1310
1355
  asyncData: !0,
1311
1356
  disabledOptionsFilter: !0,
1312
1357
  emptyText: "沒有符合的成員",
@@ -1319,9 +1364,9 @@ var xn = {
1319
1364
  loading: Ae,
1320
1365
  loadingText: "搜尋成員中...",
1321
1366
  mode: "single",
1322
- onChange: (e) => ke(Mt(e)),
1367
+ onChange: (e) => ke(Nt(e)),
1323
1368
  onSearch: yt,
1324
- onSearchTextChange: (e) => ke(Nt(e, Pe)),
1369
+ onSearchTextChange: (e) => ke(Pt(e, Pe)),
1325
1370
  onVisibilityChange: (e) => {
1326
1371
  e && yt("");
1327
1372
  },
@@ -1333,27 +1378,27 @@ var xn = {
1333
1378
  }), /* @__PURE__ */ E(n, {
1334
1379
  label: "轉派說明",
1335
1380
  name: "transferComment",
1336
- children: /* @__PURE__ */ E(_e, {
1381
+ children: /* @__PURE__ */ E(ge, {
1337
1382
  onChange: (e) => De(e.target.value),
1338
1383
  placeholder: "可補充轉派原因",
1339
- ref: bn,
1384
+ ref: wn,
1340
1385
  resize: "vertical",
1341
1386
  rows: 4,
1342
- style: gn,
1387
+ style: bn,
1343
1388
  value: Ee
1344
1389
  })
1345
1390
  })]
1346
1391
  })
1347
1392
  }),
1348
- /* @__PURE__ */ E(S, {
1393
+ /* @__PURE__ */ E(C, {
1349
1394
  cancelText: "取消",
1350
- confirmButtonProps: { disabled: !ot || at && !tt },
1395
+ confirmButtonProps: { disabled: !st || ot && !nt },
1351
1396
  confirmText: "送出退回",
1352
1397
  loading: p,
1353
1398
  modalType: "standard",
1354
- onCancel: _t,
1355
- onClose: _t,
1356
- onConfirm: () => void bt(),
1399
+ onCancel: z,
1400
+ onClose: z,
1401
+ onConfirm: () => void xt(),
1357
1402
  open: be,
1358
1403
  showModalFooter: !0,
1359
1404
  showModalHeader: !0,
@@ -1361,102 +1406,102 @@ var xn = {
1361
1406
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1362
1407
  title: "退回簽核",
1363
1408
  children: /* @__PURE__ */ D("div", {
1364
- style: _n,
1409
+ style: xn,
1365
1410
  children: [/* @__PURE__ */ E(n, {
1366
1411
  label: "退回節點",
1367
1412
  name: "returnTargetNodeId",
1368
1413
  required: !0,
1369
- children: /* @__PURE__ */ E(C, {
1414
+ children: /* @__PURE__ */ E(w, {
1370
1415
  clearable: !1,
1371
1416
  fullWidth: !0,
1372
1417
  onChange: (e) => O(e?.id ?? null),
1373
- options: [...I],
1418
+ options: [...F],
1374
1419
  placeholder: "選擇退回節點",
1375
- value: ot
1420
+ value: st
1376
1421
  })
1377
1422
  }), /* @__PURE__ */ E(n, {
1378
- hintText: at ? "此關卡設定退回時必須填寫意見。" : void 0,
1423
+ hintText: ot ? "此關卡設定退回時必須填寫意見。" : void 0,
1379
1424
  label: "退回說明",
1380
1425
  name: "returnComment",
1381
- required: at,
1382
- children: /* @__PURE__ */ E(_e, {
1383
- onChange: (e) => ve(e.target.value),
1384
- placeholder: at ? "請說明退回原因" : "可補充需要修改的內容",
1385
- ref: bn,
1426
+ required: ot,
1427
+ children: /* @__PURE__ */ E(ge, {
1428
+ onChange: (e) => _e(e.target.value),
1429
+ placeholder: ot ? "請說明退回原因" : "可補充需要修改的內容",
1430
+ ref: wn,
1386
1431
  resize: "vertical",
1387
1432
  rows: 4,
1388
- style: gn,
1389
- value: he
1433
+ style: bn,
1434
+ value: me
1390
1435
  })
1391
1436
  })]
1392
1437
  })
1393
1438
  }),
1394
- /* @__PURE__ */ E(S, {
1439
+ /* @__PURE__ */ E(C, {
1395
1440
  cancelText: "取消",
1396
- confirmButtonProps: { disabled: Pt },
1441
+ confirmButtonProps: { disabled: Ft },
1397
1442
  confirmText: "送出",
1398
- loading: M,
1443
+ loading: Xe,
1399
1444
  modalType: "standard",
1400
1445
  onCancel: Ct,
1401
1446
  onClose: Ct,
1402
- onConfirm: () => void wt(),
1447
+ onConfirm: () => void Et(),
1403
1448
  open: Ke,
1404
1449
  showModalFooter: !0,
1405
1450
  showModalHeader: !0,
1406
1451
  size: "regular",
1407
- supportingText: Sn[A],
1408
- title: xn[A],
1452
+ supportingText: En[A],
1453
+ title: Tn[A],
1409
1454
  children: /* @__PURE__ */ D("div", {
1410
- style: _n,
1455
+ style: xn,
1411
1456
  children: [
1412
- Y ? /* @__PURE__ */ E(n, {
1457
+ J ? /* @__PURE__ */ E(n, {
1413
1458
  label: "通知時機",
1414
1459
  name: "adhocNotifyMode",
1415
1460
  required: !0,
1416
- children: /* @__PURE__ */ E(C, {
1461
+ children: /* @__PURE__ */ E(w, {
1417
1462
  clearable: !1,
1418
1463
  fullWidth: !0,
1419
1464
  onChange: (e) => Je(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1420
1465
  options: [{
1421
1466
  id: "STAGE_NOTIFY",
1422
- name: xn.STAGE_NOTIFY
1467
+ name: Tn.STAGE_NOTIFY
1423
1468
  }, {
1424
1469
  id: "COMPLETION_NOTIFY",
1425
- name: xn.COMPLETION_NOTIFY
1470
+ name: Tn.COMPLETION_NOTIFY
1426
1471
  }],
1427
1472
  value: {
1428
1473
  id: A,
1429
- name: xn[A]
1474
+ name: Tn[A]
1430
1475
  }
1431
1476
  })
1432
1477
  }) : null,
1433
- Y ? /* @__PURE__ */ E(n, {
1478
+ J ? /* @__PURE__ */ E(n, {
1434
1479
  label: "通知對象類型",
1435
1480
  name: "adhocTargetKind",
1436
1481
  required: !0,
1437
- children: /* @__PURE__ */ E(C, {
1482
+ children: /* @__PURE__ */ E(w, {
1438
1483
  clearable: !1,
1439
1484
  fullWidth: !0,
1440
- onChange: (e) => Qe(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1441
- options: [...wn],
1442
- value: It
1485
+ onChange: (e) => $e(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1486
+ options: [...On],
1487
+ value: Y
1443
1488
  })
1444
1489
  }) : null,
1445
- Y && Ze === "WEBHOOK" ? /* @__PURE__ */ E(n, {
1490
+ J && Qe === "WEBHOOK" ? /* @__PURE__ */ E(n, {
1446
1491
  label: "Webhook URL",
1447
1492
  name: "adhocWebhookUrl",
1448
1493
  required: !0,
1449
- children: /* @__PURE__ */ E(ue, {
1494
+ children: /* @__PURE__ */ E(le, {
1450
1495
  fullWidth: !0,
1451
- onChange: (e) => et(e.target.value),
1496
+ onChange: (e) => tt(e.target.value),
1452
1497
  placeholder: "https://example.com/webhook",
1453
- value: $e
1498
+ value: et
1454
1499
  })
1455
1500
  }) : /* @__PURE__ */ E(n, {
1456
- label: Y ? "通知對象" : "簽核對象",
1501
+ label: J ? "通知對象" : "簽核對象",
1457
1502
  name: "adhocMemberId",
1458
1503
  required: !0,
1459
- children: /* @__PURE__ */ E(se, {
1504
+ children: /* @__PURE__ */ E(oe, {
1460
1505
  asyncData: !0,
1461
1506
  disabledOptionsFilter: !0,
1462
1507
  emptyText: "沒有符合的成員",
@@ -1470,10 +1515,10 @@ var xn = {
1470
1515
  loadingText: "搜尋成員中...",
1471
1516
  menuMaxHeight: 320,
1472
1517
  mode: "multiple",
1473
- onChange: (e) => Ve(e.map(Mt).filter(J)),
1474
- onSearch: K,
1518
+ onChange: (e) => Ve(e.map(Nt).filter(Mt)),
1519
+ onSearch: Tt,
1475
1520
  onVisibilityChange: (e) => {
1476
- e && K("");
1521
+ e && Tt("");
1477
1522
  },
1478
1523
  options: [...We],
1479
1524
  overflowStrategy: "wrap",
@@ -1486,24 +1531,24 @@ var xn = {
1486
1531
  label: "拒簽處理方式",
1487
1532
  name: "adhocOnReject",
1488
1533
  required: !0,
1489
- children: /* @__PURE__ */ E(C, {
1534
+ children: /* @__PURE__ */ E(w, {
1490
1535
  clearable: !1,
1491
1536
  fullWidth: !0,
1492
1537
  onChange: (e) => j(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1493
- options: [...Cn],
1494
- value: Ft
1538
+ options: [...Dn],
1539
+ value: It
1495
1540
  })
1496
1541
  }) : null,
1497
- Y ? null : /* @__PURE__ */ E(n, {
1542
+ J ? null : /* @__PURE__ */ E(n, {
1498
1543
  label: "說明",
1499
1544
  name: "adhocComment",
1500
- children: /* @__PURE__ */ E(_e, {
1545
+ children: /* @__PURE__ */ E(ge, {
1501
1546
  onChange: (e) => ze(e.target.value),
1502
1547
  placeholder: "可補充原因",
1503
- ref: bn,
1548
+ ref: wn,
1504
1549
  resize: "vertical",
1505
1550
  rows: 3,
1506
- style: gn,
1551
+ style: bn,
1507
1552
  value: Re
1508
1553
  })
1509
1554
  })
@@ -1512,31 +1557,31 @@ var xn = {
1512
1557
  })
1513
1558
  ] });
1514
1559
  });
1515
- function En(e, t) {
1560
+ function An(e, t) {
1516
1561
  try {
1517
1562
  let n = JSON.parse(e.targetValueJson);
1518
- if (n.memberIds?.length) return n.memberIds.map((e) => q(e, t)).join("、");
1563
+ if (n.memberIds?.length) return n.memberIds.map((e) => G(e, t)).join("、");
1519
1564
  if (n.webhookUrl) return n.webhookUrl;
1520
1565
  if (n.positionId) return `職位 ${n.positionId}`;
1521
1566
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
1522
1567
  } catch {}
1523
1568
  return e.targetKind;
1524
1569
  }
1525
- function Dn(e, t) {
1570
+ function jn(e, t) {
1526
1571
  if (e.isAdhoc || e.status !== "PENDING" && e.status !== "IN_PROGRESS") return 0;
1527
1572
  let n = t?.nodes.find((t) => t.id === e.nodeId);
1528
- return n?.type === "userTask" ? M(n).size : 0;
1573
+ return n?.type === "userTask" ? Xe(n).size : 0;
1529
1574
  }
1530
1575
  //#endregion
1531
1576
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1532
- var On = {
1577
+ var Mn = {
1533
1578
  display: "grid",
1534
1579
  gap: 16
1535
1580
  };
1536
- function kn({ signatureVerification: e, signatures: n }) {
1581
+ function Nn({ signatureVerification: e, signatures: n }) {
1537
1582
  let r = _(() => n.map((e) => ({
1538
1583
  algorithm: e.algorithm,
1539
- hashLabel: St(e.signedPayloadHash),
1584
+ hashLabel: W(e.signedPayloadHash),
1540
1585
  key: e.id,
1541
1586
  keyVersion: e.keyVersion,
1542
1587
  signedAtLabel: t(e.signedAt),
@@ -1574,19 +1619,19 @@ function kn({ signatureVerification: e, signatures: n }) {
1574
1619
  }
1575
1620
  ], []);
1576
1621
  return /* @__PURE__ */ D("div", {
1577
- style: On,
1622
+ style: Mn,
1578
1623
  children: [
1579
- /* @__PURE__ */ E(w, {
1624
+ /* @__PURE__ */ E(T, {
1580
1625
  component: "h2",
1581
1626
  variant: "h3",
1582
1627
  children: "簽章"
1583
1628
  }),
1584
- /* @__PURE__ */ E(w, {
1629
+ /* @__PURE__ */ E(T, {
1585
1630
  color: e?.valid ? "text-success" : "text-error",
1586
1631
  variant: "body",
1587
1632
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1588
1633
  }),
1589
- r.length > 0 ? /* @__PURE__ */ E(ge, {
1634
+ r.length > 0 ? /* @__PURE__ */ E(he, {
1590
1635
  columns: i,
1591
1636
  dataSource: r,
1592
1637
  fullWidth: !0
@@ -1596,14 +1641,14 @@ function kn({ signatureVerification: e, signatures: n }) {
1596
1641
  }
1597
1642
  //#endregion
1598
1643
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1599
- var An = {
1644
+ var Pn = {
1600
1645
  display: "grid",
1601
1646
  gap: 16
1602
- }, jn = {
1647
+ }, Fn = {
1603
1648
  cursor: "help",
1604
1649
  textDecoration: "underline dotted",
1605
1650
  textUnderlineOffset: 3
1606
- }, Mn = {
1651
+ }, In = {
1607
1652
  borderLeftColor: "var(--mzn-color-border)",
1608
1653
  borderLeftStyle: "solid",
1609
1654
  borderLeftWidth: 2,
@@ -1612,41 +1657,41 @@ var An = {
1612
1657
  marginTop: 4,
1613
1658
  paddingLeft: 8,
1614
1659
  whiteSpace: "pre-wrap"
1615
- }, Nn = { color: "var(--mzn-color-text-secondary)" }, Pn = {
1616
- ...Mn,
1660
+ }, Ln = { color: "var(--mzn-color-text-secondary)" }, Rn = {
1661
+ ...In,
1617
1662
  borderLeftColor: "var(--mzn-color-text-error)",
1618
1663
  color: "var(--mzn-color-text-error)"
1619
1664
  };
1620
- function Fn(...e) {
1665
+ function zn(...e) {
1621
1666
  return e.filter((e) => H(e ?? null)).join(" ");
1622
1667
  }
1623
- var In = re(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1668
+ var Bn = ie(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1624
1669
  let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
1625
1670
  return /* @__PURE__ */ D("div", {
1626
1671
  ...l,
1627
- className: Fn(R.host, c === "dot" ? R.dot : null, n && d !== "processing" ? R.error : null, a === "horizontal" ? R.horizontal : null, c === "number" ? R.number : null, d === "pending" ? R.pending : null, d === "processing" ? R.processing : null, n && d === "processing" ? R.processingError : null, !n && d === "succeeded" ? R.succeeded : null, a === "vertical" ? R.vertical : null, e),
1672
+ className: zn(L.host, c === "dot" ? L.dot : null, n && d !== "processing" ? L.error : null, a === "horizontal" ? L.horizontal : null, c === "number" ? L.number : null, d === "pending" ? L.pending : null, d === "processing" ? L.processing : null, n && d === "processing" ? L.processingError : null, !n && d === "succeeded" ? L.succeeded : null, a === "vertical" ? L.vertical : null, e),
1628
1673
  ref: u,
1629
- children: [c === "dot" ? /* @__PURE__ */ E("span", { className: Fn(R.statusIndicator, R.statusIndicatorDot) }) : /* @__PURE__ */ E("span", {
1630
- className: R.statusIndicator,
1674
+ children: [c === "dot" ? /* @__PURE__ */ E("span", { className: zn(L.statusIndicator, L.statusIndicatorDot) }) : /* @__PURE__ */ E("span", {
1675
+ className: L.statusIndicator,
1631
1676
  children: i + 1
1632
1677
  }), /* @__PURE__ */ D("div", {
1633
- className: R.textContainer,
1678
+ className: L.textContainer,
1634
1679
  children: [
1635
- /* @__PURE__ */ D(w, {
1636
- className: R.title,
1680
+ /* @__PURE__ */ D(T, {
1681
+ className: L.title,
1637
1682
  variant: "label-primary-highlight",
1638
- children: [s, /* @__PURE__ */ E("span", { className: R.titleConnectLine })]
1683
+ children: [s, /* @__PURE__ */ E("span", { className: L.titleConnectLine })]
1639
1684
  }),
1640
- f.length > 0 ? /* @__PURE__ */ E(w, {
1641
- className: R.description,
1685
+ f.length > 0 ? /* @__PURE__ */ E(T, {
1686
+ className: L.description,
1642
1687
  variant: "caption",
1643
- children: f.map((e, t) => /* @__PURE__ */ D(h, { children: [t > 0 ? " · " : null, Ln(e)] }, `${e.type}-${t}`))
1688
+ children: f.map((e, t) => /* @__PURE__ */ D(re, { children: [t > 0 ? " · " : null, Vn(e)] }, `${e.type}-${t}`))
1644
1689
  }) : null,
1645
- p.map((e, t) => /* @__PURE__ */ D(w, {
1646
- style: e.tone === "danger" ? Pn : Mn,
1690
+ p.map((e, t) => /* @__PURE__ */ D(T, {
1691
+ style: e.tone === "danger" ? Rn : In,
1647
1692
  variant: "body",
1648
1693
  children: [/* @__PURE__ */ D("span", {
1649
- style: e.tone === "danger" ? void 0 : Nn,
1694
+ style: e.tone === "danger" ? void 0 : Ln,
1650
1695
  children: [e.label, ":"]
1651
1696
  }), e.text]
1652
1697
  }, `comment-${t}`))
@@ -1654,44 +1699,44 @@ var In = re(function({ className: e, descriptionParts: t, error: n, forcePending
1654
1699
  })]
1655
1700
  });
1656
1701
  });
1657
- function Ln(e) {
1658
- return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ D(T, { children: [
1702
+ function Vn(e) {
1703
+ return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ D(ve, { children: [
1659
1704
  e.prefix,
1660
1705
  ":",
1661
- /* @__PURE__ */ E(ve, {
1706
+ /* @__PURE__ */ E(_e, {
1662
1707
  title: e.email,
1663
1708
  children: ({ ref: t, ...n }) => /* @__PURE__ */ E("span", {
1664
1709
  ...n,
1665
1710
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1666
1711
  ref: t,
1667
- style: jn,
1712
+ style: Fn,
1668
1713
  children: e.label
1669
1714
  })
1670
1715
  })
1671
1716
  ] }) : `${e.prefix}:${e.label}`;
1672
1717
  }
1673
- function Rn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
1718
+ function Hn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
1674
1719
  let u = rn(e, s, l, c, n, r, o, a, i, t), d = Lt(u), f = u.map((e) => ({
1675
1720
  ...e,
1676
- descriptionParts: e.descriptionParts.filter(It)
1721
+ descriptionParts: e.descriptionParts.filter(Y)
1677
1722
  }));
1678
1723
  return /* @__PURE__ */ D("div", {
1679
- style: An,
1680
- children: [/* @__PURE__ */ E(w, {
1724
+ style: Pn,
1725
+ children: [/* @__PURE__ */ E(T, {
1681
1726
  component: "h2",
1682
1727
  variant: "h3",
1683
1728
  children: "歷程"
1684
- }), f.length > 0 ? /* @__PURE__ */ E(he, {
1729
+ }), f.length > 0 ? /* @__PURE__ */ E(me, {
1685
1730
  currentStep: d,
1686
1731
  orientation: "vertical",
1687
1732
  type: "dot",
1688
- children: f.map((e) => /* @__PURE__ */ E(In, {
1733
+ children: f.map((e) => /* @__PURE__ */ E(Bn, {
1689
1734
  descriptionParts: e.descriptionParts,
1690
1735
  error: e.error,
1691
1736
  forcePending: e.forcePending,
1692
1737
  title: e.title
1693
1738
  }, e.id))
1694
- }) : /* @__PURE__ */ E(w, {
1739
+ }) : /* @__PURE__ */ E(T, {
1695
1740
  color: "text-neutral",
1696
1741
  variant: "body",
1697
1742
  children: "尚無歷程紀錄。"
@@ -1700,30 +1745,30 @@ function Rn({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1700
1745
  }
1701
1746
  //#endregion
1702
1747
  //#region src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
1703
- var zn = {
1748
+ var Un = {
1704
1749
  display: "grid",
1705
1750
  gap: 16
1706
- }, Bn = {
1751
+ }, Wn = {
1707
1752
  display: "grid",
1708
1753
  gap: 2
1709
- }, Vn = {
1754
+ }, Gn = {
1710
1755
  overflowWrap: "anywhere",
1711
1756
  whiteSpace: "pre-wrap"
1712
1757
  };
1713
- function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1714
- let [r, i] = v(null), [a, o] = v(!1), [s, c] = v(null), l = _(() => e.map((e) => ({
1758
+ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1759
+ let [r, i] = y(null), [a, o] = y(!1), [s, c] = y(null), l = _(() => e.map((e) => ({
1715
1760
  delivery: e,
1716
1761
  key: e.id
1717
1762
  })), [e]), u = _(() => [
1718
1763
  {
1719
1764
  key: "endpoint",
1720
1765
  render: ({ delivery: e }) => /* @__PURE__ */ D("div", {
1721
- style: Bn,
1722
- children: [/* @__PURE__ */ E(w, {
1766
+ style: Wn,
1767
+ children: [/* @__PURE__ */ E(T, {
1723
1768
  component: "span",
1724
1769
  variant: "body",
1725
1770
  children: e.endpointLabel ?? e.endpointKey
1726
- }), /* @__PURE__ */ D(w, {
1771
+ }), /* @__PURE__ */ D(T, {
1727
1772
  color: "text-neutral",
1728
1773
  component: "span",
1729
1774
  variant: "caption",
@@ -1742,13 +1787,13 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1742
1787
  },
1743
1788
  {
1744
1789
  key: "status",
1745
- render: ({ delivery: e }) => /* @__PURE__ */ E(Un, { status: e.status }),
1790
+ render: ({ delivery: e }) => /* @__PURE__ */ E(qn, { status: e.status }),
1746
1791
  title: "狀態",
1747
1792
  width: 120
1748
1793
  },
1749
1794
  {
1750
1795
  key: "attemptCount",
1751
- render: ({ delivery: e }) => /* @__PURE__ */ E(w, {
1796
+ render: ({ delivery: e }) => /* @__PURE__ */ E(T, {
1752
1797
  component: "span",
1753
1798
  variant: "body",
1754
1799
  children: e.attemptCount
@@ -1759,20 +1804,20 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1759
1804
  {
1760
1805
  key: "lastError",
1761
1806
  render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ D("div", {
1762
- style: Bn,
1763
- children: [/* @__PURE__ */ E(w, {
1807
+ style: Wn,
1808
+ children: [/* @__PURE__ */ E(T, {
1764
1809
  color: "text-error",
1765
1810
  component: "span",
1766
1811
  variant: "body",
1767
1812
  children: e.lastErrorCode
1768
- }), e.lastErrorDetail ? /* @__PURE__ */ E(w, {
1813
+ }), e.lastErrorDetail ? /* @__PURE__ */ E(T, {
1769
1814
  color: "text-neutral",
1770
1815
  component: "span",
1771
- style: Vn,
1816
+ style: Gn,
1772
1817
  variant: "caption",
1773
1818
  children: e.lastErrorDetail
1774
1819
  }) : null]
1775
- }) : /* @__PURE__ */ E(w, {
1820
+ }) : /* @__PURE__ */ E(T, {
1776
1821
  color: "text-neutral",
1777
1822
  component: "span",
1778
1823
  variant: "body",
@@ -1783,10 +1828,10 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1783
1828
  },
1784
1829
  {
1785
1830
  key: "time",
1786
- render: ({ delivery: e }) => /* @__PURE__ */ E(w, {
1831
+ render: ({ delivery: e }) => /* @__PURE__ */ E(T, {
1787
1832
  component: "span",
1788
1833
  variant: "body",
1789
- children: Wn(e)
1834
+ children: Jn(e)
1790
1835
  }),
1791
1836
  title: "時間",
1792
1837
  width: 220
@@ -1817,29 +1862,29 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1817
1862
  }
1818
1863
  }
1819
1864
  return /* @__PURE__ */ D("div", {
1820
- style: zn,
1865
+ style: Un,
1821
1866
  children: [
1822
- /* @__PURE__ */ E(w, {
1867
+ /* @__PURE__ */ E(T, {
1823
1868
  component: "h2",
1824
1869
  variant: "h3",
1825
1870
  children: "外部系統通知"
1826
1871
  }),
1827
- s ? /* @__PURE__ */ E(w, {
1872
+ s ? /* @__PURE__ */ E(T, {
1828
1873
  color: "text-error",
1829
1874
  variant: "body",
1830
1875
  children: s
1831
1876
  }) : null,
1832
- l.length > 0 ? /* @__PURE__ */ E(ge, {
1877
+ l.length > 0 ? /* @__PURE__ */ E(he, {
1833
1878
  actions: d,
1834
1879
  columns: u,
1835
1880
  dataSource: l,
1836
1881
  fullWidth: !0
1837
- }) : /* @__PURE__ */ E(w, {
1882
+ }) : /* @__PURE__ */ E(T, {
1838
1883
  color: "text-neutral",
1839
1884
  variant: "body",
1840
1885
  children: "此案件沒有外部系統通知。"
1841
1886
  }),
1842
- /* @__PURE__ */ E(S, {
1887
+ /* @__PURE__ */ E(C, {
1843
1888
  cancelText: "取消",
1844
1889
  confirmText: "重新傳送",
1845
1890
  loading: a,
@@ -1853,7 +1898,7 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1853
1898
  showModalHeader: !0,
1854
1899
  supportingText: "會以相同的投遞編號重新送出,接收端可據此避免重複處理。",
1855
1900
  title: "重新傳送通知",
1856
- children: /* @__PURE__ */ D(w, {
1901
+ children: /* @__PURE__ */ D(T, {
1857
1902
  variant: "body",
1858
1903
  children: [
1859
1904
  "確定要重新通知「",
@@ -1865,49 +1910,49 @@ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1865
1910
  ]
1866
1911
  });
1867
1912
  }
1868
- function Un({ status: e }) {
1869
- return e === "SENT" ? /* @__PURE__ */ E(ce, {
1913
+ function qn({ status: e }) {
1914
+ return e === "SENT" ? /* @__PURE__ */ E(se, {
1870
1915
  size: "sub",
1871
1916
  text: "已送達",
1872
1917
  variant: "dot-success"
1873
- }) : e === "FAILED" ? /* @__PURE__ */ E(ce, {
1918
+ }) : e === "FAILED" ? /* @__PURE__ */ E(se, {
1874
1919
  size: "sub",
1875
1920
  text: "失敗",
1876
1921
  variant: "dot-error"
1877
- }) : /* @__PURE__ */ E(ce, {
1922
+ }) : /* @__PURE__ */ E(se, {
1878
1923
  size: "sub",
1879
1924
  text: e === "PENDING" ? "等待傳送" : "傳送中",
1880
1925
  variant: "dot-info"
1881
1926
  });
1882
1927
  }
1883
- function Wn(e) {
1928
+ function Jn(e) {
1884
1929
  return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
1885
1930
  }
1886
1931
  //#endregion
1887
1932
  //#region src/views/instances/viewer-field-access.ts
1888
- function Gn(e, t) {
1933
+ function Yn(e, t) {
1889
1934
  let n = new Map(t.map((e) => [e.id, e]));
1890
1935
  return new Set(e.filter((e) => e.eventType === "TASK_CREATED").map((e) => e.taskId === null ? void 0 : n.get(e.taskId)).filter((e) => e !== void 0 && !e.isAdhoc).map((e) => e.nodeId));
1891
1936
  }
1892
- function Kn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1937
+ function Xn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1893
1938
  let i = n.workflowSnapshot;
1894
- return Qe({
1939
+ return $e({
1895
1940
  definition: i,
1896
1941
  fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
1897
1942
  isAdhocTask: t?.isAdhoc ?? !1,
1898
1943
  nodeId: t?.nodeId ?? null,
1899
- revealedFieldKeys: Xe(i, Gn(e, r))
1944
+ revealedFieldKeys: Ze(i, Yn(e, r))
1900
1945
  });
1901
1946
  }
1902
1947
  //#endregion
1903
1948
  //#region src/views/instances/detail/InstanceDetailView.tsx
1904
- function qn(e) {
1905
- return `還有 ${new Set(Object.keys(e).map(Ze)).size} 個補填欄位需要完成`;
1949
+ function Zn(e) {
1950
+ return `還有 ${new Set(Object.keys(e).map(Qe)).size} 個補填欄位需要完成`;
1906
1951
  }
1907
- var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
1952
+ var Qn = 3e3, $n = 40, er = 184, tr = 96, nr = {
1908
1953
  display: "grid",
1909
1954
  gap: 16
1910
- }, $n = {
1955
+ }, rr = {
1911
1956
  background: "#f8fafc",
1912
1957
  border: "1px solid #e2e8f0",
1913
1958
  borderRadius: 8,
@@ -1915,7 +1960,7 @@ var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
1915
1960
  minHeight: 440,
1916
1961
  overflow: "hidden",
1917
1962
  width: "min(80vw, 1040px)"
1918
- }, er = {
1963
+ }, ir = {
1919
1964
  background: "#ffffff",
1920
1965
  border: "1px solid #cbd5e1",
1921
1966
  borderRadius: 8,
@@ -1925,24 +1970,24 @@ var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
1925
1970
  minHeight: 82,
1926
1971
  padding: 12,
1927
1972
  width: 184
1928
- }, tr = {
1973
+ }, ar = {
1929
1974
  borderRadius: 999,
1930
1975
  fontSize: 12,
1931
1976
  fontWeight: 600,
1932
1977
  justifySelf: "start",
1933
1978
  lineHeight: "18px",
1934
1979
  padding: "0 8px"
1935
- }, nr = {
1980
+ }, or = {
1936
1981
  color: "#64748b",
1937
1982
  fontSize: 12,
1938
1983
  overflow: "hidden",
1939
1984
  textOverflow: "ellipsis",
1940
1985
  whiteSpace: "nowrap"
1941
- }, rr = { opacity: 0 }, ir = {
1986
+ }, sr = { opacity: 0 }, cr = {
1942
1987
  display: "flex",
1943
1988
  flexWrap: "wrap",
1944
1989
  gap: 8
1945
- }, ar = {
1990
+ }, lr = {
1946
1991
  alignItems: "center",
1947
1992
  background: "#ffffff",
1948
1993
  border: "1px solid #cbd5e1",
@@ -1954,29 +1999,29 @@ var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
1954
1999
  gap: 6,
1955
2000
  lineHeight: "20px",
1956
2001
  padding: "4px 8px"
1957
- }, or = {
2002
+ }, ur = {
1958
2003
  display: "grid",
1959
2004
  gap: 16
1960
- }, sr = { workflowRuntime: _r };
1961
- function cr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: h = !0, showSignatures: re = !0, showTasks: ae = !0, showWebhookDeliveries: se = !0 }) {
1962
- let { member: ce } = e(), b = ce?.memberId ?? null, le = se && r(ce), [x, ue] = v([]), [C, he] = v(null), [ge, ve] = v([]), [ye, xe] = v([]), [Se, Ce] = v([]), [O, je] = v([]), [Me, Ne] = v(null), [k, ze] = v([]), [Be, He] = v([]), [Ue, qe] = v([]), [Ye, j] = v(null), [Xe, Ze] = v(!0), [Qe, N] = v(!1), [F, I] = v(!1), [L, it] = v(!1), [at, R] = v(""), [z, ot] = v(!1), [st, ct] = v({}), [lt, ut] = v({}), [dt, ft] = v({}), [B, mt] = v(null), [gt, _t] = v(null), [V, vt] = v([]), yt = at.trim(), U = oe(null), bt = oe(0), xt = O.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
1963
- ie(() => {
1964
- $t();
1965
- }, [b, i]), ie(() => {
1966
- if (!le || !xt || bt.current >= Yn) return;
2005
+ }, dr = { workflowRuntime: xr };
2006
+ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: re = !0, showSignatures: ie = !0, showTasks: ae = !0, showWebhookDeliveries: oe = !0 }) {
2007
+ let { member: se } = e(), x = se?.memberId ?? null, ce = oe && r(se), [S, le] = y([]), [w, me] = y(null), [he, _e] = y([]), [ye, xe] = y([]), [Se, Ce] = y([]), [O, je] = y([]), [Me, Ne] = y(null), [k, ze] = y([]), [Be, He] = y([]), [Ue, qe] = y([]), [Ye, j] = y(null), [Ze, Qe] = y(!0), [$e, M] = y(!1), [P, F] = y(!1), [I, at] = y(!1), [ot, L] = y(""), [R, st] = y(!1), [ct, lt] = y({}), [ut, dt] = y({}), { clearAfterResubmit: ft, comment: pt, setComment: ht } = dn(i), [gt, vt] = y({}), [z, B] = y(null), [V, yt] = y(null), [bt, xt] = y([]), St = ot.trim(), W = v(null), wt = v(0), Tt = O.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2008
+ g(() => {
2009
+ nn();
2010
+ }, [x, i]), g(() => {
2011
+ if (!ce || !Tt || wt.current >= $n) return;
1967
2012
  let e = setTimeout(() => {
1968
- bt.current += 1, nn();
1969
- }, Jn);
2013
+ wt.current += 1, on();
2014
+ }, Qn);
1970
2015
  return () => clearTimeout(e);
1971
2016
  }, [
1972
- le,
1973
- xt,
2017
+ ce,
2018
+ Tt,
1974
2019
  O
1975
- ]), ie(() => {
1976
- ut(C?.formData ?? {}), ft({});
1977
- }, [C]);
1978
- let St = g((e, t) => {
1979
- ft((n) => {
2020
+ ]), g(() => {
2021
+ dt(w?.formData ?? {}), vt({});
2022
+ }, [w]);
2023
+ let Et = h((e, t) => {
2024
+ vt((n) => {
1980
2025
  let r = n[e];
1981
2026
  return r?.hasValue === t.hasValue && r.status === t.status ? n : {
1982
2027
  ...n,
@@ -1986,96 +2031,96 @@ function cr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
1986
2031
  }
1987
2032
  };
1988
2033
  });
1989
- }, []), G = _(() => Ot(k, b), [b, k]), K = _(() => G && C ? C.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, C]), wt = K?.type === "userTask" && K.data.returnBehavior.allowReturn, Et = K?.type === "userTask" && K.data.allowReject !== !1, Dt = K?.type === "userTask" && K.data.allowTransfer !== !1, kt = K?.type === "userTask" && K.data.allowAddSigner, At = !(!C || C.initiatorMemberId !== b || C.state !== "RUNNING" && C.state !== "RETURNED"), jt = !!(C && C.initiatorMemberId === b && C.state === "RETURNED"), J = _(() => G && !G.isAdhoc && K?.type === "userTask" && M(K).size > 0 ? K : null, [G, K]), Mt = J ? G?.id ?? null : null, [Nt, Y] = v({}), [Pt, Ft] = v({}), [It, Lt] = v(!1);
1990
- ie(() => {
1991
- Y({}), Ft({}), Lt(!1);
1992
- }, [Mt]);
1993
- let X = C?.formDefinitionSnapshot.schema ?? null, Z = _(() => J && X ? o(X, J) : null, [J, X]), Q = _(() => Z && C ? $e(Z.fields, {
1994
- ...C.formData,
1995
- ...Nt
2034
+ }, []), K = _(() => Ot(k, x), [x, k]), q = _(() => K && w ? w.workflowSnapshot.nodes.find((e) => e.id === K.nodeId) ?? null : null, [K, w]), kt = q?.type === "userTask" && q.data.returnBehavior.allowReturn, At = q?.type === "userTask" && q.data.allowReject !== !1, jt = q?.type === "userTask" && q.data.allowTransfer !== !1, Mt = q?.type === "userTask" && q.data.allowAddSigner, Nt = !(!w || w.initiatorMemberId !== x || w.state !== "RUNNING" && w.state !== "RETURNED"), Pt = !!(w && w.initiatorMemberId === x && w.state === "RETURNED"), J = _(() => K && !K.isAdhoc && q?.type === "userTask" && Xe(q).size > 0 ? q : null, [K, q]), Ft = J ? K?.id ?? null : null, [It, Y] = y({}), [Lt, Rt] = y({}), [zt, Bt] = y(!1);
2035
+ g(() => {
2036
+ Y({}), Rt({}), Bt(!1);
2037
+ }, [Ft]);
2038
+ let X = w?.formDefinitionSnapshot.schema ?? null, Z = _(() => J && X ? o(X, J) : null, [J, X]), Q = _(() => Z && w ? et(Z.fields, {
2039
+ ...w.formData,
2040
+ ...It
1996
2041
  }) : null, [
1997
- Nt,
2042
+ It,
1998
2043
  Z,
1999
- C
2000
- ]), Rt = _(() => J && Z && Q && C ? c({
2001
- draft: Nt,
2044
+ w
2045
+ ]), Vt = _(() => J && Z && Q && w ? c({
2046
+ draft: It,
2002
2047
  node: J,
2003
2048
  schema: Z,
2004
- stored: C.formData,
2049
+ stored: w.formData,
2005
2050
  values: Q
2006
2051
  }) : {}, [
2007
- Nt,
2052
+ It,
2008
2053
  J,
2009
2054
  Z,
2010
2055
  Q,
2011
- C
2012
- ]), zt = _(() => C ? Kn({
2013
- activityLogs: x,
2014
- actingTask: G,
2015
- instance: C,
2056
+ w
2057
+ ]), Ht = _(() => w ? Xn({
2058
+ activityLogs: S,
2059
+ actingTask: K,
2060
+ instance: w,
2016
2061
  tasks: k
2017
2062
  }) : void 0, [
2018
- x,
2019
- G,
2020
- C,
2063
+ S,
2064
+ K,
2065
+ w,
2021
2066
  k
2022
- ]), Bt = _(() => C ? d(C.workflowSnapshot, J) : void 0, [J, C]), Vt = _(() => new Map(Ue.map((e) => [e.memberId, e])), [Ue]), Ht = _(() => J && Q && X && C?.formDataFingerprint ? {
2023
- expectedFormDataFingerprint: C.formDataFingerprint,
2024
- formData: p(Rt, J),
2025
- summary: l(X, J, Rt, new Map([...Vt.keys()].map((e) => [e, q(e, Vt)])))
2067
+ ]), Ut = _(() => w ? d(w.workflowSnapshot, J) : void 0, [J, w]), Wt = _(() => new Map(Ue.map((e) => [e.memberId, e])), [Ue]), Gt = _(() => J && Q && X && w?.formDataFingerprint ? {
2068
+ expectedFormDataFingerprint: w.formDataFingerprint,
2069
+ formData: p(Vt, J),
2070
+ summary: l(X, J, Vt, new Map([...Wt.keys()].map((e) => [e, G(e, Wt)])))
2026
2071
  } : null, [
2027
- Rt,
2072
+ Vt,
2028
2073
  J,
2029
2074
  Q,
2030
- C,
2031
- Vt,
2075
+ w,
2076
+ Wt,
2032
2077
  X
2033
2078
  ]);
2034
- function Ut(e) {
2079
+ function Kt(e) {
2035
2080
  if (!J) return;
2036
- let t = M(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2081
+ let t = Xe(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2037
2082
  Y((e) => ({
2038
2083
  ...e,
2039
2084
  ...Object.fromEntries(n)
2040
- })), Ft({});
2085
+ })), Rt({});
2041
2086
  }
2042
- function Wt() {
2043
- if (J && !C?.formDataFingerprint) de.error("無法確認表單版本,請重新整理頁面後再同意。");
2087
+ function qt() {
2088
+ if (J && !w?.formDataFingerprint) ue.error("無法確認表單版本,請重新整理頁面後再同意。");
2044
2089
  else {
2045
- if (J && Q && X && C?.formDefinitionSnapshot.uiSchema) {
2046
- let e = tt({
2090
+ if (J && Q && X && w?.formDefinitionSnapshot.uiSchema) {
2091
+ let e = nt({
2047
2092
  schema: te(X, J),
2048
- uiSchema: C.formDefinitionSnapshot.uiSchema,
2093
+ uiSchema: w.formDefinitionSnapshot.uiSchema,
2049
2094
  values: Q
2050
2095
  });
2051
2096
  if (!e.valid) {
2052
- Ft(e.errors), e.firstInvalidFieldKey && et(e.firstInvalidFieldKey), de.warning(qn(e.errors));
2097
+ Rt(e.errors), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey), ue.warning(Zn(e.errors));
2053
2098
  return;
2054
2099
  }
2055
2100
  }
2056
- U.current?.handleApprove();
2101
+ W.current?.handleApprove();
2057
2102
  }
2058
2103
  }
2059
- function Gt(e) {
2104
+ function Jt(e) {
2060
2105
  if (!J || !X) return !1;
2061
- if (ee(e)) return Lt(!0), !0;
2106
+ if (ee(e)) return Bt(!0), !0;
2062
2107
  let t = s(e, X, J);
2063
- return t ? (Ft(t), et(Object.keys(t)[0] ?? ""), de.warning(qn(t)), !0) : !1;
2108
+ return t ? (Rt(t), tt(Object.keys(t)[0] ?? ""), ue.warning(Zn(t)), !0) : !1;
2064
2109
  }
2065
- async function Kt() {
2066
- await $t(), Lt(!1);
2110
+ async function Yt() {
2111
+ await nn(), Bt(!1);
2067
2112
  }
2068
- let qt = _(() => un(ge), [ge]), Jt = _(() => new Map(Se.map((e) => [e.id, e])), [Se]), Yt = _(() => C ? pr(C.workflowSnapshot) : null, [C]), Xt = _(() => C && Yt ? fr(Yt, k, Be, C.state) : [], [
2069
- C,
2070
- Yt,
2113
+ let Xt = _(() => un(he), [he]), Zt = _(() => new Map(Se.map((e) => [e.id, e])), [Se]), Qt = _(() => w ? _r(w.workflowSnapshot) : null, [w]), $t = _(() => w && Qt ? gr(Qt, k, Be, w.state) : [], [
2114
+ w,
2115
+ Qt,
2071
2116
  k,
2072
2117
  Be
2073
- ]), Zt = _(() => Yt ? mr(Yt) : [], [Yt]), Qt = _(() => C ? ur(C.workflowSnapshot) : [], [C]);
2074
- async function $t() {
2075
- Ze(!0), j(null);
2118
+ ]), en = _(() => Qt ? vr(Qt) : [], [Qt]), tn = _(() => w ? mr(w.workflowSnapshot) : [], [w]);
2119
+ async function nn() {
2120
+ Qe(!0), j(null);
2076
2121
  try {
2077
2122
  let e = await De(i);
2078
- ue(e.activityLogs), he(e.instance), ze(e.tasks), He(e.workflowTokens);
2123
+ le(e.activityLogs), me(e.instance), ze(e.tasks), He(e.workflowTokens);
2079
2124
  let t = await we(e.instance.id), [n, r, a, o, s] = await Promise.all([
2080
2125
  ln(e.tasks),
2081
2126
  sn({
@@ -2084,351 +2129,354 @@ function cr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2084
2129
  }),
2085
2130
  Te(e.instance.id),
2086
2131
  Ae(e.instance.id),
2087
- en(e.instance.id)
2132
+ rn(e.instance.id)
2088
2133
  ]);
2089
- ve(n), qe(r), xe(a), Ce(o.signatures), Ne(o.verification), vt(t), je(s);
2134
+ _e(n), qe(r), xe(a), Ce(o.signatures), Ne(o.verification), xt(t), je(s);
2090
2135
  } catch (e) {
2091
- j(W(e));
2136
+ j(U(e));
2092
2137
  } finally {
2093
- Ze(!1);
2138
+ Qe(!1);
2094
2139
  }
2095
2140
  }
2096
- async function en(e) {
2097
- return le ? Ee(e).catch(() => []) : [];
2141
+ async function rn(e) {
2142
+ return ce ? Ee(e).catch(() => []) : [];
2098
2143
  }
2099
- async function tn(e) {
2100
- await Fe(e.id), bt.current = 0, await $t();
2144
+ async function an(e) {
2145
+ await Fe(e.id), wt.current = 0, await nn();
2101
2146
  }
2102
- async function nn() {
2103
- let e = await en(i);
2104
- e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? je(e) : await $t();
2147
+ async function on() {
2148
+ let e = await rn(i);
2149
+ e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? je(e) : await nn();
2105
2150
  }
2106
- async function rn(e, t) {
2107
- if (!b) throw Error("尚未登入,無法上傳附件");
2151
+ async function cn(e, t) {
2152
+ if (!x) throw Error("尚未登入,無法上傳附件");
2108
2153
  return { id: (await Ie({
2109
2154
  file: t,
2110
2155
  formFieldPath: `form.${e.fieldKey}`
2111
2156
  })).id };
2112
2157
  }
2113
- async function an(e) {
2114
- if (!b) return;
2158
+ async function fn(e) {
2159
+ if (!x) return;
2115
2160
  let t = await Oe({ id: e.id });
2116
2161
  window.open(t, "_blank", "noopener,noreferrer");
2117
2162
  }
2118
- async function on(e) {
2119
- if (!b) return;
2163
+ async function pn(e) {
2164
+ if (!x) return;
2120
2165
  let t = await ke({ id: e.id });
2121
- mt(e), _t(t);
2166
+ B(e), yt(t);
2122
2167
  }
2123
- async function cn() {
2124
- if (b && C && At) {
2125
- N(!0), j(null), ct({});
2168
+ async function mn() {
2169
+ if (x && w && Nt) {
2170
+ M(!0), j(null), lt({});
2126
2171
  try {
2127
2172
  await be({
2128
- cancelledByMemberId: b,
2129
- comment: yt || null,
2130
- instanceId: C.id
2131
- }), R(""), ot(!1), await $t();
2173
+ cancelledByMemberId: x,
2174
+ comment: St || null,
2175
+ instanceId: w.id
2176
+ }), L(""), st(!1), await nn();
2132
2177
  } catch (e) {
2133
- j(W(e));
2178
+ j(U(e));
2134
2179
  } finally {
2135
- N(!1);
2180
+ M(!1);
2136
2181
  }
2137
2182
  }
2138
2183
  }
2139
- async function dn() {
2140
- if (!b || !C || !jt) return;
2141
- N(!0), j(null), ct({});
2142
- let e = m(Object.values(dt));
2184
+ async function hn() {
2185
+ if (!x || !w || !Pt) return;
2186
+ M(!0), j(null), lt({});
2187
+ let e = m(Object.values(gt));
2143
2188
  if (e) {
2144
- j(e), N(!1);
2189
+ j(e), M(!1);
2145
2190
  return;
2146
2191
  }
2147
- let t = C.formDefinitionSnapshot.schema ? u(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = f(t ? $e(t.fields, lt) : lt, C.workflowSnapshot);
2148
- if (t && C.formDefinitionSnapshot.uiSchema) {
2149
- let e = tt({
2192
+ let t = w.formDefinitionSnapshot.schema ? u(w.formDefinitionSnapshot.schema, w.workflowSnapshot) : null, n = f(t ? et(t.fields, ut) : ut, w.workflowSnapshot);
2193
+ if (t && w.formDefinitionSnapshot.uiSchema) {
2194
+ let e = nt({
2150
2195
  schema: t,
2151
- uiSchema: C.formDefinitionSnapshot.uiSchema,
2196
+ uiSchema: w.formDefinitionSnapshot.uiSchema,
2152
2197
  values: n
2153
2198
  });
2154
2199
  if (!e.valid) {
2155
- ct(e.errors), j("請先補齊必填欄位。"), e.firstInvalidFieldKey && et(e.firstInvalidFieldKey), N(!1);
2200
+ lt(e.errors), j("請先補齊必填欄位。"), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey), M(!1);
2156
2201
  return;
2157
2202
  }
2158
2203
  }
2159
2204
  try {
2160
2205
  await Pe({
2206
+ comment: pt,
2161
2207
  formData: n,
2162
- initiatorMemberId: b,
2163
- instanceId: C.id,
2164
- title: C.title
2165
- }), await $t();
2208
+ initiatorMemberId: x,
2209
+ instanceId: w.id,
2210
+ title: w.title
2211
+ }), ft(w.id), await nn();
2166
2212
  } catch (e) {
2167
- j(W(e));
2213
+ j(U(e));
2168
2214
  } finally {
2169
- N(!1);
2215
+ M(!1);
2170
2216
  }
2171
2217
  }
2172
- let $ = Qe || F;
2173
- return /* @__PURE__ */ D(T, { children: [
2174
- /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ D(Le, {
2175
- description: C ? [
2176
- Ct(C.state),
2177
- t(C.startedAt),
2178
- ht(C, Vt)
2218
+ let $ = $e || P;
2219
+ return /* @__PURE__ */ D(ve, { children: [
2220
+ /* @__PURE__ */ E(de, { children: /* @__PURE__ */ D(Le, {
2221
+ description: w ? [
2222
+ Ct(w.state),
2223
+ t(w.startedAt),
2224
+ _t(w, Wt)
2179
2225
  ].filter(H).join(" · ") : "載入案件內容。",
2180
- title: C?.title ?? "簽核案件",
2226
+ title: w?.title ?? "簽核案件",
2181
2227
  children: [
2182
- C ? /* @__PURE__ */ E(y, {
2228
+ w ? /* @__PURE__ */ E(b, {
2183
2229
  "aria-label": "查看流程圖",
2184
2230
  icon: A,
2185
2231
  iconType: "icon-only",
2186
- onClick: () => it(!0),
2232
+ onClick: () => at(!0),
2187
2233
  title: "查看流程圖",
2188
2234
  variant: "base-secondary",
2189
2235
  children: "流程圖"
2190
2236
  }) : null,
2191
- At ? /* @__PURE__ */ E(y, {
2237
+ Nt ? /* @__PURE__ */ E(b, {
2192
2238
  disabled: $,
2193
2239
  icon: Ve,
2194
2240
  iconType: "leading",
2195
- onClick: () => ot(!0),
2241
+ onClick: () => st(!0),
2196
2242
  variant: "destructive-secondary",
2197
2243
  children: "取消案件"
2198
2244
  }) : null,
2199
- G ? /* @__PURE__ */ D(T, { children: [
2200
- kt ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(y, {
2245
+ K ? /* @__PURE__ */ D(ve, { children: [
2246
+ Mt ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(b, {
2201
2247
  disabled: $,
2202
2248
  icon: Ge,
2203
2249
  iconType: "leading",
2204
- onClick: () => U.current?.openAdhocModal("COUNTERSIGN"),
2250
+ onClick: () => W.current?.openAdhocModal("COUNTERSIGN"),
2205
2251
  variant: "base-secondary",
2206
2252
  children: "會簽"
2207
- }, "adhoc-countersign"), /* @__PURE__ */ E(y, {
2253
+ }, "adhoc-countersign"), /* @__PURE__ */ E(b, {
2208
2254
  disabled: $,
2209
2255
  icon: Ge,
2210
2256
  iconType: "leading",
2211
- onClick: () => U.current?.openAdhocModal("PRE_APPROVAL"),
2257
+ onClick: () => W.current?.openAdhocModal("PRE_APPROVAL"),
2212
2258
  variant: "base-secondary",
2213
2259
  children: "加簽"
2214
2260
  }, "adhoc-pre-approval")] }) : null,
2215
- /* @__PURE__ */ E(y, {
2261
+ /* @__PURE__ */ E(b, {
2216
2262
  disabled: $,
2217
2263
  icon: We,
2218
2264
  iconType: "leading",
2219
- onClick: () => U.current?.openAdhocModal("STAGE_NOTIFY"),
2265
+ onClick: () => W.current?.openAdhocModal("STAGE_NOTIFY"),
2220
2266
  variant: "base-secondary",
2221
2267
  children: "通知設定"
2222
2268
  }, "adhoc-notify"),
2223
- wt ? /* @__PURE__ */ E(y, {
2269
+ kt ? /* @__PURE__ */ E(b, {
2224
2270
  disabled: $,
2225
2271
  icon: Ke,
2226
2272
  iconType: "leading",
2227
- onClick: () => U.current?.openReturnModal(),
2273
+ onClick: () => W.current?.openReturnModal(),
2228
2274
  variant: "base-secondary",
2229
2275
  children: "退回"
2230
2276
  }, "task-return") : null,
2231
- Dt ? /* @__PURE__ */ E(y, {
2277
+ jt ? /* @__PURE__ */ E(b, {
2232
2278
  disabled: $,
2233
2279
  icon: Je,
2234
2280
  iconType: "leading",
2235
- onClick: () => U.current?.openTransferModal(),
2281
+ onClick: () => W.current?.openTransferModal(),
2236
2282
  variant: "base-secondary",
2237
2283
  children: "轉派"
2238
2284
  }, "task-transfer") : null,
2239
- Et ? /* @__PURE__ */ E(y, {
2285
+ At ? /* @__PURE__ */ E(b, {
2240
2286
  disabled: $,
2241
2287
  icon: Ve,
2242
2288
  iconType: "leading",
2243
- onClick: () => U.current?.openRejectModal(),
2289
+ onClick: () => W.current?.openRejectModal(),
2244
2290
  variant: "destructive-secondary",
2245
2291
  children: "拒絕"
2246
2292
  }, "task-reject") : null,
2247
- /* @__PURE__ */ E(y, {
2293
+ /* @__PURE__ */ E(b, {
2248
2294
  disabled: $,
2249
2295
  icon: Re,
2250
2296
  iconType: "leading",
2251
- onClick: Wt,
2297
+ onClick: qt,
2252
2298
  variant: "base-primary",
2253
2299
  children: "同意"
2254
2300
  }, "task-approve")
2255
2301
  ] }) : null
2256
2302
  ]
2257
2303
  }) }),
2258
- /* @__PURE__ */ D(me, { children: [
2259
- ne ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(fn, {
2260
- canResubmitInstance: jt,
2261
- deciding: Qe,
2304
+ /* @__PURE__ */ D(pe, { children: [
2305
+ ne ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(gn, {
2306
+ canResubmitInstance: Pt,
2307
+ deciding: $e,
2262
2308
  error: Ye,
2263
- fieldAccess: zt,
2264
- fieldLabelMarkers: Bt,
2309
+ fieldAccess: Ht,
2310
+ fieldLabelMarkers: Ut,
2265
2311
  fill: Z && Q && J ? {
2266
- errors: Pt,
2267
- fieldCount: M(J).size,
2268
- onChange: Ut,
2312
+ errors: Lt,
2313
+ fieldCount: Xe(J).size,
2314
+ onChange: Kt,
2269
2315
  schema: Z,
2270
2316
  value: Q
2271
2317
  } : null,
2272
- instance: C,
2273
- loading: Xe,
2274
- onDataSourceStateChange: St,
2275
- onReloadAfterConflict: It ? () => void Kt() : null,
2318
+ instance: w,
2319
+ loading: Ze,
2320
+ onDataSourceStateChange: Et,
2321
+ onReloadAfterConflict: zt ? () => void Yt() : null,
2276
2322
  onResubmitFormChange: (e) => {
2277
- ut(e), ct({});
2323
+ dt(e), lt({});
2278
2324
  },
2279
- onResubmitInstance: () => void dn(),
2280
- onUploadAttachment: rn,
2281
- resubmitFormData: lt,
2282
- resubmitFormErrors: st
2325
+ onResubmitCommentChange: ht,
2326
+ onResubmitInstance: () => void hn(),
2327
+ onUploadAttachment: cn,
2328
+ resubmitComment: pt,
2329
+ resubmitFormData: ut,
2330
+ resubmitFormErrors: ct
2283
2331
  }) }) : null,
2284
- a ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(mn, {
2332
+ a ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(vn, {
2285
2333
  attachments: ye,
2286
2334
  onDownload: (e) => {
2287
- an(e);
2335
+ fn(e);
2288
2336
  },
2289
2337
  onPreview: (e) => {
2290
- on(e);
2338
+ pn(e);
2291
2339
  }
2292
2340
  }) }) : null,
2293
- ae ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Tn, {
2294
- adhocDirectives: V,
2295
- currentMemberId: b,
2296
- fill: Ht,
2297
- instance: C,
2298
- memberProfilesById: Vt,
2299
- onChanged: $t,
2300
- onDecidingChange: I,
2301
- onFillApproveError: Gt,
2302
- ref: U,
2341
+ ae ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(kn, {
2342
+ adhocDirectives: bt,
2343
+ currentMemberId: x,
2344
+ fill: Gt,
2345
+ instance: w,
2346
+ memberProfilesById: Wt,
2347
+ onChanged: nn,
2348
+ onDecidingChange: F,
2349
+ onFillApproveError: Jt,
2350
+ ref: W,
2303
2351
  tasks: k
2304
2352
  }) }) : null,
2305
- re ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(kn, {
2353
+ ie ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Nn, {
2306
2354
  signatureVerification: Me,
2307
2355
  signatures: Se
2308
2356
  }) }) : null,
2309
- le && O.length > 0 ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Hn, {
2357
+ ce && O.length > 0 ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Kn, {
2310
2358
  deliveries: O,
2311
- onRetry: tn,
2312
- readNodeLabel: (e) => Tt(e, C?.workflowSnapshot ?? null)
2359
+ onRetry: an,
2360
+ readNodeLabel: (e) => Dt(e, w?.workflowSnapshot ?? null)
2313
2361
  }) }) : null,
2314
- h ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Rn, {
2315
- activityLogs: x,
2362
+ re ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Hn, {
2363
+ activityLogs: S,
2316
2364
  formSchema: X,
2317
- instanceState: C?.state ?? "RUNNING",
2318
- memberProfilesById: Vt,
2365
+ instanceState: w?.state ?? "RUNNING",
2366
+ memberProfilesById: Wt,
2319
2367
  signatureVerification: Me,
2320
- signaturesById: Jt,
2321
- taskDecisionsByTaskId: qt,
2368
+ signaturesById: Zt,
2369
+ taskDecisionsByTaskId: Xt,
2322
2370
  tasks: k,
2323
- workflowSnapshot: C?.workflowSnapshot ?? null,
2371
+ workflowSnapshot: w?.workflowSnapshot ?? null,
2324
2372
  workflowTokens: Be
2325
2373
  }) }) : null
2326
2374
  ] }),
2327
- C ? /* @__PURE__ */ E(S, {
2375
+ w ? /* @__PURE__ */ E(C, {
2328
2376
  modalType: "standard",
2329
- onClose: () => it(!1),
2330
- open: L,
2377
+ onClose: () => at(!1),
2378
+ open: I,
2331
2379
  showModalHeader: !0,
2332
2380
  size: "wide",
2333
- supportingText: `${Ct(C.state)} · ${t(C.startedAt)}`,
2381
+ supportingText: `${Ct(w.state)} · ${t(w.startedAt)}`,
2334
2382
  title: "流程圖",
2335
2383
  children: /* @__PURE__ */ D("div", {
2336
- style: Qn,
2384
+ style: nr,
2337
2385
  children: [/* @__PURE__ */ E("div", {
2338
- style: $n,
2339
- children: /* @__PURE__ */ D(rt, {
2340
- edges: Zt,
2386
+ style: rr,
2387
+ children: /* @__PURE__ */ D(it, {
2388
+ edges: en,
2341
2389
  fitView: !0,
2342
2390
  fitViewOptions: { padding: .18 },
2343
2391
  maxZoom: 1.2,
2344
2392
  minZoom: .2,
2345
- nodes: Xt,
2393
+ nodes: $t,
2346
2394
  nodesDraggable: !1,
2347
2395
  nodesFocusable: !1,
2348
- nodeTypes: sr,
2396
+ nodeTypes: dr,
2349
2397
  panOnDrag: !0,
2350
2398
  proOptions: { hideAttribution: !0 },
2351
- children: [/* @__PURE__ */ E(nt, {}), /* @__PURE__ */ E(P, { showInteractive: !1 })]
2399
+ children: [/* @__PURE__ */ E(rt, {}), /* @__PURE__ */ E(N, { showInteractive: !1 })]
2352
2400
  })
2353
- }), Qt.length > 0 ? /* @__PURE__ */ E("div", {
2354
- style: ir,
2355
- children: Qt.map((e) => /* @__PURE__ */ E("span", {
2356
- style: ar,
2401
+ }), tn.length > 0 ? /* @__PURE__ */ E("div", {
2402
+ style: cr,
2403
+ children: tn.map((e) => /* @__PURE__ */ E("span", {
2404
+ style: lr,
2357
2405
  children: e
2358
2406
  }, e))
2359
2407
  }) : null]
2360
2408
  })
2361
2409
  }) : null,
2362
- /* @__PURE__ */ E(S, {
2410
+ /* @__PURE__ */ E(C, {
2363
2411
  modalType: "standard",
2364
2412
  onClose: () => {
2365
- mt(null), _t(null);
2413
+ B(null), yt(null);
2366
2414
  },
2367
- open: !!(B && gt),
2415
+ open: !!(z && V),
2368
2416
  showModalHeader: !0,
2369
2417
  size: "wide",
2370
- supportingText: B?.filename ?? void 0,
2418
+ supportingText: z?.filename ?? void 0,
2371
2419
  title: "PDF 預覽",
2372
- children: gt ? /* @__PURE__ */ E(pt, {
2373
- filename: B?.filename ?? "PDF 預覽",
2374
- fileUrl: gt,
2375
- onDownload: B ? () => void an(B) : void 0
2420
+ children: V ? /* @__PURE__ */ E(mt, {
2421
+ filename: z?.filename ?? "PDF 預覽",
2422
+ fileUrl: V,
2423
+ onDownload: z ? () => void fn(z) : void 0
2376
2424
  }) : null
2377
2425
  }),
2378
- /* @__PURE__ */ E(S, {
2426
+ /* @__PURE__ */ E(C, {
2379
2427
  cancelText: "保留案件",
2380
2428
  confirmButtonProps: { variant: "destructive-primary" },
2381
2429
  confirmText: "確認取消",
2382
- loading: Qe,
2430
+ loading: $e,
2383
2431
  modalStatusType: "error",
2384
2432
  modalType: "standard",
2385
- onCancel: () => ot(!1),
2386
- onClose: () => ot(!1),
2387
- onConfirm: () => void cn(),
2388
- open: z,
2433
+ onCancel: () => st(!1),
2434
+ onClose: () => st(!1),
2435
+ onConfirm: () => void mn(),
2436
+ open: R,
2389
2437
  showModalFooter: !0,
2390
2438
  showModalHeader: !0,
2391
2439
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2392
2440
  title: "取消案件",
2393
2441
  children: /* @__PURE__ */ D("div", {
2394
- style: or,
2395
- children: [/* @__PURE__ */ D(w, {
2442
+ style: ur,
2443
+ children: [/* @__PURE__ */ D(T, {
2396
2444
  variant: "body",
2397
2445
  children: [
2398
2446
  "確定要取消「",
2399
- C?.title ?? "",
2447
+ w?.title ?? "",
2400
2448
  "」嗎?"
2401
2449
  ]
2402
2450
  }), /* @__PURE__ */ E(n, {
2403
2451
  label: "取消原因",
2404
2452
  name: "cancelComment",
2405
- children: /* @__PURE__ */ E(_e, {
2406
- onChange: (e) => R(e.target.value),
2453
+ children: /* @__PURE__ */ E(ge, {
2454
+ onChange: (e) => L(e.target.value),
2407
2455
  placeholder: "可填寫取消原因",
2408
2456
  resize: "vertical",
2409
2457
  rows: 3,
2410
- value: at
2458
+ value: ot
2411
2459
  })
2412
2460
  })]
2413
2461
  })
2414
2462
  })
2415
2463
  ] });
2416
2464
  }
2417
- function lr(e) {
2465
+ function pr(e) {
2418
2466
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2419
2467
  }
2420
- function ur(e) {
2421
- return e.edges.map(lr).filter((e) => e.trim().length > 0);
2468
+ function mr(e) {
2469
+ return e.edges.map(pr).filter((e) => e.trim().length > 0);
2422
2470
  }
2423
- function dr(e) {
2471
+ function hr(e) {
2424
2472
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
2425
2473
  }
2426
- function fr(e, t, n, r) {
2474
+ function gr(e, t, n, r) {
2427
2475
  return e.nodes.map((e) => {
2428
2476
  let i = on(e, t, n, r);
2429
2477
  return {
2430
2478
  data: {
2431
- kindLabel: dr(e.type),
2479
+ kindLabel: hr(e.type),
2432
2480
  label: e.data.label,
2433
2481
  secondaryLabel: i.secondaryLabel,
2434
2482
  statusLabel: i.statusLabel,
@@ -2436,42 +2484,42 @@ function fr(e, t, n, r) {
2436
2484
  },
2437
2485
  id: e.id,
2438
2486
  position: e.position,
2439
- sourcePosition: I.Right,
2440
- targetPosition: I.Left,
2487
+ sourcePosition: F.Right,
2488
+ targetPosition: F.Left,
2441
2489
  type: "workflowRuntime"
2442
2490
  };
2443
2491
  });
2444
2492
  }
2445
- function pr(e) {
2446
- let t = new L.graphlib.Graph();
2493
+ function _r(e) {
2494
+ let t = new I.graphlib.Graph();
2447
2495
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2448
2496
  nodesep: 56,
2449
2497
  rankdir: "LR",
2450
2498
  ranksep: 120
2451
2499
  }), e.nodes.forEach((e) => {
2452
2500
  t.setNode(e.id, {
2453
- height: Zn,
2454
- width: Xn
2501
+ height: tr,
2502
+ width: er
2455
2503
  });
2456
2504
  }), e.edges.forEach((e) => {
2457
2505
  t.setEdge(e.source, e.target);
2458
- }), L.layout(t), {
2506
+ }), I.layout(t), {
2459
2507
  ...e,
2460
2508
  nodes: e.nodes.map((e) => {
2461
2509
  let n = t.node(e.id);
2462
2510
  return n ? {
2463
2511
  ...e,
2464
2512
  position: {
2465
- x: n.x - Xn / 2,
2466
- y: n.y - Zn / 2
2513
+ x: n.x - er / 2,
2514
+ y: n.y - tr / 2
2467
2515
  }
2468
2516
  } : e;
2469
2517
  })
2470
2518
  };
2471
2519
  }
2472
- function mr(e) {
2520
+ function vr(e) {
2473
2521
  return e.edges.map((e) => {
2474
- let t = lr(e);
2522
+ let t = pr(e);
2475
2523
  return {
2476
2524
  animated: !1,
2477
2525
  id: e.id,
@@ -2499,25 +2547,25 @@ function mr(e) {
2499
2547
  };
2500
2548
  });
2501
2549
  }
2502
- function hr(e) {
2550
+ function yr(e) {
2503
2551
  return e === "current" ? {
2504
- ...er,
2552
+ ...ir,
2505
2553
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2506
2554
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
2507
2555
  } : e === "completed" ? {
2508
- ...er,
2556
+ ...ir,
2509
2557
  border: "1px solid #16a34a"
2510
2558
  } : e === "cancelled" ? {
2511
- ...er,
2559
+ ...ir,
2512
2560
  border: "1px solid #dc2626",
2513
2561
  opacity: .72
2514
2562
  } : e === "waiting" ? {
2515
- ...er,
2563
+ ...ir,
2516
2564
  border: "1px dashed #64748b"
2517
- } : er;
2565
+ } : ir;
2518
2566
  }
2519
- function gr(e) {
2520
- let t = tr;
2567
+ function br(e) {
2568
+ let t = ar;
2521
2569
  return e === "current" ? {
2522
2570
  ...t,
2523
2571
  background: "#eff6ff",
@@ -2540,17 +2588,17 @@ function gr(e) {
2540
2588
  color: "#64748b"
2541
2589
  };
2542
2590
  }
2543
- function _r({ data: e }) {
2591
+ function xr({ data: e }) {
2544
2592
  return /* @__PURE__ */ D("div", {
2545
- style: hr(e.tone),
2593
+ style: yr(e.tone),
2546
2594
  children: [
2547
- /* @__PURE__ */ E(F, {
2595
+ /* @__PURE__ */ E(P, {
2548
2596
  isConnectable: !1,
2549
- position: I.Left,
2550
- style: rr,
2597
+ position: F.Left,
2598
+ style: sr,
2551
2599
  type: "target"
2552
2600
  }),
2553
- /* @__PURE__ */ E(w, {
2601
+ /* @__PURE__ */ E(T, {
2554
2602
  component: "span",
2555
2603
  ellipsis: !0,
2556
2604
  title: e.label,
@@ -2558,24 +2606,24 @@ function _r({ data: e }) {
2558
2606
  children: e.label
2559
2607
  }),
2560
2608
  /* @__PURE__ */ E("span", {
2561
- style: gr(e.tone),
2609
+ style: br(e.tone),
2562
2610
  children: e.statusLabel
2563
2611
  }),
2564
2612
  /* @__PURE__ */ E("span", {
2565
2613
  title: e.secondaryLabel,
2566
- style: nr,
2614
+ style: or,
2567
2615
  children: e.secondaryLabel || e.kindLabel
2568
2616
  }),
2569
- /* @__PURE__ */ E(F, {
2617
+ /* @__PURE__ */ E(P, {
2570
2618
  isConnectable: !1,
2571
- position: I.Right,
2572
- style: rr,
2619
+ position: F.Right,
2620
+ style: sr,
2573
2621
  type: "source"
2574
2622
  })
2575
2623
  ]
2576
2624
  });
2577
2625
  }
2578
2626
  //#endregion
2579
- export { Tn as a, kn as i, Hn as n, mn as o, Rn as r, fn as s, cr as t };
2627
+ export { kn as a, Nn as i, Kn as n, vn as o, Hn as r, gn as s, fr as t };
2580
2628
 
2581
- //# sourceMappingURL=detail-D6X61pkg.js.map
2629
+ //# sourceMappingURL=detail-CExpbazF.js.map