@rytass/bpm-core-react 0.17.6 → 0.17.7

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