@rytass/bpm-core-react 0.13.3 → 0.13.5

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