@rytass/bpm-core-react 0.21.1 → 0.21.3

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 (76) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs → FormBuilderView-Bq4TXdxF.cjs} +2 -2
  3. package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs.map → FormBuilderView-Bq4TXdxF.cjs.map} +1 -1
  4. package/dist/chunks/{FormBuilderView-6KdApi-D.js → FormBuilderView-DNsFwZgk.js} +2 -2
  5. package/dist/chunks/{FormBuilderView-6KdApi-D.js.map → FormBuilderView-DNsFwZgk.js.map} +1 -1
  6. package/dist/chunks/{FormRendererView-BcQKUi1A.js → FormRendererView-BF8Ge0Zk.js} +178 -153
  7. package/dist/chunks/FormRendererView-BF8Ge0Zk.js.map +1 -0
  8. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs +6 -0
  9. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs.map +1 -0
  10. package/dist/chunks/admin-pickers-BjbkBpSJ.cjs.map +1 -1
  11. package/dist/chunks/admin-pickers-DfGxsjpp.js.map +1 -1
  12. package/dist/chunks/approval-instance-list-page-BI5fIXc-.js.map +1 -1
  13. package/dist/chunks/approval-instance-list-page-Cv5I1YPX.cjs.map +1 -1
  14. package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
  15. package/dist/chunks/auth-provider-C2b-5mGt.js.map +1 -1
  16. package/dist/chunks/categories-CyyqG6wG.cjs.map +1 -1
  17. package/dist/chunks/categories-f7E-RJEc.js.map +1 -1
  18. package/dist/chunks/{compose-DFuLPmOA.js → compose-C_Y38ENa.js} +4 -4
  19. package/dist/chunks/{compose-DFuLPmOA.js.map → compose-C_Y38ENa.js.map} +1 -1
  20. package/dist/chunks/{compose-DK3ocWwG.cjs → compose-NHbyjV73.cjs} +2 -2
  21. package/dist/chunks/{compose-DK3ocWwG.cjs.map → compose-NHbyjV73.cjs.map} +1 -1
  22. package/dist/chunks/dashboard-page-BoqNhjT_.js.map +1 -1
  23. package/dist/chunks/dashboard-page-D7YJ3udk.cjs.map +1 -1
  24. package/dist/chunks/delegations-ClRCwD1I.cjs.map +1 -1
  25. package/dist/chunks/delegations-CqND-Qtz.js.map +1 -1
  26. package/dist/chunks/delegations-D43VDSz1.cjs.map +1 -1
  27. package/dist/chunks/delegations-zisffLwk.js.map +1 -1
  28. package/dist/chunks/{designer-CCy5EbOe.js → designer-BRYIpeTC.js} +300 -298
  29. package/dist/chunks/designer-BRYIpeTC.js.map +1 -0
  30. package/dist/chunks/designer-oDGvHWBJ.cjs +69 -0
  31. package/dist/chunks/designer-oDGvHWBJ.cjs.map +1 -0
  32. package/dist/chunks/{detail-C5KrUC7s.cjs → detail-BLhZp1mO.cjs} +2 -2
  33. package/dist/chunks/detail-BLhZp1mO.cjs.map +1 -0
  34. package/dist/chunks/{detail-Dnc4PPWO.js → detail-CkRgfU7l.js} +2 -2
  35. package/dist/chunks/detail-CkRgfU7l.js.map +1 -0
  36. package/dist/chunks/login-D6cc3bo7.js.map +1 -1
  37. package/dist/chunks/login-uvVcltrS.cjs.map +1 -1
  38. package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
  39. package/dist/chunks/notifications-Cvme5Qbl.js.map +1 -1
  40. package/dist/chunks/orgs-B_2J2tLX.cjs.map +1 -1
  41. package/dist/chunks/orgs-DqxMds26.js.map +1 -1
  42. package/dist/chunks/users-BBtiZ9QQ.js.map +1 -1
  43. package/dist/chunks/users-EqSzDhuj.cjs.map +1 -1
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/instances/detail/index.cjs +1 -1
  47. package/dist/pages/instances/detail/index.js +1 -1
  48. package/dist/pages/templates/compose/index.cjs +1 -1
  49. package/dist/pages/templates/compose/index.js +1 -1
  50. package/dist/pages/templates/designer/index.cjs +1 -1
  51. package/dist/pages/templates/designer/index.js +1 -1
  52. package/dist/views/forms/builder/index.cjs +1 -1
  53. package/dist/views/forms/builder/index.js +1 -1
  54. package/dist/views/forms/renderer/form-control-menu.d.cts +7 -0
  55. package/dist/views/forms/renderer/form-control-menu.d.ts +7 -0
  56. package/dist/views/forms/renderer/form-data-source-field.d.cts +12 -0
  57. package/dist/views/forms/renderer/form-data-source-field.d.ts +12 -0
  58. package/dist/views/forms/renderer/index.cjs +1 -1
  59. package/dist/views/forms/renderer/index.js +1 -1
  60. package/dist/views/instances/detail/index.cjs +1 -1
  61. package/dist/views/instances/detail/index.js +1 -1
  62. package/dist/views/instances/new/index.cjs +1 -1
  63. package/dist/views/instances/new/index.js +1 -1
  64. package/dist/views/templates/compose/index.cjs +1 -1
  65. package/dist/views/templates/compose/index.js +1 -1
  66. package/dist/views/templates/designer/index.cjs +1 -1
  67. package/dist/views/templates/designer/index.js +1 -1
  68. package/package.json +3 -3
  69. package/dist/chunks/FormRendererView-B-xycC9S.cjs +0 -6
  70. package/dist/chunks/FormRendererView-B-xycC9S.cjs.map +0 -1
  71. package/dist/chunks/FormRendererView-BcQKUi1A.js.map +0 -1
  72. package/dist/chunks/designer-CAUWEKJ4.cjs +0 -69
  73. package/dist/chunks/designer-CAUWEKJ4.cjs.map +0 -1
  74. package/dist/chunks/designer-CCy5EbOe.js.map +0 -1
  75. package/dist/chunks/detail-C5KrUC7s.cjs.map +0 -1
  76. package/dist/chunks/detail-Dnc4PPWO.js.map +0 -1
@@ -2,18 +2,18 @@
2
2
  import { t as e } from "./format-member-label-C73FuP-d.js";
3
3
  import { r as t } from "./router-adapter-CkxCyzf5.js";
4
4
  import { t as n } from "./workflow-chat-prompt-B4wCFKPB.js";
5
- import { t as r } from "./FormBuilderView-6KdApi-D.js";
5
+ import { t as r } from "./FormBuilderView-DNsFwZgk.js";
6
6
  import { r as i } from "./routes-config-BcNaWJWJ.js";
7
7
  import { n as a, o } from "./organization-time-zone-provider-DNL8yo4-.js";
8
8
  import '../style.css';/* empty css */
9
9
  import { a as s, n as c, o as l, r as u } from "./admin-pickers-DfGxsjpp.js";
10
10
  import { t as d } from "./bpm-form-field-9B-Det0u.js";
11
- import { i as f, r as p } from "./FormRendererView-BcQKUi1A.js";
11
+ import { i as f, r as p } from "./FormRendererView-BF8Ge0Zk.js";
12
12
  import { Fragment as m, useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
13
13
  import { AutoComplete as b, Badge as x, Button as S, Icon as ee, InlineMessage as C, Input as w, Modal as te, PageHeader as T, Section as ne, SectionGroup as re, Select as E, Table as D, Tag as ie, Textarea as ae, Toggle as O, Typography as k } from "@mezzanine-ui/react";
14
14
  import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
15
- import { DEFAULT_BPM_ORGANIZATION_TIME_ZONE as oe, FIELD_ACCESS_CHOICES as N, WORKFLOW_TOOLSET as se, applyWorkflowCommand as P, applyWorkflowMacroCommand as ce, executeWorkflowTool as F, isFieldAccessEntryValid as le, readFieldAccessEntryForChoice as I, readFieldAccessMatrix as ue, readNodeFieldAccess as de, readNodeFieldAccessIssues as fe, readReachableWorkflowNodeIds as pe, readWorkflowSnapshot as L } from "@rytass/bpm-core-shared";
16
- import me from "@mezzanine-ui/react/Drawer";
15
+ import { DEFAULT_BPM_ORGANIZATION_TIME_ZONE as oe, FIELD_ACCESS_CHOICES as se, WORKFLOW_TOOLSET as N, applyWorkflowCommand as P, applyWorkflowMacroCommand as ce, executeWorkflowTool as F, isFieldAccessEntryValid as I, readFieldAccessEntryForChoice as le, readFieldAccessMatrix as ue, readNodeFieldAccess as de, readNodeFieldAccessIssues as fe, readReachableWorkflowNodeIds as pe, readWorkflowSnapshot as me } from "@rytass/bpm-core-shared";
16
+ import L from "@mezzanine-ui/react/Drawer";
17
17
  import he from "@mezzanine-ui/react/ContentHeader";
18
18
  import { analyzeWorkflowExpressions as ge, composeApprovalTemplateWithForm as _e, dryRunApprovalWorkflow as ve, forkApprovalTemplate as ye, listWorkflowWebhookEndpoints as be, previewExpression as xe, previewWorkflowDialectUpgrade as Se, publishApprovalTemplateVersion as Ce, readExpressionCatalog as we, readExpressionFieldReferences as Te, readExpressionIssueMessage as Ee, readExpressionLabelLocation as De, readTemplateDesigner as Oe, readWorkflowLintMessage as ke, resolveMemberOptions as Ae, searchMemberOptions as je, searchPublishedFormVersionOptions as Me, updateApprovalTemplateDraft as Ne } from "@rytass/bpm-core-client/template";
19
19
  import { readFormBuilder as Pe, readFormSchemaLintMessage as Fe } from "@rytass/bpm-core-client/form";
@@ -730,7 +730,7 @@ function kr({ directory: e, expressionTools: t, initialState: n, layout: r, onLa
730
730
  return {
731
731
  ...r,
732
732
  result: e,
733
- snapshot: L(e.state)
733
+ snapshot: me(e.state)
734
734
  };
735
735
  }
736
736
  return r;
@@ -740,7 +740,7 @@ function kr({ directory: e, expressionTools: t, initialState: n, layout: r, onLa
740
740
  }, [m]), b = h((e) => {
741
741
  let t = typeof e == "function" ? e(s.current) : e;
742
742
  s.current = t, o(t);
743
- }, []), x = h(() => s.current, []), S = _(() => L(a), [a]);
743
+ }, []), x = h(() => s.current, []), S = _(() => me(a), [a]);
744
744
  return _(() => ({
745
745
  dispatch: d,
746
746
  dispatchMacro: f,
@@ -749,7 +749,7 @@ function kr({ directory: e, expressionTools: t, initialState: n, layout: r, onLa
749
749
  replaceState: b,
750
750
  snapshot: S,
751
751
  state: a,
752
- tools: se
752
+ tools: N
753
753
  }), [
754
754
  d,
755
755
  f,
@@ -802,7 +802,7 @@ var Nr = {
802
802
  type: "object"
803
803
  };
804
804
  function Pr() {
805
- let e = se.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n");
805
+ let e = N.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n");
806
806
  return `你是「簽核流程設計器」頁面的離線 AI 助理。只能透過下列工具操作這個流程畫布,其他請求一律婉拒並引導回流程設計。
807
807
 
808
808
  每一步只輸出一個 JSON 決策物件:
@@ -971,7 +971,7 @@ function Xr({ api: e, controller: t, onClose: n, open: r }) {
971
971
  ]), _ = h((e) => {
972
972
  e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), g());
973
973
  }, [g]);
974
- return /* @__PURE__ */ M(me, {
974
+ return /* @__PURE__ */ M(L, {
975
975
  headerTitle: "AI 流程助理",
976
976
  isHeaderDisplay: !0,
977
977
  onClose: n,
@@ -1107,7 +1107,7 @@ var si = {
1107
1107
  gap: 4
1108
1108
  }, li = { display: "grid" };
1109
1109
  function ui(e) {
1110
- return e.nodes.filter((e) => e.type === "userTask").flatMap((e) => de(e).filter(le).map((t) => ({
1110
+ return e.nodes.filter((e) => e.type === "userTask").flatMap((e) => de(e).filter(I).map((t) => ({
1111
1111
  ...t,
1112
1112
  nodeId: e.id
1113
1113
  })));
@@ -1117,7 +1117,7 @@ function di(e, t, n, r) {
1117
1117
  return i === -1 ? r === null ? e : [...e, r] : e.flatMap((e, t) => t === i ? r === null ? [] : [r] : [e]);
1118
1118
  }
1119
1119
  function fi(e, t, n, r) {
1120
- let i = I(n, r);
1120
+ let i = le(n, r);
1121
1121
  return di(e, t, n, i === null ? null : {
1122
1122
  ...i,
1123
1123
  nodeId: t
@@ -1185,7 +1185,7 @@ function Ci(e) {
1185
1185
  return e.cells.some((e) => e.explicit !== null) || e.issues.length > 0 || e.notices.length > 0;
1186
1186
  }
1187
1187
  function wi(e) {
1188
- return N.filter((t) => t === e.choice || !e.disabledChoices.includes(t)).map((t) => ({
1188
+ return se.filter((t) => t === e.choice || !e.disabledChoices.includes(t)).map((t) => ({
1189
1189
  id: t,
1190
1190
  name: t === "DEFAULT" && e.choice === "DEFAULT" ? `預設:${$r[e.effective]}` : Qr[t]
1191
1191
  }));
@@ -1319,7 +1319,7 @@ function Ei({ definition: e, expressionReferences: t, formSchema: n, language: r
1319
1319
  ]
1320
1320
  });
1321
1321
  }
1322
- return /* @__PURE__ */ j(me, {
1322
+ return /* @__PURE__ */ j(L, {
1323
1323
  bottomGhostActionText: "取消",
1324
1324
  bottomOnGhostActionClick: a,
1325
1325
  bottomOnPrimaryActionClick: T,
@@ -2394,8 +2394,8 @@ function vo({ api: e = oo, debounceMs: t = 400, dialect: n, disabled: r = !1, ed
2394
2394
  let [w, te] = y({
2395
2395
  issues: [],
2396
2396
  status: "EMPTY"
2397
- }), [T, ne] = y(null), [re, D] = y("{\n \"form\": {}\n}"), [ie, O] = y(null), [A, oe] = y(!1), N = v(f);
2398
- N.current = f, g(() => {
2397
+ }), [T, ne] = y(null), [re, D] = y("{\n \"form\": {}\n}"), [ie, O] = y(null), [A, oe] = y(!1), se = v(f);
2398
+ se.current = f, g(() => {
2399
2399
  let t = new AbortController();
2400
2400
  return e.readCatalog({
2401
2401
  formDefinitionVersionId: o,
@@ -2409,7 +2409,7 @@ function vo({ api: e = oo, debounceMs: t = 400, dialect: n, disabled: r = !1, ed
2409
2409
  b
2410
2410
  ]), g(() => {
2411
2411
  let r = ee.trim(), a = (e) => {
2412
- te(e), N.current?.(e);
2412
+ te(e), se.current?.(e);
2413
2413
  };
2414
2414
  if (O(null), r.length === 0) return a({
2415
2415
  issues: [],
@@ -2451,7 +2451,7 @@ function vo({ api: e = oo, debounceMs: t = 400, dialect: n, disabled: r = !1, ed
2451
2451
  b,
2452
2452
  ee
2453
2453
  ]);
2454
- let se = _(() => uo(T), [T]), P = _(() => fo(T), [T]), ce = mo(w.status), F = async () => {
2454
+ let N = _(() => uo(T), [T]), P = _(() => fo(T), [T]), ce = mo(w.status), F = async () => {
2455
2455
  let t = go(re);
2456
2456
  if (typeof t == "string") O(t);
2457
2457
  else {
@@ -2502,13 +2502,13 @@ function vo({ api: e = oo, debounceMs: t = 400, dialect: n, disabled: r = !1, ed
2502
2502
  children: "宿主函式目錄暫時讀不到,只列出欄位。"
2503
2503
  }) : null]
2504
2504
  }),
2505
- se.length > 0 && !r ? /* @__PURE__ */ j(E, {
2505
+ N.length > 0 && !r ? /* @__PURE__ */ j(E, {
2506
2506
  clearable: !1,
2507
2507
  fullWidth: !0,
2508
2508
  onChange: (e) => {
2509
2509
  e && u(po(ee, e.id));
2510
2510
  },
2511
- options: [...se],
2511
+ options: [...N],
2512
2512
  placeholder: "插入欄位或函式",
2513
2513
  value: null
2514
2514
  }) : null,
@@ -3000,17 +3000,17 @@ var Io = "這個組織範圍內目前沒有擁有此職位的有效會員,請
3000
3000
  id: "FAIL",
3001
3001
  name: "停止流程並提示"
3002
3002
  }
3003
- ], Fs = { whenEmpty: "INITIATOR_MANAGER" }, Is = {
3003
+ ], Fs = "往上可能簽到申請人本人;若不允許,請開啟「申請人不可簽核自己的單」。", Is = "「改由申請人的直屬主管簽核」是申請人的主管,不是主管鏈起點那一位的主管。", Ls = { whenEmpty: "INITIATOR_MANAGER" }, Rs = {
3004
3004
  nodeIds: [],
3005
3005
  whenEmpty: "FAIL"
3006
- }, Ls = [
3006
+ }, zs = [
3007
3007
  "EQUALS",
3008
3008
  "GREATER_THAN",
3009
3009
  "GREATER_THAN_OR_EQUALS",
3010
3010
  "LESS_THAN",
3011
3011
  "LESS_THAN_OR_EQUALS",
3012
3012
  "NOT_EQUALS"
3013
- ], Rs = [
3013
+ ], Bs = [
3014
3014
  {
3015
3015
  id: "NONE",
3016
3016
  name: "未設定"
@@ -3027,47 +3027,47 @@ var Io = "這個組織範圍內目前沒有擁有此職位的有效會員,請
3027
3027
  id: "ORG_UNIT_POSITION",
3028
3028
  name: "指定組織職位"
3029
3029
  }
3030
- ], zs = {
3030
+ ], Vs = {
3031
3031
  id: "CUSTOM",
3032
3032
  name: "自訂運算式"
3033
- }, Bs = [{
3033
+ }, Hs = [{
3034
3034
  id: "NOTIFY",
3035
3035
  name: "知會"
3036
3036
  }, {
3037
3037
  id: "SET_FORM_FIELD",
3038
3038
  name: "寫入表單欄位"
3039
- }], Vs = "member-001", Hs = { whiteSpace: "pre-line" }, Us = {
3039
+ }], Us = "member-001", Ws = { whiteSpace: "pre-line" }, Gs = {
3040
3040
  display: "flex",
3041
3041
  flexDirection: "column",
3042
3042
  height: "100%"
3043
- }, Ws = {
3043
+ }, Ks = {
3044
3044
  flex: 1,
3045
3045
  minHeight: 0,
3046
3046
  overflowY: "auto"
3047
- }, Gs = {
3047
+ }, qs = {
3048
3048
  borderTop: "1px solid var(--mzn-color-border-neutral)",
3049
3049
  display: "flex",
3050
3050
  gap: 8,
3051
3051
  paddingTop: 12
3052
- }, Ks = {
3052
+ }, Js = {
3053
3053
  fields: [],
3054
3054
  schemaVersion: 1
3055
- }, qs = {
3055
+ }, Ys = {
3056
3056
  layout: [],
3057
3057
  schemaVersion: 1
3058
- }, Js = {
3059
- endEvent: Qs,
3060
- exclusiveGateway: Qs,
3061
- parallelGateway: Qs,
3062
- serviceTask: Qs,
3063
- startEvent: Qs,
3064
- userTask: Qs
3058
+ }, Xs = {
3059
+ endEvent: ec,
3060
+ exclusiveGateway: ec,
3061
+ parallelGateway: ec,
3062
+ serviceTask: ec,
3063
+ startEvent: ec,
3064
+ userTask: ec
3065
3065
  };
3066
- function Ys(e, t) {
3066
+ function Zs(e, t) {
3067
3067
  return typeof e == "function" ? e(t) : e;
3068
3068
  }
3069
- function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride: a, initialInitiatorPolicyCel: s, initialWorkflowDefinition: l, onInitiatorPolicyChange: m, onWorkflowChange: x, showAiAssistant: D = !1, showDryRun: ie = !0, templateId: oe }) {
3070
- let N = t(), se = i(), P = o(), ce = Zi(), [F, le] = y(null), [I, de] = y(null), [fe, pe] = y(""), [L, ge] = y(null), [xe, Se] = y(null), [we, Te] = y(!1), [Ee, De] = y(null), Fe = v(null), [Le, ze] = y(void 0), Be = v([]), Ve = v([]), R = kr({
3069
+ function Qs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride: a, initialInitiatorPolicyCel: s, initialWorkflowDefinition: l, onInitiatorPolicyChange: m, onWorkflowChange: x, showAiAssistant: D = !1, showDryRun: ie = !0, templateId: oe }) {
3070
+ let se = t(), N = i(), P = o(), ce = Zi(), [F, I] = y(null), [le, de] = y(null), [fe, pe] = y(""), [me, ge] = y(null), [xe, Se] = y(null), [we, Te] = y(!1), [Ee, De] = y(null), Fe = v(null), [Le, ze] = y(void 0), Be = v([]), Ve = v([]), R = kr({
3071
3071
  directory: _(() => ({
3072
3072
  listOrgUnits: async () => Be.current.map((e) => ({
3073
3073
  id: e.id,
@@ -3077,7 +3077,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3077
3077
  id: e.id,
3078
3078
  name: e.name
3079
3079
  })),
3080
- searchMembers: async (e) => rl(await je(e)).map((e) => ({
3080
+ searchMembers: async (e) => al(await je(e)).map((e) => ({
3081
3081
  email: e.email,
3082
3082
  id: e.memberId,
3083
3083
  name: e.name
@@ -3085,7 +3085,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3085
3085
  }), []),
3086
3086
  expressionTools: So,
3087
3087
  initialState: {
3088
- definition: n && l != null ? uc(l) : hc(),
3088
+ definition: n && l != null ? fc(l) : _c(),
3089
3089
  editingEdgeId: null,
3090
3090
  formDefinitionVersionId: null,
3091
3091
  formSchema: null,
@@ -3093,32 +3093,32 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3093
3093
  selectedEdgeIds: [],
3094
3094
  selectedNodeId: n && l != null ? l.nodes[0]?.id ?? "start" : "start"
3095
3095
  },
3096
- layout: _c,
3096
+ layout: yc,
3097
3097
  onLayout: (e) => {
3098
- let t = ml(e, Fe.current);
3098
+ let t = gl(e, Fe.current);
3099
3099
  t && ze(t);
3100
3100
  }
3101
3101
  }), z = R.state.definition, B = R.state.formDefinitionVersionId, V = R.state.initiatorPolicyCel, We = z.expressionDialect === "cel-v2" ? "cel-v2" : "cel-legacy", Ge = R.state.selectedNodeId, H = R.state.selectedEdgeIds, Ke = R.state.editingEdgeId, qe = (e) => R.replaceState((t) => ({
3102
3102
  ...t,
3103
- definition: Ys(e, t.definition)
3103
+ definition: Zs(e, t.definition)
3104
3104
  })), Je = (e) => R.replaceState((t) => ({
3105
3105
  ...t,
3106
- formDefinitionVersionId: Ys(e, t.formDefinitionVersionId)
3106
+ formDefinitionVersionId: Zs(e, t.formDefinitionVersionId)
3107
3107
  })), et = (e) => R.replaceState((t) => ({
3108
3108
  ...t,
3109
- initiatorPolicyCel: Ys(e, t.initiatorPolicyCel)
3109
+ initiatorPolicyCel: Zs(e, t.initiatorPolicyCel)
3110
3110
  })), nt = (e) => R.replaceState((t) => ({
3111
3111
  ...t,
3112
3112
  definition: e(t.definition)
3113
3113
  })), U = (e) => R.replaceState((t) => ({
3114
3114
  ...t,
3115
- selectedNodeId: Ys(e, t.selectedNodeId)
3115
+ selectedNodeId: Zs(e, t.selectedNodeId)
3116
3116
  })), at = (e) => R.replaceState((t) => ({
3117
3117
  ...t,
3118
- selectedEdgeIds: Ys(e, t.selectedEdgeIds)
3118
+ selectedEdgeIds: Zs(e, t.selectedEdgeIds)
3119
3119
  })), ot = (e) => R.replaceState((t) => ({
3120
3120
  ...t,
3121
- editingEdgeId: Ys(e, t.editingEdgeId)
3121
+ editingEdgeId: Zs(e, t.editingEdgeId)
3122
3122
  })), [st, W] = y(null), [lt, pt] = y(null);
3123
3123
  g(() => {
3124
3124
  pt(null);
@@ -3133,7 +3133,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3133
3133
  z
3134
3134
  ]), At = !!fe && kt !== fe, [jt, Mt] = y(!1), [G, Nt] = y([]), [Ft, Lt] = y([]), Rt = v(0), zt = v(0), Bt = v(/* @__PURE__ */ new Set()), [K, Ht] = y([]), [q, Ut] = y([]), [Gt, Kt] = y([]);
3135
3135
  Be.current = K, Ve.current = q;
3136
- let [qt, Jt] = y(!1), [Yt, Xt] = y(!1), [Zt, Qt] = y(!1), [$t, en] = y(!1), [tn, nn] = y("{}"), [rn, an] = y(null), [on, sn] = y(null), [cn, un] = y([]), [fn, mn] = y("loading"), [hn, gn] = y(!1), [_n, vn] = y(!1), [yn, xn] = y(null), [Sn, wn] = y(null), Tn = Sn !== null, [En, Dn] = y(!1), [On, Mn] = y(!1), Pn = At || Tn ? "保存並發布" : I ? "發布草稿" : "已發布";
3136
+ let [qt, Jt] = y(!1), [Yt, Xt] = y(!1), [Zt, Qt] = y(!1), [$t, en] = y(!1), [tn, nn] = y("{}"), [rn, an] = y(null), [on, sn] = y(null), [cn, un] = y([]), [fn, mn] = y("loading"), [hn, gn] = y(!1), [_n, vn] = y(!1), [yn, xn] = y(null), [Sn, wn] = y(null), Tn = Sn !== null, [En, Dn] = y(!1), [On, Mn] = y(!1), Pn = At || Tn ? "保存並發布" : le ? "發布草稿" : "已發布";
3137
3137
  g(() => {
3138
3138
  n ? Pr() : Fr();
3139
3139
  }, [n, oe]), g(() => {
@@ -3146,16 +3146,16 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3146
3146
  }, [At]), g(() => {
3147
3147
  Rr(z);
3148
3148
  }, [z, G]), g(() => {
3149
- qe((e) => uc(e));
3149
+ qe((e) => fc(e));
3150
3150
  }, [z.edges, z.nodes]);
3151
3151
  function Fn() {
3152
- (!At || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && N.push(se.templates());
3152
+ (!At || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && se.push(N.templates());
3153
3153
  }
3154
- let J = _(() => z.nodes.find((e) => e.id === Ge) ?? null, [Ge, z.nodes]), In = J ? Kc(J) : !1, Vn = H.length > 0 || In, Hn = h(() => {
3154
+ let J = _(() => z.nodes.find((e) => e.id === Ge) ?? null, [Ge, z.nodes]), In = J ? Jc(J) : !1, Vn = H.length > 0 || In, Hn = h(() => {
3155
3155
  R.getState().selectedEdgeIds.forEach((e) => R.dispatch({
3156
3156
  edgeId: e,
3157
3157
  type: "deleteEdge"
3158
- })), J && Kc(J) && R.dispatch({
3158
+ })), J && Jc(J) && R.dispatch({
3159
3159
  nodeId: J.id,
3160
3160
  type: "deleteNode"
3161
3161
  });
@@ -3163,7 +3163,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3163
3163
  g(() => {
3164
3164
  if (!Vn) return;
3165
3165
  function e(e) {
3166
- e.key !== "Delete" && e.key !== "Backspace" || Xc(e.target) || (e.preventDefault(), Hn());
3166
+ e.key !== "Delete" && e.key !== "Backspace" || Qc(e.target) || (e.preventDefault(), Hn());
3167
3167
  }
3168
3168
  return window.addEventListener("keydown", e), () => {
3169
3169
  window.removeEventListener("keydown", e);
@@ -3172,27 +3172,27 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3172
3172
  let Un = _(() => z.edges.find((e) => e.id === Ke) ?? null, [Ke, z.edges]), Kn = _(() => H.length === 1 ? z.edges.find((e) => e.id === H[0]) ?? null : null, [H, z.edges]), Jn = _(() => H.map((e) => z.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [H, z.edges]), Y = _(() => we ? {
3173
3173
  mode: "CUSTOM",
3174
3174
  value: V ?? ""
3175
- } : xe ?? Rc(V, L), [
3175
+ } : xe ?? Bc(V, me), [
3176
3176
  V,
3177
3177
  we,
3178
3178
  xe,
3179
- L
3180
- ]), tr = _(() => z.edges.map((e) => cc(e, z.nodes, H.includes(e.id))), [
3179
+ me
3180
+ ]), tr = _(() => z.edges.map((e) => uc(e, z.nodes, H.includes(e.id))), [
3181
3181
  H,
3182
3182
  z.edges,
3183
3183
  z.nodes
3184
- ]), X = _(() => $(Dt, B) ?? $(Zc(F?.formVersions ?? []), B), [
3184
+ ]), X = _(() => $(Dt, B) ?? $($c(F?.formVersions ?? []), B), [
3185
3185
  B,
3186
3186
  Dt,
3187
3187
  F?.formVersions
3188
- ]), nr = _(() => nl(Dt, X), [Dt, X]), rr = X?.schema ?? null, ir = n ? a ?? null : rr;
3188
+ ]), nr = _(() => il(Dt, X), [Dt, X]), rr = X?.schema ?? null, ir = n ? a ?? null : rr;
3189
3189
  g(() => {
3190
3190
  R.getState().formSchema !== ir && R.replaceState((e) => ({
3191
3191
  ...e,
3192
3192
  formSchema: ir
3193
3193
  }));
3194
3194
  }, [R, ir]);
3195
- let ar = _(() => hl(z), [z]);
3195
+ let ar = _(() => _l(z), [z]);
3196
3196
  g(() => {
3197
3197
  let e = !0;
3198
3198
  return be({ includeDeprecated: !0 }).then((t) => {
@@ -3228,7 +3228,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3228
3228
  id: e.id,
3229
3229
  name: e.data.label || e.id
3230
3230
  }));
3231
- return z.nodes.map((t) => rc(t, G, K, q, t.id === Ge, Y, Z, e));
3231
+ return z.nodes.map((t) => ac(t, G, K, q, t.id === Ge, Y, Z, e));
3232
3232
  }, [
3233
3233
  Y,
3234
3234
  G,
@@ -3237,7 +3237,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3237
3237
  Ge,
3238
3238
  Z,
3239
3239
  z.nodes
3240
- ]), Mr = _(() => _t(z), [z]), Nr = _(() => zc(Y), [Y]);
3240
+ ]), Mr = _(() => _t(z), [z]), Nr = _(() => Vc(Y), [Y]);
3241
3241
  g(() => {
3242
3242
  n && x?.(z);
3243
3243
  }, [n, z]), g(() => {
@@ -3261,13 +3261,13 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3261
3261
  let [t, n] = await Promise.all([Oe(oe), Ye()]);
3262
3262
  if (e !== zt.current) return;
3263
3263
  let r = t.versions.find((e) => e.status === "DRAFT") ?? null, i = r ?? t.versions[0] ?? null;
3264
- le(t), de(r), Ht(n.orgUnits), Ut(n.positions), Kt(n.memberships), Ot(Zc(t.formVersions));
3265
- let a = uc(i?.workflowDefinition ?? hc()), o = i?.formDefinitionVersionId ?? t.formVersions[0]?.id ?? null, s = i?.initiatorPolicyCel ?? null;
3264
+ I(t), de(r), Ht(n.orgUnits), Ut(n.positions), Kt(n.memberships), Ot($c(t.formVersions));
3265
+ let a = fc(i?.workflowDefinition ?? _c()), o = i?.formDefinitionVersionId ?? t.formVersions[0]?.id ?? null, s = i?.initiatorPolicyCel ?? null;
3266
3266
  qe(a), Je(o), et(s), pe(JSON.stringify({
3267
3267
  formDefinitionVersionId: o,
3268
3268
  initiatorPolicyCel: s,
3269
3269
  workflowDefinition: a
3270
- })), ge(i && !t.template.currentVersionId && !i.initiatorPolicyCel && gc(i.workflowDefinition) ? "NONE" : null), Se(null), Te(!1), U(i?.workflowDefinition.nodes[0]?.id ?? "start"), at([]), ot(null), xn(null), wn(null);
3270
+ })), ge(i && !t.template.currentVersionId && !i.initiatorPolicyCel && vc(i.workflowDefinition) ? "NONE" : null), Se(null), Te(!1), U(i?.workflowDefinition.nodes[0]?.id ?? "start"), at([]), ot(null), xn(null), wn(null);
3271
3271
  } catch (t) {
3272
3272
  e === zt.current && W(Mi(t, P));
3273
3273
  } finally {
@@ -3278,7 +3278,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3278
3278
  Et(!0), W(null);
3279
3279
  try {
3280
3280
  let t = await Me(e);
3281
- Ot(nl(Zc(t), X));
3281
+ Ot(il($c(t), X));
3282
3282
  } catch (e) {
3283
3283
  W(Mi(e, P));
3284
3284
  } finally {
@@ -3289,8 +3289,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3289
3289
  Mt(!0), W(null);
3290
3290
  let t = ++Rt.current;
3291
3291
  try {
3292
- let n = rl(await je(e));
3293
- Nt((e) => sl(e, n)), t === Rt.current && Lt(n);
3292
+ let n = al(await je(e));
3293
+ Nt((e) => ll(e, n)), t === Rt.current && Lt(n);
3294
3294
  } catch (e) {
3295
3295
  t === Rt.current && W(Mi(e, P));
3296
3296
  } finally {
@@ -3298,15 +3298,15 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3298
3298
  }
3299
3299
  }
3300
3300
  async function Rr(e) {
3301
- let t = cl(e), n = p(t.filter((e) => !G.some((t) => t.memberId === e && !t.unresolved)), Bt.current);
3301
+ let t = ul(e), n = p(t.filter((e) => !G.some((t) => t.memberId === e && !t.unresolved)), Bt.current);
3302
3302
  if (n.length === 0) return;
3303
3303
  let { profiles: r, skippedIds: i } = await f(n, Ae), a = new Set(r.map((e) => e.memberId)), o = n.filter((e) => !a.has(e) && !i.includes(e));
3304
- o.forEach((e) => Bt.current.add(e)), Nt((e) => sl(e, [...rl(r), ...[...o, ...i].map(Bn)]));
3304
+ o.forEach((e) => Bt.current.add(e)), Nt((e) => ll(e, [...al(r), ...[...o, ...i].map(Bn)]));
3305
3305
  }
3306
3306
  async function zr(e) {
3307
3307
  bt(!0), W(null);
3308
3308
  try {
3309
- let t = hl(z), n = zc(Y), r = e ? Ar : null;
3309
+ let t = _l(z), n = Vc(Y), r = e ? Ar : null;
3310
3310
  if (t || n || r) {
3311
3311
  let e = t ?? n ?? r ?? "流程設定未完成";
3312
3312
  throw W(e), Error(e);
@@ -3329,7 +3329,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3329
3329
  workflowDefinition: z
3330
3330
  }), wn(null), xn(null), await Fr();
3331
3331
  else {
3332
- let t = I ?? await ye(oe), n = await Ne({
3332
+ let t = le ?? await ye(oe), n = await Ne({
3333
3333
  formDefinitionVersionId: B,
3334
3334
  initiatorPolicyCel: V,
3335
3335
  versionId: t.id,
@@ -3358,10 +3358,10 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3358
3358
  async function Wr() {
3359
3359
  en(!0), sn(null), an(null);
3360
3360
  try {
3361
- let e = Qc(tn), t = await ve({
3361
+ let e = el(tn), t = await ve({
3362
3362
  formData: e,
3363
- initiatorMemberId: Vs,
3364
- initiatorMetadataSnapshot: il(Vs, Gt, ce),
3363
+ initiatorMemberId: Us,
3364
+ initiatorMetadataSnapshot: ol(Us, Gt, ce),
3365
3365
  workflowDefinition: z
3366
3366
  });
3367
3367
  an(t);
@@ -3375,16 +3375,16 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3375
3375
  if (dr(null), vn(!0), yn !== null) return;
3376
3376
  let e = X?.formDefinitionId ?? null;
3377
3377
  if (!e) xn({
3378
- schema: Ks,
3379
- uiSchema: qs
3378
+ schema: Js,
3379
+ uiSchema: Ys
3380
3380
  });
3381
3381
  else {
3382
3382
  Dn(!0);
3383
3383
  try {
3384
3384
  let t = await Pe(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
3385
3385
  xn({
3386
- schema: n?.schema ?? Ks,
3387
- uiSchema: n?.uiSchema ?? qs
3386
+ schema: n?.schema ?? Js,
3387
+ uiSchema: n?.uiSchema ?? Ys
3388
3388
  });
3389
3389
  } catch (e) {
3390
3390
  W(Mi(e, P));
@@ -3435,14 +3435,14 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3435
3435
  }));
3436
3436
  }
3437
3437
  function Yr(e) {
3438
- Wc(e, z.nodes) && e.source && e.target && R.dispatch({
3438
+ Kc(e, z.nodes) && e.source && e.target && R.dispatch({
3439
3439
  source: e.source,
3440
3440
  target: e.target,
3441
3441
  type: "connectEdge"
3442
3442
  });
3443
3443
  }
3444
3444
  function Zr(e, t) {
3445
- e.stopPropagation(), at((n) => e.shiftKey || e.metaKey || e.ctrlKey ? Gc(n, t.id) : [t.id]), U(null);
3445
+ e.stopPropagation(), at((n) => e.shiftKey || e.metaKey || e.ctrlKey ? qc(n, t.id) : [t.id]), U(null);
3446
3446
  }
3447
3447
  function Qr() {
3448
3448
  ot(null);
@@ -3554,7 +3554,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3554
3554
  });
3555
3555
  }
3556
3556
  function di(e) {
3557
- Se(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), ge(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), et(Vc(e, K));
3557
+ Se(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), ge(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), et(Uc(e, K));
3558
3558
  }
3559
3559
  function fi(e) {
3560
3560
  J && J.type !== "startEvent" && R.dispatch({
@@ -3586,7 +3586,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3586
3586
  /* @__PURE__ */ j("style", { children: Wo }),
3587
3587
  n ? null : /* @__PURE__ */ j(T, { children: /* @__PURE__ */ M(he, {
3588
3588
  description: Po(No({
3589
- draftVersion: I?.version ?? null,
3589
+ draftVersion: le?.version ?? null,
3590
3590
  hasPublishedVersion: !!F?.template.currentVersionId,
3591
3591
  publishedVersion: F?.versions.find((e) => e.id === F.template.currentVersionId)?.version ?? null
3592
3592
  }), We),
@@ -3623,7 +3623,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3623
3623
  children: "試跑流程"
3624
3624
  }) : null,
3625
3625
  /* @__PURE__ */ j(S, {
3626
- disabled: yt || !I && !At && !Tn || !!ar || !!Nr || !!Ar,
3626
+ disabled: yt || !le && !At && !Tn || !!ar || !!Nr || !!Ar,
3627
3627
  icon: Ie,
3628
3628
  iconType: "leading",
3629
3629
  onClick: () => void Vr(),
@@ -3637,7 +3637,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3637
3637
  children: [
3638
3638
  st ? /* @__PURE__ */ j(k, {
3639
3639
  color: "text-error",
3640
- style: Hs,
3640
+ style: Ws,
3641
3641
  variant: "body",
3642
3642
  children: st
3643
3643
  }) : null,
@@ -3717,8 +3717,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3717
3717
  connectionMode: Ze.Strict,
3718
3718
  edges: tr,
3719
3719
  fitView: !0,
3720
- isValidConnection: (e) => Wc(e, z.nodes),
3721
- nodeTypes: Js,
3720
+ isValidConnection: (e) => Kc(e, z.nodes),
3721
+ nodeTypes: Xs,
3722
3722
  nodes: jr,
3723
3723
  deleteKeyCode: null,
3724
3724
  multiSelectionKeyCode: [
@@ -3755,7 +3755,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3755
3755
  })
3756
3756
  })
3757
3757
  }) : null }),
3758
- /* @__PURE__ */ j(Zs, { onApplyAutoLayout: hi }),
3758
+ /* @__PURE__ */ j($s, { onApplyAutoLayout: hi }),
3759
3759
  /* @__PURE__ */ j(tt, {})
3760
3760
  ]
3761
3761
  })
@@ -3881,17 +3881,17 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3881
3881
  onClose: () => gn(!1),
3882
3882
  open: hn
3883
3883
  }) : null,
3884
- n ? null : /* @__PURE__ */ j(me, {
3884
+ n ? null : /* @__PURE__ */ j(L, {
3885
3885
  headerTitle: "編輯表單",
3886
3886
  isHeaderDisplay: !0,
3887
3887
  onClose: Kr,
3888
3888
  open: _n,
3889
3889
  size: "wide",
3890
3890
  children: /* @__PURE__ */ M("div", {
3891
- style: Us,
3891
+ style: Gs,
3892
3892
  children: [
3893
3893
  /* @__PURE__ */ j("div", {
3894
- style: Ws,
3894
+ style: Ks,
3895
3895
  children: En ? /* @__PURE__ */ j(k, {
3896
3896
  color: "text-neutral",
3897
3897
  variant: "body",
@@ -3903,8 +3903,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3903
3903
  },
3904
3904
  templateId: oe ?? null,
3905
3905
  value: yn ?? {
3906
- schema: Ks,
3907
- uiSchema: qs
3906
+ schema: Js,
3907
+ uiSchema: Ys
3908
3908
  }
3909
3909
  })
3910
3910
  }),
@@ -3913,7 +3913,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3913
3913
  severity: "error"
3914
3914
  }) : null,
3915
3915
  /* @__PURE__ */ M("div", {
3916
- style: Gs,
3916
+ style: qs,
3917
3917
  children: [/* @__PURE__ */ j(S, {
3918
3918
  disabled: En || On,
3919
3919
  loading: On,
@@ -3956,7 +3956,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3956
3956
  showModalFooter: !0,
3957
3957
  showModalHeader: !0,
3958
3958
  size: "wide",
3959
- supportingText: `使用 ${Vs} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
3959
+ supportingText: `使用 ${Us} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
3960
3960
  title: "試跑流程",
3961
3961
  children: /* @__PURE__ */ M("div", {
3962
3962
  style: Zo,
@@ -3998,14 +3998,14 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
3998
3998
  children: [
3999
3999
  t.nodeLabel,
4000
4000
  " · ",
4001
- el(t.status)
4001
+ nl(t.status)
4002
4002
  ]
4003
4003
  }),
4004
4004
  /* @__PURE__ */ M(k, {
4005
4005
  color: "text-neutral",
4006
4006
  variant: "caption",
4007
4007
  children: [
4008
- tl(t.nodeType),
4008
+ rl(t.nodeType),
4009
4009
  t.assigneeMemberId ? ` · 處理者:${Mo(t.assigneeMemberId, e)}` : "",
4010
4010
  t.edgeLabel ? ` · 來源線段:${t.edgeLabel}` : ""
4011
4011
  ]
@@ -4031,7 +4031,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4031
4031
  variant: "body",
4032
4032
  children: t.message
4033
4033
  }),
4034
- (t.status === "SKIPPED" ? [] : fl(z, t.nodeId, cn)).map((e) => /* @__PURE__ */ M(k, {
4034
+ (t.status === "SKIPPED" ? [] : ml(z, t.nodeId, cn)).map((e) => /* @__PURE__ */ M(k, {
4035
4035
  color: "text-neutral",
4036
4036
  variant: "caption",
4037
4037
  children: ["將送出 Webhook:", e.label]
@@ -4091,7 +4091,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4091
4091
  });
4092
4092
  }
4093
4093
  function vi() {
4094
- let e = [...Rs, zs], t = Y.mode === "ORG_UNIT" || Y.mode === "ORG_UNIT_POSITION" ? Ln(K, Y.orgUnitId ?? "") : null, n = Y.mode === "ORG_UNIT_POSITION" ? Rn(q, Y.positionId ?? "") : null, r = Y.mode === "ORG_UNIT_POSITION" ? ea({
4094
+ let e = [...Bs, Vs], t = Y.mode === "ORG_UNIT" || Y.mode === "ORG_UNIT_POSITION" ? Ln(K, Y.orgUnitId ?? "") : null, n = Y.mode === "ORG_UNIT_POSITION" ? Rn(q, Y.positionId ?? "") : null, r = Y.mode === "ORG_UNIT_POSITION" ? ea({
4095
4095
  date: ce,
4096
4096
  includeDescendants: !!Y.includeDescendants,
4097
4097
  memberships: Gt,
@@ -4118,8 +4118,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4118
4118
  return;
4119
4119
  }
4120
4120
  Te(!1);
4121
- let t = Ic(e?.id ?? null), n = Uc(t);
4122
- ge(t === "ALL" ? null : t), Se(t === "ALL" ? null : n), et(Vc(n, K));
4121
+ let t = Rc(e?.id ?? null), n = Gc(t);
4122
+ ge(t === "ALL" ? null : t), Se(t === "ALL" ? null : n), et(Uc(n, K));
4123
4123
  },
4124
4124
  options: e,
4125
4125
  placeholder: "選擇誰可以發起",
@@ -4193,7 +4193,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4193
4193
  required: !0,
4194
4194
  children: /* @__PURE__ */ j(E, {
4195
4195
  clearable: !1,
4196
- onChange: (e) => n ? void 0 : fi(vc(e?.id ?? null)),
4196
+ onChange: (e) => n ? void 0 : fi(bc(e?.id ?? null)),
4197
4197
  options: [...Ds],
4198
4198
  readOnly: n,
4199
4199
  value: $(Ds, r)
@@ -4213,8 +4213,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4213
4213
  positionId: t.type === "ORG_UNIT_POSITION" ? t.positionId : "",
4214
4214
  positions: q,
4215
4215
  scopedPositions: f
4216
- }), m = n.mode === "DYNAMIC_FORM" ? n.levelsUp === null ? ln(Z, n.formPath) : dn(Z, n.formPath) : null, h = n.mode === "ORG_UNIT_MANAGER" && n.orgSource === "FORM_FIELD" ? pn(Z, n.formPath) : null, g = n.mode === "ORG_UNIT_MANAGER" && n.orgSource === "FIXED" ? Ln(K, n.orgUnitId) : null, _ = n.mode === "NODE_ACTOR" ? Vi(z, e.id, n.nodeIds) : null, v = t.type === "ORG_MANAGER" ? An(t.levelsUp) : bn[0], y = a?.fallback ?? { type: "NONE" }, x = Vt(y), S = x === null ? Ms : [...Ms, Ns], ee = t.type === "ORG_MANAGER_CHAIN" ? Wt(q, t.minPositionLevel) : [], C = t.type === "ORG_MANAGER_CHAIN" ? t : null, te = C ? sr(C) : null, T = C ? cr(C) : null, ne = C && te === "FORM_MEMBER" ? dn(Z, pr(C) ?? "") : null, re = C && te === "NODE_ACTOR" ? Hi(z, e.id, mr(C) ?? []) : null, D = C ? yr(C, q) : null, ie = C ? xr(C) : null, ae = y.type === "DIRECT" && y.memberId ? zn(G, y.memberId) : null, k = y.type === "POSITION" ? Rn(q, y.positionId) : null, oe = e.data.returnBehavior.resubmitStrategy ?? "RESTART", N = e.data.sla ?? null, se = e.data.excludeInitiator ?? null, F = e.data.excludeNodeActors ?? null, le = F ? Ji(z, e.id, F.nodeIds, F.whenEmpty) : null, I = N ? It(N.duration) : null, ue = I?.unit ?? "DAY", de = Oc(N?.warningAt ?? null), fe = An(N?.escalateLevelsUp ?? 1), pe = xc(e.data.decisionPolicy), L = Cc(e.data.decisionPolicy);
4217
- function me() {
4216
+ }), m = n.mode === "DYNAMIC_FORM" ? n.levelsUp === null ? ln(Z, n.formPath) : dn(Z, n.formPath) : null, h = n.mode === "ORG_UNIT_MANAGER" && n.orgSource === "FORM_FIELD" ? pn(Z, n.formPath) : null, g = n.mode === "ORG_UNIT_MANAGER" && n.orgSource === "FIXED" ? Ln(K, n.orgUnitId) : null, _ = n.mode === "NODE_ACTOR" ? Vi(z, e.id, n.nodeIds) : null, v = t.type === "ORG_MANAGER" ? An(t.levelsUp) : bn[0], y = a?.fallback ?? { type: "NONE" }, x = Vt(y), S = x === null ? Ms : [...Ms, Ns], ee = t.type === "ORG_MANAGER_CHAIN" ? Wt(q, t.minPositionLevel) : [], C = t.type === "ORG_MANAGER_CHAIN" ? t : null, te = C ? sr(C) : null, T = te !== null && te !== "INITIATOR", ne = C ? cr(C) : null, re = C && te === "FORM_MEMBER" ? dn(Z, pr(C) ?? "") : null, D = C && te === "NODE_ACTOR" ? Hi(z, e.id, mr(C) ?? []) : null, ie = C ? yr(C, q) : null, ae = C ? xr(C) : null, k = y.type === "DIRECT" && y.memberId ? zn(G, y.memberId) : null, oe = y.type === "POSITION" ? Rn(q, y.positionId) : null, se = e.data.returnBehavior.resubmitStrategy ?? "RESTART", N = e.data.sla ?? null, F = e.data.excludeInitiator ?? null, I = e.data.excludeNodeActors ?? null, le = I ? Ji(z, e.id, I.nodeIds, I.whenEmpty) : null, ue = N ? It(N.duration) : null, de = ue?.unit ?? "DAY", fe = Ac(N?.warningAt ?? null), pe = An(N?.escalateLevelsUp ?? 1), me = Cc(e.data.decisionPolicy), L = Tc(e.data.decisionPolicy);
4217
+ function he() {
4218
4218
  return i ? /* @__PURE__ */ j(d, {
4219
4219
  hintText: i.invalid ? "原本儲存的主管層級無效(需為第 1 層以上),請重新選擇;發布前必須修正。" : n.mode === "NODE_ACTOR" ? "選「關卡的簽核者」就是簽核者本人;選主管則往上找他的主管,不會是簽核者自己。" : "選「欄位裡的人」就是欄位選的人;選主管則往上找他的主管,不會是欄位裡的人自己。",
4220
4220
  label: "簽核人",
@@ -4301,7 +4301,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4301
4301
  onVisibilityChange: (e) => {
4302
4302
  e && (Lt([]), Lr(""));
4303
4303
  },
4304
- options: [...sl(o, Ft)],
4304
+ options: [...ll(o, Ft)],
4305
4305
  placeholder: "搜尋姓名或信箱",
4306
4306
  searchDebounceTime: 300,
4307
4307
  value: o
@@ -4322,7 +4322,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4322
4322
  placeholder: "選擇人員選擇欄位",
4323
4323
  value: m?.selected ?? void 0
4324
4324
  })
4325
- }), me()] }) : null,
4325
+ }), he()] }) : null,
4326
4326
  t.type === "ORG_MANAGER" ? /* @__PURE__ */ j(d, {
4327
4327
  hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
4328
4328
  label: "主管層級",
@@ -4342,7 +4342,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4342
4342
  }) : null,
4343
4343
  t.type === "ORG_MANAGER_CHAIN" ? /* @__PURE__ */ M(A, { children: [
4344
4344
  /* @__PURE__ */ j(d, {
4345
- hintText: te === "INITIATOR" ? "從發起人的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。" : "從起點的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。",
4345
+ hintText: te === "INITIATOR" ? "從發起人的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。" : `從起點的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。${T && !F ? Fs : ""}`,
4346
4346
  label: "簽到職等",
4347
4347
  name: "minPositionLevel",
4348
4348
  required: !0,
@@ -4353,8 +4353,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4353
4353
  value: $(ee, String(t.minPositionLevel))
4354
4354
  })
4355
4355
  }),
4356
- T ? /* @__PURE__ */ j(d, {
4357
- hintText: T.hint,
4356
+ ne ? /* @__PURE__ */ j(d, {
4357
+ hintText: ne.hint,
4358
4358
  label: "從誰的主管開始",
4359
4359
  name: "orgManagerChainStart",
4360
4360
  required: !0,
@@ -4364,25 +4364,25 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4364
4364
  let n = fr(t, e?.id ?? null);
4365
4365
  n && Q(n);
4366
4366
  },
4367
- options: [...T.options],
4368
- value: T.selected
4367
+ options: [...ne.options],
4368
+ value: ne.selected
4369
4369
  })
4370
4370
  }) : null,
4371
- ne ? /* @__PURE__ */ j(d, {
4372
- hintText: ne.problem ?? "只能選單選的人員欄位;欄位要必填、不被條件隱藏,否則送出時可能找不到起點。",
4371
+ re ? /* @__PURE__ */ j(d, {
4372
+ hintText: re.problem ?? "只能選單選的人員欄位;欄位要必填、不被條件隱藏,否則送出時可能找不到起點。",
4373
4373
  label: "表單欄位",
4374
4374
  name: "orgManagerChainStartFormPath",
4375
4375
  required: !0,
4376
4376
  children: /* @__PURE__ */ j(E, {
4377
4377
  clearable: !1,
4378
4378
  onChange: (e) => Q(hr(t, e?.id ?? "")),
4379
- options: [...ne.options],
4379
+ options: [...re.options],
4380
4380
  placeholder: "選擇人員選擇欄位",
4381
- value: ne.selected ?? void 0
4381
+ value: re.selected ?? void 0
4382
4382
  })
4383
4383
  }) : null,
4384
- re ? /* @__PURE__ */ j(d, {
4385
- hintText: re.problems.length > 0 ? re.problems.join(";") : Fi,
4384
+ D ? /* @__PURE__ */ j(d, {
4385
+ hintText: D.problems.length > 0 ? D.problems.join(";") : Fi,
4386
4386
  label: "關卡",
4387
4387
  name: "orgManagerChainStartNodeIds",
4388
4388
  required: !0,
@@ -4390,14 +4390,14 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4390
4390
  clearable: !0,
4391
4391
  mode: "multiple",
4392
4392
  onChange: (e) => Q(gr(t, e.map((e) => e.id))),
4393
- options: [...re.options],
4393
+ options: [...D.options],
4394
4394
  overflowStrategy: "wrap",
4395
4395
  placeholder: "選擇前面的簽核關卡",
4396
- value: [...re.selected]
4396
+ value: [...D.selected]
4397
4397
  })
4398
4398
  }) : null,
4399
- D ? /* @__PURE__ */ j(d, {
4400
- hintText: ie ?? (D.invalid ? "原本儲存的起始職等無效,請重新選擇;發布前必須修正。" : "職等低於這裡的主管只會被略過、不簽核;留白則從鏈上第一位有職等的主管開始簽。不可高於「簽到職等」。"),
4399
+ ie ? /* @__PURE__ */ j(d, {
4400
+ hintText: ae ?? (ie.invalid ? "原本儲存的起始職等無效,請重新選擇;發布前必須修正。" : "職等低於這裡的主管只會被略過、不簽核;留白則從鏈上第一位有職等的主管開始簽。不可高於「簽到職等」。"),
4401
4401
  label: "從職等幾開始簽",
4402
4402
  name: "startPositionLevel",
4403
4403
  children: /* @__PURE__ */ j(E, {
@@ -4406,8 +4406,8 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4406
4406
  let n = br(t, e?.id ?? null);
4407
4407
  n && Q(n);
4408
4408
  },
4409
- options: [...D.options],
4410
- value: D.selected
4409
+ options: [...ie.options],
4410
+ value: ie.selected
4411
4411
  })
4412
4412
  }) : null
4413
4413
  ] }) : null,
@@ -4472,7 +4472,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4472
4472
  placeholder: "選擇前面的簽核關卡",
4473
4473
  value: [..._?.selected ?? []]
4474
4474
  })
4475
- }), me()] }) : null,
4475
+ }), he()] }) : null,
4476
4476
  t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ j(d, {
4477
4477
  hintText: "依指定組織目前有效會員歸屬建立候選簽核人。",
4478
4478
  label: "組織",
@@ -4517,7 +4517,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4517
4517
  children: /* @__PURE__ */ j(E, {
4518
4518
  clearable: !1,
4519
4519
  onChange: (e) => {
4520
- e?.id !== "UNSUPPORTED" && Q(kn(t, Fc(e?.id ?? null)));
4520
+ e?.id !== "UNSUPPORTED" && Q(kn(t, Lc(e?.id ?? null)));
4521
4521
  },
4522
4522
  options: [...S],
4523
4523
  value: x === null ? $(Ms, y.type) : Ns
@@ -4549,10 +4549,10 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4549
4549
  onVisibilityChange: (e) => {
4550
4550
  e && (Lt([]), Lr(""));
4551
4551
  },
4552
- options: [...sl(Ft, ae ? [ae] : [])],
4552
+ options: [...ll(Ft, k ? [k] : [])],
4553
4553
  placeholder: "搜尋姓名或信箱",
4554
4554
  searchDebounceTime: 300,
4555
- value: ae
4555
+ value: k
4556
4556
  })
4557
4557
  }), /* @__PURE__ */ j(d, {
4558
4558
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
@@ -4585,7 +4585,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4585
4585
  })),
4586
4586
  placeholder: "選擇職位",
4587
4587
  positions: q,
4588
- value: k
4588
+ value: oe
4589
4589
  })
4590
4590
  }), /* @__PURE__ */ j(d, {
4591
4591
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
@@ -4663,12 +4663,12 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4663
4663
  required: !0,
4664
4664
  children: /* @__PURE__ */ j(E, {
4665
4665
  clearable: !1,
4666
- onChange: (t) => ci(Sc(t?.id ?? null, e.data.decisionPolicy)),
4666
+ onChange: (t) => ci(wc(t?.id ?? null, e.data.decisionPolicy)),
4667
4667
  options: [...Er.filter((e) => t.type !== "ORG_MANAGER_CHAIN" || e.id === "SEQUENTIAL" || e.id === "PARALLEL_ALL")],
4668
- value: Or(pe)
4668
+ value: Or(me)
4669
4669
  })
4670
4670
  }),
4671
- pe === "QUORUM" ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4671
+ me === "QUORUM" ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4672
4672
  label: "門檻計算方式",
4673
4673
  name: "quorumThresholdType",
4674
4674
  required: !0,
@@ -4676,7 +4676,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4676
4676
  clearable: !1,
4677
4677
  onChange: (e) => ci({
4678
4678
  threshold: L.threshold,
4679
- thresholdType: wc(e?.id ?? null),
4679
+ thresholdType: Ec(e?.id ?? null),
4680
4680
  type: "QUORUM"
4681
4681
  }),
4682
4682
  options: [...js],
@@ -4711,7 +4711,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4711
4711
  required: !0,
4712
4712
  children: /* @__PURE__ */ j(E, {
4713
4713
  clearable: !1,
4714
- onChange: (e) => ti(yc(e?.id ?? null)),
4714
+ onChange: (e) => ti(xc(e?.id ?? null)),
4715
4715
  options: [...Os],
4716
4716
  value: $(Os, e.data.returnBehavior.allowedTargets)
4717
4717
  })
@@ -4723,9 +4723,9 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4723
4723
  required: !0,
4724
4724
  children: /* @__PURE__ */ j(E, {
4725
4725
  clearable: !1,
4726
- onChange: (e) => ni(bc(e?.id ?? null)),
4726
+ onChange: (e) => ni(Sc(e?.id ?? null)),
4727
4727
  options: [...ks],
4728
- value: $(ks, oe)
4728
+ value: $(ks, se)
4729
4729
  })
4730
4730
  }) : null,
4731
4731
  e.data.returnBehavior.allowReturn ? /* @__PURE__ */ j(d, {
@@ -4767,7 +4767,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4767
4767
  onChange: (e) => ai(e.target.checked ? ct : null)
4768
4768
  })
4769
4769
  }),
4770
- N && !I ? /* @__PURE__ */ j(d, {
4770
+ N && !ue ? /* @__PURE__ */ j(d, {
4771
4771
  hintText: "此期限混用了日與時,無法在表單中編輯。請改以單一單位設定,或透過 API 維護。",
4772
4772
  label: "時效期限",
4773
4773
  name: "slaDurationRaw",
@@ -4777,7 +4777,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4777
4777
  variant: "base"
4778
4778
  })
4779
4779
  }) : null,
4780
- N && I ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4780
+ N && ue ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4781
4781
  label: "時效期限",
4782
4782
  name: "slaDurationValue",
4783
4783
  required: !0,
@@ -4786,11 +4786,11 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4786
4786
  inputProps: { min: 1 },
4787
4787
  inputType: "number",
4788
4788
  name: "slaDurationValue",
4789
- onChange: (e) => ai(Ac(N, {
4790
- unit: ue,
4789
+ onChange: (e) => ai(Mc(N, {
4790
+ unit: de,
4791
4791
  value: Number(e.target.value)
4792
4792
  })),
4793
- value: String(I.value),
4793
+ value: String(ue.value),
4794
4794
  variant: "base"
4795
4795
  })
4796
4796
  }), /* @__PURE__ */ j(d, {
@@ -4799,15 +4799,15 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4799
4799
  required: !0,
4800
4800
  children: /* @__PURE__ */ j(E, {
4801
4801
  clearable: !1,
4802
- onChange: (e) => ai(Ac(N, {
4803
- unit: Tc(e?.id ?? null),
4804
- value: I.value
4802
+ onChange: (e) => ai(Mc(N, {
4803
+ unit: Dc(e?.id ?? null),
4804
+ value: ue.value
4805
4805
  })),
4806
4806
  options: [...dt],
4807
- value: $(dt, ue)
4807
+ value: $(dt, de)
4808
4808
  })
4809
4809
  })] }) : null,
4810
- N && ue === "DAY" ? /* @__PURE__ */ j(d, {
4810
+ N && de === "DAY" ? /* @__PURE__ */ j(d, {
4811
4811
  hintText: "工作日會跳過週末與行事曆上的假日,補班日仍計為工作日;行事曆由系統管理者設定。",
4812
4812
  label: "計算方式",
4813
4813
  name: "slaCalendar",
@@ -4816,7 +4816,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4816
4816
  clearable: !1,
4817
4817
  onChange: (e) => ai({
4818
4818
  ...N,
4819
- calendar: Ec(e?.id ?? null)
4819
+ calendar: Oc(e?.id ?? null)
4820
4820
  }),
4821
4821
  options: [...ut],
4822
4822
  value: $(ut, N.calendar ?? "CALENDAR")
@@ -4828,7 +4828,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4828
4828
  required: !0,
4829
4829
  children: /* @__PURE__ */ j(E, {
4830
4830
  clearable: !1,
4831
- onChange: (e) => ai(jc(N, Dc(e?.id ?? null))),
4831
+ onChange: (e) => ai(Nc(N, kc(e?.id ?? null))),
4832
4832
  options: [...ft],
4833
4833
  value: $(ft, N.onTimeout)
4834
4834
  })
@@ -4845,7 +4845,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4845
4845
  escalateLevelsUp: jn(e?.id ?? null).value
4846
4846
  }),
4847
4847
  options: [...bn],
4848
- value: fe
4848
+ value: pe
4849
4849
  })
4850
4850
  }) : null,
4851
4851
  N ? /* @__PURE__ */ j(d, {
@@ -4854,9 +4854,9 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4854
4854
  name: "slaWarningAt",
4855
4855
  children: /* @__PURE__ */ j(E, {
4856
4856
  clearable: !1,
4857
- onChange: (e) => ai(Mc(N, kc(e?.id ?? null).value)),
4857
+ onChange: (e) => ai(Pc(N, jc(e?.id ?? null).value)),
4858
4858
  options: [...As],
4859
- value: de
4859
+ value: fe
4860
4860
  })
4861
4861
  }) : null,
4862
4862
  /* @__PURE__ */ j(d, {
@@ -4903,23 +4903,24 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4903
4903
  label: "申請人不可簽核自己的單",
4904
4904
  name: "excludeInitiator",
4905
4905
  children: /* @__PURE__ */ j(O, {
4906
- checked: !!se,
4906
+ checked: !!F,
4907
4907
  inputProps: {
4908
4908
  id: "excludeInitiator",
4909
4909
  name: "excludeInitiator"
4910
4910
  },
4911
- onChange: (e) => oi(e.target.checked ? Fs : null)
4911
+ onChange: (e) => oi(e.target.checked ? Ls : null)
4912
4912
  })
4913
4913
  }),
4914
- se ? /* @__PURE__ */ j(d, {
4914
+ F ? /* @__PURE__ */ j(d, {
4915
+ hintText: T && F.whenEmpty === "INITIATOR_MANAGER" ? Is : void 0,
4915
4916
  label: "排除後沒有簽核人時",
4916
4917
  name: "excludeInitiatorWhenEmpty",
4917
4918
  required: !0,
4918
4919
  children: /* @__PURE__ */ j(E, {
4919
4920
  clearable: !1,
4920
- onChange: (e) => oi({ whenEmpty: $(Ps, e?.id ?? null)?.id ?? Fs.whenEmpty }),
4921
+ onChange: (e) => oi({ whenEmpty: $(Ps, e?.id ?? null)?.id ?? Ls.whenEmpty }),
4921
4922
  options: [...Ps],
4922
- value: $(Ps, se.whenEmpty)
4923
+ value: $(Ps, F.whenEmpty)
4923
4924
  })
4924
4925
  }) : null,
4925
4926
  /* @__PURE__ */ j(d, {
@@ -4927,15 +4928,15 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4927
4928
  label: "不可與前面關卡同一人",
4928
4929
  name: "excludeNodeActors",
4929
4930
  children: /* @__PURE__ */ j(O, {
4930
- checked: !!F,
4931
+ checked: !!I,
4931
4932
  inputProps: {
4932
4933
  id: "excludeNodeActors",
4933
4934
  name: "excludeNodeActors"
4934
4935
  },
4935
- onChange: (e) => si(e.target.checked ? Is : null)
4936
+ onChange: (e) => si(e.target.checked ? Rs : null)
4936
4937
  })
4937
4938
  }),
4938
- F && le ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4939
+ I && le ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(d, {
4939
4940
  hintText: le.problems.length > 0 ? le.problems.join(";") : Ki,
4940
4941
  label: "不能與以下關卡同一人",
4941
4942
  name: "excludeNodeActorsNodeIds",
@@ -4944,7 +4945,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4944
4945
  clearable: !0,
4945
4946
  mode: "multiple",
4946
4947
  onChange: (e) => si({
4947
- ...F,
4948
+ ...I,
4948
4949
  nodeIds: e.map((e) => e.id)
4949
4950
  }),
4950
4951
  options: [...le.options],
@@ -4953,17 +4954,18 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4953
4954
  value: [...le.selected]
4954
4955
  })
4955
4956
  }), /* @__PURE__ */ j(d, {
4957
+ hintText: T && I.whenEmpty === "INITIATOR_MANAGER" ? Is : void 0,
4956
4958
  label: "排除後沒有簽核人時",
4957
4959
  name: "excludeNodeActorsWhenEmpty",
4958
4960
  required: !0,
4959
4961
  children: /* @__PURE__ */ j(E, {
4960
4962
  clearable: !1,
4961
4963
  onChange: (e) => si({
4962
- ...F,
4963
- whenEmpty: $(Ps, e?.id ?? null)?.id ?? Is.whenEmpty
4964
+ ...I,
4965
+ whenEmpty: $(Ps, e?.id ?? null)?.id ?? Rs.whenEmpty
4964
4966
  }),
4965
4967
  options: [...Ps],
4966
- value: $(Ps, F.whenEmpty)
4968
+ value: $(Ps, I.whenEmpty)
4967
4969
  })
4968
4970
  })] }) : null,
4969
4971
  /* @__PURE__ */ j(ki, {
@@ -4982,7 +4984,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
4982
4984
  ] });
4983
4985
  }
4984
4986
  function xi(e) {
4985
- let t = e.data.action, n = Ka(t), r = qa(n), i = r.readOnly && r.hint ? `目前知會對象為「${Nn(n, G, K, q, Z)}${n.type === "EXPRESSION" ? `:${n.expression}` : ""}」。${r.hint}` : r.hint, a = wl(t).map((e) => zn(G, e)), o = n.type === "ORG_UNIT_MEMBER" || n.type === "ORG_UNIT_POSITION" || n.type === "ORG_UNIT_MANAGER" ? Ln(K, n.orgUnitId) : null, s = n.type === "POSITION" || n.type === "ORG_UNIT_POSITION" ? Rn(q, n.positionId) : null, l = $i(Gt, ce), f = n.type === "POSITION" && !!n.positionId && !l.has(n.positionId), p = q.filter((e) => l.has(e.id) || f && e.id === n.positionId), m = n.type === "ORG_UNIT_POSITION" ? ea({
4987
+ let t = e.data.action, n = Ka(t), r = qa(n), i = r.readOnly && r.hint ? `目前知會對象為「${Nn(n, G, K, q, Z)}${n.type === "EXPRESSION" ? `:${n.expression}` : ""}」。${r.hint}` : r.hint, a = El(t).map((e) => zn(G, e)), o = n.type === "ORG_UNIT_MEMBER" || n.type === "ORG_UNIT_POSITION" || n.type === "ORG_UNIT_MANAGER" ? Ln(K, n.orgUnitId) : null, s = n.type === "POSITION" || n.type === "ORG_UNIT_POSITION" ? Rn(q, n.positionId) : null, l = $i(Gt, ce), f = n.type === "POSITION" && !!n.positionId && !l.has(n.positionId), p = q.filter((e) => l.has(e.id) || f && e.id === n.positionId), m = n.type === "ORG_UNIT_POSITION" ? ea({
4986
4988
  date: ce,
4987
4989
  includeDescendants: !!n.includeDescendants,
4988
4990
  memberships: Gt,
@@ -5024,12 +5026,12 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5024
5026
  type: "NOTIFY"
5025
5027
  });
5026
5028
  },
5027
- options: [...Bs],
5028
- value: $(Bs, t.type)
5029
+ options: [...Hs],
5030
+ value: $(Hs, t.type)
5029
5031
  })
5030
5032
  });
5031
5033
  if (t.type === "SET_FORM_FIELD") {
5032
- let e = gl(X?.schema ?? null), n = t.fieldPath.replace(/^form\./u, "");
5034
+ let e = vl(X?.schema ?? null), n = t.fieldPath.replace(/^form\./u, "");
5033
5035
  return /* @__PURE__ */ M(A, { children: [
5034
5036
  y,
5035
5037
  /* @__PURE__ */ j(d, {
@@ -5100,7 +5102,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5100
5102
  onVisibilityChange: (e) => {
5101
5103
  e && (Lt([]), Lr(""));
5102
5104
  },
5103
- options: [...sl(a, Ft)],
5105
+ options: [...ll(a, Ft)],
5104
5106
  overflowStrategy: "wrap",
5105
5107
  placeholder: "搜尋姓名或信箱",
5106
5108
  searchDebounceTime: 300,
@@ -5212,7 +5214,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5212
5214
  });
5213
5215
  }
5214
5216
  function Ci(e) {
5215
- let t = Sl(e, z.nodes);
5217
+ let t = wl(e, z.nodes);
5216
5218
  return /* @__PURE__ */ M("div", {
5217
5219
  style: Zo,
5218
5220
  children: [
@@ -5239,7 +5241,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5239
5241
  });
5240
5242
  }
5241
5243
  function wi(e) {
5242
- return !e || !Sl(e, z.nodes) ? null : /* @__PURE__ */ j(te, {
5244
+ return !e || !wl(e, z.nodes) ? null : /* @__PURE__ */ j(te, {
5243
5245
  cancelText: "取消",
5244
5246
  confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
5245
5247
  confirmText: "完成",
@@ -5257,7 +5259,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5257
5259
  });
5258
5260
  }
5259
5261
  function Ti(e) {
5260
- let t = bl(e, z.nodes), n = gl(X?.schema ?? null), r = _l(X?.schema ?? null, e.data.conditionFieldKey ?? null), i = wt(r), a = vl(r), o = $(i, e.data.conditionOperator ?? null), s = !e.data.isDefault && !e.data.condition, c = !e.data.isDefault && (Ee === e.id || To(e));
5262
+ let t = Sl(e, z.nodes), n = vl(X?.schema ?? null), r = yl(X?.schema ?? null, e.data.conditionFieldKey ?? null), i = wt(r), a = bl(r), o = $(i, e.data.conditionOperator ?? null), s = !e.data.isDefault && !e.data.condition, c = !e.data.isDefault && (Ee === e.id || To(e));
5261
5263
  return /* @__PURE__ */ M("div", {
5262
5264
  style: Zo,
5263
5265
  children: [
@@ -5348,7 +5350,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5348
5350
  value: o
5349
5351
  })
5350
5352
  }),
5351
- o && yl(o.id) ? /* @__PURE__ */ j(d, {
5353
+ o && xl(o.id) ? /* @__PURE__ */ j(d, {
5352
5354
  label: "條件值",
5353
5355
  name: "edgeConditionValue",
5354
5356
  required: !0,
@@ -5376,7 +5378,7 @@ function Xs({ aiAssistantAvailable: e = !0, embedded: n = !1, formSchemaOverride
5376
5378
  });
5377
5379
  }
5378
5380
  }
5379
- function Zs({ onApplyAutoLayout: e }) {
5381
+ function $s({ onApplyAutoLayout: e }) {
5380
5382
  function t() {
5381
5383
  e();
5382
5384
  }
@@ -5392,12 +5394,12 @@ function Zs({ onApplyAutoLayout: e }) {
5392
5394
  })
5393
5395
  });
5394
5396
  }
5395
- function Qs({ data: e, selected: t, type: n }) {
5396
- let r = e.approverLines ?? [e.approverSummary ?? e.label], i = $s(e), a = ec(n, t);
5397
+ function ec({ data: e, selected: t, type: n }) {
5398
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = tc(e), a = nc(n, t);
5397
5399
  return /* @__PURE__ */ M("div", {
5398
5400
  style: a,
5399
5401
  children: [
5400
- nc(e),
5402
+ ic(e),
5401
5403
  /* @__PURE__ */ j("div", {
5402
5404
  style: xs,
5403
5405
  children: r.map((e, t) => /* @__PURE__ */ j(k, {
@@ -5426,21 +5428,21 @@ function Qs({ data: e, selected: t, type: n }) {
5426
5428
  ]
5427
5429
  });
5428
5430
  }
5429
- function $s(e) {
5431
+ function tc(e) {
5430
5432
  return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : ws[e.nodeKind];
5431
5433
  }
5432
- function ec(e, t) {
5433
- let n = tc(e);
5434
+ function nc(e, t) {
5435
+ let n = rc(e);
5434
5436
  return t ? {
5435
5437
  ...n,
5436
5438
  border: "1px solid var(--mzn-color-primary, #0057ff)",
5437
5439
  boxShadow: os
5438
5440
  } : n;
5439
5441
  }
5440
- function tc(e) {
5442
+ function rc(e) {
5441
5443
  return e === "exclusiveGateway" ? hs : e === "parallelGateway" ? gs : e === "startEvent" ? vs : e === "endEvent" ? ys : e === "userTask" ? _s : as;
5442
5444
  }
5443
- function nc(e) {
5445
+ function ic(e) {
5444
5446
  return !e.hasInput && e.hasOutput ? /* @__PURE__ */ j(et, {
5445
5447
  id: Cs,
5446
5448
  position: U.Right,
@@ -5459,21 +5461,21 @@ function nc(e) {
5459
5461
  type: "source"
5460
5462
  }, "source")];
5461
5463
  }
5462
- function rc(e, t, n, r, i, a, o, s) {
5463
- let c = ic(e);
5464
+ function ac(e, t, n, r, i, a, o, s) {
5465
+ let c = oc(e);
5464
5466
  return {
5465
5467
  data: {
5466
- approverLines: ul(e, t, n, r, o),
5467
- approverSummary: ll(e, t, n, r, o, s),
5468
+ approverLines: fl(e, t, n, r, o),
5469
+ approverSummary: dl(e, t, n, r, o, s),
5468
5470
  fieldAccessTag: e.type === "userTask" ? ii(e) : null,
5469
- hasInput: qc(e),
5470
- hasOutput: Jc(e),
5471
- initiatorPolicySummary: e.type === "startEvent" ? Hc(a, n, r) : null,
5471
+ hasInput: Yc(e),
5472
+ hasOutput: Xc(e),
5473
+ initiatorPolicySummary: e.type === "startEvent" ? Wc(a, n, r) : null,
5472
5474
  label: e.data.label,
5473
5475
  nodeKind: e.type
5474
5476
  },
5475
5477
  height: c.height,
5476
- handles: ac(e),
5478
+ handles: sc(e),
5477
5479
  id: e.id,
5478
5480
  initialHeight: c.height,
5479
5481
  initialWidth: c.width,
@@ -5485,23 +5487,23 @@ function rc(e, t, n, r, i, a, o, s) {
5485
5487
  width: c.width
5486
5488
  };
5487
5489
  }
5488
- function ic(e) {
5490
+ function oc(e) {
5489
5491
  return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
5490
5492
  height: fs,
5491
5493
  width: ps
5492
5494
  } : e.type === "serviceTask" ? {
5493
- height: ss + (dl(e.data.action) - 1) * ls,
5495
+ height: ss + (pl(e.data.action) - 1) * ls,
5494
5496
  width: cs
5495
5497
  } : {
5496
5498
  height: ss + (e.type === "userTask" && ii(e) !== null ? us : 0),
5497
5499
  width: cs
5498
5500
  };
5499
5501
  }
5500
- function ac(e) {
5501
- let t = ic(e);
5502
- return [...qc(e) ? [oc(t)] : [], ...Jc(e) ? [sc(t)] : []];
5502
+ function sc(e) {
5503
+ let t = oc(e);
5504
+ return [...Yc(e) ? [cc(t)] : [], ...Xc(e) ? [lc(t)] : []];
5503
5505
  }
5504
- function oc({ height: e }) {
5506
+ function cc({ height: e }) {
5505
5507
  let t = e / 2 - 9 / 2;
5506
5508
  return {
5507
5509
  height: 9,
@@ -5513,7 +5515,7 @@ function oc({ height: e }) {
5513
5515
  y: t
5514
5516
  };
5515
5517
  }
5516
- function sc({ height: e, width: t }) {
5518
+ function lc({ height: e, width: t }) {
5517
5519
  let n = e / 2 - 9 / 2;
5518
5520
  return {
5519
5521
  height: 9,
@@ -5525,8 +5527,8 @@ function sc({ height: e, width: t }) {
5525
5527
  y: n
5526
5528
  };
5527
5529
  }
5528
- function cc(e, t, n) {
5529
- let r = bl(e, t), i = Sl(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? qo : i ? Go : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? qo : i ? Go : Ko;
5530
+ function uc(e, t, n) {
5531
+ let r = Sl(e, t), i = wl(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? qo : i ? Go : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? qo : i ? Go : Ko;
5530
5532
  return {
5531
5533
  className: n ? "workflow-edge--selected" : void 0,
5532
5534
  data: e.data,
@@ -5560,7 +5562,7 @@ function cc(e, t, n) {
5560
5562
  type: e.type ?? "smoothstep"
5561
5563
  };
5562
5564
  }
5563
- function lc(e, t) {
5565
+ function dc(e, t) {
5564
5566
  return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
5565
5567
  ...e,
5566
5568
  data: {
@@ -5569,10 +5571,10 @@ function lc(e, t) {
5569
5571
  }
5570
5572
  });
5571
5573
  }
5572
- function uc(e) {
5573
- return mc(fc(pc(dc(e))));
5574
+ function fc(e) {
5575
+ return gc(mc(hc(pc(e))));
5574
5576
  }
5575
- function dc(e) {
5577
+ function pc(e) {
5576
5578
  let t = e.edges.map((e) => {
5577
5579
  let t = e.data ?? {};
5578
5580
  return e.data === t ? e : {
@@ -5585,7 +5587,7 @@ function dc(e) {
5585
5587
  edges: t
5586
5588
  } : e;
5587
5589
  }
5588
- function fc(e) {
5590
+ function mc(e) {
5589
5591
  let t = e.nodes.map((e) => {
5590
5592
  if (e.type !== "userTask") return e;
5591
5593
  let t = e.data.allowAddSigner ?? !1, n = e.data.allowReject ?? !0, r = e.data.allowTransfer ?? !0, i = !e.data.decisionPolicy;
@@ -5605,24 +5607,24 @@ function fc(e) {
5605
5607
  nodes: t
5606
5608
  } : e;
5607
5609
  }
5608
- function pc(e) {
5609
- let t = new Set(e.nodes.filter((e) => Yc(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
5610
+ function hc(e) {
5611
+ let t = new Set(e.nodes.filter((e) => Zc(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
5610
5612
  return n.length === e.edges.length ? e : {
5611
5613
  ...e,
5612
5614
  edges: n
5613
5615
  };
5614
5616
  }
5615
- function mc(e) {
5617
+ function gc(e) {
5616
5618
  let t = e.edges.reduce((e, t) => ({
5617
5619
  ...e,
5618
5620
  [t.target]: (e[t.target] ?? 0) + 1
5619
- }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? lc(e, "AND") : e);
5621
+ }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? dc(e, "AND") : e);
5620
5622
  return n.some((t, n) => t !== e.nodes[n]) ? {
5621
5623
  ...e,
5622
5624
  nodes: n
5623
5625
  } : e;
5624
5626
  }
5625
- function hc() {
5627
+ function _c() {
5626
5628
  return {
5627
5629
  edges: [],
5628
5630
  expressionDialect: "cel-v2",
@@ -5650,16 +5652,16 @@ function hc() {
5650
5652
  }]
5651
5653
  };
5652
5654
  }
5653
- function gc(e) {
5655
+ function vc(e) {
5654
5656
  return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
5655
5657
  }
5656
- function _c(e) {
5658
+ function yc(e) {
5657
5659
  let t = new ot.graphlib.Graph();
5658
5660
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
5659
5661
  rankdir: "LR",
5660
5662
  ranksep: 120
5661
5663
  }), e.nodes.forEach((e) => {
5662
- t.setNode(e.id, ic(e));
5664
+ t.setNode(e.id, oc(e));
5663
5665
  }), e.edges.forEach((e) => {
5664
5666
  t.setEdge(e.source, e.target);
5665
5667
  }), ot.layout(t), {
@@ -5669,8 +5671,8 @@ function _c(e) {
5669
5671
  return n ? {
5670
5672
  ...e,
5671
5673
  position: {
5672
- x: n.x - ic(e).width / 2,
5673
- y: n.y - ic(e).height / 2
5674
+ x: n.x - oc(e).width / 2,
5675
+ y: n.y - oc(e).height / 2
5674
5676
  }
5675
5677
  } : e;
5676
5678
  })
@@ -5679,53 +5681,53 @@ function _c(e) {
5679
5681
  function $(e, t) {
5680
5682
  return t ? e.find((e) => e.id === t) ?? null : null;
5681
5683
  }
5682
- function vc(e) {
5684
+ function bc(e) {
5683
5685
  return e === "OR" ? "OR" : "AND";
5684
5686
  }
5685
- function yc(e) {
5687
+ function xc(e) {
5686
5688
  return e === "PREVIOUS" || e === "ANY" ? e : "INITIATOR";
5687
5689
  }
5688
- function bc(e) {
5690
+ function Sc(e) {
5689
5691
  return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
5690
5692
  }
5691
- function xc(e) {
5693
+ function Cc(e) {
5692
5694
  return e?.type ?? "SINGLE";
5693
5695
  }
5694
- function Sc(e, t) {
5696
+ function wc(e, t) {
5695
5697
  return e === "QUORUM" ? t?.type === "QUORUM" ? t : {
5696
5698
  threshold: st,
5697
5699
  thresholdType: "COUNT",
5698
5700
  type: "QUORUM"
5699
5701
  } : e === "PARALLEL_ALL" || e === "PARALLEL_ANY" || e === "SEQUENTIAL" ? { type: e } : { type: "SINGLE" };
5700
5702
  }
5701
- function Cc(e) {
5703
+ function Tc(e) {
5702
5704
  return e?.type === "QUORUM" ? {
5703
5705
  threshold: Number.isFinite(e.threshold) ? e.threshold : st,
5704
- thresholdType: wc(e.thresholdType ?? null)
5706
+ thresholdType: Ec(e.thresholdType ?? null)
5705
5707
  } : {
5706
5708
  threshold: st,
5707
5709
  thresholdType: "COUNT"
5708
5710
  };
5709
5711
  }
5710
- function wc(e) {
5712
+ function Ec(e) {
5711
5713
  return e === "PERCENTAGE" ? "PERCENTAGE" : "COUNT";
5712
5714
  }
5713
- function Tc(e) {
5715
+ function Dc(e) {
5714
5716
  return e === "HOUR" ? "HOUR" : "DAY";
5715
5717
  }
5716
- function Ec(e) {
5718
+ function Oc(e) {
5717
5719
  return e === "BUSINESS_DAY" ? "BUSINESS_DAY" : "CALENDAR";
5718
5720
  }
5719
- function Dc(e) {
5721
+ function kc(e) {
5720
5722
  return ft.find((t) => t.id === e)?.id ?? "REMIND";
5721
5723
  }
5722
- function Oc(e) {
5724
+ function Ac(e) {
5723
5725
  return As.find((t) => t.value === e) ?? As[0];
5724
5726
  }
5725
- function kc(e) {
5727
+ function jc(e) {
5726
5728
  return As.find((t) => t.id === e) ?? As[0];
5727
5729
  }
5728
- function Ac(e, t) {
5730
+ function Mc(e, t) {
5729
5731
  let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = ht({
5730
5732
  unit: t.unit,
5731
5733
  value: n
@@ -5736,30 +5738,30 @@ function Ac(e, t) {
5736
5738
  duration: r
5737
5739
  };
5738
5740
  }
5739
- function jc(e, t) {
5741
+ function Nc(e, t) {
5740
5742
  return t === "ESCALATE" ? {
5741
5743
  ...e,
5742
5744
  escalateLevelsUp: e.escalateLevelsUp ?? 1,
5743
5745
  onTimeout: t
5744
5746
  } : {
5745
- ...Nc(e, "escalateLevelsUp"),
5747
+ ...Fc(e, "escalateLevelsUp"),
5746
5748
  onTimeout: t
5747
5749
  };
5748
5750
  }
5749
- function Mc(e, t) {
5750
- return t === null ? Nc(e, "warningAt") : {
5751
+ function Pc(e, t) {
5752
+ return t === null ? Fc(e, "warningAt") : {
5751
5753
  ...e,
5752
5754
  warningAt: t
5753
5755
  };
5754
5756
  }
5755
- function Nc(e, t) {
5757
+ function Fc(e, t) {
5756
5758
  return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
5757
5759
  }
5758
- function Pc(e) {
5760
+ function Ic(e) {
5759
5761
  return e === "DIRECT" || e === "POSITION" ? e : "NONE";
5760
5762
  }
5761
- function Fc(e) {
5762
- let t = Pc(e);
5763
+ function Lc(e) {
5764
+ let t = Ic(e);
5763
5765
  return t === "DIRECT" ? {
5764
5766
  memberId: "",
5765
5767
  type: "DIRECT"
@@ -5768,16 +5770,16 @@ function Fc(e) {
5768
5770
  type: "POSITION"
5769
5771
  } : { type: "NONE" };
5770
5772
  }
5771
- function Ic(e) {
5773
+ function Rc(e) {
5772
5774
  return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
5773
5775
  }
5774
- function Lc(e) {
5776
+ function zc(e) {
5775
5777
  let t = e?.trim();
5776
5778
  if (!t) return {
5777
5779
  mode: "ALL",
5778
5780
  value: ""
5779
5781
  };
5780
- let n = Bc(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = Bc(t, /"([^"]+)" in subject\.positionIds/gu);
5782
+ let n = Hc(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = Hc(t, /"([^"]+)" in subject\.positionIds/gu);
5781
5783
  return n.length > 0 && r.length > 0 ? {
5782
5784
  includeDescendants: n.length > 1,
5783
5785
  mode: "ORG_UNIT_POSITION",
@@ -5794,20 +5796,20 @@ function Lc(e) {
5794
5796
  value: t
5795
5797
  };
5796
5798
  }
5797
- function Rc(e, t) {
5798
- let n = Lc(e);
5799
+ function Bc(e, t) {
5800
+ let n = zc(e);
5799
5801
  return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
5800
5802
  mode: t,
5801
5803
  value: ""
5802
- } : n : n.mode === t ? n : Uc(t);
5804
+ } : n : n.mode === t ? n : Gc(t);
5803
5805
  }
5804
- function zc(e) {
5806
+ function Vc(e) {
5805
5807
  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;
5806
5808
  }
5807
- function Bc(e, t) {
5809
+ function Hc(e, t) {
5808
5810
  return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
5809
5811
  }
5810
- function Vc(e, t) {
5812
+ function Uc(e, t) {
5811
5813
  if (e.mode === "ALL" || e.mode === "NONE") return null;
5812
5814
  let n = e.orgUnitId?.trim() ?? "";
5813
5815
  if (!n) return null;
@@ -5816,10 +5818,10 @@ function Vc(e, t) {
5816
5818
  let i = e.positionId?.trim() ?? "";
5817
5819
  return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
5818
5820
  }
5819
- function Hc(e, t, n) {
5821
+ function Wc(e, t, n) {
5820
5822
  return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${J(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${J(t, e.orgUnitId)} / ${In(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
5821
5823
  }
5822
- function Uc(e) {
5824
+ function Gc(e) {
5823
5825
  return {
5824
5826
  includeDescendants: !0,
5825
5827
  mode: e,
@@ -5828,29 +5830,29 @@ function Uc(e) {
5828
5830
  value: ""
5829
5831
  };
5830
5832
  }
5831
- function Wc(e, t) {
5833
+ function Kc(e, t) {
5832
5834
  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;
5833
- return !!n && !!r && e.source !== e.target && e.sourceHandle === Cs && e.targetHandle === Ss && !!(n && Jc(n)) && !!(r && qc(r));
5835
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === Cs && e.targetHandle === Ss && !!(n && Xc(n)) && !!(r && Yc(r));
5834
5836
  }
5835
- function Gc(e, t) {
5837
+ function qc(e, t) {
5836
5838
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
5837
5839
  }
5838
- function Kc(e) {
5840
+ function Jc(e) {
5839
5841
  return e.type !== "startEvent" && e.type !== "endEvent";
5840
5842
  }
5841
- function qc(e) {
5843
+ function Yc(e) {
5842
5844
  return e.type !== "startEvent";
5843
5845
  }
5844
- function Jc(e) {
5845
- return e.type !== "endEvent" && !Yc(e);
5846
+ function Xc(e) {
5847
+ return e.type !== "endEvent" && !Zc(e);
5846
5848
  }
5847
- function Yc(e) {
5849
+ function Zc(e) {
5848
5850
  return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
5849
5851
  }
5850
- function Xc(e) {
5852
+ function Qc(e) {
5851
5853
  return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
5852
5854
  }
5853
- function Zc(e) {
5855
+ function $c(e) {
5854
5856
  return e.map((e) => ({
5855
5857
  formDefinitionId: e.formDefinitionId,
5856
5858
  formName: e.formName,
@@ -5859,86 +5861,86 @@ function Zc(e) {
5859
5861
  schema: e.schema
5860
5862
  }));
5861
5863
  }
5862
- function Qc(e) {
5864
+ function el(e) {
5863
5865
  let t = JSON.parse(e);
5864
- if (!$c(t)) throw Error("表單資料 JSON 必須是物件。");
5866
+ if (!tl(t)) throw Error("表單資料 JSON 必須是物件。");
5865
5867
  return t;
5866
5868
  }
5867
- function $c(e) {
5869
+ function tl(e) {
5868
5870
  return typeof e == "object" && !!e && !Array.isArray(e);
5869
5871
  }
5870
- function el(e) {
5872
+ function nl(e) {
5871
5873
  return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
5872
5874
  }
5873
- function tl(e) {
5875
+ function rl(e) {
5874
5876
  return e in ws ? ws[e] : e;
5875
5877
  }
5876
- function nl(e, t) {
5878
+ function il(e, t) {
5877
5879
  return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
5878
5880
  }
5879
- function rl(e) {
5881
+ function al(e) {
5880
5882
  return e.map((e) => ({
5881
5883
  displayName: e.name,
5882
5884
  email: e.email,
5883
5885
  id: e.memberId,
5884
5886
  memberId: e.memberId,
5885
- name: pl(e.name, e.email)
5887
+ name: hl(e.name, e.email)
5886
5888
  }));
5887
5889
  }
5888
- function il(e, t, n) {
5889
- let r = t.filter((t) => t.memberId === e && Qi(t, n)), i = r.reduce((e, t) => e && al(e, t) <= 0 ? e : t, null);
5890
+ function ol(e, t, n) {
5891
+ let r = t.filter((t) => t.memberId === e && Qi(t, n)), i = r.reduce((e, t) => e && sl(e, t) <= 0 ? e : t, null);
5890
5892
  return {
5891
5893
  customFields: {},
5892
5894
  managerMemberId: "member-002",
5893
5895
  memberId: e,
5894
5896
  orgCode: "HQ",
5895
- orgUnitIds: ol(r.map((e) => e.orgUnitId)),
5897
+ orgUnitIds: cl(r.map((e) => e.orgUnitId)),
5896
5898
  positionId: i?.positionId ?? null,
5897
- positionIds: ol(r.map((e) => e.positionId)),
5899
+ positionIds: cl(r.map((e) => e.positionId)),
5898
5900
  primaryOrgUnitId: i?.orgUnitId ?? null,
5899
5901
  roles: ["manager"]
5900
5902
  };
5901
5903
  }
5902
- function al(e, t) {
5904
+ function sl(e, t) {
5903
5905
  return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
5904
5906
  }
5905
- function ol(e) {
5907
+ function cl(e) {
5906
5908
  return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
5907
5909
  }
5908
- function sl(e, t) {
5910
+ function ll(e, t) {
5909
5911
  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);
5910
5912
  return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
5911
5913
  }
5912
- function cl(e) {
5913
- return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Mn(e.data.approverResolver) : e.type === "serviceTask" ? wl(e.data.action) : []))];
5914
+ function ul(e) {
5915
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Mn(e.data.approverResolver) : e.type === "serviceTask" ? El(e.data.action) : []))];
5914
5916
  }
5915
- function ll(e, t, n, r, i, a) {
5917
+ function dl(e, t, n, r, i, a) {
5916
5918
  return e.type === "userTask" ? Nn(e.data.approverResolver, t, n, r, i, a) : null;
5917
5919
  }
5918
- function ul(e, t, n, r, i) {
5920
+ function fl(e, t, n, r, i) {
5919
5921
  if (e.type !== "serviceTask") return null;
5920
- let a = e.data.action, o = a.type === "NOTIFY" && a.recipients.type !== "DIRECT" ? [Nn(a.recipients, t, n, r, i)] : wl(a).map((e) => zn(t, e).name), s = Pt(a).length, c = [...o, ...s ? [`Webhook ${s} 個`] : []];
5922
+ let a = e.data.action, o = a.type === "NOTIFY" && a.recipients.type !== "DIRECT" ? [Nn(a.recipients, t, n, r, i)] : El(a).map((e) => zn(t, e).name), s = Pt(a).length, c = [...o, ...s ? [`Webhook ${s} 個`] : []];
5921
5923
  return c.length ? c : ["未指定知會對象"];
5922
5924
  }
5923
- function dl(e) {
5924
- let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : wl(e).length, n = +!!Pt(e).length;
5925
+ function pl(e) {
5926
+ let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : El(e).length, n = +!!Pt(e).length;
5925
5927
  return Math.max(1, t + n);
5926
5928
  }
5927
- function fl(e, t, n) {
5929
+ function ml(e, t, n) {
5928
5930
  let r = e.nodes.find((e) => e.id === t);
5929
5931
  return r?.type === "serviceTask" && r.data.action.type === "NOTIFY" && pa(r.data.action.webhooks) ? Pt(r.data.action).map((e) => ({
5930
5932
  key: e.id,
5931
5933
  label: oa(n, e.endpoint)?.label ?? aa(e.endpoint)
5932
5934
  })) : [];
5933
5935
  }
5934
- function pl(t, n) {
5936
+ function hl(t, n) {
5935
5937
  return e(t, n);
5936
5938
  }
5937
- function ml(e, t) {
5939
+ function gl(e, t) {
5938
5940
  let n = t?.getBoundingClientRect();
5939
5941
  if (!n || e.nodes.length === 0) return null;
5940
5942
  let r = e.nodes.reduce((e, t) => {
5941
- let n = ic(t);
5943
+ let n = oc(t);
5942
5944
  return {
5943
5945
  maxX: Math.max(e.maxX, t.position.x + n.width),
5944
5946
  maxY: Math.max(e.maxY, t.position.y + n.height),
@@ -5958,21 +5960,21 @@ function ml(e, t) {
5958
5960
  y: r.minY
5959
5961
  }, n.width, n.height, .1, 1, .2);
5960
5962
  }
5961
- function hl(e) {
5962
- let t = e.nodes.find((e) => e.type === "userTask" && !!St(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "userTask" && !!Et(e.data.excludeInitiator)), r = e.nodes.map((e) => e.type === "userTask" ? Ot(e.data.excludeNodeActors) : null).find((e) => e !== null) ?? null, i = e.nodes.map((e) => jt(e)).find((e) => e !== null) ?? null, a = e.edges.find((t) => Sl(t, e.nodes) && !t.data.isDefault && !t.data.condition), o = e.nodes.find((e) => e.type === "userTask" && xt(e.data.approverResolver, e.data.decisionPolicy));
5963
+ function _l(e) {
5964
+ let t = e.nodes.find((e) => e.type === "userTask" && !!St(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "userTask" && !!Et(e.data.excludeInitiator)), r = e.nodes.map((e) => e.type === "userTask" ? Ot(e.data.excludeNodeActors) : null).find((e) => e !== null) ?? null, i = e.nodes.map((e) => jt(e)).find((e) => e !== null) ?? null, a = e.edges.find((t) => wl(t, e.nodes) && !t.data.isDefault && !t.data.condition), o = e.nodes.find((e) => e.type === "userTask" && xt(e.data.approverResolver, e.data.decisionPolicy));
5963
5965
  return t && t.type === "userTask" ? St(t.data.approverResolver) : o && o.type === "userTask" ? `簽核節點「${o.data.label}」使用「沿主管鏈簽核」時,決策方式必須是「依序簽核或全部同意」,否則任一位主管簽完就會結案。` : n && n.type === "userTask" ? Et(n.data.excludeInitiator) : r || i || (a ? "條件分流的每條輸出連線都需要先設定條件。" : null);
5964
5966
  }
5965
- function gl(e) {
5967
+ function vl(e) {
5966
5968
  return e?.fields.map((e) => ({
5967
5969
  fieldType: e.type,
5968
5970
  id: e.fieldKey,
5969
5971
  name: `${e.label} (${e.fieldKey})`
5970
5972
  })) ?? [];
5971
5973
  }
5972
- function _l(e, t) {
5974
+ function yl(e, t) {
5973
5975
  return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
5974
5976
  }
5975
- function vl(e) {
5977
+ function bl(e) {
5976
5978
  return e ? e.type === "boolean" ? [{
5977
5979
  id: "true",
5978
5980
  name: "是"
@@ -5984,26 +5986,26 @@ function vl(e) {
5984
5986
  name: e.label
5985
5987
  })) : [] : [];
5986
5988
  }
5987
- function yl(e) {
5988
- return Ls.includes(e);
5989
+ function xl(e) {
5990
+ return zs.includes(e);
5989
5991
  }
5990
- function bl(e, t) {
5992
+ function Sl(e, t) {
5991
5993
  if (e.data.label) return e.data.label;
5992
- if (Sl(e, t)) return xl(e);
5993
- if (Cl(e, t)) return "同時進行";
5994
+ if (wl(e, t)) return Cl(e);
5995
+ if (Tl(e, t)) return "同時進行";
5994
5996
  }
5995
- function xl(e) {
5997
+ function Cl(e) {
5996
5998
  return e.data.isDefault ? "其他情況" : "請設定條件";
5997
5999
  }
5998
- function Sl(e, t) {
6000
+ function wl(e, t) {
5999
6001
  return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
6000
6002
  }
6001
- function Cl(e, t) {
6003
+ function Tl(e, t) {
6002
6004
  return t.some((t) => t.id === e.source && t.type === "parallelGateway");
6003
6005
  }
6004
- function wl(e) {
6006
+ function El(e) {
6005
6007
  return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
6006
6008
  }
6007
- export { Mi as n, Hn as r, Xs as t };
6009
+ export { Mi as n, Hn as r, Qs as t };
6008
6010
 
6009
- //# sourceMappingURL=designer-CCy5EbOe.js.map
6011
+ //# sourceMappingURL=designer-BRYIpeTC.js.map