@owp/core 2.5.17 → 2.5.19

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 (89) hide show
  1. package/dist/_virtual/index10.js +2 -2
  2. package/dist/_virtual/index12.js +2 -2
  3. package/dist/_virtual/index13.js +2 -2
  4. package/dist/_virtual/index14.js +2 -2
  5. package/dist/_virtual/index16.js +4 -4
  6. package/dist/_virtual/index17.js +4 -4
  7. package/dist/_virtual/index18.js +4 -4
  8. package/dist/_virtual/index19.js +4 -4
  9. package/dist/components/OwpPageContent/OwpPageContent.js +14 -12
  10. package/dist/components/OwpPageContent/OwpPageContent.js.map +1 -1
  11. package/dist/components/OwpPageTitle/OwpPageTitle.js +37 -35
  12. package/dist/components/OwpPageTitle/OwpPageTitle.js.map +1 -1
  13. package/dist/components/OwpPicker/OwpDatePicker.js +339 -102
  14. package/dist/components/OwpPicker/OwpDatePicker.js.map +1 -1
  15. package/dist/components/OwpPicker/OwpDateRangePicker.js +87 -82
  16. package/dist/components/OwpPicker/OwpDateRangePicker.js.map +1 -1
  17. package/dist/components/OwpPicker/OwpTimePicker.js +494 -220
  18. package/dist/components/OwpPicker/OwpTimePicker.js.map +1 -1
  19. package/dist/components/OwpPicker/constants/index.js +6 -5
  20. package/dist/components/OwpPicker/constants/index.js.map +1 -1
  21. package/dist/components/OwpPicker/internal/DatePickerInput.js +71 -47
  22. package/dist/components/OwpPicker/internal/DatePickerInput.js.map +1 -1
  23. package/dist/components/OwpSection/OwpSection.js +84 -62
  24. package/dist/components/OwpSection/OwpSection.js.map +1 -1
  25. package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js +42 -40
  26. package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js.map +1 -1
  27. package/dist/components/OwpTreeGrid/OwpTreeGrid.js +273 -224
  28. package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
  29. package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js +476 -105
  30. package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js.map +1 -1
  31. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +317 -245
  32. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
  33. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js +315 -151
  34. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js.map +1 -1
  35. package/dist/constants/gridTheme.js +9 -7
  36. package/dist/constants/gridTheme.js.map +1 -1
  37. package/dist/constants/treeGrid.js +37 -35
  38. package/dist/constants/treeGrid.js.map +1 -1
  39. package/dist/constants.js +25 -23
  40. package/dist/features/themePreview/configs/grid.js +3 -1
  41. package/dist/features/themePreview/configs/grid.js.map +1 -1
  42. package/dist/features/themePreview/utils/themePreviewDefinitions.js +10 -0
  43. package/dist/features/themePreview/utils/themePreviewDefinitions.js.map +1 -1
  44. package/dist/layout/components/toggles/NavigationSearchToggle.js +3 -3
  45. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
  46. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
  47. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
  48. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/constants.js +1 -1
  49. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
  50. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
  51. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
  52. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/constants.js +1 -1
  53. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
  54. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
  55. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
  56. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
  57. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
  58. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
  59. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
  60. package/dist/node_modules/.pnpm/react-overlays@5.2.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-overlays/esm/Portal.js +1 -1
  61. package/dist/owp-app.css +1 -1
  62. package/dist/types/components/OwpPageContent/OwpPageContent.d.ts +3 -1
  63. package/dist/types/components/OwpPageTitle/OwpPageTitle.d.ts +3 -1
  64. package/dist/types/components/OwpPicker/OwpTimePicker.d.ts +3 -1
  65. package/dist/types/components/OwpPicker/constants/index.d.ts +1 -0
  66. package/dist/types/components/OwpPicker/internal/DatePickerInput.d.ts +7 -0
  67. package/dist/types/components/OwpSection/OwpSection.d.ts +3 -1
  68. package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +6 -6
  69. package/dist/types/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.d.ts +3 -0
  70. package/dist/types/components/OwpTreeGrid/internal/treeGridRuntime.d.ts +33 -7
  71. package/dist/types/components/OwpTreeGrid/internal/treeGridTheme.d.ts +1 -1
  72. package/dist/types/constants/gridTheme.d.ts +4 -0
  73. package/dist/types/constants/treeGrid.d.ts +3 -1
  74. package/dist/types/features/themePreview/configs/grid.d.ts +2 -0
  75. package/dist/types/features/themePreview/configs/settings.d.ts +2 -0
  76. package/dist/types/types/OwpGridThemeTypes.d.ts +2 -0
  77. package/dist/types/utils/index.d.ts +0 -1
  78. package/dist/types/utils/treeGridUtil.d.ts +42 -3
  79. package/dist/utils/treeGridUtil.js +220 -119
  80. package/dist/utils/treeGridUtil.js.map +1 -1
  81. package/dist/utils.js +90 -86
  82. package/dist/utils.js.map +1 -1
  83. package/package.json +1 -1
  84. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js +0 -84
  85. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js.map +0 -1
  86. package/dist/types/components/OwpTreeGrid/internal/treeGridColumnEditRules.d.ts +0 -60
  87. package/dist/types/utils/normalizeTimeToHourMinute.d.ts +0 -11
  88. package/dist/utils/normalizeTimeToHourMinute.js +0 -34
  89. package/dist/utils/normalizeTimeToHourMinute.js.map +0 -1
package/dist/utils.js CHANGED
@@ -1,102 +1,106 @@
1
1
  import { generateBarcodeUrl as o } from "./utils/barcodeUtil.js";
2
2
  import { buildTreeGridEnumAttributesByCommonCodeList as d, transformCommonCodeBasedOnGroupId as i, transformGridEnumByCommonCodeList as a } from "./utils/commonCodeUtils.js";
3
- import { createDateRangeSearchParams as T } from "./utils/createDateRangeSearchParams.js";
4
- import { createFormDataBody as s, normalizeFormDataUploadParams as E } from "./utils/createFormDataBody.js";
5
- import { createJsonBody as p } from "./utils/createJsonBody.js";
6
- import { createJsonString as G } from "./utils/createJsonString.js";
7
- import { exportExcelByBuffer as f, getIndexByLetters as L, getLettersByIndex as _, setCellValue as g, setMergeCells as C } from "./utils/excelUtil.js";
8
- import { fetchFile as u } from "./utils/fetchFile.js";
9
- import { formatDateToYmd as B, getTodayYmd as D } from "./utils/formatDateToYmd.js";
10
- import { formatNumber as H } from "./utils/formatNumber.js";
11
- import { getDisplayValue as h } from "./utils/getDisplayValue.js";
12
- import { getEstimatedTextCellWidth as c } from "./utils/getEstimatedTextCellWidth.js";
13
- import { getFormDefaultValues as N } from "./utils/getFormDefaultValues.js";
14
- import { getStartPagePath as w } from "./utils/getStartPagePath.js";
3
+ import { createDateRangeSearchParams as m } from "./utils/createDateRangeSearchParams.js";
4
+ import { createFormDataBody as T, normalizeFormDataUploadParams as s } from "./utils/createFormDataBody.js";
5
+ import { createJsonBody as G } from "./utils/createJsonBody.js";
6
+ import { createJsonString as I } from "./utils/createJsonString.js";
7
+ import { exportExcelByBuffer as g, getIndexByLetters as _, getLettersByIndex as L, setCellValue as R, setMergeCells as C } from "./utils/excelUtil.js";
8
+ import { fetchFile as D } from "./utils/fetchFile.js";
9
+ import { formatDateToYmd as y, getTodayYmd as A } from "./utils/formatDateToYmd.js";
10
+ import { formatNumber as h } from "./utils/formatNumber.js";
11
+ import { getDisplayValue as c } from "./utils/getDisplayValue.js";
12
+ import { getEstimatedTextCellWidth as U } from "./utils/getEstimatedTextCellWidth.js";
13
+ import { getFormDefaultValues as w } from "./utils/getFormDefaultValues.js";
14
+ import { getStartPagePath as N } from "./utils/getStartPagePath.js";
15
15
  import { getTrimmedValue as P } from "./utils/getTrimmedValue.js";
16
- import { isEnterKeyEvent as b } from "./utils/isEnterKeyEvent.js";
17
- import { getApiLanguageCode as Y, getI18nextLanguageCode as z } from "./utils/language.js";
18
- import { formatTimeInputToHourMinute as Z, normalizeTimeToHourMinute as k } from "./utils/normalizeTimeToHourMinute.js";
19
- import { preloadOnIdle as K } from "./utils/preloadOnIdle.js";
20
- import { generateQrCodeUrl as j } from "./utils/qrCodeUtil.js";
21
- import { rebuildValue as X } from "./utils/rebuildValue.js";
22
- import { sanitizePasswordValue as ee, sanitizeUserIdValue as re } from "./utils/sanitizeAuthInputValue.js";
23
- import { exportTreeGridExcel as te } from "./utils/treeGridExportExcelUtil.js";
24
- import { isTreeGridCheckedValue as ie, toTreeGridBoolValue as ae, toTreeGridYnValue as me } from "./utils/treeGridYnUtils.js";
25
- import { TREEGRID_ADDED_ROW_BY_ID_FLAG as le, TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY as se, addTreeGridRowById as Ee, appendTreeGridAddedRowHighlightColumn as ne, exportTreeGridToExcelById as pe, getTreeGridAddedRowHighlightColumns as Ie, getTreeGridById as Ge, getTreeGridDataRowsById as xe, getTreeGridRowChangesById as fe, getTreeGridSelectedRowsById as Le, highlightTreeGridCellById as _e, isTreeGridRowAddedById as ge, markTreeGridRowAddedById as Ce, reloadTreeGridBodyById as Re, resetTreeGridChangesById as ue, resetTreeGridChangesByIds as ye, resetTreeGridSelectionById as Be, resetTreeGridSelectionsByIds as De, setTreeGridColumnEnumOptionsById as Ae, setTreeGridColumnVisibilityById as He } from "./utils/treeGridUtil.js";
26
- import { readZipEntryJson as he, readZipEntryText as Fe, saveAsZipFile as ce } from "./utils/zipUtil.js";
27
- import { OwpUtils as Ne } from "./utils/common/OwpUtils.js";
28
- import { DEFAULT_CELL_ALIGNMENT as we, DEFAULT_HEADER_FILL as Se, DEFAULT_HEADER_FONT as Pe, DEFAULT_THIN_BORDER as Me, DEFAULT_VALUE_FONT as be, DEFAULT_WRAP_CELL_ALIGNMENT as We } from "./constants/excel.js";
29
- import { TREEGRID_CELL_HIGHLIGHT_CLASS as ze, TREEGRID_CELL_HIGHLIGHT_COLOR as Je, TREEGRID_INPUT_CELL_COLOR as Ze, TREEGRID_WARNING_CELL_COLOR as ke } from "./constants/treeGrid.js";
16
+ import { isEnterKeyEvent as W } from "./utils/isEnterKeyEvent.js";
17
+ import { getApiLanguageCode as z, getI18nextLanguageCode as M } from "./utils/language.js";
18
+ import { preloadOnIdle as J } from "./utils/preloadOnIdle.js";
19
+ import { generateQrCodeUrl as Z } from "./utils/qrCodeUtil.js";
20
+ import { rebuildValue as Q } from "./utils/rebuildValue.js";
21
+ import { sanitizePasswordValue as q, sanitizeUserIdValue as X } from "./utils/sanitizeAuthInputValue.js";
22
+ import { exportTreeGridExcel as ee } from "./utils/treeGridExportExcelUtil.js";
23
+ import { isTreeGridCheckedValue as oe, toTreeGridBoolValue as te, toTreeGridYnValue as de } from "./utils/treeGridYnUtils.js";
24
+ import { TREEGRID_ADDED_ROW_BASELINE_VALUES_KEY as ae, TREEGRID_ADDED_ROW_BY_ID_FLAG as le, TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY as me, addTreeGridRowById as Ee, appendTreeGridAddedRowHighlightColumn as Te, clearTreeGridCellHighlightById as se, exportTreeGridToExcelById as ne, getTreeGridAddedRowBaselineValue as Ge, getTreeGridAddedRowHighlightColumns as pe, getTreeGridById as Ie, getTreeGridCellComparableValue as xe, getTreeGridDataRowsById as ge, getTreeGridRowChangesById as _e, getTreeGridSelectedRowsById as Le, highlightTreeGridCellById as Re, isTreeGridRowAddedById as Ce, markTreeGridRowAddedById as fe, normalizeTreeGridExternalRow as De, normalizeTreeGridExternalRows as Be, reloadTreeGridBodyById as ye, removeTreeGridAddedRowHighlightColumn as Ae, resetTreeGridChangesById as ue, resetTreeGridChangesByIds as he, resetTreeGridSelectionById as Oe, resetTreeGridSelectionsByIds as ce, setTreeGridColumnEnumOptionsById as Fe, setTreeGridColumnVisibilityById as Ue } from "./utils/treeGridUtil.js";
25
+ import { readZipEntryJson as we, readZipEntryText as He, saveAsZipFile as Ne } from "./utils/zipUtil.js";
26
+ import { OwpUtils as Pe } from "./utils/common/OwpUtils.js";
27
+ import { DEFAULT_CELL_ALIGNMENT as We, DEFAULT_HEADER_FILL as Ye, DEFAULT_HEADER_FONT as ze, DEFAULT_THIN_BORDER as Me, DEFAULT_VALUE_FONT as ve, DEFAULT_WRAP_CELL_ALIGNMENT as Je } from "./constants/excel.js";
28
+ import { TREEGRID_CELL_CHANGED_CLASS as Ze, TREEGRID_CELL_HIGHLIGHT_COLOR as ke, TREEGRID_INPUT_CELL_COLOR as Qe, TREEGRID_WARNING_CELL_COLOR as je } from "./constants/treeGrid.js";
30
29
  export {
31
- we as DEFAULT_CELL_ALIGNMENT,
32
- Se as DEFAULT_HEADER_FILL,
33
- Pe as DEFAULT_HEADER_FONT,
30
+ We as DEFAULT_CELL_ALIGNMENT,
31
+ Ye as DEFAULT_HEADER_FILL,
32
+ ze as DEFAULT_HEADER_FONT,
34
33
  Me as DEFAULT_THIN_BORDER,
35
- be as DEFAULT_VALUE_FONT,
36
- We as DEFAULT_WRAP_CELL_ALIGNMENT,
37
- Ne as OwpUtils,
34
+ ve as DEFAULT_VALUE_FONT,
35
+ Je as DEFAULT_WRAP_CELL_ALIGNMENT,
36
+ Pe as OwpUtils,
37
+ ae as TREEGRID_ADDED_ROW_BASELINE_VALUES_KEY,
38
38
  le as TREEGRID_ADDED_ROW_BY_ID_FLAG,
39
- se as TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY,
40
- ze as TREEGRID_CELL_HIGHLIGHT_CLASS,
41
- Je as TREEGRID_CELL_HIGHLIGHT_COLOR,
42
- Ze as TREEGRID_INPUT_CELL_COLOR,
43
- ke as TREEGRID_WARNING_CELL_COLOR,
39
+ me as TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY,
40
+ Ze as TREEGRID_CELL_CHANGED_CLASS,
41
+ ke as TREEGRID_CELL_HIGHLIGHT_COLOR,
42
+ Qe as TREEGRID_INPUT_CELL_COLOR,
43
+ je as TREEGRID_WARNING_CELL_COLOR,
44
44
  Ee as addTreeGridRowById,
45
- ne as appendTreeGridAddedRowHighlightColumn,
45
+ Te as appendTreeGridAddedRowHighlightColumn,
46
46
  d as buildTreeGridEnumAttributesByCommonCodeList,
47
- T as createDateRangeSearchParams,
48
- s as createFormDataBody,
49
- p as createJsonBody,
50
- G as createJsonString,
51
- f as exportExcelByBuffer,
52
- te as exportTreeGridExcel,
53
- pe as exportTreeGridToExcelById,
54
- u as fetchFile,
55
- B as formatDateToYmd,
56
- H as formatNumber,
57
- Z as formatTimeInputToHourMinute,
47
+ se as clearTreeGridCellHighlightById,
48
+ m as createDateRangeSearchParams,
49
+ T as createFormDataBody,
50
+ G as createJsonBody,
51
+ I as createJsonString,
52
+ g as exportExcelByBuffer,
53
+ ee as exportTreeGridExcel,
54
+ ne as exportTreeGridToExcelById,
55
+ D as fetchFile,
56
+ y as formatDateToYmd,
57
+ h as formatNumber,
58
58
  o as generateBarcodeUrl,
59
- j as generateQrCodeUrl,
60
- Y as getApiLanguageCode,
61
- h as getDisplayValue,
62
- c as getEstimatedTextCellWidth,
63
- N as getFormDefaultValues,
64
- z as getI18nextLanguageCode,
65
- L as getIndexByLetters,
66
- _ as getLettersByIndex,
67
- w as getStartPagePath,
68
- D as getTodayYmd,
69
- Ie as getTreeGridAddedRowHighlightColumns,
70
- Ge as getTreeGridById,
71
- xe as getTreeGridDataRowsById,
72
- fe as getTreeGridRowChangesById,
59
+ Z as generateQrCodeUrl,
60
+ z as getApiLanguageCode,
61
+ c as getDisplayValue,
62
+ U as getEstimatedTextCellWidth,
63
+ w as getFormDefaultValues,
64
+ M as getI18nextLanguageCode,
65
+ _ as getIndexByLetters,
66
+ L as getLettersByIndex,
67
+ N as getStartPagePath,
68
+ A as getTodayYmd,
69
+ Ge as getTreeGridAddedRowBaselineValue,
70
+ pe as getTreeGridAddedRowHighlightColumns,
71
+ Ie as getTreeGridById,
72
+ xe as getTreeGridCellComparableValue,
73
+ ge as getTreeGridDataRowsById,
74
+ _e as getTreeGridRowChangesById,
73
75
  Le as getTreeGridSelectedRowsById,
74
76
  P as getTrimmedValue,
75
- _e as highlightTreeGridCellById,
76
- b as isEnterKeyEvent,
77
- ie as isTreeGridCheckedValue,
78
- ge as isTreeGridRowAddedById,
79
- Ce as markTreeGridRowAddedById,
80
- E as normalizeFormDataUploadParams,
81
- k as normalizeTimeToHourMinute,
82
- K as preloadOnIdle,
83
- he as readZipEntryJson,
84
- Fe as readZipEntryText,
85
- X as rebuildValue,
86
- Re as reloadTreeGridBodyById,
77
+ Re as highlightTreeGridCellById,
78
+ W as isEnterKeyEvent,
79
+ oe as isTreeGridCheckedValue,
80
+ Ce as isTreeGridRowAddedById,
81
+ fe as markTreeGridRowAddedById,
82
+ s as normalizeFormDataUploadParams,
83
+ De as normalizeTreeGridExternalRow,
84
+ Be as normalizeTreeGridExternalRows,
85
+ J as preloadOnIdle,
86
+ we as readZipEntryJson,
87
+ He as readZipEntryText,
88
+ Q as rebuildValue,
89
+ ye as reloadTreeGridBodyById,
90
+ Ae as removeTreeGridAddedRowHighlightColumn,
87
91
  ue as resetTreeGridChangesById,
88
- ye as resetTreeGridChangesByIds,
89
- Be as resetTreeGridSelectionById,
90
- De as resetTreeGridSelectionsByIds,
91
- ee as sanitizePasswordValue,
92
- re as sanitizeUserIdValue,
93
- ce as saveAsZipFile,
94
- g as setCellValue,
92
+ he as resetTreeGridChangesByIds,
93
+ Oe as resetTreeGridSelectionById,
94
+ ce as resetTreeGridSelectionsByIds,
95
+ q as sanitizePasswordValue,
96
+ X as sanitizeUserIdValue,
97
+ Ne as saveAsZipFile,
98
+ R as setCellValue,
95
99
  C as setMergeCells,
96
- Ae as setTreeGridColumnEnumOptionsById,
97
- He as setTreeGridColumnVisibilityById,
98
- ae as toTreeGridBoolValue,
99
- me as toTreeGridYnValue,
100
+ Fe as setTreeGridColumnEnumOptionsById,
101
+ Ue as setTreeGridColumnVisibilityById,
102
+ te as toTreeGridBoolValue,
103
+ de as toTreeGridYnValue,
100
104
  i as transformCommonCodeBasedOnGroupId,
101
105
  a as transformGridEnumByCommonCodeList
102
106
  };
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@owp/core",
3
3
  "private": false,
4
- "version": "2.5.17",
4
+ "version": "2.5.19",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -1,84 +0,0 @@
1
- var E = Object.defineProperty;
2
- var o = (t, i) => E(t, "name", { value: i, configurable: !0 });
3
- import { normalizeTimeToHourMinute as M, formatTimeInputToHourMinute as f } from "../../../utils/normalizeTimeToHourMinute.js";
4
- const C = "^$|^[\\d:]*$", R = /* @__PURE__ */ o(function(t, i) {
5
- var r, d;
6
- const e = f(t, i);
7
- !this.Tag || e === t || (this.Tag.value = e, (d = (r = this.Tag).setSelectionRange) == null || d.call(r, e.length, e.length));
8
- }, "handleHourMinuteEditChange"), h = {
9
- OnChange: R,
10
- OnKeyDown: /* @__PURE__ */ o(() => {
11
- }, "OnKeyDown"),
12
- OnStartEdit: /* @__PURE__ */ o(() => {
13
- }, "OnStartEdit")
14
- }, g = /* @__PURE__ */ o((t) => M(`${t ?? ""}`), "normalizeHourMinuteColumnValue"), v = /* @__PURE__ */ o((t, i) => t === "hourMinute" ? {
15
- edit: h,
16
- editMask: C,
17
- resultMask: "",
18
- resultText: "",
19
- normalize: g,
20
- invalidText: i.hourMinuteInvalidText
21
- } : {}, "getTreeGridColumnEditPresetDefinition"), m = /* @__PURE__ */ o(() => ({
22
- appliedColumns: {},
23
- originalAttributes: {}
24
- }), "createTreeGridColumnEditRulesState"), A = /* @__PURE__ */ o((t) => {
25
- t.appliedColumns = {}, t.originalAttributes = {};
26
- }, "resetTreeGridColumnEditRulesState"), O = /* @__PURE__ */ o((t, i) => {
27
- if (!(t != null && t.length))
28
- return;
29
- const e = {};
30
- return t.forEach((r) => {
31
- const d = v(r.preset, i);
32
- r.columns.forEach((l) => {
33
- l && (e[l] = d);
34
- });
35
- }), Object.keys(e).length > 0 ? e : void 0;
36
- }, "resolveTreeGridColumnEditRuleLookup"), p = /* @__PURE__ */ o((t, i, e) => {
37
- if (!t)
38
- return;
39
- const r = i ? Object.keys(i) : [], l = Object.keys(e.appliedColumns).filter((n) => !(i != null && i[n]));
40
- l.length === 0 && r.length === 0 || (t.StartUpdate(), l.forEach((n) => {
41
- var a;
42
- const s = (a = t.Cols) == null ? void 0 : a[n], u = e.originalAttributes[n];
43
- if (!s || !u) {
44
- delete e.appliedColumns[n];
45
- return;
46
- }
47
- s.Edit = u.Edit, s.EditMask = u.EditMask, s.ResultMask = u.ResultMask, s.ResultText = u.ResultText, delete e.appliedColumns[n];
48
- }), r.forEach((n) => {
49
- var c, T;
50
- const s = (c = t.Cols) == null ? void 0 : c[n], u = i == null ? void 0 : i[n];
51
- if (!s || !u)
52
- return;
53
- (T = e.originalAttributes)[n] ?? (T[n] = {
54
- Edit: s.Edit,
55
- EditMask: s.EditMask,
56
- ResultMask: s.ResultMask,
57
- ResultText: s.ResultText
58
- });
59
- const a = e.originalAttributes[n];
60
- s.Edit = u.edit ?? a.Edit, s.EditMask = u.editMask ?? a.EditMask, s.ResultMask = u.resultMask ?? a.ResultMask, s.ResultText = u.resultText ?? a.ResultText, e.appliedColumns[n] = !0;
61
- }), t.EndUpdate());
62
- }, "syncTreeGridColumnEditRules"), k = /* @__PURE__ */ o((t, i, e) => {
63
- const r = t == null ? void 0 : t[i], d = r == null ? void 0 : r.normalize;
64
- if (typeof d != "function")
65
- return;
66
- const l = d(e), n = `${e ?? ""}`;
67
- if (l == null)
68
- return n ? {
69
- value: "",
70
- invalidText: r == null ? void 0 : r.invalidText
71
- } : void 0;
72
- if (l !== n)
73
- return {
74
- value: l
75
- };
76
- }, "resolveTreeGridColumnEditValue");
77
- export {
78
- m as createTreeGridColumnEditRulesState,
79
- A as resetTreeGridColumnEditRulesState,
80
- O as resolveTreeGridColumnEditRuleLookup,
81
- k as resolveTreeGridColumnEditValue,
82
- p as syncTreeGridColumnEditRules
83
- };
84
- //# sourceMappingURL=treeGridColumnEditRules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeGridColumnEditRules.js","sources":["../../../../src/components/OwpTreeGrid/internal/treeGridColumnEditRules.ts"],"sourcesContent":["import {\n formatTimeInputToHourMinute,\n normalizeTimeToHourMinute,\n} from '@/utils/normalizeTimeToHourMinute';\nimport type {\n OwpTreeGridColumnEditPreset,\n OwpTreeGridColumnEditRule,\n} from '../OwpTreeGrid';\n\nconst HOUR_MINUTE_EDIT_MASK = '^$|^[\\\\d:]*$';\n\ntype TreeGridColumnEditValue = TCol['Edit'] | TEdit;\ntype TreeGridColumnEditAttributeSnapshot = {\n Edit?: TreeGridColumnEditValue;\n EditMask?: TCol['EditMask'];\n ResultMask?: TCol['ResultMask'];\n ResultText?: TCol['ResultText'];\n};\ntype TreeGridColumnEditMutableColumn = Omit<TCol, 'Edit'> & TreeGridColumnEditAttributeSnapshot;\n\ntype TreeGridColumnEditPresetMessages = {\n hourMinuteInvalidText: string;\n};\n\ntype TreeGridColumnEditPresetDefinition = {\n edit?: TreeGridColumnEditValue;\n editMask?: string;\n resultMask?: string;\n resultText?: string;\n normalize?: (value: unknown) => string | null | undefined;\n invalidText?: string;\n};\n\ntype TreeGridColumnEditRuleLookup = Record<string, TreeGridColumnEditPresetDefinition>;\n\ntype TreeGridColumnEditRulesState = {\n appliedColumns: Record<string, true>;\n originalAttributes: Record<string, TreeGridColumnEditAttributeSnapshot>;\n};\n\ntype HourMinuteEdit = {\n Tag?: HTMLInputElement | HTMLTextAreaElement | null;\n};\n\n/**\n * HH:mm 편집 중 입력 보정\n * @param value 현재 입력값\n * @param oldValue 이전 입력값\n */\nconst handleHourMinuteEditChange = function (this: HourMinuteEdit, value: string, oldValue: string) {\n const formattedValue = formatTimeInputToHourMinute(value, oldValue);\n\n if (!this.Tag || formattedValue === value) {\n return;\n }\n\n this.Tag.value = formattedValue;\n this.Tag.setSelectionRange?.(formattedValue.length, formattedValue.length);\n};\n\nconst HOUR_MINUTE_EDIT: TEdit = {\n OnChange: handleHourMinuteEditChange,\n OnKeyDown: () => {},\n OnStartEdit: () => {},\n};\n\nconst normalizeHourMinuteColumnValue = (value: unknown) => {\n return normalizeTimeToHourMinute(`${value ?? ''}`);\n};\n\nconst getTreeGridColumnEditPresetDefinition = (\n preset: OwpTreeGridColumnEditPreset,\n messages: TreeGridColumnEditPresetMessages,\n): TreeGridColumnEditPresetDefinition => {\n if (preset === 'hourMinute') {\n return {\n edit: HOUR_MINUTE_EDIT,\n editMask: HOUR_MINUTE_EDIT_MASK,\n resultMask: '',\n resultText: '',\n normalize: normalizeHourMinuteColumnValue,\n invalidText: messages.hourMinuteInvalidText,\n };\n }\n\n return {};\n};\n\n/**\n * 컬럼 편집 규칙 상태 생성\n */\nexport const createTreeGridColumnEditRulesState = (): TreeGridColumnEditRulesState => {\n return {\n appliedColumns: {},\n originalAttributes: {},\n };\n};\n\n/**\n * 컬럼 편집 규칙 상태 초기화\n * @param state 컬럼 편집 규칙 상태\n */\nexport const resetTreeGridColumnEditRulesState = (state: TreeGridColumnEditRulesState) => {\n state.appliedColumns = {};\n state.originalAttributes = {};\n};\n\n/**\n * 컬럼 편집 규칙 lookup 생성\n * @param rules 컬럼 편집 규칙 목록\n * @param messages preset 메시지 집합\n */\nexport const resolveTreeGridColumnEditRuleLookup = (\n rules: readonly OwpTreeGridColumnEditRule[] | undefined,\n messages: TreeGridColumnEditPresetMessages,\n) => {\n if (!rules?.length) {\n return undefined;\n }\n\n const lookup: TreeGridColumnEditRuleLookup = {};\n\n rules.forEach((rule) => {\n const presetDefinition = getTreeGridColumnEditPresetDefinition(rule.preset, messages);\n\n rule.columns.forEach((column) => {\n if (column) {\n lookup[column] = presetDefinition;\n }\n });\n });\n\n return Object.keys(lookup).length > 0 ? lookup : undefined;\n};\n\n/**\n * 컬럼 편집 규칙 동기화\n * @param grid TreeGrid 인스턴스\n * @param lookup 컬럼 편집 규칙 lookup\n * @param state 컬럼 편집 규칙 상태\n */\nexport const syncTreeGridColumnEditRules = (\n grid: TGrid | null,\n lookup: TreeGridColumnEditRuleLookup | undefined,\n state: TreeGridColumnEditRulesState,\n) => {\n if (!grid) {\n return;\n }\n\n const nextColumns = lookup ? Object.keys(lookup) : [];\n const previousColumns = Object.keys(state.appliedColumns);\n const columnsToRestore = previousColumns.filter((column) => !lookup?.[column]);\n\n if (columnsToRestore.length === 0 && nextColumns.length === 0) {\n return;\n }\n\n grid.StartUpdate();\n\n columnsToRestore.forEach((columnName) => {\n const column = grid.Cols?.[columnName] as TreeGridColumnEditMutableColumn | undefined;\n const originalAttributes = state.originalAttributes[columnName];\n\n if (!column || !originalAttributes) {\n delete state.appliedColumns[columnName];\n return;\n }\n\n column.Edit = originalAttributes.Edit;\n column.EditMask = originalAttributes.EditMask;\n column.ResultMask = originalAttributes.ResultMask;\n column.ResultText = originalAttributes.ResultText;\n\n delete state.appliedColumns[columnName];\n });\n\n nextColumns.forEach((columnName) => {\n const column = grid.Cols?.[columnName] as TreeGridColumnEditMutableColumn | undefined;\n const presetDefinition = lookup?.[columnName];\n\n if (!column || !presetDefinition) {\n return;\n }\n\n state.originalAttributes[columnName] ??= {\n Edit: column.Edit,\n EditMask: column.EditMask,\n ResultMask: column.ResultMask,\n ResultText: column.ResultText,\n };\n\n const originalAttributes = state.originalAttributes[columnName];\n\n column.Edit = presetDefinition.edit ?? originalAttributes.Edit;\n column.EditMask = presetDefinition.editMask ?? originalAttributes.EditMask;\n column.ResultMask = presetDefinition.resultMask ?? originalAttributes.ResultMask;\n column.ResultText = presetDefinition.resultText ?? originalAttributes.ResultText;\n\n state.appliedColumns[columnName] = true;\n });\n\n grid.EndUpdate();\n};\n\n/**\n * 컬럼 편집 규칙 최종값 정규화\n * @param lookup 컬럼 편집 규칙 lookup\n * @param columnName 컬럼명\n * @param value 원본 값\n */\nexport const resolveTreeGridColumnEditValue = (\n lookup: TreeGridColumnEditRuleLookup | undefined,\n columnName: string,\n value: unknown,\n) => {\n const presetDefinition = lookup?.[columnName];\n const normalize = presetDefinition?.normalize;\n\n if (typeof normalize !== 'function') {\n return undefined;\n }\n\n const normalizedValue = normalize(value);\n const currentValue = `${value ?? ''}`;\n\n if (normalizedValue == null) {\n return currentValue\n ? {\n value: '',\n invalidText: presetDefinition?.invalidText,\n }\n : undefined;\n }\n\n if (normalizedValue === currentValue) {\n return undefined;\n }\n\n return {\n value: normalizedValue,\n };\n};\n\nexport type { TreeGridColumnEditRuleLookup, TreeGridColumnEditRulesState };\n"],"names":["HOUR_MINUTE_EDIT_MASK","handleHourMinuteEditChange","__name","value","oldValue","formattedValue","formatTimeInputToHourMinute","_b","_a","HOUR_MINUTE_EDIT","normalizeHourMinuteColumnValue","normalizeTimeToHourMinute","getTreeGridColumnEditPresetDefinition","preset","messages","createTreeGridColumnEditRulesState","resetTreeGridColumnEditRulesState","state","resolveTreeGridColumnEditRuleLookup","rules","lookup","rule","presetDefinition","column","syncTreeGridColumnEditRules","grid","nextColumns","columnsToRestore","columnName","originalAttributes","resolveTreeGridColumnEditValue","normalize","normalizedValue","currentValue"],"mappings":";;;AASA,MAAMA,IAAwB,gBAwCxBC,IAA6B,gBAAAC,EAAA,SAAgCC,GAAeC,GAAkB;;AAClG,QAAMC,IAAiBC,EAA4BH,GAAOC,CAAQ;AAElE,EAAI,CAAC,KAAK,OAAOC,MAAmBF,MAIpC,KAAK,IAAI,QAAQE,IACjBE,KAAAC,IAAA,KAAK,KAAI,sBAAT,QAAAD,EAAA,KAAAC,GAA6BH,EAAe,QAAQA,EAAe;AACrE,GATmC,+BAW7BI,IAA0B;AAAA,EAC9B,UAAUR;AAAA,EACV,WAAW,gBAAAC,EAAA,MAAM;AAAA,EAAC,GAAP;AAAA,EACX,aAAa,gBAAAA,EAAA,MAAM;AAAA,EAAC,GAAP;AACf,GAEMQ,IAAiC,gBAAAR,EAAA,CAACC,MAC/BQ,EAA0B,GAAGR,KAAS,EAAE,EAAE,GADZ,mCAIjCS,IAAwC,gBAAAV,EAAA,CAC5CW,GACAC,MAEID,MAAW,eACN;AAAA,EACL,MAAMJ;AAAA,EACN,UAAUT;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAWU;AAAA,EACX,aAAaI,EAAS;AAAA,IAInB,CAAA,GAfqC,0CAqBjCC,IAAqC,gBAAAb,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
3
- type TreeGridColumnEditAttributeSnapshot = {
4
- Edit?: TreeGridColumnEditValue;
5
- EditMask?: TCol['EditMask'];
6
- ResultMask?: TCol['ResultMask'];
7
- ResultText?: TCol['ResultText'];
8
- };
9
- type TreeGridColumnEditPresetMessages = {
10
- hourMinuteInvalidText: string;
11
- };
12
- type TreeGridColumnEditPresetDefinition = {
13
- edit?: TreeGridColumnEditValue;
14
- editMask?: string;
15
- resultMask?: string;
16
- resultText?: string;
17
- normalize?: (value: unknown) => string | null | undefined;
18
- invalidText?: string;
19
- };
20
- type TreeGridColumnEditRuleLookup = Record<string, TreeGridColumnEditPresetDefinition>;
21
- type TreeGridColumnEditRulesState = {
22
- appliedColumns: Record<string, true>;
23
- originalAttributes: Record<string, TreeGridColumnEditAttributeSnapshot>;
24
- };
25
- /**
26
- * 컬럼 편집 규칙 상태 생성
27
- */
28
- export declare const createTreeGridColumnEditRulesState: () => TreeGridColumnEditRulesState;
29
- /**
30
- * 컬럼 편집 규칙 상태 초기화
31
- * @param state 컬럼 편집 규칙 상태
32
- */
33
- export declare const resetTreeGridColumnEditRulesState: (state: TreeGridColumnEditRulesState) => void;
34
- /**
35
- * 컬럼 편집 규칙 lookup 생성
36
- * @param rules 컬럼 편집 규칙 목록
37
- * @param messages preset 메시지 집합
38
- */
39
- export declare const resolveTreeGridColumnEditRuleLookup: (rules: readonly OwpTreeGridColumnEditRule[] | undefined, messages: TreeGridColumnEditPresetMessages) => TreeGridColumnEditRuleLookup;
40
- /**
41
- * 컬럼 편집 규칙 동기화
42
- * @param grid TreeGrid 인스턴스
43
- * @param lookup 컬럼 편집 규칙 lookup
44
- * @param state 컬럼 편집 규칙 상태
45
- */
46
- export declare const syncTreeGridColumnEditRules: (grid: TGrid | null, lookup: TreeGridColumnEditRuleLookup | undefined, state: TreeGridColumnEditRulesState) => void;
47
- /**
48
- * 컬럼 편집 규칙 최종값 정규화
49
- * @param lookup 컬럼 편집 규칙 lookup
50
- * @param columnName 컬럼명
51
- * @param value 원본 값
52
- */
53
- export declare const resolveTreeGridColumnEditValue: (lookup: TreeGridColumnEditRuleLookup | undefined, columnName: string, value: unknown) => {
54
- value: string;
55
- invalidText: string;
56
- } | {
57
- value: string;
58
- invalidText?: undefined;
59
- };
60
- export type { TreeGridColumnEditRuleLookup, TreeGridColumnEditRulesState };
@@ -1,11 +0,0 @@
1
- /**
2
- * 시간 입력 문자열을 편집 중 HH:mm 형태로 포맷
3
- * @param value 현재 입력값
4
- * @param oldValue 이전 입력값
5
- */
6
- export declare const formatTimeInputToHourMinute: (value: string, oldValue?: string) => string;
7
- /**
8
- * 시간 문자열을 HH:mm 형식으로 정규화
9
- * @param value 원본 시간 문자열
10
- */
11
- export declare const normalizeTimeToHourMinute: (value?: string | null) => string;
@@ -1,34 +0,0 @@
1
- var o = Object.defineProperty;
2
- var r = (e, n) => o(e, "name", { value: n, configurable: !0 });
3
- import { isString as l } from "../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isString.js";
4
- const m = /* @__PURE__ */ r((e) => {
5
- const n = e.replace(/[^\d:]/g, "");
6
- if (!n.includes(":"))
7
- return n.slice(0, 4);
8
- const [i = "", t = ""] = n.split(":");
9
- return `${i.slice(0, 2)}:${t.replace(/:/g, "").slice(0, 3)}`;
10
- }, "sanitizeTimeInputValue"), a = /* @__PURE__ */ r((e) => e.replace(/\D/g, "").slice(0, 4), "getTimeDigits"), f = /* @__PURE__ */ r((e, n = "") => {
11
- const i = m(e);
12
- if (!i)
13
- return "";
14
- if (e.length < n.length)
15
- return i;
16
- const t = a(e);
17
- return t.length === 1 ? `${t}:` : t.length === 2 ? `${t}:` : t.length === 3 ? `${t.slice(0, 1)}:${t.slice(1)}` : `${t.slice(0, 2)}:${t.slice(2, 4)}`;
18
- }, "formatTimeInputToHourMinute"), h = /* @__PURE__ */ r((e) => {
19
- if (!l(e))
20
- return null;
21
- const n = f(e.trim());
22
- if (!n)
23
- return "";
24
- const i = n.match(/^(\d{1,2}):(\d{2})$/);
25
- if (!i)
26
- return null;
27
- const [, t = "", s = ""] = i, u = Number(t), c = Number(s);
28
- return u < 0 || u > 23 || c < 0 || c > 59 ? null : `${u.toString().padStart(2, "0")}:${s}`;
29
- }, "normalizeTimeToHourMinute");
30
- export {
31
- f as formatTimeInputToHourMinute,
32
- h as normalizeTimeToHourMinute
33
- };
34
- //# sourceMappingURL=normalizeTimeToHourMinute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeTimeToHourMinute.js","sources":["../../src/utils/normalizeTimeToHourMinute.ts"],"sourcesContent":["import { isString } from 'es-toolkit/compat';\n\nconst sanitizeTimeInputValue = (value: string) => {\n const sanitizedValue = value.replace(/[^\\d:]/g, '');\n\n if (!sanitizedValue.includes(':')) {\n return sanitizedValue.slice(0, 4);\n }\n\n const [hourText = '', minuteText = ''] = sanitizedValue.split(':');\n\n return `${hourText.slice(0, 2)}:${minuteText.replace(/:/g, '').slice(0, 3)}`;\n};\n\nconst getTimeDigits = (value: string) => value.replace(/\\D/g, '').slice(0, 4);\n\n/**\n * 시간 입력 문자열을 편집 중 HH:mm 형태로 포맷\n * @param value 현재 입력값\n * @param oldValue 이전 입력값\n */\nexport const formatTimeInputToHourMinute = (value: string, oldValue = '') => {\n const sanitizedValue = sanitizeTimeInputValue(value);\n\n if (!sanitizedValue) {\n return '';\n }\n\n if (value.length < oldValue.length) {\n return sanitizedValue;\n }\n\n const digits = getTimeDigits(value);\n\n if (digits.length === 1) {\n return `${digits}:`;\n }\n\n if (digits.length === 2) {\n return `${digits}:`;\n }\n\n if (digits.length === 3) {\n return `${digits.slice(0, 1)}:${digits.slice(1)}`;\n }\n\n return `${digits.slice(0, 2)}:${digits.slice(2, 4)}`;\n};\n\n/**\n * 시간 문자열을 HH:mm 형식으로 정규화\n * @param value 원본 시간 문자열\n */\nexport const normalizeTimeToHourMinute = (value?: string | null) => {\n if (!isString(value)) {\n return null;\n }\n\n const formattedValue = formatTimeInputToHourMinute(value.trim());\n\n if (!formattedValue) {\n return '';\n }\n\n const timeMatch = formattedValue.match(/^(\\d{1,2}):(\\d{2})$/);\n\n if (!timeMatch) {\n return null;\n }\n\n const [, hourText = '', minuteText = ''] = timeMatch;\n const hour = Number(hourText);\n const minute = Number(minuteText);\n\n if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {\n return null;\n }\n\n return `${hour.toString().padStart(2, '0')}:${minuteText}`;\n};\n"],"names":["sanitizeTimeInputValue","__name","value","sanitizedValue","hourText","minuteText","getTimeDigits","formatTimeInputToHourMinute","oldValue","digits","normalizeTimeToHourMinute","isString","formattedValue","timeMatch","hour","minute"],"mappings":";;;AAEA,MAAMA,IAAyB,gBAAAC,EAAA,CAACC,MAAkB;AAChD,QAAMC,IAAiBD,EAAM,QAAQ,WAAW,EAAE;AAElD,MAAI,CAACC,EAAe,SAAS,GAAG;AAC9B,WAAOA,EAAe,MAAM,GAAG,CAAC;AAGlC,QAAM,CAACC,IAAW,IAAIC,IAAa,EAAE,IAAIF,EAAe,MAAM,GAAG;AAEjE,SAAO,GAAGC,EAAS,MAAM,GAAG,CAAC,CAAC,IAAIC,EAAW,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAC5E,GAV+B,2BAYzBC,IAAgB,gBAAAL,EAAA,CAACC,MAAkBA,EAAM,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,CAAC,GAAtD,kBAOTK,IAA8B,gBAAAN,EAAA,CAACC,GAAeM,IAAW,OAAO;AAC3E,QAAML,IAAiBH,EAAuBE,CAAK;AAEnD,MAAI,CAACC;AACH,WAAO;AAGT,MAAID,EAAM,SAASM,EAAS;AAC1B,WAAOL;AAGT,QAAMM,IAASH,EAAcJ,CAAK;AAElC,SAAIO,EAAO,WAAW,IACb,GAAGA,CAAM,MAGdA,EAAO,WAAW,IACb,GAAGA,CAAM,MAGdA,EAAO,WAAW,IACb,GAAGA,EAAO,MAAM,GAAG,CAAC,CAAC,IAAIA,EAAO,MAAM,CAAC,C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