@rytass/bpm-core-react 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/chunks/{FormBuilderView-vQfVc08Z.js → FormBuilderView-Djlm3y4S.js} +2 -2
  3. package/dist/chunks/{FormBuilderView-vQfVc08Z.js.map → FormBuilderView-Djlm3y4S.js.map} +1 -1
  4. package/dist/chunks/{FormBuilderView-CHaAQL5v.cjs → FormBuilderView-G6uRSywl.cjs} +2 -2
  5. package/dist/chunks/{FormBuilderView-CHaAQL5v.cjs.map → FormBuilderView-G6uRSywl.cjs.map} +1 -1
  6. package/dist/chunks/{FormRendererView-CTLlG13b.js → FormRendererView-DHfVgbo6.js} +391 -265
  7. package/dist/chunks/FormRendererView-DHfVgbo6.js.map +1 -0
  8. package/dist/chunks/FormRendererView-DwfFbaip.cjs +6 -0
  9. package/dist/chunks/FormRendererView-DwfFbaip.cjs.map +1 -0
  10. package/dist/chunks/{compose-D9ipJpF_.js → compose-D6zBIc2Z.js} +4 -4
  11. package/dist/chunks/{compose-D9ipJpF_.js.map → compose-D6zBIc2Z.js.map} +1 -1
  12. package/dist/chunks/{compose-DtfX8DQ9.cjs → compose-NH6dsFXD.cjs} +2 -2
  13. package/dist/chunks/{compose-DtfX8DQ9.cjs.map → compose-NH6dsFXD.cjs.map} +1 -1
  14. package/dist/chunks/{designer-Df79YzUn.cjs → designer-Be9UI9Tg.cjs} +2 -2
  15. package/dist/chunks/{designer-Df79YzUn.cjs.map → designer-Be9UI9Tg.cjs.map} +1 -1
  16. package/dist/chunks/{designer-ubnZbP-A.js → designer-uhC_7m2i.js} +3 -3
  17. package/dist/chunks/{designer-ubnZbP-A.js.map → designer-uhC_7m2i.js.map} +1 -1
  18. package/dist/chunks/detail-6uw5dmTi.cjs +5 -0
  19. package/dist/chunks/detail-6uw5dmTi.cjs.map +1 -0
  20. package/dist/chunks/{detail-C6XKZjlF.js → detail-_GeKqNC-.js} +851 -839
  21. package/dist/chunks/detail-_GeKqNC-.js.map +1 -0
  22. package/dist/chunks/{approver-filled-form-B4zPg9kz.cjs → instance-error-message-DTARGbGo.cjs} +2 -2
  23. package/dist/chunks/instance-error-message-DTARGbGo.cjs.map +1 -0
  24. package/dist/chunks/{approver-filled-form-Bgazhbvd.js → instance-error-message-q6gy5evy.js} +44 -36
  25. package/dist/chunks/instance-error-message-q6gy5evy.js.map +1 -0
  26. package/dist/pages/instances/detail/index.cjs +1 -1
  27. package/dist/pages/instances/detail/index.js +1 -1
  28. package/dist/pages/templates/compose/index.cjs +1 -1
  29. package/dist/pages/templates/compose/index.js +1 -1
  30. package/dist/pages/templates/designer/index.cjs +1 -1
  31. package/dist/pages/templates/designer/index.js +1 -1
  32. package/dist/views/forms/builder/index.cjs +1 -1
  33. package/dist/views/forms/builder/index.js +1 -1
  34. package/dist/views/forms/renderer/FormRendererView.d.cts +24 -1
  35. package/dist/views/forms/renderer/FormRendererView.d.ts +24 -1
  36. package/dist/views/forms/renderer/file-upload-field.d.cts +84 -0
  37. package/dist/views/forms/renderer/file-upload-field.d.ts +84 -0
  38. package/dist/views/forms/renderer/form-value-readers.d.cts +7 -0
  39. package/dist/views/forms/renderer/form-value-readers.d.ts +7 -0
  40. package/dist/views/forms/renderer/index.cjs +1 -1
  41. package/dist/views/forms/renderer/index.d.cts +1 -0
  42. package/dist/views/forms/renderer/index.d.ts +1 -0
  43. package/dist/views/forms/renderer/index.js +1 -1
  44. package/dist/views/instances/detail/index.cjs +1 -1
  45. package/dist/views/instances/detail/index.js +1 -1
  46. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +19 -2
  47. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +19 -2
  48. package/dist/views/instances/detail/sections/shared.d.cts +1 -2
  49. package/dist/views/instances/detail/sections/shared.d.ts +1 -2
  50. package/dist/views/instances/instance-error-message.d.cts +5 -0
  51. package/dist/views/instances/instance-error-message.d.ts +5 -0
  52. package/dist/views/instances/new/index.cjs +1 -1
  53. package/dist/views/instances/new/index.cjs.map +1 -1
  54. package/dist/views/instances/new/index.js +77 -75
  55. package/dist/views/instances/new/index.js.map +1 -1
  56. package/dist/views/templates/compose/index.cjs +1 -1
  57. package/dist/views/templates/compose/index.js +1 -1
  58. package/dist/views/templates/designer/index.cjs +1 -1
  59. package/dist/views/templates/designer/index.js +1 -1
  60. package/package.json +3 -3
  61. package/dist/chunks/FormRendererView-CTLlG13b.js.map +0 -1
  62. package/dist/chunks/FormRendererView-ChmM_4Yc.cjs +0 -4
  63. package/dist/chunks/FormRendererView-ChmM_4Yc.cjs.map +0 -1
  64. package/dist/chunks/approver-filled-form-B4zPg9kz.cjs.map +0 -1
  65. package/dist/chunks/approver-filled-form-Bgazhbvd.js.map +0 -1
  66. package/dist/chunks/detail-BBC9kqXd.cjs +0 -5
  67. package/dist/chunks/detail-BBC9kqXd.cjs.map +0 -1
  68. package/dist/chunks/detail-C6XKZjlF.js.map +0 -1
@@ -4,39 +4,39 @@ import { t as e } from "./bpm-form-field-9B-Det0u.js";
4
4
  import { t } from "./format-date-time-B0LdmWg4.js";
5
5
  import { n } from "./auth-provider-C2b-5mGt.js";
6
6
  import { t as r } from "./use-bpm-member-BPzcNU1g.js";
7
- import { n as i, s as a, t as o } from "./FormRendererView-CTLlG13b.js";
8
- import { a as s, n as c, o as l, r as u, t as d } from "./task-decision-3d17ZvZE.js";
9
- import { t as f } from "./format-member-label-C73FuP-d.js";
10
- import { a as p, c as m, d as h, i as g, l as ee, n as te, o as ne, r as _, s as re, t as ie, u as v } from "./approver-filled-form-Bgazhbvd.js";
11
- import { Fragment as ae, forwardRef as y, useCallback as oe, useEffect as se, useImperativeHandle as ce, useMemo as b, useRef as le, useState as x } from "react";
12
- import { AutoComplete as ue, Badge as de, Button as S, Description as C, DescriptionContent as fe, InlineMessage as w, Input as pe, Message as me, Modal as T, PageHeader as he, Section as ge, SectionGroup as _e, Select as ve, Stepper as ye, Table as be, Textarea as xe, Tooltip as Se, Typography as E } from "@mezzanine-ui/react";
13
- import { Fragment as Ce, jsx as D, jsxs as O } from "react/jsx-runtime";
14
- import { cancelAdhocDirective as we, cancelApprovalInstance as Te, configureAdhocCompletionNotification as Ee, configureAdhocStageNotification as De, decideTask as Oe, listAdhocDirectives as ke, listAttachments as Ae, listTaskDecisions as k, listWorkflowWebhookDeliveries as je, readApprovalInstance as Me, readAttachmentDownloadUrl as Ne, readAttachmentPreviewUrl as Pe, readInstanceSignatures as Fe, requestAdhocCountersign as Ie, requestAdhocPreApproval as Le, resolveMemberProfiles as Re, resubmitApprovalInstance as ze, retryWorkflowWebhookDelivery as Be, searchMembers as Ve, uploadAttachment as He } from "@rytass/bpm-core-client/workflow";
15
- import Ue from "@mezzanine-ui/react/ContentHeader";
16
- import { CheckedIcon as We, ChevronLeftIcon as Ge, ChevronRightIcon as Ke, DangerousOutlineIcon as qe, DownloadIcon as A, FileSearchIcon as Je, NotificationUnreadIcon as Ye, PlusIcon as Xe, RefreshCcwIcon as Ze, ResetIcon as Qe, ShareIcon as $e, UserIcon as et, ZoomInIcon as tt, ZoomOutIcon as j } from "@mezzanine-ui/icons";
17
- import { readNodeFillableFieldKeys as nt, readRevealedFieldKeys as rt, readTopLevelFieldKey as it, resolveFieldAccess as M } from "@rytass/bpm-core-shared";
18
- import { buildFormRendererValues as N, focusFormRendererField as at, readFormDataSourceErrorMessage as ot, validateFormRendererValuesInWorker as st } from "@rytass/bpm-core-client/form";
19
- import { resolveOrgUnitOptions as ct } from "@rytass/bpm-core-client/organization";
20
- import { Background as lt, Controls as ut, Handle as dt, Position as P, ReactFlow as ft } from "@xyflow/react";
21
- import * as pt from "dagre";
22
- import { Document as mt, Page as ht } from "react-pdf";
23
- import { readSelectableReturnTargetNodeIds as gt } from "@rytass/bpm-core-shared/workflow-graph";
24
- import { stepClasses as F } from "@mezzanine-ui/core/stepper";
25
- function _t(e) {
26
- let [t, n] = x(/* @__PURE__ */ new Map()), r = e.join("\n");
27
- return se(() => {
28
- let e = r ? [...new Set(r.split("\n"))].filter((e) => !t.has(e)) : [], a = !1;
29
- return e.length === 0 ? () => void 0 : (ct(e).then((e) => e.map(i)).catch(() => []).then((t) => {
30
- a || n((n) => new Map([...n, ...e.map((e) => [e, t.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? null])]));
7
+ import { l as i, n as a, o, t as s } from "./FormRendererView-DHfVgbo6.js";
8
+ import { a as c, n as l, o as u, r as d, t as f } from "./task-decision-3d17ZvZE.js";
9
+ import { t as p } from "./format-member-label-C73FuP-d.js";
10
+ import { a as m, c as h, d as g, f as ee, i as te, l as ne, n as re, o as ie, r as ae, s as oe, t as _, u as v } from "./instance-error-message-q6gy5evy.js";
11
+ import { Fragment as y, forwardRef as b, useCallback as se, useEffect as ce, useImperativeHandle as le, useMemo as x, useRef as ue, useState as S } from "react";
12
+ import { AutoComplete as de, Badge as fe, Button as C, Description as w, DescriptionContent as pe, InlineMessage as me, Input as he, Message as ge, Modal as T, PageHeader as _e, Section as E, SectionGroup as ve, Select as ye, Stepper as be, Table as xe, Textarea as Se, Tooltip as Ce, Typography as D } from "@mezzanine-ui/react";
13
+ import { Fragment as we, jsx as O, jsxs as k } from "react/jsx-runtime";
14
+ import { cancelAdhocDirective as Te, cancelApprovalInstance as Ee, configureAdhocCompletionNotification as De, configureAdhocStageNotification as Oe, decideTask as ke, listAdhocDirectives as Ae, listAttachments as je, listTaskDecisions as A, listWorkflowWebhookDeliveries as Me, readApprovalInstance as Ne, readAttachmentDownloadUrl as Pe, readAttachmentPreviewUrl as Fe, readInstanceSignatures as Ie, requestAdhocCountersign as Le, requestAdhocPreApproval as Re, resolveMemberProfiles as ze, resubmitApprovalInstance as Be, retryWorkflowWebhookDelivery as Ve, searchMembers as He, uploadAttachment as Ue } from "@rytass/bpm-core-client/workflow";
15
+ import We from "@mezzanine-ui/react/ContentHeader";
16
+ import { CheckedIcon as Ge, ChevronLeftIcon as Ke, ChevronRightIcon as qe, DangerousOutlineIcon as j, DownloadIcon as M, FileSearchIcon as Je, NotificationUnreadIcon as Ye, PlusIcon as Xe, RefreshCcwIcon as Ze, ResetIcon as Qe, ShareIcon as $e, UserIcon as et, ZoomInIcon as tt, ZoomOutIcon as N } from "@mezzanine-ui/icons";
17
+ import { readNodeFillableFieldKeys as nt, readRevealedFieldKeys as rt, readTopLevelFieldKey as P, resolveFieldAccess as F } from "@rytass/bpm-core-shared";
18
+ import { buildFormRendererValues as it, focusFormRendererField as at, validateFormRendererValuesInWorker as ot } from "@rytass/bpm-core-client/form";
19
+ import { resolveOrgUnitOptions as st } from "@rytass/bpm-core-client/organization";
20
+ import { Background as ct, Controls as lt, Handle as ut, Position as I, ReactFlow as dt } from "@xyflow/react";
21
+ import * as ft from "dagre";
22
+ import { Document as pt, Page as mt } from "react-pdf";
23
+ import { readSelectableReturnTargetNodeIds as L } from "@rytass/bpm-core-shared/workflow-graph";
24
+ import { stepClasses as R } from "@mezzanine-ui/core/stepper";
25
+ function ht(e) {
26
+ let [t, n] = S(/* @__PURE__ */ new Map()), r = e.join("\n");
27
+ return ce(() => {
28
+ let e = r ? [...new Set(r.split("\n"))].filter((e) => !t.has(e)) : [], i = !1;
29
+ return e.length === 0 ? () => void 0 : (st(e).then((e) => e.map(a)).catch(() => []).then((t) => {
30
+ i || n((n) => new Map([...n, ...e.map((e) => [e, t.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? null])]));
31
31
  }), () => {
32
- a = !0;
32
+ i = !0;
33
33
  });
34
- }, [r, t]), b(() => new Map((r ? [...new Set(r.split("\n"))] : []).flatMap((e) => {
34
+ }, [r, t]), x(() => new Map((r ? [...new Set(r.split("\n"))] : []).flatMap((e) => {
35
35
  let n = t.get(e);
36
36
  return n === null ? [] : [[e, n ?? "讀取中…"]];
37
37
  })), [r, t]);
38
38
  }
39
- var I = {
39
+ var z = {
40
40
  root: "bpm_root_ehm7w",
41
41
  toolbar: "bpm_toolbar_R-tis",
42
42
  pageControls: "bpm_pageControls_jM-rC",
@@ -45,10 +45,10 @@ var I = {
45
45
  viewport: "bpm_viewport_DQXms",
46
46
  page: "bpm_page_Cv5Rg",
47
47
  state: "bpm_state_bpgp3"
48
- }, vt = 760, yt = 920, bt = 320, xt = 32, St = .75, Ct = 1.75, L = .25;
49
- function wt({ filename: e, fileUrl: t, onDownload: n }) {
50
- let r = le(null), [i, a] = x(null), [o, s] = x(1), [c, l] = x(1), [u, d] = x(vt);
51
- se(() => {
48
+ }, gt = 760, _t = 920, vt = 320, yt = 32, bt = .75, xt = 1.75, St = .25;
49
+ function Ct({ filename: e, fileUrl: t, onDownload: n }) {
50
+ let r = ue(null), [i, a] = S(null), [o, s] = S(1), [c, l] = S(1), [u, d] = S(gt);
51
+ ce(() => {
52
52
  let e = r.current;
53
53
  if (!e || typeof ResizeObserver > "u") return;
54
54
  let t = new ResizeObserver((e) => {
@@ -56,45 +56,45 @@ function wt({ filename: e, fileUrl: t, onDownload: n }) {
56
56
  t && d(t);
57
57
  });
58
58
  return t.observe(e), () => t.disconnect();
59
- }, []), se(() => {
59
+ }, []), ce(() => {
60
60
  a(null), s(1), l(1);
61
61
  }, [t]);
62
- let f = b(() => {
63
- let e = Math.max(bt, u - xt);
64
- return Math.round(Math.min(yt, e) * c);
65
- }, [c, u]), p = oe((e) => {
62
+ let f = x(() => {
63
+ let e = Math.max(vt, u - yt);
64
+ return Math.round(Math.min(_t, e) * c);
65
+ }, [c, u]), p = se((e) => {
66
66
  a(e.numPages), s(1);
67
- }, []), m = o > 1, h = i !== null && o < i, g = c > St, ee = c < Ct, te = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ne = `${Math.round(c * 100)}%`;
68
- return /* @__PURE__ */ O("section", {
67
+ }, []), m = o > 1, h = i !== null && o < i, g = c > bt, ee = c < xt, te = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ne = `${Math.round(c * 100)}%`;
68
+ return /* @__PURE__ */ k("section", {
69
69
  "aria-label": `${e} PDF 預覽`,
70
- className: I.root,
71
- children: [/* @__PURE__ */ O("div", {
72
- className: I.toolbar,
70
+ className: z.root,
71
+ children: [/* @__PURE__ */ k("div", {
72
+ className: z.toolbar,
73
73
  children: [
74
- /* @__PURE__ */ O("div", {
75
- className: I.pageControls,
74
+ /* @__PURE__ */ k("div", {
75
+ className: z.pageControls,
76
76
  "aria-label": "頁面切換",
77
77
  children: [
78
- /* @__PURE__ */ D(S, {
78
+ /* @__PURE__ */ O(C, {
79
79
  "aria-label": "上一頁",
80
80
  disabled: !m,
81
- icon: Ge,
81
+ icon: Ke,
82
82
  onClick: () => {
83
83
  s((e) => Math.max(1, e - 1));
84
84
  },
85
85
  size: "minor",
86
86
  variant: "base-secondary"
87
87
  }),
88
- /* @__PURE__ */ D(E, {
89
- className: I.counter,
88
+ /* @__PURE__ */ O(D, {
89
+ className: z.counter,
90
90
  component: "span",
91
91
  variant: "body",
92
92
  children: te
93
93
  }),
94
- /* @__PURE__ */ D(S, {
94
+ /* @__PURE__ */ O(C, {
95
95
  "aria-label": "下一頁",
96
96
  disabled: !h,
97
- icon: Ke,
97
+ icon: qe,
98
98
  onClick: () => {
99
99
  s((e) => i === null ? e : Math.min(i, e + 1));
100
100
  },
@@ -103,40 +103,40 @@ function wt({ filename: e, fileUrl: t, onDownload: n }) {
103
103
  })
104
104
  ]
105
105
  }),
106
- /* @__PURE__ */ O("div", {
107
- className: I.zoomControls,
106
+ /* @__PURE__ */ k("div", {
107
+ className: z.zoomControls,
108
108
  "aria-label": "縮放",
109
109
  children: [
110
- /* @__PURE__ */ D(S, {
110
+ /* @__PURE__ */ O(C, {
111
111
  "aria-label": "縮小",
112
112
  disabled: !g,
113
- icon: j,
113
+ icon: N,
114
114
  onClick: () => {
115
- l((e) => Math.max(St, e - L));
115
+ l((e) => Math.max(bt, e - St));
116
116
  },
117
117
  size: "minor",
118
118
  variant: "base-secondary"
119
119
  }),
120
- /* @__PURE__ */ D(E, {
121
- className: I.counter,
120
+ /* @__PURE__ */ O(D, {
121
+ className: z.counter,
122
122
  component: "span",
123
123
  variant: "body",
124
124
  children: ne
125
125
  }),
126
- /* @__PURE__ */ D(S, {
126
+ /* @__PURE__ */ O(C, {
127
127
  "aria-label": "放大",
128
128
  disabled: !ee,
129
129
  icon: tt,
130
130
  onClick: () => {
131
- l((e) => Math.min(Ct, e + L));
131
+ l((e) => Math.min(xt, e + St));
132
132
  },
133
133
  size: "minor",
134
134
  variant: "base-secondary"
135
135
  })
136
136
  ]
137
137
  }),
138
- n ? /* @__PURE__ */ D(S, {
139
- icon: A,
138
+ n ? /* @__PURE__ */ O(C, {
139
+ icon: M,
140
140
  iconType: "leading",
141
141
  onClick: n,
142
142
  size: "minor",
@@ -144,19 +144,19 @@ function wt({ filename: e, fileUrl: t, onDownload: n }) {
144
144
  children: "下載"
145
145
  }) : null
146
146
  ]
147
- }), /* @__PURE__ */ D("div", {
148
- className: I.viewport,
147
+ }), /* @__PURE__ */ O("div", {
148
+ className: z.viewport,
149
149
  ref: r,
150
- children: /* @__PURE__ */ D(mt, {
151
- error: /* @__PURE__ */ D(Tt, { message: "PDF 無法載入。" }),
150
+ children: /* @__PURE__ */ O(pt, {
151
+ error: /* @__PURE__ */ O(B, { message: "PDF 無法載入。" }),
152
152
  file: t,
153
- loading: /* @__PURE__ */ D(Tt, { message: "正在載入 PDF..." }),
154
- noData: /* @__PURE__ */ D(Tt, { message: "沒有可預覽的 PDF。" }),
153
+ loading: /* @__PURE__ */ O(B, { message: "正在載入 PDF..." }),
154
+ noData: /* @__PURE__ */ O(B, { message: "沒有可預覽的 PDF。" }),
155
155
  onLoadSuccess: p,
156
156
  suspense: !1,
157
- children: /* @__PURE__ */ D(ht, {
158
- className: I.page,
159
- loading: /* @__PURE__ */ D(Tt, { message: "正在載入頁面..." }),
157
+ children: /* @__PURE__ */ O(mt, {
158
+ className: z.page,
159
+ loading: /* @__PURE__ */ O(B, { message: "正在載入頁面..." }),
160
160
  pageNumber: o,
161
161
  renderAnnotationLayer: !0,
162
162
  renderTextLayer: !0,
@@ -166,10 +166,10 @@ function wt({ filename: e, fileUrl: t, onDownload: n }) {
166
166
  })]
167
167
  });
168
168
  }
169
- function Tt({ message: e }) {
170
- return /* @__PURE__ */ D("div", {
171
- className: I.state,
172
- children: /* @__PURE__ */ D(E, {
169
+ function B({ message: e }) {
170
+ return /* @__PURE__ */ O("div", {
171
+ className: z.state,
172
+ children: /* @__PURE__ */ O(D, {
173
173
  color: "text-neutral",
174
174
  variant: "body",
175
175
  children: e
@@ -177,119 +177,116 @@ function Tt({ message: e }) {
177
177
  });
178
178
  }
179
179
  // src/views/instances/detail/submitted-by.ts
180
- function Et({ initiatorMemberId: e, submittedByMemberId: t }) {
180
+ function wt({ initiatorMemberId: e, submittedByMemberId: t }) {
181
181
  return t && t !== e ? t : null;
182
182
  }
183
- function Dt(e, t) {
184
- let n = Et(e);
183
+ function Tt(e, t) {
184
+ let n = wt(e);
185
185
  if (!n || !e.initiatorMemberId) return null;
186
186
  let r = (e) => t.get(e)?.name ?? e;
187
187
  return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
188
188
  }
189
189
  // src/views/instances/detail/sections/shared.ts
190
- function Ot(e) {
191
- let t = R(e, "from"), n = R(e, "to"), r = R(e, "reason");
190
+ function Et(e) {
191
+ let t = V(e, "from"), n = V(e, "to"), r = V(e, "reason");
192
192
  return !t || !n || !r ? null : {
193
193
  from: t,
194
194
  reason: r,
195
- ruleId: R(e, "ruleId"),
195
+ ruleId: V(e, "ruleId"),
196
196
  to: n
197
197
  };
198
198
  }
199
- function kt(e) {
199
+ function Dt(e) {
200
200
  try {
201
201
  let t = JSON.parse(e);
202
- return Array.isArray(t) ? t.map((e) => jt(e) ? Ot(e) : null).filter((e) => e !== null) : [];
202
+ return Array.isArray(t) ? t.map((e) => U(e) ? Et(e) : null).filter((e) => e !== null) : [];
203
203
  } catch {
204
204
  return [];
205
205
  }
206
206
  }
207
- function R(e, t) {
207
+ function V(e, t) {
208
208
  let n = e[t];
209
209
  return typeof n == "string" ? n : null;
210
210
  }
211
- function At(e, t) {
211
+ function Ot(e, t) {
212
212
  let n = e[t];
213
213
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
214
214
  }
215
- function z(e, t) {
215
+ function kt(e, t) {
216
216
  let n = e[t];
217
217
  return typeof n == "number" ? n : null;
218
218
  }
219
- function B(e) {
219
+ function H(e) {
220
220
  return typeof e == "string" && e.trim().length > 0;
221
221
  }
222
- function jt(e) {
222
+ function U(e) {
223
223
  return typeof e == "object" && !!e;
224
224
  }
225
- function Mt(e) {
225
+ function At(e) {
226
226
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
227
227
  }
228
- function V(e) {
229
- return ot(e) || (e instanceof Error ? e.message : "發生未知錯誤");
230
- }
231
- function Nt(e) {
228
+ function jt(e) {
232
229
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
233
230
  }
234
- function H(e) {
231
+ function Mt(e) {
235
232
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
236
233
  }
237
- function Pt(e) {
234
+ function Nt(e) {
238
235
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
239
236
  }
240
- function U(e) {
237
+ function W(e) {
241
238
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
242
239
  }
243
- function Ft(e) {
240
+ function G(e) {
244
241
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
245
242
  }
246
- function It(e) {
243
+ function Pt(e) {
247
244
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
248
245
  }
249
- function Lt(e, t) {
246
+ function Ft(e, t) {
250
247
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
251
248
  }
252
- function W(e, t) {
249
+ function K(e, t) {
253
250
  if (!e) return "-";
254
251
  let n = t.get(e);
255
- return n ? f(n.name, n.email, "fullwidth") : e;
252
+ return n ? p(n.name, n.email, "fullwidth") : e;
256
253
  }
257
- function Rt(e, t = /* @__PURE__ */ new Map()) {
258
- let n = kt(e.delegationChainJson);
259
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => W(e, t)).join("、")}` : "未指定";
260
- let r = W(e.assigneeMemberId, t), i = W(e.originalAssigneeMemberId, t);
254
+ function It(e, t = /* @__PURE__ */ new Map()) {
255
+ let n = Dt(e.delegationChainJson);
256
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => K(e, t)).join("、")}` : "未指定";
257
+ let r = K(e.assigneeMemberId, t), i = K(e.originalAssigneeMemberId, t);
261
258
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
262
259
  }
263
- function zt(e, t) {
260
+ function Lt(e, t) {
264
261
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
265
262
  }
266
- function Bt(e, t) {
267
- let n = e.filter((e) => zt(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
263
+ function Rt(e, t) {
264
+ let n = e.filter((e) => Lt(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
268
265
  return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
269
266
  }
270
- function Vt(e, t) {
267
+ function zt(e, t) {
271
268
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
272
269
  if (t.data.returnBehavior.allowedTargets === "ANY") {
273
- let n = gt(e, t.id);
270
+ let n = L(e, t.id);
274
271
  return e.nodes.filter((e) => n.includes(e.id)).map((e) => ({
275
272
  id: e.id,
276
- name: `${e.data.label}(${It(e.type)})`
273
+ name: `${e.data.label}(${Pt(e.type)})`
277
274
  }));
278
275
  }
279
276
  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);
280
277
  return r ? [{
281
278
  id: r.id,
282
- name: `${r.data.label}(${It(r.type)})`
279
+ name: `${r.data.label}(${Pt(r.type)})`
283
280
  }] : [];
284
281
  }
285
- function Ht(e) {
282
+ function Bt(e) {
286
283
  return {
287
284
  email: e.email,
288
285
  id: e.memberId,
289
- name: f(e.name, e.email, "dot")
286
+ name: p(e.name, e.email, "dot")
290
287
  };
291
288
  }
292
- function G({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
289
+ function Vt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
293
290
  if (t) {
294
291
  let e = n.trim();
295
292
  return e ? {
@@ -314,11 +311,11 @@ function G({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
314
311
  valid: !1
315
312
  };
316
313
  }
317
- function Ut(e) {
314
+ function q(e) {
318
315
  return !!e;
319
316
  }
320
- function Wt(e) {
321
- if (!jt(e)) return null;
317
+ function Ht(e) {
318
+ if (!U(e)) return null;
322
319
  let t = e.email, n = e.id, r = e.name;
323
320
  return typeof n == "string" && typeof r == "string" ? {
324
321
  email: typeof t == "string" ? t : null,
@@ -326,7 +323,7 @@ function Wt(e) {
326
323
  name: r
327
324
  } : null;
328
325
  }
329
- function Gt(e, t) {
326
+ function Ut(e, t) {
330
327
  let n = e.trim().toLocaleLowerCase();
331
328
  if (!n) return null;
332
329
  let r = t.filter((e) => [
@@ -336,21 +333,21 @@ function Gt(e, t) {
336
333
  ].some((e) => e.toLocaleLowerCase().includes(n)));
337
334
  return r.length === 1 ? r[0] ?? null : null;
338
335
  }
339
- function K(e) {
340
- return B(e) ? {
336
+ function J(e) {
337
+ return H(e) ? {
341
338
  text: e,
342
339
  type: "text"
343
340
  } : null;
344
341
  }
345
- function q(e, t, n = "neutral") {
346
- return B(t) ? {
342
+ function Wt(e, t, n = "neutral") {
343
+ return H(t) ? {
347
344
  label: e,
348
345
  text: t,
349
346
  tone: n,
350
347
  type: "comment"
351
348
  } : null;
352
349
  }
353
- function Kt(e, t, n, r) {
350
+ function Gt(e, t, n, r) {
354
351
  let i = t ? n.get(t) : null;
355
352
  return {
356
353
  email: i?.email ?? null,
@@ -360,43 +357,43 @@ function Kt(e, t, n, r) {
360
357
  type: "member"
361
358
  };
362
359
  }
363
- function J(e) {
360
+ function Y(e) {
364
361
  return !!e;
365
362
  }
366
- function Y(e) {
363
+ function Kt(e) {
367
364
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
368
365
  return t === -1 ? e.length : t;
369
366
  }
367
+ function qt(e) {
368
+ 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" || X(e) || Jt(e.eventType, Qt(e));
369
+ }
370
370
  function X(e) {
371
- 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" || Z(e) || Yt(e.eventType, $t(e));
371
+ return e.eventType === "TASK_CREATED" && Ot(Qt(e), "sequentialCandidateMemberIds").length > 0;
372
372
  }
373
373
  function Z(e) {
374
- return e.eventType === "TASK_CREATED" && At($t(e), "sequentialCandidateMemberIds").length > 0;
375
- }
376
- function qt(e) {
377
374
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
378
- let t = $t(e);
375
+ let t = Qt(e);
379
376
  return [
380
- ...At(t, "sequentialCandidateMemberIds"),
381
- R(t, "candidateMemberId"),
382
- R(t, "previousMemberId")
383
- ].filter(B);
377
+ ...Ot(t, "sequentialCandidateMemberIds"),
378
+ V(t, "candidateMemberId"),
379
+ V(t, "previousMemberId")
380
+ ].filter(H);
384
381
  }
385
- var Jt = /* @__PURE__ */ new Set([
382
+ var Q = /* @__PURE__ */ new Set([
386
383
  "SERVICE_TASK_EXECUTED",
387
384
  "SERVICE_TASK_FAILED",
388
385
  "WEBHOOK_DELIVERY_RETRIED"
389
386
  ]);
390
- function Yt(e, t) {
391
- return Jt.has(e) && R(t, "action") === "NOTIFY_WEBHOOK";
387
+ function Jt(e, t) {
388
+ return Q.has(e) && V(t, "action") === "NOTIFY_WEBHOOK";
392
389
  }
393
- function Xt(e) {
394
- return R(e, "endpointLabel") ?? R(e, "endpointKey") ?? "外部系統";
390
+ function Yt(e) {
391
+ return V(e, "endpointLabel") ?? V(e, "endpointKey") ?? "外部系統";
395
392
  }
396
- function Zt(e) {
393
+ function Xt(e) {
397
394
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
398
395
  }
399
- function Qt(e, t) {
396
+ function Zt(e, t) {
400
397
  if (e === "INSTANCE_STARTED") return "案件已發起";
401
398
  if (e === "INSTANCE_CANCELLED") return "案件已取消";
402
399
  if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
@@ -406,102 +403,102 @@ function Qt(e, t) {
406
403
  if (e === "TOKEN_ADVANCED") return "流程已前進";
407
404
  if (e === "TASK_CREATED") return "待簽任務已建立";
408
405
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
409
- if (e === "TASK_DECIDED") return Zt(R(t, "action"));
406
+ if (e === "TASK_DECIDED") return Xt(V(t, "action"));
410
407
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
411
408
  if (e === "TASK_REASSIGNED") return "管理者改派待辦";
412
- if (Yt(e, t)) {
413
- let n = Xt(t);
409
+ if (Jt(e, t)) {
410
+ let n = Yt(t);
414
411
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
415
412
  }
416
413
  return e;
417
414
  }
418
- function $t(e) {
415
+ function Qt(e) {
419
416
  try {
420
417
  let t = JSON.parse(e.payloadJson);
421
- return jt(t) ? t : {};
418
+ return U(t) ? t : {};
422
419
  } catch {
423
420
  return {};
424
421
  }
425
422
  }
426
- function en(e, t) {
427
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Yt(e.eventType, t) || R(t, "action") === "REJECTED" || R(t, "instanceState") === "REJECTED";
423
+ function $t(e, t) {
424
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Jt(e.eventType, t) || V(t, "action") === "REJECTED" || V(t, "instanceState") === "REJECTED";
428
425
  }
429
- function tn(e) {
426
+ function en(e) {
430
427
  return t(e);
431
428
  }
432
- function nn(e, t, n, r) {
433
- if (e.eventType === "INSTANCE_STARTED") return Dt({
429
+ function tn(e, t, n, r) {
430
+ if (e.eventType === "INSTANCE_STARTED") return Tt({
434
431
  initiatorMemberId: e.actorMemberId,
435
- submittedByMemberId: R(t, "submittedByMemberId")
432
+ submittedByMemberId: V(t, "submittedByMemberId")
436
433
  }, r);
437
434
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
438
- let e = R(t, "candidateMemberId"), n = R(t, "previousMemberId");
435
+ let e = V(t, "candidateMemberId"), n = V(t, "previousMemberId");
439
436
  if (!e) return null;
440
- let i = W(e, r);
441
- return n ? `輪到:${i}(前一位:${W(n, r)})` : `輪到:${i}`;
437
+ let i = K(e, r);
438
+ return n ? `輪到:${i}(前一位:${K(n, r)})` : `輪到:${i}`;
442
439
  }
443
440
  if (e.eventType === "TASK_CREATED") {
444
- let e = At(t, "sequentialCandidateMemberIds");
445
- if (e.length) return `簽核順序:${e.map((e) => W(e, r)).join(" → ")}`;
446
- let n = R(t, "assigneeMemberId"), i = R(t, "originalAssigneeMemberId");
441
+ let e = Ot(t, "sequentialCandidateMemberIds");
442
+ if (e.length) return `簽核順序:${e.map((e) => K(e, r)).join(" → ")}`;
443
+ let n = V(t, "assigneeMemberId"), i = V(t, "originalAssigneeMemberId");
447
444
  if (!n) {
448
- let e = At(t, "candidateMemberIds");
449
- return e.length ? `候選簽核人:${e.map((e) => W(e, r)).join("、")}` : null;
445
+ let e = Ot(t, "candidateMemberIds");
446
+ return e.length ? `候選簽核人:${e.map((e) => K(e, r)).join("、")}` : null;
450
447
  }
451
- let a = W(n, r), o = W(i, r);
448
+ let a = K(n, r), o = K(i, r);
452
449
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
453
450
  }
454
451
  if (e.eventType === "TASK_DECIDED") {
455
- let e = R(t, "action"), n = R(t, "comment"), i = e ? `決議:${Ft(e)}` : null, a = R(t, "transferToMemberId");
456
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(B).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(B).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${W(a, r)}`].filter(B).join(" · ") : i;
452
+ let e = V(t, "action"), n = V(t, "comment"), i = e ? `決議:${G(e)}` : null, a = V(t, "transferToMemberId");
453
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${K(a, r)}`].filter(H).join(" · ") : i;
457
454
  }
458
455
  if (e.eventType === "TOKEN_ADVANCED") {
459
- let e = R(t, "action");
460
- if (e) return `流程結果:${Ft(e)}`;
461
- let r = z(t, "arrivedCount"), i = z(t, "requiredCount");
456
+ let e = V(t, "action");
457
+ if (e) return `流程結果:${G(e)}`;
458
+ let r = kt(t, "arrivedCount"), i = kt(t, "requiredCount");
462
459
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
463
- let a = R(t, "fromNodeId"), o = R(t, "toNodeId");
464
- if (a && o) return `由 ${Lt(a, n)} 前進至 ${Lt(o, n)}`;
460
+ let a = V(t, "fromNodeId"), o = V(t, "toNodeId");
461
+ if (a && o) return `由 ${Ft(a, n)} 前進至 ${Ft(o, n)}`;
465
462
  }
466
463
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
467
- let e = R(t, "state");
468
- return e ? `案件狀態:${Pt(e)}` : null;
464
+ let e = V(t, "state");
465
+ return e ? `案件狀態:${Nt(e)}` : null;
469
466
  }
470
467
  return null;
471
468
  }
472
- function rn(e, t, n, r, i, a, o, s = null, c = null) {
473
- if (e.eventType === "INSTANCE_RESUBMITTED") return [q("簽核意見", R(t, "comment"))].filter(J);
474
- if (e.eventType !== "TASK_DECIDED") return [K(nn(e, t, n, o))].filter(J);
475
- let l = an(e, t, r, c), u = R(t, "action") ?? l?.action ?? null, d = R(t, "comment") ?? l?.comment ?? null, f = R(t, "transferToMemberId") ?? l?.transferToMemberId ?? null, p = R(t, "signatureId") ?? l?.signatureId ?? null, m = p ? i.get(p) : null;
469
+ function nn(e, t, n, r, i, a, o, s = null, c = null) {
470
+ if (e.eventType === "INSTANCE_RESUBMITTED") return [Wt("簽核意見", V(t, "comment"))].filter(Y);
471
+ if (e.eventType !== "TASK_DECIDED") return [J(tn(e, t, n, o))].filter(Y);
472
+ let l = rn(e, t, r, c), u = V(t, "action") ?? l?.action ?? null, d = V(t, "comment") ?? l?.comment ?? null, f = V(t, "transferToMemberId") ?? l?.transferToMemberId ?? null, p = V(t, "signatureId") ?? l?.signatureId ?? null, m = p ? i.get(p) : null;
476
473
  return [
477
- K(u ? `決議:${Ft(u)}` : null),
478
- u === "REJECTED" ? q("拒絕原因", d ?? "-", "danger") : null,
479
- u === "APPROVED" ? q("同意說明", d) : null,
480
- u === "RETURNED" ? q("退回說明", d ?? "-") : null,
481
- u === "TRANSFERRED" ? K(`轉派給:${W(f, o)}`) : null,
482
- u === "TRANSFERRED" ? q("轉派說明", d ?? "-") : null,
483
- K(sn(t, s)),
484
- m ? K(a?.valid ? `簽章:已驗證(${H(m.signedPayloadHash)})` : `簽章:待檢查(${H(m.signedPayloadHash)})`) : null
485
- ].filter(J);
486
- }
487
- function an(e, t, n, r) {
474
+ J(u ? `決議:${G(u)}` : null),
475
+ u === "REJECTED" ? Wt("拒絕原因", d ?? "-", "danger") : null,
476
+ u === "APPROVED" ? Wt("同意說明", d) : null,
477
+ u === "RETURNED" ? Wt("退回說明", d ?? "-") : null,
478
+ u === "TRANSFERRED" ? J(`轉派給:${K(f, o)}`) : null,
479
+ u === "TRANSFERRED" ? Wt("轉派說明", d ?? "-") : null,
480
+ J(on(t, s)),
481
+ m ? J(a?.valid ? `簽章:已驗證(${Mt(m.signedPayloadHash)})` : `簽章:待檢查(${Mt(m.signedPayloadHash)})`) : null
482
+ ].filter(Y);
483
+ }
484
+ function rn(e, t, n, r) {
488
485
  let i = e.taskId;
489
486
  if (!i) return null;
490
- let a = R(t, "decisionId"), o = (t) => a ? t.id === a : t.decidedByMemberId === e.actorMemberId;
487
+ let a = V(t, "decisionId"), o = (t) => a ? t.id === a : t.decidedByMemberId === e.actorMemberId;
491
488
  if (!r) {
492
489
  let e = n.get(i) ?? null;
493
490
  return e && o(e) ? e : null;
494
491
  }
495
- return on(r.filter((e) => e.taskId === i && o(e)), new Date(e.createdAt).getTime());
492
+ return an(r.filter((e) => e.taskId === i && o(e)), new Date(e.createdAt).getTime());
496
493
  }
497
- function on(e, t) {
498
- let n = (e) => Math.abs(u(e) - t), r = (e, t) => {
494
+ function an(e, t) {
495
+ let n = (e) => Math.abs(d(e) - t), r = (e, t) => {
499
496
  let r = n(e) - n(t);
500
- return r < 0 || !(r > 0) && d(e, t) < 0;
497
+ return r < 0 || !(r > 0) && f(e, t) < 0;
501
498
  };
502
499
  return e.reduce((e, t) => !e || r(t, e) ? t : e, null);
503
500
  }
504
- function sn(e, t) {
501
+ function on(e, t) {
505
502
  let n = e.changedFieldKeys;
506
503
  if (!Array.isArray(n)) return null;
507
504
  let r = n.filter((e) => typeof e == "string" && e !== "");
@@ -509,21 +506,21 @@ function sn(e, t) {
509
506
  let i = r.map((e) => t?.fields.find((t) => t.fieldKey === e)?.label || e);
510
507
  return `補填 ${r.length} 個欄位:${i.join("、")}`;
511
508
  }
512
- function cn(e, t, n, r, i) {
509
+ function sn(e, t, n, r, i) {
513
510
  if (e.type === "startEvent" || i.has(e.id)) return !1;
514
511
  if (r === "REJECTED") return !0;
515
512
  let a = _n(e, t, n, r);
516
513
  return a.tone === "neutral" || a.tone === "waiting";
517
514
  }
518
- function ln(e, t, n, r, i) {
515
+ function cn(e, t, n, r, i) {
519
516
  if (r !== "RUNNING" && r !== "REJECTED") return [];
520
- let a = e.nodes.filter((e) => cn(e, t, n, r, i)), o = Q(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
517
+ let a = e.nodes.filter((e) => sn(e, t, n, r, i)), o = ln(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
521
518
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
522
519
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
523
520
  return n === r ? e.position.x === t.position.x ? e.position.y === t.position.y ? (s.get(e.id) ?? 0) - (s.get(t.id) ?? 0) : e.position.y - t.position.y : e.position.x - t.position.x : n - r;
524
521
  });
525
522
  }
526
- function Q(e, t, n, r, i) {
523
+ function ln(e, t, n, r, i) {
527
524
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
528
525
  let n = [...e.get(t.source) ?? [], t.target];
529
526
  return new Map(e).set(t.source, n);
@@ -531,7 +528,7 @@ function Q(e, t, n, r, i) {
531
528
  return un(e, n, r, i).reduce((e, t) => pn(e, dn(t, o, a)), /* @__PURE__ */ new Map());
532
529
  }
533
530
  function un(e, t, n, r) {
534
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(Mt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
531
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(At).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
535
532
  ...i,
536
533
  ...a,
537
534
  ...o
@@ -560,31 +557,31 @@ function pn(e, t) {
560
557
  function mn(e) {
561
558
  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}`;
562
559
  }
563
- function hn(e, t, n, r, i, a, o, s, l, u = null, d = null) {
564
- let f = d ? c(d) : null, p = e.filter(X).map((e) => {
565
- let t = $t(e), n = e.nodeId ? Lt(e.nodeId, r) : null;
560
+ function hn(e, t, n, r, i, a, o, s, c, u = null, d = null) {
561
+ let f = d ? l(d) : null, p = e.filter(qt).map((e) => {
562
+ let t = Qt(e), n = e.nodeId ? Ft(e.nodeId, r) : null;
566
563
  return {
567
564
  descriptionParts: [
568
- K(n ? `節點:${n}` : "節點:全流程"),
569
- Kt("操作者", e.actorMemberId, a, "系統"),
570
- K(`時間:${tn(e.createdAt)}`),
571
- ...rn(e, t, r, o, s, l, a, u, f ? f.get(e.taskId ?? "") ?? [] : null)
572
- ].filter(J),
573
- error: en(e, t),
565
+ J(n ? `節點:${n}` : "節點:全流程"),
566
+ Gt("操作者", e.actorMemberId, a, "系統"),
567
+ J(`時間:${en(e.createdAt)}`),
568
+ ...nn(e, t, r, o, s, c, a, u, f ? f.get(e.taskId ?? "") ?? [] : null)
569
+ ].filter(Y),
570
+ error: $t(e, t),
574
571
  id: e.id,
575
- title: Qt(e.eventType, t)
572
+ title: Zt(e.eventType, t)
576
573
  };
577
- }), m = t.filter(Mt).map((e) => ({
574
+ }), m = t.filter(At).map((e) => ({
578
575
  descriptionParts: [
579
- K(`節點:${Lt(e.nodeId, r)}`),
580
- Kt("處理者", e.assigneeMemberId, a, "未指定"),
581
- K(`建立時間:${tn(e.createdAt)}`)
582
- ].filter(J),
576
+ J(`節點:${Ft(e.nodeId, r)}`),
577
+ Gt("處理者", e.assigneeMemberId, a, "未指定"),
578
+ J(`建立時間:${en(e.createdAt)}`)
579
+ ].filter(Y),
583
580
  error: !1,
584
581
  id: `pending-task-${e.id}`,
585
582
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
586
- })), h = new Set([...e.filter(X).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(B)), g = r ? ln(r, t, n, i, h).map((e) => ({
587
- descriptionParts: [K(`${It(e.type)} · 尚未抵達`)].filter(J),
583
+ })), h = new Set([...e.filter(qt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), g = r ? cn(r, t, n, i, h).map((e) => ({
584
+ descriptionParts: [J(`${Pt(e.type)} · 尚未抵達`)].filter(Y),
588
585
  error: !1,
589
586
  forcePending: !0,
590
587
  id: `future-node-${e.id}`,
@@ -617,17 +614,17 @@ var gn = {
617
614
  function _n(e, t, n, r) {
618
615
  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");
619
616
  if (a) return {
620
- secondaryLabel: `處理者 ${Rt(a)}`,
617
+ secondaryLabel: `處理者 ${It(a)}`,
621
618
  statusLabel: "待處理",
622
619
  tone: "current"
623
620
  };
624
621
  if (o) return {
625
- secondaryLabel: `已取消 ${Rt(o)}`,
622
+ secondaryLabel: `已取消 ${It(o)}`,
626
623
  statusLabel: "已取消",
627
624
  tone: "cancelled"
628
625
  };
629
626
  if (s) return {
630
- secondaryLabel: `已完成 ${Rt(s)}`,
627
+ secondaryLabel: `已完成 ${It(s)}`,
631
628
  statusLabel: "已完成",
632
629
  tone: "completed"
633
630
  };
@@ -651,7 +648,7 @@ function _n(e, t, n, r) {
651
648
  ...d,
652
649
  secondaryLabel: r
653
650
  } : {
654
- secondaryLabel: It(e.type),
651
+ secondaryLabel: Pt(e.type),
655
652
  statusLabel: "未抵達",
656
653
  tone: "neutral"
657
654
  };
@@ -662,40 +659,40 @@ async function vn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks
662
659
  n?.initiatorMemberId ?? null,
663
660
  n?.submittedByMemberId ?? null,
664
661
  ...e.map((e) => e.actorMemberId),
665
- ...e.flatMap(qt),
662
+ ...e.flatMap(Z),
666
663
  ...r.map((e) => e.assigneeMemberId),
667
664
  ...r.map((e) => e.originalAssigneeMemberId),
668
665
  ...r.flatMap((e) => e.candidateMemberIds),
669
- ...r.flatMap((e) => kt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
670
- ...t.flatMap((e) => [e.createdByMemberId, ...$(e.targetValueJson)])
671
- ].filter(B))];
666
+ ...r.flatMap((e) => Dt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
667
+ ...t.flatMap((e) => [e.createdByMemberId, ...yn(e.targetValueJson)])
668
+ ].filter(H))];
672
669
  try {
673
- return await Re(i);
670
+ return await ze(i);
674
671
  } catch {
675
672
  return [];
676
673
  }
677
674
  }
678
- function $(e) {
675
+ function yn(e) {
679
676
  try {
680
677
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
681
678
  } catch {
682
679
  return [];
683
680
  }
684
681
  }
685
- async function yn(e) {
686
- return (await Promise.all(e.map((e) => k(e.id)))).flat();
682
+ async function bn(e) {
683
+ return (await Promise.all(e.map((e) => A(e.id)))).flat();
687
684
  }
688
685
  // src/views/instances/detail/use-resubmit-comment-draft.ts
689
- function bn(e) {
690
- let [t, n] = x({
686
+ function xn(e) {
687
+ let [t, n] = S({
691
688
  instanceId: e,
692
689
  text: ""
693
- }), r = oe((t) => n({
690
+ }), r = se((t) => n({
694
691
  instanceId: e,
695
692
  text: t
696
693
  }), [e]);
697
694
  return {
698
- clearAfterResubmit: oe((e) => n((t) => t.instanceId === e ? {
695
+ clearAfterResubmit: se((e) => n((t) => t.instanceId === e ? {
699
696
  instanceId: e,
700
697
  text: ""
701
698
  } : t), []),
@@ -704,10 +701,10 @@ function bn(e) {
704
701
  };
705
702
  }
706
703
  // src/views/instances/detail/sections/InstanceFormSection.tsx
707
- var xn = {
704
+ var Sn = {
708
705
  display: "grid",
709
706
  gap: 16
710
- }, Sn = {
707
+ }, $ = {
711
708
  display: "flex",
712
709
  flexWrap: "wrap",
713
710
  gap: 8
@@ -718,95 +715,98 @@ var xn = {
718
715
  function Tn(e) {
719
716
  e && (e.style.width = "100%");
720
717
  }
721
- function En({ canResubmitInstance: t, deciding: n, error: r, fieldAccess: i, fieldLabelMarkers: a, fill: s = null, instance: c, loading: l, onDataSourceStateChange: u, onResubmitFormChange: d, onReloadAfterConflict: f = null, onResubmitCommentChange: p = null, onResubmitInstance: m, onUploadAttachment: h, resubmitComment: g = "", resubmitFormData: ee, resubmitFormErrors: ne }) {
722
- let _ = c?.formDefinitionSnapshot.schema, re = c?.workflowSnapshot, ie = b(() => t && _ && re ? te(_, re) : s?.schema ?? _, [
723
- t,
724
- s?.schema,
725
- _,
726
- re
727
- ]), v = !t && s !== null;
728
- return /* @__PURE__ */ O("div", {
729
- style: xn,
718
+ function En({ attachments: t, canResubmitInstance: n, deciding: r, error: i, fieldAccess: a, fieldLabelMarkers: o, fill: c = null, instance: l, loading: u, onDataSourceStateChange: d, onDownloadAttachment: f, onFileUploadStateChange: p, onResubmitFormChange: m, onReloadAfterConflict: h = null, onResubmitCommentChange: g = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: ne = "", resubmitFormData: re, resubmitFormErrors: ie }) {
719
+ let oe = l?.formDefinitionSnapshot.schema, _ = l?.workflowSnapshot, v = x(() => n && oe && _ ? ae(oe, _) : c?.schema ?? oe, [
720
+ n,
721
+ c?.schema,
722
+ oe,
723
+ _
724
+ ]), y = !n && c !== null;
725
+ return /* @__PURE__ */ k("div", {
726
+ style: Sn,
730
727
  children: [
731
- r ? /* @__PURE__ */ D(E, {
728
+ i ? /* @__PURE__ */ O(D, {
732
729
  color: "text-error",
733
730
  variant: "body",
734
- children: r
731
+ children: i
735
732
  }) : null,
736
- l ? /* @__PURE__ */ D(E, {
733
+ u ? /* @__PURE__ */ O(D, {
737
734
  color: "text-neutral",
738
735
  variant: "body",
739
736
  children: "載入中..."
740
737
  }) : null,
741
- f ? /* @__PURE__ */ O("div", {
742
- style: xn,
743
- children: [/* @__PURE__ */ D(w, {
738
+ h ? /* @__PURE__ */ k("div", {
739
+ style: Sn,
740
+ children: [/* @__PURE__ */ O(me, {
744
741
  content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
745
742
  severity: "error"
746
- }), /* @__PURE__ */ D("div", {
747
- style: Sn,
748
- children: /* @__PURE__ */ D(S, {
749
- disabled: l,
743
+ }), /* @__PURE__ */ O("div", {
744
+ style: $,
745
+ children: /* @__PURE__ */ O(C, {
746
+ disabled: u,
750
747
  icon: Ze,
751
748
  iconType: "leading",
752
- onClick: f,
749
+ onClick: h,
753
750
  variant: "base-secondary",
754
751
  children: "重新載入"
755
752
  })
756
753
  })]
757
754
  }) : null,
758
- v && s.fieldCount > 0 ? /* @__PURE__ */ D(w, {
759
- content: `本關需要你補填 ${s.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
755
+ y && c.fieldCount > 0 ? /* @__PURE__ */ O(me, {
756
+ content: `本關需要你補填 ${c.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
760
757
  severity: "info"
761
758
  }) : null,
762
- ie && c?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ O(Ce, { children: [
763
- /* @__PURE__ */ D(o, {
764
- dataSourceContext: t ? {
765
- instanceId: c.id,
759
+ v && l?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ k(we, { children: [
760
+ /* @__PURE__ */ O(s, {
761
+ attachments: t,
762
+ dataSourceContext: n ? {
763
+ instanceId: l.id,
766
764
  kind: "runtime"
767
765
  } : void 0,
768
- dataSourceInitialValues: c.formData,
769
- errors: v ? s.errors : ne,
770
- ...!t && i ? { fieldAccess: i } : {},
771
- ...!t && a ? { fieldLabelMarkers: a } : {},
766
+ dataSourceInitialValues: l.formData,
767
+ errors: y ? c.errors : ie,
768
+ ...!n && a ? { fieldAccess: a } : {},
769
+ ...!n && o ? { fieldLabelMarkers: o } : {},
772
770
  onChange: (e) => {
773
- v ? s.onChange(e) : d(e);
771
+ y ? c.onChange(e) : m(e);
774
772
  },
775
- onDataSourceStateChange: u,
776
- onUploadAttachment: t ? h : void 0,
777
- optionSnapshots: c.formDataOptionSnapshot,
778
- readonly: !t,
779
- schema: ie,
780
- uiSchema: c.formDefinitionSnapshot.uiSchema,
781
- value: t ? ee : v ? s.value : c.formData
773
+ onDataSourceStateChange: d,
774
+ onDownloadAttachment: f,
775
+ onFileUploadStateChange: p,
776
+ onUploadAttachment: n ? te : void 0,
777
+ optionSnapshots: l.formDataOptionSnapshot,
778
+ readonly: !n,
779
+ schema: v,
780
+ uiSchema: l.formDefinitionSnapshot.uiSchema,
781
+ value: n ? re : y ? c.value : l.formData
782
782
  }),
783
- t && p ? /* @__PURE__ */ D(e, {
783
+ n && g ? /* @__PURE__ */ O(e, {
784
784
  label: "簽核意見",
785
785
  name: "resubmitComment",
786
- children: /* @__PURE__ */ D(xe, {
787
- disabled: n,
788
- onChange: (e) => p(e.target.value),
786
+ children: /* @__PURE__ */ O(Se, {
787
+ disabled: r,
788
+ onChange: (e) => g(e.target.value),
789
789
  placeholder: "選填,例如說明這次補正或修改了哪些內容",
790
790
  maxLength: Cn,
791
791
  ref: Tn,
792
792
  resize: "vertical",
793
793
  rows: 4,
794
794
  style: wn,
795
- value: g
795
+ value: ne
796
796
  })
797
797
  }) : null,
798
- t ? /* @__PURE__ */ D("div", {
799
- style: Sn,
800
- children: /* @__PURE__ */ D(S, {
801
- disabled: n,
798
+ n ? /* @__PURE__ */ O("div", {
799
+ style: $,
800
+ children: /* @__PURE__ */ O(C, {
801
+ disabled: r,
802
802
  icon: Ze,
803
803
  iconType: "leading",
804
- onClick: m,
804
+ onClick: ee,
805
805
  variant: "base-primary",
806
806
  children: "重新送出"
807
807
  })
808
808
  }) : null
809
- ] }) : /* @__PURE__ */ D(E, {
809
+ ] }) : /* @__PURE__ */ O(D, {
810
810
  color: "text-neutral",
811
811
  variant: "body",
812
812
  children: "此案件沒有可顯示的表單快照。"
@@ -820,15 +820,15 @@ var Dn = {
820
820
  gap: 16
821
821
  };
822
822
  function On({ attachments: e, onDownload: n, onPreview: r }) {
823
- let i = b(() => e.map((e) => ({
823
+ let i = x(() => e.map((e) => ({
824
824
  attachment: e,
825
825
  createdAt: e.createdAt,
826
826
  filename: e.filename,
827
827
  id: e.id,
828
828
  key: e.id,
829
829
  mimeType: e.mimeType,
830
- sizeLabel: Nt(Number(e.sizeBytes))
831
- })), [e]), a = b(() => [
830
+ sizeLabel: jt(Number(e.sizeBytes))
831
+ })), [e]), a = x(() => [
832
832
  {
833
833
  dataIndex: "filename",
834
834
  key: "filename",
@@ -849,7 +849,7 @@ function On({ attachments: e, onDownload: n, onPreview: r }) {
849
849
  },
850
850
  {
851
851
  key: "createdAt",
852
- render: (e) => /* @__PURE__ */ D(E, {
852
+ render: (e) => /* @__PURE__ */ O(D, {
853
853
  component: "span",
854
854
  variant: "body",
855
855
  children: t(e.createdAt)
@@ -857,7 +857,7 @@ function On({ attachments: e, onDownload: n, onPreview: r }) {
857
857
  title: "上傳時間",
858
858
  width: 220
859
859
  }
860
- ], []), o = b(() => ({
860
+ ], []), o = x(() => ({
861
861
  render: (e) => [...e.mimeType === "application/pdf" ? [{
862
862
  icon: Je,
863
863
  iconType: "leading",
@@ -866,7 +866,7 @@ function On({ attachments: e, onDownload: n, onPreview: r }) {
866
866
  r(e.attachment);
867
867
  }
868
868
  }] : [], {
869
- icon: A,
869
+ icon: M,
870
870
  iconType: "leading",
871
871
  name: "下載",
872
872
  onClick: () => {
@@ -876,18 +876,18 @@ function On({ attachments: e, onDownload: n, onPreview: r }) {
876
876
  variant: "base-secondary",
877
877
  width: 160
878
878
  }), [n, r]);
879
- return /* @__PURE__ */ O("div", {
879
+ return /* @__PURE__ */ k("div", {
880
880
  style: Dn,
881
- children: [/* @__PURE__ */ D(E, {
881
+ children: [/* @__PURE__ */ O(D, {
882
882
  component: "h2",
883
883
  variant: "h3",
884
884
  children: "附件"
885
- }), i.length > 0 ? /* @__PURE__ */ D(be, {
885
+ }), i.length > 0 ? /* @__PURE__ */ O(xe, {
886
886
  actions: o,
887
887
  columns: a,
888
888
  dataSource: i,
889
889
  fullWidth: !0
890
- }) : /* @__PURE__ */ D(E, {
890
+ }) : /* @__PURE__ */ O(D, {
891
891
  color: "text-neutral",
892
892
  variant: "body",
893
893
  children: "此案件沒有附件。"
@@ -932,26 +932,26 @@ var Fn = {
932
932
  }, {
933
933
  id: "WEBHOOK",
934
934
  name: "Webhook"
935
- }], zn = y(function({ adhocDirectives: n, currentMemberId: r, fill: i = null, instance: a, memberProfilesById: o, onChanged: s, onDecidingChange: c, onFillApproveError: u, tasks: d }, f) {
936
- let [p, m] = x(!1), [h, g] = x(null);
937
- se(() => {
935
+ }], zn = b(function({ adhocDirectives: n, currentMemberId: r, fill: i = null, instance: a, memberProfilesById: o, onChanged: s, onDecidingChange: c, onFillApproveError: l, tasks: d }, f) {
936
+ let [p, m] = S(!1), [h, g] = S(null);
937
+ ce(() => {
938
938
  c?.(p);
939
939
  }, [p, c]);
940
- let [ee, te] = x(""), [ne, _] = x(!1), [re, ie] = x(""), [v, ae] = x(null), [y, oe] = x(!1), [le, w] = x(""), [me, he] = x(!1), [ge, _e] = x(null), [ye, Se] = x(""), [Te, ke] = x(null), [Ae, k] = x(!1), [je, Me] = x([]), [Ne, Pe] = x(!1), [Fe, Re] = x(""), [ze, Be] = x([]), [He, Ue] = x(!1), [We, Ge] = x([]), [Ke, qe] = x(!1), [A, Je] = x("COUNTERSIGN"), [Ye, Xe] = x("REJECT_INSTANCE"), [Ze, Qe] = x(!1), [$e, et] = x("MEMBER"), [tt, j] = x(""), nt = re.trim(), rt = le.trim(), it = ye.trim(), M = b(() => Bt(d, r), [r, d]), N = b(() => M && a ? a.workflowSnapshot.nodes.find((e) => e.id === M.nodeId) ?? null : null, [M, a]), at = b(() => N && a ? Vt(a.workflowSnapshot, N) : [], [N, a]), ot = N?.type === "userTask" && N.data.returnBehavior.allowReturn, st = N?.type === "userTask" && N.data.allowReject !== !1, ct = N?.type === "userTask" && N.data.allowTransfer !== !1, lt = N?.type === "userTask" && N.data.returnBehavior.requireComment === !0, ut = N?.type === "userTask" && N.data.allowAddSigner, dt = b(() => n.filter((e) => e.status === "PENDING"), [n]), P = at.find((e) => e.id === ge) ?? at[0] ?? null, ft = b(() => d.map((e) => ({
940
+ let [ee, te] = S(""), [ne, re] = S(!1), [ie, ae] = S(""), [oe, v] = S(null), [y, b] = S(!1), [se, ue] = S(""), [me, ge] = S(!1), [_e, E] = S(null), [ve, be] = S(""), [Ce, Ee] = S(null), [Ae, je] = S(!1), [A, Me] = S([]), [Ne, Pe] = S(!1), [Fe, Ie] = S(""), [ze, Be] = S([]), [Ve, Ue] = S(!1), [We, Ge] = S([]), [Ke, qe] = S(!1), [j, M] = S("COUNTERSIGN"), [Je, Ye] = S("REJECT_INSTANCE"), [Xe, Ze] = S(!1), [Qe, $e] = S("MEMBER"), [et, tt] = S(""), N = ie.trim(), nt = se.trim(), rt = ve.trim(), P = x(() => Rt(d, r), [r, d]), F = x(() => P && a ? a.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, a]), it = x(() => F && a ? zt(a.workflowSnapshot, F) : [], [F, a]), at = F?.type === "userTask" && F.data.returnBehavior.allowReturn, ot = F?.type === "userTask" && F.data.allowReject !== !1, st = F?.type === "userTask" && F.data.allowTransfer !== !1, ct = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, lt = F?.type === "userTask" && F.data.allowAddSigner, ut = x(() => n.filter((e) => e.status === "PENDING"), [n]), I = it.find((e) => e.id === _e) ?? it[0] ?? null, dt = x(() => d.map((e) => ({
941
941
  ...e,
942
- assigneeLabel: Rt(e, o),
942
+ assigneeLabel: It(e, o),
943
943
  fillFieldCount: Vn(e, a?.workflowSnapshot ?? null),
944
944
  key: e.id,
945
- nodeLabel: l({
945
+ nodeLabel: u({
946
946
  ...e,
947
- nodeLabel: Lt(e.nodeId, a?.workflowSnapshot ?? null)
947
+ nodeLabel: Ft(e.nodeId, a?.workflowSnapshot ?? null)
948
948
  }),
949
- statusLabel: U(e.status)
949
+ statusLabel: W(e.status)
950
950
  })), [
951
951
  a,
952
952
  o,
953
953
  d
954
- ]), pt = b(() => [
954
+ ]), ft = x(() => [
955
955
  {
956
956
  dataIndex: "nodeLabel",
957
957
  key: "nodeLabel",
@@ -961,7 +961,7 @@ var Fn = {
961
961
  {
962
962
  key: "assigneeMemberId",
963
963
  title: "處理者",
964
- render: (e) => /* @__PURE__ */ D(E, {
964
+ render: (e) => /* @__PURE__ */ O(D, {
965
965
  component: "span",
966
966
  variant: "body",
967
967
  children: e.assigneeLabel
@@ -976,7 +976,7 @@ var Fn = {
976
976
  },
977
977
  {
978
978
  key: "fill",
979
- render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ D(de, {
979
+ render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ O(fe, {
980
980
  size: "sub",
981
981
  text: `需補填 ${e.fillFieldCount} 欄`,
982
982
  variant: "dot-warning"
@@ -986,7 +986,7 @@ var Fn = {
986
986
  },
987
987
  {
988
988
  key: "createdAt",
989
- render: (e) => /* @__PURE__ */ D(E, {
989
+ render: (e) => /* @__PURE__ */ O(D, {
990
990
  component: "span",
991
991
  variant: "body",
992
992
  children: t(e.createdAt)
@@ -994,13 +994,13 @@ var Fn = {
994
994
  title: "建立時間",
995
995
  width: 220
996
996
  }
997
- ], []), mt = b(() => dt.map((e) => ({
997
+ ], []), pt = x(() => ut.map((e) => ({
998
998
  ...e,
999
- createdByLabel: W(e.createdByMemberId, o),
999
+ createdByLabel: K(e.createdByMemberId, o),
1000
1000
  key: e.id,
1001
1001
  targetLabel: Bn(e, o),
1002
1002
  typeLabel: Fn[e.type]
1003
- })), [o, dt]), ht = b(() => [
1003
+ })), [o, ut]), mt = x(() => [
1004
1004
  {
1005
1005
  dataIndex: "typeLabel",
1006
1006
  key: "typeLabel",
@@ -1009,7 +1009,7 @@ var Fn = {
1009
1009
  },
1010
1010
  {
1011
1011
  key: "targetLabel",
1012
- render: (e) => /* @__PURE__ */ D(E, {
1012
+ render: (e) => /* @__PURE__ */ O(D, {
1013
1013
  component: "span",
1014
1014
  variant: "body",
1015
1015
  children: e.targetLabel
@@ -1019,7 +1019,7 @@ var Fn = {
1019
1019
  },
1020
1020
  {
1021
1021
  key: "createdByLabel",
1022
- render: (e) => /* @__PURE__ */ D(E, {
1022
+ render: (e) => /* @__PURE__ */ O(D, {
1023
1023
  component: "span",
1024
1024
  variant: "body",
1025
1025
  children: e.createdByLabel
@@ -1029,7 +1029,7 @@ var Fn = {
1029
1029
  },
1030
1030
  {
1031
1031
  key: "createdAt",
1032
- render: (e) => /* @__PURE__ */ D(E, {
1032
+ render: (e) => /* @__PURE__ */ O(D, {
1033
1033
  component: "span",
1034
1034
  variant: "body",
1035
1035
  children: t(e.createdAt)
@@ -1039,233 +1039,233 @@ var Fn = {
1039
1039
  },
1040
1040
  {
1041
1041
  key: "actions",
1042
- render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ D(S, {
1043
- disabled: Ze,
1044
- onClick: () => void z(e.id),
1042
+ render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ O(C, {
1043
+ disabled: Xe,
1044
+ onClick: () => void kt(e.id),
1045
1045
  size: "minor",
1046
1046
  variant: "destructive-secondary",
1047
1047
  children: "撤回"
1048
- }) : /* @__PURE__ */ D(Ce, {}),
1048
+ }) : /* @__PURE__ */ O(we, {}),
1049
1049
  title: "操作",
1050
1050
  width: 100
1051
1051
  }
1052
- ], [Ze, r]);
1053
- async function gt({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1054
- if (!r || !M || e === "REJECTED" && !st || e === "TRANSFERRED" && !ct) return !1;
1052
+ ], [Xe, r]);
1053
+ async function L({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1054
+ if (!r || !P || e === "REJECTED" && !ot || e === "TRANSFERRED" && !st) return !1;
1055
1055
  m(!0), g(null);
1056
- let o = e === "APPROVED" && i !== null && !M.isAdhoc ? {
1056
+ let o = e === "APPROVED" && i !== null && !P.isAdhoc ? {
1057
1057
  expectedFormDataFingerprint: i.expectedFormDataFingerprint,
1058
1058
  formData: i.formData
1059
1059
  } : null;
1060
1060
  try {
1061
- await Oe({
1061
+ await ke({
1062
1062
  action: e,
1063
1063
  comment: t,
1064
1064
  decidedByMemberId: r,
1065
1065
  fill: o,
1066
1066
  returnToNodeId: n,
1067
- taskId: M.id,
1067
+ taskId: P.id,
1068
1068
  transferToMemberId: a
1069
- }), oe(!1), he(!1), Pe(!1), ie(""), w(""), Se(""), ke(null), _e(null), ae(null);
1069
+ }), b(!1), ge(!1), Pe(!1), ae(""), ue(""), be(""), Ee(null), E(null), v(null);
1070
1070
  } catch (e) {
1071
- return m(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (_(!1), !1) : (g(V(e)), !1);
1071
+ return m(!1), o !== null && e instanceof Error && l?.(e.message) === !0 ? (re(!1), !1) : (g(_(e)), !1);
1072
1072
  }
1073
1073
  try {
1074
1074
  await s();
1075
1075
  } catch (e) {
1076
- g(V(e));
1076
+ g(_(e));
1077
1077
  } finally {
1078
1078
  m(!1);
1079
1079
  }
1080
1080
  return !0;
1081
1081
  }
1082
- function F() {
1083
- r && M && (g(null), _(!0));
1082
+ function R() {
1083
+ r && P && (g(null), re(!0));
1084
1084
  }
1085
- function _t() {
1086
- p || (_(!1), te(""));
1085
+ function ht() {
1086
+ p || (re(!1), te(""));
1087
1087
  }
1088
- async function I() {
1089
- p || await gt({
1088
+ async function z() {
1089
+ p || await L({
1090
1090
  action: "APPROVED",
1091
1091
  comment: ee.trim() || null
1092
- }) && (_(!1), te(""));
1092
+ }) && (re(!1), te(""));
1093
+ }
1094
+ function gt() {
1095
+ ot && (ae(""), v(null), b(!0));
1096
+ }
1097
+ function _t() {
1098
+ p || (b(!1), ae(""), v(null));
1093
1099
  }
1094
1100
  function vt() {
1095
- st && (ie(""), ae(null), oe(!0));
1101
+ ue(""), E(it[0]?.id ?? null), ge(!0);
1096
1102
  }
1097
1103
  function yt() {
1098
- p || (oe(!1), ie(""), ae(null));
1104
+ p || (ge(!1), ue(""), E(null));
1099
1105
  }
1100
1106
  function bt() {
1101
- w(""), _e(at[0]?.id ?? null), he(!0);
1107
+ st && (be(""), Ee(null), Pe(!0), St(""));
1102
1108
  }
1103
1109
  function xt() {
1104
- p || (he(!1), w(""), _e(null));
1110
+ p || (Pe(!1), be(""), Ee(null));
1105
1111
  }
1106
- function St() {
1107
- ct && (Se(""), ke(null), Pe(!0), L(""));
1108
- }
1109
- function Ct() {
1110
- p || (Pe(!1), Se(""), ke(null));
1111
- }
1112
- async function L(e) {
1113
- k(!0);
1112
+ async function St(e) {
1113
+ je(!0);
1114
1114
  try {
1115
- Me((await Ve(e)).filter((e) => e.memberId !== r).map(Ht));
1115
+ Me((await He(e)).filter((e) => e.memberId !== r).map(Bt));
1116
1116
  } catch (e) {
1117
- g(V(e));
1117
+ g(_(e));
1118
1118
  } finally {
1119
- k(!1);
1119
+ je(!1);
1120
1120
  }
1121
1121
  }
1122
- async function wt() {
1123
- st && (nt ? await gt({
1122
+ async function Ct() {
1123
+ ot && (N ? await L({
1124
1124
  action: "REJECTED",
1125
- comment: nt
1126
- }) : ae("請輸入拒絕原因"));
1125
+ comment: N
1126
+ }) : v("請輸入拒絕原因"));
1127
1127
  }
1128
- async function Tt() {
1129
- ct && (Te ? await gt({
1128
+ async function B() {
1129
+ st && (Ce ? await L({
1130
1130
  action: "TRANSFERRED",
1131
- comment: it || null,
1132
- transferToMemberId: Te.id
1131
+ comment: rt || null,
1132
+ transferToMemberId: Ce.id
1133
1133
  }) : g("請選擇轉派對象"));
1134
1134
  }
1135
- async function Et() {
1136
- await gt({
1135
+ async function wt() {
1136
+ await L({
1137
1137
  action: "RETURNED",
1138
- comment: rt || null,
1139
- returnToNodeId: P?.id ?? null
1138
+ comment: nt || null,
1139
+ returnToNodeId: I?.id ?? null
1140
1140
  });
1141
1141
  }
1142
- function Dt() {
1143
- Re(""), Be([]), Xe("REJECT_INSTANCE"), et("MEMBER"), j("");
1142
+ function Tt() {
1143
+ Ie(""), Be([]), Ye("REJECT_INSTANCE"), $e("MEMBER"), tt("");
1144
1144
  }
1145
- function Ot(e) {
1146
- Je(e), Dt(), qe(!0), R("");
1145
+ function Et(e) {
1146
+ M(e), Tt(), qe(!0), V("");
1147
1147
  }
1148
- function kt() {
1149
- Ze || (qe(!1), Dt());
1148
+ function Dt() {
1149
+ Xe || (qe(!1), Tt());
1150
1150
  }
1151
- async function R(e) {
1151
+ async function V(e) {
1152
1152
  Ue(!0);
1153
1153
  try {
1154
- Ge((await Ve(e)).map(Ht));
1154
+ Ge((await He(e)).map(Bt));
1155
1155
  } catch (e) {
1156
- g(V(e));
1156
+ g(_(e));
1157
1157
  } finally {
1158
1158
  Ue(!1);
1159
1159
  }
1160
1160
  }
1161
- async function At() {
1162
- if (!M) return;
1163
- let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && $e === "WEBHOOK", t = G({
1161
+ async function Ot() {
1162
+ if (!P) return;
1163
+ let e = (j === "STAGE_NOTIFY" || j === "COMPLETION_NOTIFY") && Qe === "WEBHOOK", t = Vt({
1164
1164
  memberIds: ze.map((e) => e.id),
1165
1165
  useWebhookTarget: e,
1166
- webhookUrl: tt
1166
+ webhookUrl: et
1167
1167
  });
1168
1168
  if (!t.valid) {
1169
1169
  g(t.error);
1170
1170
  return;
1171
1171
  }
1172
1172
  let { target: n } = t, r = Fe.trim() || null;
1173
- Qe(!0), g(null);
1173
+ Ze(!0), g(null);
1174
1174
  try {
1175
- A === "COUNTERSIGN" ? await Ie({
1175
+ j === "COUNTERSIGN" ? await Le({
1176
1176
  comment: r,
1177
1177
  target: n,
1178
- taskId: M.id
1179
- }) : A === "PRE_APPROVAL" ? await Le({
1178
+ taskId: P.id
1179
+ }) : j === "PRE_APPROVAL" ? await Re({
1180
1180
  comment: r,
1181
- onReject: Ye,
1181
+ onReject: Je,
1182
1182
  target: n,
1183
- taskId: M.id
1184
- }) : A === "STAGE_NOTIFY" ? await De({
1183
+ taskId: P.id
1184
+ }) : j === "STAGE_NOTIFY" ? await Oe({
1185
1185
  target: n,
1186
- taskId: M.id
1187
- }) : await Ee({
1186
+ taskId: P.id
1187
+ }) : await De({
1188
1188
  target: n,
1189
- taskId: M.id
1190
- }), qe(!1), Dt(), await s();
1189
+ taskId: P.id
1190
+ }), qe(!1), Tt(), await s();
1191
1191
  } catch (e) {
1192
- g(V(e));
1192
+ g(_(e));
1193
1193
  } finally {
1194
- Qe(!1);
1194
+ Ze(!1);
1195
1195
  }
1196
1196
  }
1197
- async function z(e) {
1198
- Qe(!0), g(null);
1197
+ async function kt(e) {
1198
+ Ze(!0), g(null);
1199
1199
  try {
1200
- await we(e), await s();
1200
+ await Te(e), await s();
1201
1201
  } catch (e) {
1202
- g(V(e));
1202
+ g(_(e));
1203
1203
  } finally {
1204
- Qe(!1);
1204
+ Ze(!1);
1205
1205
  }
1206
1206
  }
1207
- ce(f, () => ({
1208
- canAddSignerCurrentTask: ut,
1209
- canRejectCurrentTask: st,
1210
- canReturnCurrentTask: ot,
1211
- canTransferCurrentTask: ct,
1207
+ le(f, () => ({
1208
+ canAddSignerCurrentTask: lt,
1209
+ canRejectCurrentTask: ot,
1210
+ canReturnCurrentTask: at,
1211
+ canTransferCurrentTask: st,
1212
1212
  deciding: p,
1213
- handleApprove: F,
1214
- hasCurrentTask: M !== null,
1215
- openAdhocModal: Ot,
1216
- openRejectModal: vt,
1217
- openReturnModal: bt,
1218
- openTransferModal: St
1213
+ handleApprove: R,
1214
+ hasCurrentTask: P !== null,
1215
+ openAdhocModal: Et,
1216
+ openRejectModal: gt,
1217
+ openReturnModal: vt,
1218
+ openTransferModal: bt
1219
1219
  }), [
1220
- ut,
1221
- st,
1220
+ lt,
1222
1221
  ot,
1223
- ct,
1222
+ at,
1223
+ st,
1224
1224
  r,
1225
- M,
1225
+ P,
1226
1226
  p
1227
1227
  ]);
1228
- let B = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", jt = B && $e === "WEBHOOK" ? !tt.trim() : ze.length === 0, Mt = Ln.find((e) => e.id === Ye) ?? Ln[0], Nt = Rn.find((e) => e.id === $e) ?? Rn[0];
1229
- return /* @__PURE__ */ O(Ce, { children: [
1230
- /* @__PURE__ */ D(E, {
1228
+ let H = j === "STAGE_NOTIFY" || j === "COMPLETION_NOTIFY", U = H && Qe === "WEBHOOK" ? !et.trim() : ze.length === 0, At = Ln.find((e) => e.id === Je) ?? Ln[0], jt = Rn.find((e) => e.id === Qe) ?? Rn[0];
1229
+ return /* @__PURE__ */ k(we, { children: [
1230
+ /* @__PURE__ */ O(D, {
1231
1231
  component: "h2",
1232
1232
  variant: "h3",
1233
1233
  children: "任務"
1234
1234
  }),
1235
- h ? /* @__PURE__ */ D(E, {
1235
+ h ? /* @__PURE__ */ O(D, {
1236
1236
  color: "text-error",
1237
1237
  variant: "body",
1238
1238
  children: h
1239
1239
  }) : null,
1240
- /* @__PURE__ */ D("div", {
1240
+ /* @__PURE__ */ O("div", {
1241
1241
  style: Mn,
1242
- children: /* @__PURE__ */ D(be, {
1243
- columns: pt,
1244
- dataSource: ft,
1242
+ children: /* @__PURE__ */ O(xe, {
1243
+ columns: ft,
1244
+ dataSource: dt,
1245
1245
  fullWidth: !0
1246
1246
  })
1247
1247
  }),
1248
- dt.length > 0 ? /* @__PURE__ */ O(Ce, { children: [/* @__PURE__ */ D(E, {
1248
+ ut.length > 0 ? /* @__PURE__ */ k(we, { children: [/* @__PURE__ */ O(D, {
1249
1249
  component: "h3",
1250
1250
  style: Nn,
1251
1251
  variant: "h3",
1252
1252
  children: "待生效的臨時設定"
1253
- }), /* @__PURE__ */ D("div", {
1253
+ }), /* @__PURE__ */ O("div", {
1254
1254
  style: Mn,
1255
- children: /* @__PURE__ */ D(be, {
1256
- columns: ht,
1257
- dataSource: mt,
1255
+ children: /* @__PURE__ */ O(xe, {
1256
+ columns: mt,
1257
+ dataSource: pt,
1258
1258
  fullWidth: !0
1259
1259
  })
1260
1260
  })] }) : null,
1261
- /* @__PURE__ */ O(T, {
1261
+ /* @__PURE__ */ k(T, {
1262
1262
  cancelText: "取消",
1263
1263
  confirmText: "送出同意",
1264
1264
  loading: p,
1265
1265
  modalType: "standard",
1266
- onCancel: _t,
1267
- onClose: _t,
1268
- onConfirm: () => void I(),
1266
+ onCancel: ht,
1267
+ onClose: ht,
1268
+ onConfirm: () => void z(),
1269
1269
  open: ne,
1270
1270
  showModalFooter: !0,
1271
1271
  showModalHeader: !0,
@@ -1273,28 +1273,28 @@ var Fn = {
1273
1273
  supportingText: "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1274
1274
  title: "簽核意見",
1275
1275
  children: [
1276
- h ? /* @__PURE__ */ D(E, {
1276
+ h ? /* @__PURE__ */ O(D, {
1277
1277
  color: "text-error",
1278
1278
  role: "alert",
1279
1279
  variant: "body",
1280
1280
  children: h
1281
1281
  }) : null,
1282
- i !== null && i.summary.length > 0 ? /* @__PURE__ */ O("div", {
1282
+ i !== null && i.summary.length > 0 ? /* @__PURE__ */ k("div", {
1283
1283
  style: kn,
1284
- children: [/* @__PURE__ */ D(E, {
1284
+ children: [/* @__PURE__ */ O(D, {
1285
1285
  variant: "body",
1286
1286
  children: "將一併送出的補填欄位:"
1287
- }), i.summary.map((e) => /* @__PURE__ */ D(C, {
1287
+ }), i.summary.map((e) => /* @__PURE__ */ O(w, {
1288
1288
  title: e.label,
1289
- children: /* @__PURE__ */ D(fe, { children: e.text })
1289
+ children: /* @__PURE__ */ O(pe, { children: e.text })
1290
1290
  }, e.fieldKey))]
1291
1291
  }) : null,
1292
- /* @__PURE__ */ D("div", {
1292
+ /* @__PURE__ */ O("div", {
1293
1293
  style: kn,
1294
- children: /* @__PURE__ */ D(e, {
1294
+ children: /* @__PURE__ */ O(e, {
1295
1295
  label: "簽核意見",
1296
1296
  name: "approveComment",
1297
- children: /* @__PURE__ */ D(xe, {
1297
+ children: /* @__PURE__ */ O(Se, {
1298
1298
  autoFocus: !0,
1299
1299
  onChange: (e) => te(e.target.value),
1300
1300
  placeholder: "選填,例如補充核准的條件或提醒事項",
@@ -1308,73 +1308,73 @@ var Fn = {
1308
1308
  })
1309
1309
  ]
1310
1310
  }),
1311
- /* @__PURE__ */ D(T, {
1311
+ /* @__PURE__ */ O(T, {
1312
1312
  cancelText: "取消",
1313
1313
  confirmButtonProps: {
1314
- disabled: !nt,
1314
+ disabled: !N,
1315
1315
  variant: "destructive-primary"
1316
1316
  },
1317
1317
  confirmText: "送出拒絕",
1318
1318
  loading: p,
1319
1319
  modalStatusType: "error",
1320
1320
  modalType: "standard",
1321
- onCancel: yt,
1322
- onClose: yt,
1323
- onConfirm: () => void wt(),
1321
+ onCancel: _t,
1322
+ onClose: _t,
1323
+ onConfirm: () => void Ct(),
1324
1324
  open: y,
1325
1325
  showModalFooter: !0,
1326
1326
  showModalHeader: !0,
1327
1327
  size: "regular",
1328
1328
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1329
1329
  title: "拒絕原因",
1330
- children: /* @__PURE__ */ O("div", {
1330
+ children: /* @__PURE__ */ k("div", {
1331
1331
  style: kn,
1332
- children: [/* @__PURE__ */ D(e, {
1332
+ children: [/* @__PURE__ */ O(e, {
1333
1333
  label: "拒絕原因",
1334
1334
  name: "rejectReason",
1335
1335
  required: !0,
1336
- children: /* @__PURE__ */ D(xe, {
1336
+ children: /* @__PURE__ */ O(Se, {
1337
1337
  autoFocus: !0,
1338
1338
  onChange: (e) => {
1339
- ie(e.target.value), ae(null);
1339
+ ae(e.target.value), v(null);
1340
1340
  },
1341
1341
  placeholder: "請說明拒絕原因",
1342
1342
  ref: Pn,
1343
1343
  resize: "vertical",
1344
1344
  rows: 4,
1345
1345
  style: An,
1346
- type: v ? "error" : "default",
1347
- value: re
1346
+ type: oe ? "error" : "default",
1347
+ value: ie
1348
1348
  })
1349
- }), v ? /* @__PURE__ */ D(E, {
1349
+ }), oe ? /* @__PURE__ */ O(D, {
1350
1350
  color: "text-error",
1351
1351
  variant: "body",
1352
- children: v
1352
+ children: oe
1353
1353
  }) : null]
1354
1354
  })
1355
1355
  }),
1356
- /* @__PURE__ */ D(T, {
1356
+ /* @__PURE__ */ O(T, {
1357
1357
  cancelText: "取消",
1358
- confirmButtonProps: { disabled: !Te },
1358
+ confirmButtonProps: { disabled: !Ce },
1359
1359
  confirmText: "送出轉派",
1360
1360
  loading: p,
1361
1361
  modalType: "standard",
1362
- onCancel: Ct,
1363
- onClose: Ct,
1364
- onConfirm: () => void Tt(),
1362
+ onCancel: xt,
1363
+ onClose: xt,
1364
+ onConfirm: () => void B(),
1365
1365
  open: Ne,
1366
1366
  showModalFooter: !0,
1367
1367
  showModalHeader: !0,
1368
1368
  size: "regular",
1369
1369
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1370
1370
  title: "轉派簽核",
1371
- children: /* @__PURE__ */ O("div", {
1371
+ children: /* @__PURE__ */ k("div", {
1372
1372
  style: jn,
1373
- children: [/* @__PURE__ */ D(e, {
1373
+ children: [/* @__PURE__ */ O(e, {
1374
1374
  label: "轉派對象",
1375
1375
  name: "transferToMemberId",
1376
1376
  required: !0,
1377
- children: /* @__PURE__ */ D(ue, {
1377
+ children: /* @__PURE__ */ O(de, {
1378
1378
  asyncData: !0,
1379
1379
  disabledOptionsFilter: !0,
1380
1380
  emptyText: "沒有符合的成員",
@@ -1387,104 +1387,104 @@ var Fn = {
1387
1387
  loading: Ae,
1388
1388
  loadingText: "搜尋成員中...",
1389
1389
  mode: "single",
1390
- onChange: (e) => ke(Wt(e)),
1391
- onSearch: L,
1392
- onSearchTextChange: (e) => ke(Gt(e, je)),
1390
+ onChange: (e) => Ee(Ht(e)),
1391
+ onSearch: St,
1392
+ onSearchTextChange: (e) => Ee(Ut(e, A)),
1393
1393
  onVisibilityChange: (e) => {
1394
- e && L("");
1394
+ e && St("");
1395
1395
  },
1396
- options: [...je],
1396
+ options: [...A],
1397
1397
  placeholder: "搜尋姓名或信箱",
1398
1398
  searchDebounceTime: 300,
1399
- value: Te
1399
+ value: Ce
1400
1400
  })
1401
- }), /* @__PURE__ */ D(e, {
1401
+ }), /* @__PURE__ */ O(e, {
1402
1402
  label: "轉派說明",
1403
1403
  name: "transferComment",
1404
- children: /* @__PURE__ */ D(xe, {
1405
- onChange: (e) => Se(e.target.value),
1404
+ children: /* @__PURE__ */ O(Se, {
1405
+ onChange: (e) => be(e.target.value),
1406
1406
  placeholder: "可補充轉派原因",
1407
1407
  ref: Pn,
1408
1408
  resize: "vertical",
1409
1409
  rows: 4,
1410
1410
  style: An,
1411
- value: ye
1411
+ value: ve
1412
1412
  })
1413
1413
  })]
1414
1414
  })
1415
1415
  }),
1416
- /* @__PURE__ */ D(T, {
1416
+ /* @__PURE__ */ O(T, {
1417
1417
  cancelText: "取消",
1418
- confirmButtonProps: { disabled: !P || lt && !rt },
1418
+ confirmButtonProps: { disabled: !I || ct && !nt },
1419
1419
  confirmText: "送出退回",
1420
1420
  loading: p,
1421
1421
  modalType: "standard",
1422
- onCancel: xt,
1423
- onClose: xt,
1424
- onConfirm: () => void Et(),
1422
+ onCancel: yt,
1423
+ onClose: yt,
1424
+ onConfirm: () => void wt(),
1425
1425
  open: me,
1426
1426
  showModalFooter: !0,
1427
1427
  showModalHeader: !0,
1428
1428
  size: "regular",
1429
1429
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1430
1430
  title: "退回簽核",
1431
- children: /* @__PURE__ */ O("div", {
1431
+ children: /* @__PURE__ */ k("div", {
1432
1432
  style: jn,
1433
- children: [/* @__PURE__ */ D(e, {
1433
+ children: [/* @__PURE__ */ O(e, {
1434
1434
  label: "退回節點",
1435
1435
  name: "returnTargetNodeId",
1436
1436
  required: !0,
1437
- children: /* @__PURE__ */ D(ve, {
1437
+ children: /* @__PURE__ */ O(ye, {
1438
1438
  clearable: !1,
1439
1439
  fullWidth: !0,
1440
- onChange: (e) => _e(e?.id ?? null),
1441
- options: [...at],
1440
+ onChange: (e) => E(e?.id ?? null),
1441
+ options: [...it],
1442
1442
  placeholder: "選擇退回節點",
1443
- value: P
1443
+ value: I
1444
1444
  })
1445
- }), /* @__PURE__ */ D(e, {
1446
- hintText: lt ? "此關卡設定退回時必須填寫意見。" : void 0,
1445
+ }), /* @__PURE__ */ O(e, {
1446
+ hintText: ct ? "此關卡設定退回時必須填寫意見。" : void 0,
1447
1447
  label: "退回說明",
1448
1448
  name: "returnComment",
1449
- required: lt,
1450
- children: /* @__PURE__ */ D(xe, {
1451
- onChange: (e) => w(e.target.value),
1452
- placeholder: lt ? "請說明退回原因" : "可補充需要修改的內容",
1449
+ required: ct,
1450
+ children: /* @__PURE__ */ O(Se, {
1451
+ onChange: (e) => ue(e.target.value),
1452
+ placeholder: ct ? "請說明退回原因" : "可補充需要修改的內容",
1453
1453
  ref: Pn,
1454
1454
  resize: "vertical",
1455
1455
  rows: 4,
1456
1456
  style: An,
1457
- value: le
1457
+ value: se
1458
1458
  })
1459
1459
  })]
1460
1460
  })
1461
1461
  }),
1462
- /* @__PURE__ */ D(T, {
1462
+ /* @__PURE__ */ O(T, {
1463
1463
  cancelText: "取消",
1464
- confirmButtonProps: { disabled: jt },
1464
+ confirmButtonProps: { disabled: U },
1465
1465
  confirmText: "送出",
1466
- loading: Ze,
1466
+ loading: Xe,
1467
1467
  modalType: "standard",
1468
- onCancel: kt,
1469
- onClose: kt,
1470
- onConfirm: () => void At(),
1468
+ onCancel: Dt,
1469
+ onClose: Dt,
1470
+ onConfirm: () => void Ot(),
1471
1471
  open: Ke,
1472
1472
  showModalFooter: !0,
1473
1473
  showModalHeader: !0,
1474
1474
  size: "regular",
1475
- supportingText: In[A],
1476
- title: Fn[A],
1477
- children: /* @__PURE__ */ O("div", {
1475
+ supportingText: In[j],
1476
+ title: Fn[j],
1477
+ children: /* @__PURE__ */ k("div", {
1478
1478
  style: jn,
1479
1479
  children: [
1480
- B ? /* @__PURE__ */ D(e, {
1480
+ H ? /* @__PURE__ */ O(e, {
1481
1481
  label: "通知時機",
1482
1482
  name: "adhocNotifyMode",
1483
1483
  required: !0,
1484
- children: /* @__PURE__ */ D(ve, {
1484
+ children: /* @__PURE__ */ O(ye, {
1485
1485
  clearable: !1,
1486
1486
  fullWidth: !0,
1487
- onChange: (e) => Je(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1487
+ onChange: (e) => M(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1488
1488
  options: [{
1489
1489
  id: "STAGE_NOTIFY",
1490
1490
  name: Fn.STAGE_NOTIFY
@@ -1493,38 +1493,38 @@ var Fn = {
1493
1493
  name: Fn.COMPLETION_NOTIFY
1494
1494
  }],
1495
1495
  value: {
1496
- id: A,
1497
- name: Fn[A]
1496
+ id: j,
1497
+ name: Fn[j]
1498
1498
  }
1499
1499
  })
1500
1500
  }) : null,
1501
- B ? /* @__PURE__ */ D(e, {
1501
+ H ? /* @__PURE__ */ O(e, {
1502
1502
  label: "通知對象類型",
1503
1503
  name: "adhocTargetKind",
1504
1504
  required: !0,
1505
- children: /* @__PURE__ */ D(ve, {
1505
+ children: /* @__PURE__ */ O(ye, {
1506
1506
  clearable: !1,
1507
1507
  fullWidth: !0,
1508
- onChange: (e) => et(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1508
+ onChange: (e) => $e(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1509
1509
  options: [...Rn],
1510
- value: Nt
1510
+ value: jt
1511
1511
  })
1512
1512
  }) : null,
1513
- B && $e === "WEBHOOK" ? /* @__PURE__ */ D(e, {
1513
+ H && Qe === "WEBHOOK" ? /* @__PURE__ */ O(e, {
1514
1514
  label: "Webhook URL",
1515
1515
  name: "adhocWebhookUrl",
1516
1516
  required: !0,
1517
- children: /* @__PURE__ */ D(pe, {
1517
+ children: /* @__PURE__ */ O(he, {
1518
1518
  fullWidth: !0,
1519
- onChange: (e) => j(e.target.value),
1519
+ onChange: (e) => tt(e.target.value),
1520
1520
  placeholder: "https://example.com/webhook",
1521
- value: tt
1521
+ value: et
1522
1522
  })
1523
- }) : /* @__PURE__ */ D(e, {
1524
- label: B ? "通知對象" : "簽核對象",
1523
+ }) : /* @__PURE__ */ O(e, {
1524
+ label: H ? "通知對象" : "簽核對象",
1525
1525
  name: "adhocMemberId",
1526
1526
  required: !0,
1527
- children: /* @__PURE__ */ D(ue, {
1527
+ children: /* @__PURE__ */ O(de, {
1528
1528
  asyncData: !0,
1529
1529
  disabledOptionsFilter: !0,
1530
1530
  emptyText: "沒有符合的成員",
@@ -1534,14 +1534,14 @@ var Fn = {
1534
1534
  name: "adhoc-member-search",
1535
1535
  spellCheck: !1
1536
1536
  },
1537
- loading: He,
1537
+ loading: Ve,
1538
1538
  loadingText: "搜尋成員中...",
1539
1539
  menuMaxHeight: 320,
1540
1540
  mode: "multiple",
1541
- onChange: (e) => Be(e.map(Wt).filter(Ut)),
1542
- onSearch: R,
1541
+ onChange: (e) => Be(e.map(Ht).filter(q)),
1542
+ onSearch: V,
1543
1543
  onVisibilityChange: (e) => {
1544
- e && R("");
1544
+ e && V("");
1545
1545
  },
1546
1546
  options: [...We],
1547
1547
  overflowStrategy: "wrap",
@@ -1550,23 +1550,23 @@ var Fn = {
1550
1550
  value: [...ze]
1551
1551
  })
1552
1552
  }),
1553
- A === "PRE_APPROVAL" ? /* @__PURE__ */ D(e, {
1553
+ j === "PRE_APPROVAL" ? /* @__PURE__ */ O(e, {
1554
1554
  label: "拒簽處理方式",
1555
1555
  name: "adhocOnReject",
1556
1556
  required: !0,
1557
- children: /* @__PURE__ */ D(ve, {
1557
+ children: /* @__PURE__ */ O(ye, {
1558
1558
  clearable: !1,
1559
1559
  fullWidth: !0,
1560
- onChange: (e) => Xe(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1560
+ onChange: (e) => Ye(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1561
1561
  options: [...Ln],
1562
- value: Mt
1562
+ value: At
1563
1563
  })
1564
1564
  }) : null,
1565
- B ? null : /* @__PURE__ */ D(e, {
1565
+ H ? null : /* @__PURE__ */ O(e, {
1566
1566
  label: "說明",
1567
1567
  name: "adhocComment",
1568
- children: /* @__PURE__ */ D(xe, {
1569
- onChange: (e) => Re(e.target.value),
1568
+ children: /* @__PURE__ */ O(Se, {
1569
+ onChange: (e) => Ie(e.target.value),
1570
1570
  placeholder: "可補充原因",
1571
1571
  ref: Pn,
1572
1572
  resize: "vertical",
@@ -1583,7 +1583,7 @@ var Fn = {
1583
1583
  function Bn(e, t) {
1584
1584
  try {
1585
1585
  let n = JSON.parse(e.targetValueJson);
1586
- if (n.memberIds?.length) return n.memberIds.map((e) => W(e, t)).join("、");
1586
+ if (n.memberIds?.length) return n.memberIds.map((e) => K(e, t)).join("、");
1587
1587
  if (n.webhookUrl) return n.webhookUrl;
1588
1588
  if (n.positionId) return `職位 ${n.positionId}`;
1589
1589
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
@@ -1601,14 +1601,14 @@ var Hn = {
1601
1601
  gap: 16
1602
1602
  };
1603
1603
  function Un({ signatureVerification: e, signatures: n }) {
1604
- let r = b(() => n.map((e) => ({
1604
+ let r = x(() => n.map((e) => ({
1605
1605
  algorithm: e.algorithm,
1606
- hashLabel: H(e.signedPayloadHash),
1606
+ hashLabel: Mt(e.signedPayloadHash),
1607
1607
  key: e.id,
1608
1608
  keyVersion: e.keyVersion,
1609
1609
  signedAtLabel: t(e.signedAt),
1610
1610
  signerMemberId: e.signerMemberId
1611
- })), [n]), i = b(() => [
1611
+ })), [n]), i = x(() => [
1612
1612
  {
1613
1613
  dataIndex: "signerMemberId",
1614
1614
  key: "signerMemberId",
@@ -1640,20 +1640,20 @@ function Un({ signatureVerification: e, signatures: n }) {
1640
1640
  width: 220
1641
1641
  }
1642
1642
  ], []);
1643
- return /* @__PURE__ */ O("div", {
1643
+ return /* @__PURE__ */ k("div", {
1644
1644
  style: Hn,
1645
1645
  children: [
1646
- /* @__PURE__ */ D(E, {
1646
+ /* @__PURE__ */ O(D, {
1647
1647
  component: "h2",
1648
1648
  variant: "h3",
1649
1649
  children: "簽章"
1650
1650
  }),
1651
- /* @__PURE__ */ D(E, {
1651
+ /* @__PURE__ */ O(D, {
1652
1652
  color: e?.valid ? "text-success" : "text-error",
1653
1653
  variant: "body",
1654
1654
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1655
1655
  }),
1656
- r.length > 0 ? /* @__PURE__ */ D(be, {
1656
+ r.length > 0 ? /* @__PURE__ */ O(xe, {
1657
1657
  columns: i,
1658
1658
  dataSource: r,
1659
1659
  fullWidth: !0
@@ -1684,35 +1684,35 @@ var Wn = {
1684
1684
  color: "var(--mzn-color-text-error)"
1685
1685
  };
1686
1686
  function Yn(...e) {
1687
- return e.filter((e) => B(e ?? null)).join(" ");
1687
+ return e.filter((e) => H(e ?? null)).join(" ");
1688
1688
  }
1689
- var Xn = y(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) {
1689
+ var Xn = b(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) {
1690
1690
  let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
1691
- return /* @__PURE__ */ O("div", {
1691
+ return /* @__PURE__ */ k("div", {
1692
1692
  ...l,
1693
- className: Yn(F.host, c === "dot" ? F.dot : null, n && d !== "processing" ? F.error : null, a === "horizontal" ? F.horizontal : null, c === "number" ? F.number : null, d === "pending" ? F.pending : null, d === "processing" ? F.processing : null, n && d === "processing" ? F.processingError : null, !n && d === "succeeded" ? F.succeeded : null, a === "vertical" ? F.vertical : null, e),
1693
+ className: Yn(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),
1694
1694
  ref: u,
1695
- children: [c === "dot" ? /* @__PURE__ */ D("span", { className: Yn(F.statusIndicator, F.statusIndicatorDot) }) : /* @__PURE__ */ D("span", {
1696
- className: F.statusIndicator,
1695
+ children: [c === "dot" ? /* @__PURE__ */ O("span", { className: Yn(R.statusIndicator, R.statusIndicatorDot) }) : /* @__PURE__ */ O("span", {
1696
+ className: R.statusIndicator,
1697
1697
  children: i + 1
1698
- }), /* @__PURE__ */ O("div", {
1699
- className: F.textContainer,
1698
+ }), /* @__PURE__ */ k("div", {
1699
+ className: R.textContainer,
1700
1700
  children: [
1701
- /* @__PURE__ */ O(E, {
1702
- className: F.title,
1701
+ /* @__PURE__ */ k(D, {
1702
+ className: R.title,
1703
1703
  variant: "label-primary-highlight",
1704
- children: [s, /* @__PURE__ */ D("span", { className: F.titleConnectLine })]
1704
+ children: [s, /* @__PURE__ */ O("span", { className: R.titleConnectLine })]
1705
1705
  }),
1706
- f.length > 0 ? /* @__PURE__ */ D(E, {
1707
- className: F.description,
1706
+ f.length > 0 ? /* @__PURE__ */ O(D, {
1707
+ className: R.description,
1708
1708
  component: "div",
1709
1709
  variant: "body",
1710
- children: f.map((e, t) => /* @__PURE__ */ O(ae, { children: [t > 0 ? " · " : null, Zn(e)] }, `${e.type}-${t}`))
1710
+ children: f.map((e, t) => /* @__PURE__ */ k(y, { children: [t > 0 ? " · " : null, Zn(e)] }, `${e.type}-${t}`))
1711
1711
  }) : null,
1712
- p.map((e, t) => /* @__PURE__ */ O(E, {
1712
+ p.map((e, t) => /* @__PURE__ */ k(D, {
1713
1713
  style: e.tone === "danger" ? Jn : Kn,
1714
1714
  variant: "body",
1715
- children: [/* @__PURE__ */ O("span", {
1715
+ children: [/* @__PURE__ */ k("span", {
1716
1716
  style: e.tone === "danger" ? void 0 : qn,
1717
1717
  children: [e.label, ":"]
1718
1718
  }), e.text]
@@ -1722,12 +1722,12 @@ var Xn = y(function({ className: e, descriptionParts: t, error: n, forcePending:
1722
1722
  });
1723
1723
  });
1724
1724
  function Zn(e) {
1725
- return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ O(Ce, { children: [
1725
+ return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ k(we, { children: [
1726
1726
  e.prefix,
1727
1727
  ":",
1728
- /* @__PURE__ */ D(Se, {
1728
+ /* @__PURE__ */ O(Ce, {
1729
1729
  title: e.email,
1730
- children: ({ ref: t, ...n }) => /* @__PURE__ */ D("span", {
1730
+ children: ({ ref: t, ...n }) => /* @__PURE__ */ O("span", {
1731
1731
  ...n,
1732
1732
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1733
1733
  ref: t,
@@ -1738,7 +1738,7 @@ function Zn(e) {
1738
1738
  ] }) : `${e.prefix}:${e.label}`;
1739
1739
  }
1740
1740
  function Qn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisions: o = null, taskDecisionsByTaskId: s, tasks: c, workflowSnapshot: l, workflowTokens: u }) {
1741
- let d = b(() => hn(e, c, u, l, n, r, s, a, i, t, o), [
1741
+ let d = x(() => hn(e, c, u, l, n, r, s, a, i, t, o), [
1742
1742
  e,
1743
1743
  t,
1744
1744
  n,
@@ -1750,27 +1750,27 @@ function Qn({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1750
1750
  c,
1751
1751
  l,
1752
1752
  u
1753
- ]), f = Y(d), p = d.map((e) => ({
1753
+ ]), f = Kt(d), p = d.map((e) => ({
1754
1754
  ...e,
1755
- descriptionParts: e.descriptionParts.filter(J)
1755
+ descriptionParts: e.descriptionParts.filter(Y)
1756
1756
  }));
1757
- return /* @__PURE__ */ O("div", {
1757
+ return /* @__PURE__ */ k("div", {
1758
1758
  style: Wn,
1759
- children: [/* @__PURE__ */ D(E, {
1759
+ children: [/* @__PURE__ */ O(D, {
1760
1760
  component: "h2",
1761
1761
  variant: "h3",
1762
1762
  children: "歷程"
1763
- }), p.length > 0 ? /* @__PURE__ */ D(ye, {
1763
+ }), p.length > 0 ? /* @__PURE__ */ O(be, {
1764
1764
  currentStep: f,
1765
1765
  orientation: "vertical",
1766
1766
  type: "dot",
1767
- children: p.map((e) => /* @__PURE__ */ D(Xn, {
1767
+ children: p.map((e) => /* @__PURE__ */ O(Xn, {
1768
1768
  descriptionParts: e.descriptionParts,
1769
1769
  error: e.error,
1770
1770
  forcePending: e.forcePending,
1771
1771
  title: e.title
1772
1772
  }, e.id))
1773
- }) : /* @__PURE__ */ D(E, {
1773
+ }) : /* @__PURE__ */ O(D, {
1774
1774
  color: "text-neutral",
1775
1775
  variant: "body",
1776
1776
  children: "尚無歷程紀錄。"
@@ -1789,19 +1789,19 @@ var $n = {
1789
1789
  whiteSpace: "pre-wrap"
1790
1790
  };
1791
1791
  function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1792
- let [r, i] = x(null), [a, o] = x(!1), [s, c] = x(null), l = b(() => e.map((e) => ({
1792
+ let [r, i] = S(null), [a, o] = S(!1), [s, c] = S(null), l = x(() => e.map((e) => ({
1793
1793
  delivery: e,
1794
1794
  key: e.id
1795
- })), [e]), u = b(() => [
1795
+ })), [e]), u = x(() => [
1796
1796
  {
1797
1797
  key: "endpoint",
1798
- render: ({ delivery: e }) => /* @__PURE__ */ O("div", {
1798
+ render: ({ delivery: e }) => /* @__PURE__ */ k("div", {
1799
1799
  style: er,
1800
- children: [/* @__PURE__ */ D(E, {
1800
+ children: [/* @__PURE__ */ O(D, {
1801
1801
  component: "span",
1802
1802
  variant: "body",
1803
1803
  children: e.endpointLabel ?? e.endpointKey
1804
- }), /* @__PURE__ */ O(E, {
1804
+ }), /* @__PURE__ */ k(D, {
1805
1805
  color: "text-neutral",
1806
1806
  component: "span",
1807
1807
  variant: "caption",
@@ -1820,13 +1820,13 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1820
1820
  },
1821
1821
  {
1822
1822
  key: "status",
1823
- render: ({ delivery: e }) => /* @__PURE__ */ D(rr, { status: e.status }),
1823
+ render: ({ delivery: e }) => /* @__PURE__ */ O(rr, { status: e.status }),
1824
1824
  title: "狀態",
1825
1825
  width: 120
1826
1826
  },
1827
1827
  {
1828
1828
  key: "attemptCount",
1829
- render: ({ delivery: e }) => /* @__PURE__ */ D(E, {
1829
+ render: ({ delivery: e }) => /* @__PURE__ */ O(D, {
1830
1830
  component: "span",
1831
1831
  variant: "body",
1832
1832
  children: e.attemptCount
@@ -1836,21 +1836,21 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1836
1836
  },
1837
1837
  {
1838
1838
  key: "lastError",
1839
- render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ O("div", {
1839
+ render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ k("div", {
1840
1840
  style: er,
1841
- children: [/* @__PURE__ */ D(E, {
1841
+ children: [/* @__PURE__ */ O(D, {
1842
1842
  color: "text-error",
1843
1843
  component: "span",
1844
1844
  variant: "body",
1845
1845
  children: e.lastErrorCode
1846
- }), e.lastErrorDetail ? /* @__PURE__ */ D(E, {
1846
+ }), e.lastErrorDetail ? /* @__PURE__ */ O(D, {
1847
1847
  color: "text-neutral",
1848
1848
  component: "span",
1849
1849
  style: tr,
1850
1850
  variant: "caption",
1851
1851
  children: e.lastErrorDetail
1852
1852
  }) : null]
1853
- }) : /* @__PURE__ */ D(E, {
1853
+ }) : /* @__PURE__ */ O(D, {
1854
1854
  color: "text-neutral",
1855
1855
  component: "span",
1856
1856
  variant: "body",
@@ -1861,7 +1861,7 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1861
1861
  },
1862
1862
  {
1863
1863
  key: "time",
1864
- render: ({ delivery: e }) => /* @__PURE__ */ D(E, {
1864
+ render: ({ delivery: e }) => /* @__PURE__ */ O(D, {
1865
1865
  component: "span",
1866
1866
  variant: "body",
1867
1867
  children: ir(e)
@@ -1869,7 +1869,7 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1869
1869
  title: "時間",
1870
1870
  width: 220
1871
1871
  }
1872
- ], [n]), d = b(() => ({
1872
+ ], [n]), d = x(() => ({
1873
1873
  render: ({ delivery: e }) => e.status === "FAILED" && e.attemptCount > 0 ? [{
1874
1874
  disabled: () => a,
1875
1875
  icon: Qe,
@@ -1894,30 +1894,30 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1894
1894
  }
1895
1895
  }
1896
1896
  }
1897
- return /* @__PURE__ */ O("div", {
1897
+ return /* @__PURE__ */ k("div", {
1898
1898
  style: $n,
1899
1899
  children: [
1900
- /* @__PURE__ */ D(E, {
1900
+ /* @__PURE__ */ O(D, {
1901
1901
  component: "h2",
1902
1902
  variant: "h3",
1903
1903
  children: "外部系統通知"
1904
1904
  }),
1905
- s ? /* @__PURE__ */ D(E, {
1905
+ s ? /* @__PURE__ */ O(D, {
1906
1906
  color: "text-error",
1907
1907
  variant: "body",
1908
1908
  children: s
1909
1909
  }) : null,
1910
- l.length > 0 ? /* @__PURE__ */ D(be, {
1910
+ l.length > 0 ? /* @__PURE__ */ O(xe, {
1911
1911
  actions: d,
1912
1912
  columns: u,
1913
1913
  dataSource: l,
1914
1914
  fullWidth: !0
1915
- }) : /* @__PURE__ */ D(E, {
1915
+ }) : /* @__PURE__ */ O(D, {
1916
1916
  color: "text-neutral",
1917
1917
  variant: "body",
1918
1918
  children: "此案件沒有外部系統通知。"
1919
1919
  }),
1920
- /* @__PURE__ */ D(T, {
1920
+ /* @__PURE__ */ O(T, {
1921
1921
  cancelText: "取消",
1922
1922
  confirmText: "重新傳送",
1923
1923
  loading: a,
@@ -1931,7 +1931,7 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1931
1931
  showModalHeader: !0,
1932
1932
  supportingText: "會以相同的投遞編號重新送出,接收端可據此避免重複處理。",
1933
1933
  title: "重新傳送通知",
1934
- children: /* @__PURE__ */ O(E, {
1934
+ children: /* @__PURE__ */ k(D, {
1935
1935
  variant: "body",
1936
1936
  children: [
1937
1937
  "確定要重新通知「",
@@ -1944,15 +1944,15 @@ function nr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1944
1944
  });
1945
1945
  }
1946
1946
  function rr({ status: e }) {
1947
- return e === "SENT" ? /* @__PURE__ */ D(de, {
1947
+ return e === "SENT" ? /* @__PURE__ */ O(fe, {
1948
1948
  size: "sub",
1949
1949
  text: "已送達",
1950
1950
  variant: "dot-success"
1951
- }) : e === "FAILED" ? /* @__PURE__ */ D(de, {
1951
+ }) : e === "FAILED" ? /* @__PURE__ */ O(fe, {
1952
1952
  size: "sub",
1953
1953
  text: "失敗",
1954
1954
  variant: "dot-error"
1955
- }) : /* @__PURE__ */ D(de, {
1955
+ }) : /* @__PURE__ */ O(fe, {
1956
1956
  size: "sub",
1957
1957
  text: e === "PENDING" ? "等待傳送" : "傳送中",
1958
1958
  variant: "dot-info"
@@ -1968,7 +1968,7 @@ function ar(e, t) {
1968
1968
  }
1969
1969
  function or({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1970
1970
  let i = n.workflowSnapshot;
1971
- return M({
1971
+ return F({
1972
1972
  definition: i,
1973
1973
  fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
1974
1974
  isAdhocTask: t?.isAdhoc ?? !1,
@@ -1978,7 +1978,7 @@ function or({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1978
1978
  }
1979
1979
  // src/views/instances/detail/InstanceDetailView.tsx
1980
1980
  function sr(e) {
1981
- return `還有 ${new Set(Object.keys(e).map(it)).size} 個補填欄位需要完成`;
1981
+ return `還有 ${new Set(Object.keys(e).map(P)).size} 個補填欄位需要完成`;
1982
1982
  }
1983
1983
  var cr = 3e3, lr = 40, ur = 184, dr = 96, fr = {
1984
1984
  display: "grid",
@@ -2034,25 +2034,25 @@ var cr = 3e3, lr = 40, ur = 184, dr = 96, fr = {
2034
2034
  display: "grid",
2035
2035
  gap: 16
2036
2036
  }, xr = { workflowRuntime: jr };
2037
- function Sr({ instanceId: i, showAttachments: o = !0, showForm: c = !0, showHistory: l = !0, showSignatures: u = !0, showTasks: d = !0, showWebhookDeliveries: f = !0 }) {
2038
- let { member: ae } = n(), y = ae?.memberId ?? null, ce = f && r(ae), [ue, de] = x([]), [C, fe] = x(null), [w, pe] = x([]), [ve, ye] = x([]), [be, Se] = x([]), [we, Ee] = x([]), [De, Oe] = x(null), [k, Ie] = x([]), [Le, Re] = x([]), [Ve, Ge] = x([]), [Ke, A] = x(null), [Je, Qe] = x(!0), [tt, j] = x(!1), [rt, it] = x(!1), [M, ot] = x(!1), [ct, dt] = x(!1), [P, pt] = x(""), [mt, ht] = x(!1), [gt, F] = x({}), [I, vt] = x({}), { clearAfterResubmit: yt, comment: bt, setComment: xt } = bn(i), [St, Ct] = x({}), [L, Tt] = x(null), [Et, Ot] = x(null), [kt, R] = x([]), At = P.trim(), z = le(null), jt = le(0), Mt = we.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2039
- se(() => {
2040
- Q();
2041
- }, [y, i]), se(() => {
2042
- if (!ce || !Mt || jt.current >= lr) return;
2037
+ function Sr({ instanceId: a, showAttachments: s = !0, showForm: l = !0, showHistory: u = !0, showSignatures: d = !0, showTasks: f = !0, showWebhookDeliveries: p = !0 }) {
2038
+ let { member: y } = n(), b = y?.memberId ?? null, le = p && r(y), [de, fe] = S([]), [w, pe] = S(null), [me, he] = S([]), [ye, be] = S([]), [xe, Ce] = S([]), [Te, De] = S([]), [Oe, ke] = S(null), [A, Le] = S([]), [Re, ze] = S([]), [He, Ke] = S([]), [qe, M] = S(null), [Je, Qe] = S(!0), [tt, N] = S(!1), [rt, P] = S(!1), [F, st] = S(!1), [ut, I] = S(!1), [ft, pt] = S(""), [mt, L] = S(!1), [R, z] = S({}), [gt, _t] = S({}), { clearAfterResubmit: vt, comment: yt, setComment: bt } = xn(a), [xt, St] = S({}), [B, wt] = S(null), [Et, Dt] = S(null), [V, Ot] = S([]), kt = ft.trim(), U = ue(null), At = ue(0), jt = Te.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2039
+ ce(() => {
2040
+ dn();
2041
+ }, [b, a]), ce(() => {
2042
+ if (!le || !jt || At.current >= lr) return;
2043
2043
  let e = setTimeout(() => {
2044
- jt.current += 1, fn();
2044
+ At.current += 1, mn();
2045
2045
  }, cr);
2046
2046
  return () => clearTimeout(e);
2047
2047
  }, [
2048
- ce,
2049
- Mt,
2050
- we
2051
- ]), se(() => {
2052
- vt(C?.formData ?? {}), Ct({});
2053
- }, [C]);
2054
- let Nt = oe((e, t) => {
2055
- Ct((n) => {
2048
+ le,
2049
+ jt,
2050
+ Te
2051
+ ]), ce(() => {
2052
+ _t(w?.formData ?? {}), St({});
2053
+ }, [w]);
2054
+ let Mt = se((e, t) => {
2055
+ St((n) => {
2056
2056
  let r = n[e];
2057
2057
  return r?.hasValue === t.hasValue && r.status === t.status ? n : {
2058
2058
  ...n,
@@ -2062,274 +2062,281 @@ function Sr({ instanceId: i, showAttachments: o = !0, showForm: c = !0, showHist
2062
2062
  }
2063
2063
  };
2064
2064
  });
2065
- }, []), H = b(() => Bt(k, y), [y, k]), U = b(() => H && C ? C.workflowSnapshot.nodes.find((e) => e.id === H.nodeId) ?? null : null, [H, C]), Ft = U?.type === "userTask" && U.data.returnBehavior.allowReturn, It = U?.type === "userTask" && U.data.allowReject !== !1, Rt = U?.type === "userTask" && U.data.allowTransfer !== !1, zt = U?.type === "userTask" && U.data.allowAddSigner, Vt = !(!C || C.initiatorMemberId !== y || C.state !== "RUNNING" && C.state !== "RETURNED"), Ht = !!(C && C.initiatorMemberId === y && C.state === "RETURNED"), G = b(() => H && !H.isAdhoc && U?.type === "userTask" && nt(U).size > 0 ? U : null, [H, U]), Ut = G ? H?.id ?? null : null, [Wt, Gt] = x({}), [K, q] = x({}), [Kt, J] = x(!1);
2066
- se(() => {
2067
- Gt({}), q({}), J(!1);
2068
- }, [Ut]);
2069
- let Y = C?.formDefinitionSnapshot.schema ?? null, X = b(() => G && Y ? p(Y, G) : null, [G, Y]), Z = b(() => X && C ? N(X.fields, {
2070
- ...C.formData,
2071
- ...Wt
2065
+ }, []), W = x(() => Rt(A, b), [b, A]), G = x(() => W && w ? w.workflowSnapshot.nodes.find((e) => e.id === W.nodeId) ?? null : null, [W, w]), Pt = G?.type === "userTask" && G.data.returnBehavior.allowReturn, It = G?.type === "userTask" && G.data.allowReject !== !1, Lt = G?.type === "userTask" && G.data.allowTransfer !== !1, zt = G?.type === "userTask" && G.data.allowAddSigner, Bt = !(!w || w.initiatorMemberId !== b || w.state !== "RUNNING" && w.state !== "RETURNED"), Vt = !!(w && w.initiatorMemberId === b && w.state === "RETURNED"), q = x(() => W && !W.isAdhoc && G?.type === "userTask" && nt(G).size > 0 ? G : null, [W, G]), Ht = q ? W?.id ?? null : null, Ut = o(), [J, Wt] = S({}), [Gt, Y] = S({}), [Kt, qt] = S(!1);
2066
+ ce(() => {
2067
+ Wt({}), Y({}), qt(!1);
2068
+ }, [Ht]);
2069
+ let X = w?.formDefinitionSnapshot.schema ?? null, Z = x(() => q && X ? ie(X, q) : null, [q, X]), Q = x(() => Z && w ? it(Z.fields, {
2070
+ ...w.formData,
2071
+ ...J
2072
2072
  }) : null, [
2073
- Wt,
2074
- X,
2075
- C
2076
- ]), qt = b(() => G && X && Z && C ? g({
2077
- draft: Wt,
2078
- node: G,
2079
- schema: X,
2080
- stored: C.formData,
2081
- values: Z
2073
+ J,
2074
+ Z,
2075
+ w
2076
+ ]), Jt = x(() => q && Z && Q && w ? m({
2077
+ draft: J,
2078
+ node: q,
2079
+ schema: Z,
2080
+ stored: w.formData,
2081
+ values: Q
2082
2082
  }) : {}, [
2083
- Wt,
2084
- G,
2085
- X,
2083
+ J,
2084
+ q,
2086
2085
  Z,
2087
- C
2088
- ]), Jt = b(() => C ? or({
2089
- activityLogs: ue,
2090
- actingTask: H,
2091
- instance: C,
2092
- tasks: k
2086
+ Q,
2087
+ w
2088
+ ]), Yt = x(() => w ? or({
2089
+ activityLogs: de,
2090
+ actingTask: W,
2091
+ instance: w,
2092
+ tasks: A
2093
2093
  }) : void 0, [
2094
- ue,
2095
- H,
2096
- C,
2097
- k
2098
- ]), Yt = b(() => C ? ne(C.workflowSnapshot, G) : void 0, [G, C]), Xt = b(() => new Map(Ve.map((e) => [e.memberId, e])), [Ve]), Zt = _t(b(() => Y ? re(Y, qt) : [], [qt, Y])), Qt = b(() => G && Z && Y && C?.formDataFingerprint ? {
2099
- expectedFormDataFingerprint: C.formDataFingerprint,
2100
- formData: m(qt, G),
2101
- summary: v(Y, G, qt, new Map([...Xt.keys()].map((e) => [e, W(e, Xt)])), Zt)
2094
+ de,
2095
+ W,
2096
+ w,
2097
+ A
2098
+ ]), Xt = x(() => w ? oe(w.workflowSnapshot, q) : void 0, [q, w]), Zt = x(() => new Map(He.map((e) => [e.memberId, e])), [He]), Qt = ht(x(() => X ? h(X, Jt) : [], [Jt, X])), $t = x(() => q && Q && X && w?.formDataFingerprint ? {
2099
+ expectedFormDataFingerprint: w.formDataFingerprint,
2100
+ formData: ne(Jt, q),
2101
+ summary: g(X, q, Jt, new Map([...Zt.keys()].map((e) => [e, K(e, Zt)])), Qt)
2102
2102
  } : null, [
2103
- qt,
2104
- G,
2103
+ Jt,
2104
+ q,
2105
+ Qt,
2106
+ Q,
2107
+ w,
2105
2108
  Zt,
2106
- Z,
2107
- C,
2108
- Xt,
2109
- Y
2109
+ X
2110
2110
  ]);
2111
- function $t(e) {
2112
- if (!G) return;
2113
- let t = nt(G), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Z?.[e]));
2114
- Gt((e) => ({
2111
+ function en(e) {
2112
+ if (!q) return;
2113
+ let t = nt(q), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2114
+ Wt((e) => ({
2115
2115
  ...e,
2116
2116
  ...Object.fromEntries(n)
2117
- })), q({});
2117
+ })), Y({});
2118
2118
  }
2119
- async function en() {
2120
- if (G && !C?.formDataFingerprint) me.error("無法確認表單版本,請重新整理頁面後再同意。");
2119
+ async function tn() {
2120
+ if (q && !w?.formDataFingerprint) ge.error("無法確認表單版本,請重新整理頁面後再同意。");
2121
2121
  else {
2122
- if (G && Z && Y && C?.formDefinitionSnapshot.uiSchema) {
2123
- it(!0);
2124
- let e = await st({
2125
- schema: h(Y, G),
2126
- uiSchema: C.formDefinitionSnapshot.uiSchema,
2127
- values: Z
2128
- }).catch((e) => (me.error(V(e)), null)).finally(() => it(!1));
2122
+ if (q && Q && X && w?.formDefinitionSnapshot.uiSchema) {
2123
+ P(!0);
2124
+ let e = await ot({
2125
+ schema: ee(X, q),
2126
+ uiSchema: w.formDefinitionSnapshot.uiSchema,
2127
+ values: Q
2128
+ }).catch((e) => (ge.error(_(e)), null)).finally(() => P(!1));
2129
2129
  if (!e) return;
2130
2130
  if (!e.valid) {
2131
- q(e.errors), e.firstInvalidFieldKey && at(e.firstInvalidFieldKey), me.warning(sr(e.errors));
2131
+ Y(e.errors), e.firstInvalidFieldKey && at(e.firstInvalidFieldKey), ge.warning(sr(e.errors));
2132
2132
  return;
2133
2133
  }
2134
2134
  }
2135
- z.current?.handleApprove();
2135
+ U.current?.handleApprove();
2136
2136
  }
2137
2137
  }
2138
- function tn(e) {
2139
- if (!G || !Y) return !1;
2140
- if (ie(e)) return J(!0), !0;
2141
- let t = ee(e, Y, G);
2142
- return t ? (q(t), at(Object.keys(t)[0] ?? ""), me.warning(sr(t)), !0) : !1;
2138
+ function nn(e) {
2139
+ if (!q || !X) return !1;
2140
+ if (re(e)) return qt(!0), !0;
2141
+ let t = v(e, X, q);
2142
+ return t ? (Y(t), at(Object.keys(t)[0] ?? ""), ge.warning(sr(t)), !0) : !1;
2143
2143
  }
2144
- async function nn() {
2145
- await Q(), J(!1);
2144
+ async function rn() {
2145
+ await dn(), qt(!1);
2146
2146
  }
2147
- let rn = b(() => s(w), [w]), an = b(() => new Map(be.map((e) => [e.id, e])), [be]), on = b(() => C ? Dr(C.workflowSnapshot) : null, [C]), sn = b(() => C && on ? Er(on, k, Le, C.state) : [], [
2148
- C,
2149
- on,
2150
- k,
2151
- Le
2152
- ]), cn = b(() => on ? Or(on) : [], [on]), ln = b(() => C ? wr(C.workflowSnapshot) : [], [C]);
2153
- async function Q() {
2154
- Qe(!0), A(null);
2147
+ let an = x(() => c(me), [me]), on = x(() => new Map(xe.map((e) => [e.id, e])), [xe]), sn = x(() => w ? Dr(w.workflowSnapshot) : null, [w]), cn = x(() => w && sn ? Er(sn, A, Re, w.state) : [], [
2148
+ w,
2149
+ sn,
2150
+ A,
2151
+ Re
2152
+ ]), ln = x(() => sn ? Or(sn) : [], [sn]), un = x(() => w ? wr(w.workflowSnapshot) : [], [w]);
2153
+ async function dn() {
2154
+ Qe(!0), M(null);
2155
2155
  try {
2156
- let e = await Me(i);
2157
- de(e.activityLogs), fe(e.instance), Ie(e.tasks), Re(e.workflowTokens);
2158
- let t = await ke(e.instance.id), [n, r, a, o, s] = await Promise.all([
2159
- yn(e.tasks),
2156
+ let e = await Ne(a);
2157
+ fe(e.activityLogs), pe(e.instance), Le(e.tasks), ze(e.workflowTokens);
2158
+ let t = await Ae(e.instance.id), [n, r, i, o, s] = await Promise.all([
2159
+ bn(e.tasks),
2160
2160
  vn({
2161
2161
  ...e,
2162
2162
  adhocDirectives: t
2163
2163
  }),
2164
- Ae(e.instance.id),
2165
- Fe(e.instance.id),
2166
- un(e.instance.id)
2164
+ je(e.instance.id),
2165
+ Ie(e.instance.id),
2166
+ fn(e.instance.id)
2167
2167
  ]);
2168
- pe(n), Ge(r), ye(a), Se(o.signatures), Oe(o.verification), R(t), Ee(s);
2168
+ he(n), Ke(r), be(i), Ce(o.signatures), ke(o.verification), Ot(t), De(s);
2169
2169
  } catch (e) {
2170
- A(V(e));
2170
+ M(_(e));
2171
2171
  } finally {
2172
2172
  Qe(!1);
2173
2173
  }
2174
2174
  }
2175
- async function un(e) {
2176
- return ce ? je(e).catch(() => []) : [];
2175
+ async function fn(e) {
2176
+ return le ? Me(e).catch(() => []) : [];
2177
2177
  }
2178
- async function dn(e) {
2179
- await Be(e.id), jt.current = 0, await Q();
2178
+ async function pn(e) {
2179
+ await Ve(e.id), At.current = 0, await dn();
2180
2180
  }
2181
- async function fn() {
2182
- let e = await un(i);
2183
- e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? Ee(e) : await Q();
2181
+ async function mn() {
2182
+ let e = await fn(a);
2183
+ e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? De(e) : await dn();
2184
2184
  }
2185
- async function pn(e, t) {
2186
- if (!y) throw Error("尚未登入,無法上傳附件");
2187
- return { id: (await He({
2185
+ async function hn(e, t) {
2186
+ if (!b) throw Error("尚未登入,無法上傳附件");
2187
+ return { id: (await Ue({
2188
2188
  file: t,
2189
2189
  formFieldPath: `form.${e.fieldKey}`
2190
2190
  })).id };
2191
2191
  }
2192
- async function mn(e) {
2193
- if (!y) return;
2194
- let t = await Ne({ id: e.id });
2195
- window.open(t, "_blank", "noopener,noreferrer");
2192
+ async function gn(e) {
2193
+ if (b) try {
2194
+ let t = await Pe({ id: e });
2195
+ window.open(t, "_blank", "noopener,noreferrer");
2196
+ } catch (e) {
2197
+ ge.error(_(e));
2198
+ }
2196
2199
  }
2197
- async function hn(e) {
2198
- if (!y) return;
2199
- let t = await Pe({ id: e.id });
2200
- Tt(e), Ot(t);
2200
+ async function _n(e) {
2201
+ if (!b) return;
2202
+ let t = await Fe({ id: e.id });
2203
+ wt(e), Dt(t);
2201
2204
  }
2202
- async function gn() {
2203
- if (y && C && Vt) {
2204
- j(!0), A(null), F({});
2205
+ async function yn() {
2206
+ if (b && w && Bt) {
2207
+ N(!0), M(null), z({});
2205
2208
  try {
2206
- await Te({
2207
- cancelledByMemberId: y,
2208
- comment: At || null,
2209
- instanceId: C.id
2210
- }), pt(""), ht(!1), await Q();
2209
+ await Ee({
2210
+ cancelledByMemberId: b,
2211
+ comment: kt || null,
2212
+ instanceId: w.id
2213
+ }), pt(""), L(!1), await dn();
2211
2214
  } catch (e) {
2212
- A(V(e));
2215
+ M(_(e));
2213
2216
  } finally {
2214
- j(!1);
2217
+ N(!1);
2215
2218
  }
2216
2219
  }
2217
2220
  }
2218
- async function _n() {
2219
- if (!y || !C || !Ht) return;
2220
- j(!0), A(null), F({});
2221
- let e = a(Object.values(St));
2221
+ async function Sn() {
2222
+ if (!b || !w || !Vt) return;
2223
+ N(!0), M(null), z({});
2224
+ let e = i(Object.values(xt));
2222
2225
  if (e) {
2223
- A(e), j(!1);
2226
+ M(e), N(!1);
2224
2227
  return;
2225
2228
  }
2226
- let t = C.formDefinitionSnapshot.schema ? te(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = _(t ? N(t.fields, I) : I, C.workflowSnapshot);
2229
+ if (Ut.blockMessage) {
2230
+ M(Ut.blockMessage), N(!1);
2231
+ return;
2232
+ }
2233
+ let t = w.formDefinitionSnapshot.schema ? ae(w.formDefinitionSnapshot.schema, w.workflowSnapshot) : null, n = te(t ? it(t.fields, gt) : gt, w.workflowSnapshot);
2227
2234
  try {
2228
- if (t && C.formDefinitionSnapshot.uiSchema) {
2229
- let e = await st({
2235
+ if (t && w.formDefinitionSnapshot.uiSchema) {
2236
+ let e = await ot({
2230
2237
  schema: t,
2231
- uiSchema: C.formDefinitionSnapshot.uiSchema,
2238
+ uiSchema: w.formDefinitionSnapshot.uiSchema,
2232
2239
  values: n
2233
2240
  });
2234
2241
  if (!e.valid) {
2235
- F(e.errors), A("請先修正表單中標示的欄位。"), e.firstInvalidFieldKey && at(e.firstInvalidFieldKey);
2242
+ z(e.errors), M("請先修正表單中標示的欄位。"), e.firstInvalidFieldKey && at(e.firstInvalidFieldKey);
2236
2243
  return;
2237
2244
  }
2238
2245
  }
2239
- await ze({
2240
- comment: bt,
2246
+ await Be({
2247
+ comment: yt,
2241
2248
  formData: n,
2242
- initiatorMemberId: y,
2243
- instanceId: C.id,
2244
- title: C.title
2245
- }), yt(C.id), await Q();
2249
+ initiatorMemberId: b,
2250
+ instanceId: w.id,
2251
+ title: w.title
2252
+ }), vt(w.id), await dn();
2246
2253
  } catch (e) {
2247
- A(V(e));
2254
+ M(_(e));
2248
2255
  } finally {
2249
- j(!1);
2256
+ N(!1);
2250
2257
  }
2251
2258
  }
2252
- let $ = tt || M || rt;
2253
- return /* @__PURE__ */ O(Ce, { children: [
2254
- /* @__PURE__ */ D(he, { children: /* @__PURE__ */ O(Ue, {
2255
- description: C ? [
2256
- Pt(C.state),
2257
- t(C.startedAt),
2258
- Dt(C, Xt)
2259
- ].filter(B).join(" · ") : "載入案件內容。",
2260
- title: C?.title ?? "簽核案件",
2259
+ let $ = tt || F || rt;
2260
+ return /* @__PURE__ */ k(we, { children: [
2261
+ /* @__PURE__ */ O(_e, { children: /* @__PURE__ */ k(We, {
2262
+ description: w ? [
2263
+ Nt(w.state),
2264
+ t(w.startedAt),
2265
+ Tt(w, Zt)
2266
+ ].filter(H).join(" · ") : "載入案件內容。",
2267
+ title: w?.title ?? "簽核案件",
2261
2268
  children: [
2262
- C ? /* @__PURE__ */ D(S, {
2269
+ w ? /* @__PURE__ */ O(C, {
2263
2270
  "aria-label": "查看流程圖",
2264
2271
  icon: $e,
2265
2272
  iconType: "icon-only",
2266
- onClick: () => dt(!0),
2273
+ onClick: () => I(!0),
2267
2274
  title: "查看流程圖",
2268
2275
  variant: "base-secondary",
2269
2276
  children: "流程圖"
2270
2277
  }) : null,
2271
- Vt ? /* @__PURE__ */ D(S, {
2278
+ Bt ? /* @__PURE__ */ O(C, {
2272
2279
  disabled: $,
2273
- icon: qe,
2280
+ icon: j,
2274
2281
  iconType: "leading",
2275
- onClick: () => ht(!0),
2282
+ onClick: () => L(!0),
2276
2283
  variant: "destructive-secondary",
2277
2284
  children: "取消案件"
2278
2285
  }) : null,
2279
- H ? /* @__PURE__ */ O(Ce, { children: [
2280
- zt ? /* @__PURE__ */ O(Ce, { children: [/* @__PURE__ */ D(S, {
2286
+ W ? /* @__PURE__ */ k(we, { children: [
2287
+ zt ? /* @__PURE__ */ k(we, { children: [/* @__PURE__ */ O(C, {
2281
2288
  disabled: $,
2282
2289
  icon: Xe,
2283
2290
  iconType: "leading",
2284
- onClick: () => z.current?.openAdhocModal("COUNTERSIGN"),
2291
+ onClick: () => U.current?.openAdhocModal("COUNTERSIGN"),
2285
2292
  variant: "base-secondary",
2286
2293
  children: "會簽"
2287
- }, "adhoc-countersign"), /* @__PURE__ */ D(S, {
2294
+ }, "adhoc-countersign"), /* @__PURE__ */ O(C, {
2288
2295
  disabled: $,
2289
2296
  icon: Xe,
2290
2297
  iconType: "leading",
2291
- onClick: () => z.current?.openAdhocModal("PRE_APPROVAL"),
2298
+ onClick: () => U.current?.openAdhocModal("PRE_APPROVAL"),
2292
2299
  variant: "base-secondary",
2293
2300
  children: "加簽"
2294
2301
  }, "adhoc-pre-approval")] }) : null,
2295
- /* @__PURE__ */ D(S, {
2302
+ /* @__PURE__ */ O(C, {
2296
2303
  disabled: $,
2297
2304
  icon: Ye,
2298
2305
  iconType: "leading",
2299
- onClick: () => z.current?.openAdhocModal("STAGE_NOTIFY"),
2306
+ onClick: () => U.current?.openAdhocModal("STAGE_NOTIFY"),
2300
2307
  variant: "base-secondary",
2301
2308
  children: "通知設定"
2302
2309
  }, "adhoc-notify"),
2303
- Ft ? /* @__PURE__ */ D(S, {
2310
+ Pt ? /* @__PURE__ */ O(C, {
2304
2311
  disabled: $,
2305
2312
  icon: Ze,
2306
2313
  iconType: "leading",
2307
- onClick: () => z.current?.openReturnModal(),
2314
+ onClick: () => U.current?.openReturnModal(),
2308
2315
  variant: "base-secondary",
2309
2316
  children: "退回"
2310
2317
  }, "task-return") : null,
2311
- Rt ? /* @__PURE__ */ D(S, {
2318
+ Lt ? /* @__PURE__ */ O(C, {
2312
2319
  disabled: $,
2313
2320
  icon: et,
2314
2321
  iconType: "leading",
2315
- onClick: () => z.current?.openTransferModal(),
2322
+ onClick: () => U.current?.openTransferModal(),
2316
2323
  variant: "base-secondary",
2317
2324
  children: "轉派"
2318
2325
  }, "task-transfer") : null,
2319
- It ? /* @__PURE__ */ D(S, {
2326
+ It ? /* @__PURE__ */ O(C, {
2320
2327
  disabled: $,
2321
- icon: qe,
2328
+ icon: j,
2322
2329
  iconType: "leading",
2323
- onClick: () => z.current?.openRejectModal(),
2330
+ onClick: () => U.current?.openRejectModal(),
2324
2331
  variant: "destructive-secondary",
2325
2332
  children: "拒絕"
2326
2333
  }, "task-reject") : null,
2327
- /* @__PURE__ */ D(S, {
2334
+ /* @__PURE__ */ O(C, {
2328
2335
  disabled: $,
2329
- icon: We,
2336
+ icon: Ge,
2330
2337
  iconType: "leading",
2331
2338
  onClick: () => {
2332
- en();
2339
+ tn();
2333
2340
  },
2334
2341
  variant: "base-primary",
2335
2342
  children: "同意"
@@ -2337,162 +2344,167 @@ function Sr({ instanceId: i, showAttachments: o = !0, showForm: c = !0, showHist
2337
2344
  ] }) : null
2338
2345
  ]
2339
2346
  }) }),
2340
- /* @__PURE__ */ O(_e, { children: [
2341
- c ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(En, {
2342
- canResubmitInstance: Ht,
2347
+ /* @__PURE__ */ k(ve, { children: [
2348
+ l ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(En, {
2349
+ attachments: ye,
2350
+ canResubmitInstance: Vt,
2343
2351
  deciding: tt,
2344
- error: Ke,
2345
- fieldAccess: Jt,
2346
- fieldLabelMarkers: Yt,
2347
- fill: X && Z && G ? {
2348
- errors: K,
2349
- fieldCount: nt(G).size,
2350
- onChange: $t,
2351
- schema: X,
2352
- value: Z
2352
+ error: qe,
2353
+ fieldAccess: Yt,
2354
+ fieldLabelMarkers: Xt,
2355
+ fill: Z && Q && q ? {
2356
+ errors: Gt,
2357
+ fieldCount: nt(q).size,
2358
+ onChange: en,
2359
+ schema: Z,
2360
+ value: Q
2353
2361
  } : null,
2354
- instance: C,
2362
+ instance: w,
2355
2363
  loading: Je,
2356
- onDataSourceStateChange: Nt,
2357
- onReloadAfterConflict: Kt ? () => void nn() : null,
2364
+ onDataSourceStateChange: Mt,
2365
+ onDownloadAttachment: (e) => {
2366
+ gn(e);
2367
+ },
2368
+ onFileUploadStateChange: Ut.onFileUploadStateChange,
2369
+ onReloadAfterConflict: Kt ? () => void rn() : null,
2358
2370
  onResubmitFormChange: (e) => {
2359
- vt(e), F({});
2371
+ _t(e), z({});
2360
2372
  },
2361
- onResubmitCommentChange: xt,
2362
- onResubmitInstance: () => void _n(),
2363
- onUploadAttachment: pn,
2364
- resubmitComment: bt,
2365
- resubmitFormData: I,
2366
- resubmitFormErrors: gt
2373
+ onResubmitCommentChange: bt,
2374
+ onResubmitInstance: () => void Sn(),
2375
+ onUploadAttachment: hn,
2376
+ resubmitComment: yt,
2377
+ resubmitFormData: gt,
2378
+ resubmitFormErrors: R
2367
2379
  }) }) : null,
2368
- o ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(On, {
2369
- attachments: ve,
2380
+ s ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(On, {
2381
+ attachments: ye,
2370
2382
  onDownload: (e) => {
2371
- mn(e);
2383
+ gn(e.id);
2372
2384
  },
2373
2385
  onPreview: (e) => {
2374
- hn(e);
2386
+ _n(e);
2375
2387
  }
2376
2388
  }) }) : null,
2377
- d ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(zn, {
2378
- adhocDirectives: kt,
2379
- currentMemberId: y,
2380
- fill: Qt,
2381
- instance: C,
2382
- memberProfilesById: Xt,
2383
- onChanged: Q,
2384
- onDecidingChange: ot,
2385
- onFillApproveError: tn,
2386
- ref: z,
2387
- tasks: k
2389
+ f ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(zn, {
2390
+ adhocDirectives: V,
2391
+ currentMemberId: b,
2392
+ fill: $t,
2393
+ instance: w,
2394
+ memberProfilesById: Zt,
2395
+ onChanged: dn,
2396
+ onDecidingChange: st,
2397
+ onFillApproveError: nn,
2398
+ ref: U,
2399
+ tasks: A
2388
2400
  }) }) : null,
2389
- u ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(Un, {
2390
- signatureVerification: De,
2391
- signatures: be
2401
+ d ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(Un, {
2402
+ signatureVerification: Oe,
2403
+ signatures: xe
2392
2404
  }) }) : null,
2393
- ce && we.length > 0 ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(nr, {
2394
- deliveries: we,
2395
- onRetry: dn,
2396
- readNodeLabel: (e) => Lt(e, C?.workflowSnapshot ?? null)
2405
+ le && Te.length > 0 ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(nr, {
2406
+ deliveries: Te,
2407
+ onRetry: pn,
2408
+ readNodeLabel: (e) => Ft(e, w?.workflowSnapshot ?? null)
2397
2409
  }) }) : null,
2398
- l ? /* @__PURE__ */ D(ge, { children: /* @__PURE__ */ D(Qn, {
2399
- activityLogs: ue,
2400
- formSchema: Y,
2401
- instanceState: C?.state ?? "RUNNING",
2402
- memberProfilesById: Xt,
2403
- signatureVerification: De,
2404
- signaturesById: an,
2405
- taskDecisions: w,
2406
- taskDecisionsByTaskId: rn,
2407
- tasks: k,
2408
- workflowSnapshot: C?.workflowSnapshot ?? null,
2409
- workflowTokens: Le
2410
+ u ? /* @__PURE__ */ O(E, { children: /* @__PURE__ */ O(Qn, {
2411
+ activityLogs: de,
2412
+ formSchema: X,
2413
+ instanceState: w?.state ?? "RUNNING",
2414
+ memberProfilesById: Zt,
2415
+ signatureVerification: Oe,
2416
+ signaturesById: on,
2417
+ taskDecisions: me,
2418
+ taskDecisionsByTaskId: an,
2419
+ tasks: A,
2420
+ workflowSnapshot: w?.workflowSnapshot ?? null,
2421
+ workflowTokens: Re
2410
2422
  }) }) : null
2411
2423
  ] }),
2412
- C ? /* @__PURE__ */ D(T, {
2424
+ w ? /* @__PURE__ */ O(T, {
2413
2425
  modalType: "standard",
2414
- onClose: () => dt(!1),
2415
- open: ct,
2426
+ onClose: () => I(!1),
2427
+ open: ut,
2416
2428
  showModalHeader: !0,
2417
2429
  size: "wide",
2418
- supportingText: `${Pt(C.state)} · ${t(C.startedAt)}`,
2430
+ supportingText: `${Nt(w.state)} · ${t(w.startedAt)}`,
2419
2431
  title: "流程圖",
2420
- children: /* @__PURE__ */ O("div", {
2432
+ children: /* @__PURE__ */ k("div", {
2421
2433
  style: fr,
2422
- children: [/* @__PURE__ */ D("div", {
2434
+ children: [/* @__PURE__ */ O("div", {
2423
2435
  style: pr,
2424
- children: /* @__PURE__ */ O(ft, {
2425
- edges: cn,
2436
+ children: /* @__PURE__ */ k(dt, {
2437
+ edges: ln,
2426
2438
  fitView: !0,
2427
2439
  fitViewOptions: { padding: .18 },
2428
2440
  maxZoom: 1.2,
2429
2441
  minZoom: .2,
2430
- nodes: sn,
2442
+ nodes: cn,
2431
2443
  nodesDraggable: !1,
2432
2444
  nodesFocusable: !1,
2433
2445
  nodeTypes: xr,
2434
2446
  panOnDrag: !0,
2435
2447
  proOptions: { hideAttribution: !0 },
2436
- children: [/* @__PURE__ */ D(lt, {}), /* @__PURE__ */ D(ut, { showInteractive: !1 })]
2448
+ children: [/* @__PURE__ */ O(ct, {}), /* @__PURE__ */ O(lt, { showInteractive: !1 })]
2437
2449
  })
2438
- }), ln.length > 0 ? /* @__PURE__ */ D("div", {
2450
+ }), un.length > 0 ? /* @__PURE__ */ O("div", {
2439
2451
  style: vr,
2440
- children: ln.map((e) => /* @__PURE__ */ D("span", {
2452
+ children: un.map((e) => /* @__PURE__ */ O("span", {
2441
2453
  style: yr,
2442
2454
  children: e
2443
2455
  }, e))
2444
2456
  }) : null]
2445
2457
  })
2446
2458
  }) : null,
2447
- /* @__PURE__ */ D(T, {
2459
+ /* @__PURE__ */ O(T, {
2448
2460
  modalType: "standard",
2449
2461
  onClose: () => {
2450
- Tt(null), Ot(null);
2462
+ wt(null), Dt(null);
2451
2463
  },
2452
- open: !!(L && Et),
2464
+ open: !!(B && Et),
2453
2465
  showModalHeader: !0,
2454
2466
  size: "wide",
2455
- supportingText: L?.filename ?? void 0,
2467
+ supportingText: B?.filename ?? void 0,
2456
2468
  title: "PDF 預覽",
2457
- children: Et ? /* @__PURE__ */ D(wt, {
2458
- filename: L?.filename ?? "PDF 預覽",
2469
+ children: Et ? /* @__PURE__ */ O(Ct, {
2470
+ filename: B?.filename ?? "PDF 預覽",
2459
2471
  fileUrl: Et,
2460
- onDownload: L ? () => void mn(L) : void 0
2472
+ onDownload: B ? () => void gn(B.id) : void 0
2461
2473
  }) : null
2462
2474
  }),
2463
- /* @__PURE__ */ D(T, {
2475
+ /* @__PURE__ */ O(T, {
2464
2476
  cancelText: "保留案件",
2465
2477
  confirmButtonProps: { variant: "destructive-primary" },
2466
2478
  confirmText: "確認取消",
2467
2479
  loading: tt,
2468
2480
  modalStatusType: "error",
2469
2481
  modalType: "standard",
2470
- onCancel: () => ht(!1),
2471
- onClose: () => ht(!1),
2472
- onConfirm: () => void gn(),
2482
+ onCancel: () => L(!1),
2483
+ onClose: () => L(!1),
2484
+ onConfirm: () => void yn(),
2473
2485
  open: mt,
2474
2486
  showModalFooter: !0,
2475
2487
  showModalHeader: !0,
2476
2488
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2477
2489
  title: "取消案件",
2478
- children: /* @__PURE__ */ O("div", {
2490
+ children: /* @__PURE__ */ k("div", {
2479
2491
  style: br,
2480
- children: [/* @__PURE__ */ O(E, {
2492
+ children: [/* @__PURE__ */ k(D, {
2481
2493
  variant: "body",
2482
2494
  children: [
2483
2495
  "確定要取消「",
2484
- C?.title ?? "",
2496
+ w?.title ?? "",
2485
2497
  "」嗎?"
2486
2498
  ]
2487
- }), /* @__PURE__ */ D(e, {
2499
+ }), /* @__PURE__ */ O(e, {
2488
2500
  label: "取消原因",
2489
2501
  name: "cancelComment",
2490
- children: /* @__PURE__ */ D(xe, {
2502
+ children: /* @__PURE__ */ O(Se, {
2491
2503
  onChange: (e) => pt(e.target.value),
2492
2504
  placeholder: "可填寫取消原因",
2493
2505
  resize: "vertical",
2494
2506
  rows: 3,
2495
- value: P
2507
+ value: ft
2496
2508
  })
2497
2509
  })]
2498
2510
  })
@@ -2521,14 +2533,14 @@ function Er(e, t, n, r) {
2521
2533
  },
2522
2534
  id: e.id,
2523
2535
  position: e.position,
2524
- sourcePosition: P.Right,
2525
- targetPosition: P.Left,
2536
+ sourcePosition: I.Right,
2537
+ targetPosition: I.Left,
2526
2538
  type: "workflowRuntime"
2527
2539
  };
2528
2540
  });
2529
2541
  }
2530
2542
  function Dr(e) {
2531
- let t = new pt.graphlib.Graph();
2543
+ let t = new ft.graphlib.Graph();
2532
2544
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2533
2545
  nodesep: 56,
2534
2546
  rankdir: "LR",
@@ -2540,7 +2552,7 @@ function Dr(e) {
2540
2552
  });
2541
2553
  }), e.edges.forEach((e) => {
2542
2554
  t.setEdge(e.source, e.target);
2543
- }), pt.layout(t), {
2555
+ }), ft.layout(t), {
2544
2556
  ...e,
2545
2557
  nodes: e.nodes.map((e) => {
2546
2558
  let n = t.node(e.id);
@@ -2626,34 +2638,34 @@ function Ar(e) {
2626
2638
  };
2627
2639
  }
2628
2640
  function jr({ data: e }) {
2629
- return /* @__PURE__ */ O("div", {
2641
+ return /* @__PURE__ */ k("div", {
2630
2642
  style: kr(e.tone),
2631
2643
  children: [
2632
- /* @__PURE__ */ D(dt, {
2644
+ /* @__PURE__ */ O(ut, {
2633
2645
  isConnectable: !1,
2634
- position: P.Left,
2646
+ position: I.Left,
2635
2647
  style: _r,
2636
2648
  type: "target"
2637
2649
  }),
2638
- /* @__PURE__ */ D(E, {
2650
+ /* @__PURE__ */ O(D, {
2639
2651
  component: "span",
2640
2652
  ellipsis: !0,
2641
2653
  title: e.label,
2642
2654
  variant: "label-primary",
2643
2655
  children: e.label
2644
2656
  }),
2645
- /* @__PURE__ */ D("span", {
2657
+ /* @__PURE__ */ O("span", {
2646
2658
  style: Ar(e.tone),
2647
2659
  children: e.statusLabel
2648
2660
  }),
2649
- /* @__PURE__ */ D("span", {
2661
+ /* @__PURE__ */ O("span", {
2650
2662
  title: e.secondaryLabel,
2651
2663
  style: gr,
2652
2664
  children: e.secondaryLabel || e.kindLabel
2653
2665
  }),
2654
- /* @__PURE__ */ D(dt, {
2666
+ /* @__PURE__ */ O(ut, {
2655
2667
  isConnectable: !1,
2656
- position: P.Right,
2668
+ position: I.Right,
2657
2669
  style: _r,
2658
2670
  type: "source"
2659
2671
  })
@@ -2662,4 +2674,4 @@ function jr({ data: e }) {
2662
2674
  }
2663
2675
  export { zn as a, Un as i, nr as n, On as o, Qn as r, En as s, Sr as t };
2664
2676
 
2665
- //# sourceMappingURL=detail-C6XKZjlF.js.map
2677
+ //# sourceMappingURL=detail-_GeKqNC-.js.map