@acoustte-digital-services/digitalstore-controls-dev 0.8.1 → 0.8.2-dev.20260324084945

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.
package/dist/index.mjs CHANGED
@@ -1,3 +1,24 @@
1
+ "use client";
2
+
3
+
4
+ // src/components/pageRenderingEngine/nodes/WidgetRegistry.tsx
5
+ var GLOBAL_KEY = "__DIGITALSTORE_WIDGET_REGISTRY__";
6
+ var getRegistry = () => {
7
+ const globalAny = globalThis;
8
+ if (!globalAny[GLOBAL_KEY]) {
9
+ globalAny[GLOBAL_KEY] = {};
10
+ }
11
+ return globalAny[GLOBAL_KEY];
12
+ };
13
+ var registerWidgets = (widgets) => {
14
+ const registry = getRegistry();
15
+ Object.assign(registry, widgets);
16
+ };
17
+ var getWidget = (code) => {
18
+ const registry = getRegistry();
19
+ return registry[code];
20
+ };
21
+
1
22
  // src/components/controls/view/ViewControl.tsx
2
23
  import React11 from "react";
3
24
 
@@ -36,6 +57,8 @@ var DateView = (props) => {
36
57
  let timezone;
37
58
  try {
38
59
  const val = props.value && props.value.toString().includes("Z") ? props.value : props.value + "Z";
60
+ {
61
+ }
39
62
  const parsedDate = new Date(val);
40
63
  const timezoneOffset = parsedDate.getTimezoneOffset();
41
64
  timezone = moment.tz.zone(moment.tz.guess())?.abbr(timezoneOffset);
@@ -153,6 +176,8 @@ var StatusView_default = Status;
153
176
  import React8 from "react";
154
177
  import { jsx as jsx8, jsxs } from "react/jsx-runtime";
155
178
  var Money = (props) => {
179
+ {
180
+ }
156
181
  const parsedNumber = parseFloat(props.value);
157
182
  return /* @__PURE__ */ jsx8(React8.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ jsxs("span", { className: parsedNumber < 0 ? "text-alert" : "", children: [
158
183
  /* @__PURE__ */ jsx8("span", { className: "mr-0.5", children: "\u20B9" }),
@@ -165,6 +190,8 @@ var MoneyView_default = Money;
165
190
  import React9 from "react";
166
191
  import { jsx as jsx9 } from "react/jsx-runtime";
167
192
  var MultilineTextBullets = (props) => {
193
+ {
194
+ }
168
195
  const lines = props.value?.split("\\n");
169
196
  return /* @__PURE__ */ jsx9(React9.Fragment, { children: /* @__PURE__ */ jsx9("ul", { className: "list-disc", children: lines && lines.map((line, index) => {
170
197
  return /* @__PURE__ */ jsx9("li", { children: line }, index);
@@ -197,7 +224,7 @@ var ViewControl = React11.forwardRef(
197
224
  [ViewControlTypes_default.booleanView]: BooleanView_default
198
225
  // [ViewControlTypes.booleanView]: BooleanView
199
226
  };
200
- const SelectedControlComponent = ControlComponents[props.controlType];
227
+ const SelectedControlComponent = props.controlType ? ControlComponents[props.controlType] : void 0;
201
228
  return /* @__PURE__ */ jsx11(React11.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx11(SelectedControlComponent, { ...props }) : "Control not found" });
202
229
  }
203
230
  );
@@ -367,6 +394,9 @@ var MoneyInput = (props) => {
367
394
  var MoneyInput_default = MoneyInput;
368
395
 
369
396
  // src/components/controls/edit/InputControlType.tsx
397
+ var Constants = {
398
+ pagesize: 10
399
+ };
370
400
  var InputControlType = {
371
401
  lineTextInput: "text",
372
402
  multilineTextInput: "multilinetext",
@@ -908,6 +938,7 @@ var ColorInput = (props) => {
908
938
  {
909
939
  type: "color",
910
940
  name: props.name,
941
+ title: color,
911
942
  id: props.name,
912
943
  value: color,
913
944
  onChange: handleColorChange,
@@ -1094,53 +1125,28 @@ var ToastService_default = ToastService;
1094
1125
 
1095
1126
  // src/components/StyleTypes.tsx
1096
1127
  var buttonClasses = /* @__PURE__ */ new Map([
1097
- [
1098
- "Primary" /* Primary */,
1099
- "relative inline-flex items-center justify-center bg-primary rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg hover:bg-primary-strong focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body"
1100
- ],
1101
- [
1102
- "Secondary" /* Secondary */,
1103
- "relative inline-flex items-center justify-center bg-gradient-to-b from-secondary to-secondary-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-secondary-strong"
1104
- ],
1105
- [
1106
- "Neutral" /* Neutral */,
1107
- "relative inline-flex items-center justify-center bg-neutral-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-neutral-stronger"
1108
- ],
1109
- [
1110
- "PrimaryHollow" /* PrimaryHollow */,
1111
- "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-primary border text-primary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
1112
- ],
1113
- [
1114
- "SecondaryHollow" /* SecondaryHollow */,
1115
- "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-secondary border text-secondary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
1116
- ],
1117
- [
1118
- "NeutralHollow" /* NeutralHollow */,
1119
- "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-neutral border text-neutral rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
1120
- ],
1121
- [
1122
- "Ripple" /* Ripple */,
1123
- "px-3 py-1.5 inline-flex items-center text-sm font-medium rounded border-[1.5px] border-primary ripple btn-bg-primary btn-primary-text"
1124
- ],
1125
- [
1126
- "Danger" /* Danger */,
1127
- "inline-flex text-sm font-medium items-center justify-center px-4 py-2 border border-alert bg-alert text-white rounded hover:bg-alert-600 hover:border-alert-600 focus:outline-none active:ring-1 active:ring-alert"
1128
- ],
1129
- ["Link" /* Link */, ""],
1130
- [
1131
- "Light" /* Light */,
1132
- "inline-flex items-center justify-center rounded bg-white border px-4 py-2 leading-6 text-primary shadow-sm hover:shadow focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:opacity-50 disabled:cursor-not-allowed"
1133
- ]
1128
+ ["Primary" /* Solid */, "btn-solid"],
1129
+ ["PrimaryHollow" /* Hollow */, "btn-hollow"],
1130
+ ["Link" /* Link */, "btn-link"]
1131
+ // [StyleTypes.Solid, "relative inline-flex items-center justify-center bg-gradient-to-b from-secondary to-secondary-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-secondary-strong"],
1132
+ // [StyleTypes.Solid, "relative inline-flex items-center justify-center bg-neutral-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-neutral-stronger"],
1133
+ // [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-primary border text-primary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
1134
+ // [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-secondary border text-secondary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
1135
+ // [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-neutral border text-neutral rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
1136
+ // [StyleTypes.Ripple, "px-3 py-1.5 inline-flex items-center text-sm font-medium rounded border-[1.5px] border-primary ripple btn-bg-primary btn-primary-text"],
1137
+ // [StyleTypes.Danger, "inline-flex text-sm font-medium items-center justify-center px-4 py-2 border border-alert bg-alert text-white rounded hover:bg-alert-600 hover:border-alert-600 focus:outline-none active:ring-1 active:ring-alert"],
1138
+ // [StyleTypes.Link, ""],
1139
+ // [StyleTypes.Light, "inline-flex items-center justify-center rounded bg-white border px-4 py-2 leading-6 text-primary shadow-sm hover:shadow focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:opacity-50 disabled:cursor-not-allowed"],
1134
1140
  ]);
1135
1141
  var progressClasses = /* @__PURE__ */ new Map([
1136
- ["Primary" /* Primary */, ""],
1137
- ["PrimaryHollow" /* PrimaryHollow */, ""],
1138
- ["Secondary" /* Secondary */, ""],
1139
- ["SecondaryHollow" /* SecondaryHollow */, ""],
1140
- ["Neutral" /* Neutral */, ""],
1141
- ["NeutralHollow" /* NeutralHollow */, ""],
1142
- ["Ripple" /* Ripple */, ""],
1143
- ["Danger" /* Danger */, ""],
1142
+ ["Primary" /* Solid */, ""],
1143
+ ["PrimaryHollow" /* Hollow */, ""],
1144
+ // [StyleTypes.Solid, ""],
1145
+ // [StyleTypes.Hollow, ""],
1146
+ // [StyleTypes.Solid, ""],
1147
+ // [StyleTypes.Hollow, ""],
1148
+ // [StyleTypes.Ripple, ""],
1149
+ // [StyleTypes.Danger, ""],
1144
1150
  ["Link" /* Link */, ""]
1145
1151
  ]);
1146
1152
 
@@ -1149,56 +1155,21 @@ import { useState as useState3 } from "react";
1149
1155
 
1150
1156
  // src/components/ClientButton.tsx
1151
1157
  import React24 from "react";
1152
-
1153
- // src/components/utilities/ToastService.tsx
1154
- var ToastService2 = class {
1155
- static showError(message) {
1156
- console.error(message);
1157
- if (typeof window !== "undefined") {
1158
- alert(message);
1159
- }
1160
- }
1161
- static showSuccess(message) {
1162
- console.log(message);
1163
- if (typeof window !== "undefined") {
1164
- alert(message);
1165
- }
1166
- }
1167
- static showWarning(message) {
1168
- console.warn(message);
1169
- if (typeof window !== "undefined") {
1170
- alert(message);
1171
- }
1172
- }
1173
- static showInfo(message) {
1174
- console.info(message);
1175
- if (typeof window !== "undefined") {
1176
- alert(message);
1177
- }
1178
- }
1179
- };
1180
- var ToastService_default2 = ToastService2;
1181
-
1182
- // src/components/ClientButton.tsx
1183
1158
  import { jsx as jsx24 } from "react/jsx-runtime";
1184
1159
  var ClientButton = (props) => {
1185
1160
  const execute = async (event) => {
1186
- event.preventDefault();
1187
1161
  if (props.onClick !== void 0) {
1188
1162
  props.onClick();
1189
1163
  } else {
1190
- ToastService_default2.showError("No action defined.");
1164
+ ToastService_default.showError("No action defined.");
1191
1165
  }
1192
1166
  };
1193
- let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Primary */);
1167
+ let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
1194
1168
  return /* @__PURE__ */ jsx24(React24.Fragment, { children: /* @__PURE__ */ jsx24(
1195
1169
  "button",
1196
1170
  {
1197
1171
  type: "button",
1198
1172
  onClick: execute,
1199
- "data-role": props.dataRole,
1200
- disabled: props.disabled,
1201
- tabIndex: props.tabIndex,
1202
1173
  className: buttonClass + " " + props.className,
1203
1174
  children: props.children
1204
1175
  }
@@ -1222,21 +1193,27 @@ var Confirm = ({ message, onConfirm, onCancel }) => {
1222
1193
  onCancel();
1223
1194
  }
1224
1195
  };
1225
- return /* @__PURE__ */ jsx25(Fragment, { children: showModal && /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 flex items-center justify-center z-20", children: [
1196
+ return /* @__PURE__ */ jsx25(Fragment, { children: showModal && /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
1226
1197
  /* @__PURE__ */ jsx25("div", { className: "absolute inset-0 bg-black opacity-70" }),
1227
- /* @__PURE__ */ jsxs14("div", { className: "bg-white rounded-md p-6 shadow border z-50", children: [
1228
- /* @__PURE__ */ jsx25("p", { className: "text-xl font-semibold mb-4", children: "Confirmation" }),
1198
+ /* @__PURE__ */ jsxs14("div", { className: "bg-white rounded-md p-6 w-2/6 shadow border z-50", children: [
1199
+ /* @__PURE__ */ jsx25("p", { className: "text-xl font-medium mb-4", children: "Confirmation" }),
1229
1200
  /* @__PURE__ */ jsx25("p", { className: "mb-4", children: message }),
1230
1201
  /* @__PURE__ */ jsxs14("div", { className: "flex justify-end gap-8", children: [
1231
1202
  /* @__PURE__ */ jsx25(
1232
1203
  ClientButton_default,
1233
1204
  {
1234
1205
  onClick: handleCancelAction,
1235
- ButtonType: "PrimaryHollow" /* PrimaryHollow */,
1206
+ ButtonType: "PrimaryHollow" /* Hollow */,
1236
1207
  children: "Cancel"
1237
1208
  }
1238
1209
  ),
1239
- /* @__PURE__ */ jsx25(ClientButton_default, { onClick: handleConfirmAction, children: "Confirm" })
1210
+ /* @__PURE__ */ jsx25(
1211
+ ClientButton_default,
1212
+ {
1213
+ onClick: handleConfirmAction,
1214
+ children: "Confirm"
1215
+ }
1216
+ )
1240
1217
  ] })
1241
1218
  ] })
1242
1219
  ] }) });
@@ -1254,10 +1231,9 @@ var Button = (props) => {
1254
1231
  const [showModal, setShowModal] = useState4(null);
1255
1232
  const execute = async (event) => {
1256
1233
  event.preventDefault();
1234
+ event.stopPropagation();
1257
1235
  if (props.confirm) {
1258
- const confirmed = await showConfirmation(
1259
- "Are you sure you want to delete this item?"
1260
- );
1236
+ const confirmed = await showConfirmation("Are you sure you want to delete this item?");
1261
1237
  setShowModal(null);
1262
1238
  if (!confirmed) {
1263
1239
  return;
@@ -1272,15 +1248,12 @@ var Button = (props) => {
1272
1248
  isValid = await props.onValidate();
1273
1249
  if (!isValid) {
1274
1250
  setInProgress(false);
1275
- ToastService_default.showError(
1276
- "There are error in the form. Please fix them before proceeding."
1277
- );
1251
+ ToastService_default.showError("There are errors in the form. Please fix them before proceeding.");
1278
1252
  return;
1279
1253
  }
1280
1254
  }
1281
1255
  if (props.onClick !== void 0) {
1282
- let response = await props.onClick(props.index);
1283
- console.log(response);
1256
+ let response = await props.onClick();
1284
1257
  if (response.isSuccessful) {
1285
1258
  setIsActionPerformed(true);
1286
1259
  setResponseMessage(response.message);
@@ -1299,61 +1272,27 @@ var Button = (props) => {
1299
1272
  return new Promise((resolve) => {
1300
1273
  const onConfirm = () => resolve(true);
1301
1274
  const onCancel = () => resolve(false);
1302
- setShowModal(
1303
- /* @__PURE__ */ jsx26(
1304
- Confirm_default,
1305
- {
1306
- message: props.confirmationMessage,
1307
- onConfirm,
1308
- onCancel
1309
- }
1310
- )
1311
- );
1275
+ setShowModal(/* @__PURE__ */ jsx26(Confirm_default, { message: props.confirmationMessage, onConfirm, onCancel }));
1312
1276
  });
1313
1277
  };
1314
- let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Primary */);
1315
- let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /* Primary */);
1278
+ let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
1279
+ let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /* Solid */);
1280
+ const isDisabled = inProgress || isActionPerformed && props.oneTimeAction;
1316
1281
  return /* @__PURE__ */ jsxs15(React26.Fragment, { children: [
1317
1282
  /* @__PURE__ */ jsxs15(
1318
1283
  "button",
1319
1284
  {
1320
1285
  type: "submit",
1321
1286
  onClick: execute,
1322
- id: props.id,
1323
1287
  disabled: props.disabled,
1324
- className: buttonClass + " relative " + (props.className || "") + (props.isActive ? " scale-95 shadow-inner" : ""),
1288
+ title: isDisabled ? "The button is disabled to prevent any action" : "",
1289
+ className: buttonClass + " relative " + props.className,
1325
1290
  children: [
1326
1291
  isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
1327
- inProgress && /* @__PURE__ */ jsx26(React26.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ jsx26("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs15(
1328
- "svg",
1329
- {
1330
- className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass,
1331
- xmlns: "http://www.w3.org/2000/svg",
1332
- fill: "none",
1333
- viewBox: "0 0 24 24",
1334
- children: [
1335
- /* @__PURE__ */ jsx26(
1336
- "circle",
1337
- {
1338
- className: "opacity-25",
1339
- cx: "12",
1340
- cy: "12",
1341
- r: "10",
1342
- stroke: "currentColor",
1343
- strokeWidth: "4"
1344
- }
1345
- ),
1346
- /* @__PURE__ */ jsx26(
1347
- "path",
1348
- {
1349
- className: "opacity-75",
1350
- fill: "currentColor",
1351
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
1352
- }
1353
- )
1354
- ]
1355
- }
1356
- ) })
1292
+ inProgress && /* @__PURE__ */ jsx26(React26.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ jsx26("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs15("svg", { className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
1293
+ /* @__PURE__ */ jsx26("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1294
+ /* @__PURE__ */ jsx26("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
1295
+ ] }) })
1357
1296
  ]
1358
1297
  }
1359
1298
  ),
@@ -1380,7 +1319,7 @@ var SelectWithSearchPanel = (props) => {
1380
1319
  const containerRef = useRef2(null);
1381
1320
  const [isCreateOpen, setIsCreateOpen] = useState5(false);
1382
1321
  const [formData, setFormData] = useState5({});
1383
- const getNestedValue = (obj, path) => {
1322
+ const getNestedValue2 = (obj, path) => {
1384
1323
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
1385
1324
  };
1386
1325
  useEffect4(() => {
@@ -1418,7 +1357,7 @@ var SelectWithSearchPanel = (props) => {
1418
1357
  props.dataSourceDependsOn
1419
1358
  ]);
1420
1359
  const filteredItems = list?.filter((item) => {
1421
- const value = getNestedValue(item, props.dataTextFieldName);
1360
+ const value = getNestedValue2(item, props.dataTextFieldName);
1422
1361
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
1423
1362
  });
1424
1363
  const playBeep = () => {
@@ -1449,7 +1388,7 @@ var SelectWithSearchPanel = (props) => {
1449
1388
  }, [searchTerm]);
1450
1389
  const handleSelect = (event, item) => {
1451
1390
  event.preventDefault();
1452
- setSearchTerm(getNestedValue(item, props.dataTextFieldName));
1391
+ setSearchTerm(getNestedValue2(item, props.dataTextFieldName));
1453
1392
  if (props.callback) {
1454
1393
  const val = {};
1455
1394
  props.callback({
@@ -1574,7 +1513,10 @@ var SelectWithSearchPanel = (props) => {
1574
1513
  }
1575
1514
  )
1576
1515
  ] }, field.name)),
1577
- /* @__PURE__ */ jsxs16(Button_default, { onClick: handleSaveModal, className: "w-full", children: [
1516
+ /* @__PURE__ */ jsxs16(Button_default, { onClick: async () => {
1517
+ handleSaveModal();
1518
+ return { isSuccessful: true };
1519
+ }, className: "w-full", children: [
1578
1520
  "Save ",
1579
1521
  props.attributes?.label
1580
1522
  ] })
@@ -1596,7 +1538,7 @@ var SelectWithSearchPanel = (props) => {
1596
1538
  role: "option",
1597
1539
  tabIndex: -1,
1598
1540
  onMouseEnter: () => setHighlightedIndex(index),
1599
- children: /* @__PURE__ */ jsx27("span", { children: getNestedValue(item, props.dataTextFieldName) })
1541
+ children: /* @__PURE__ */ jsx27("span", { children: getNestedValue2(item, props.dataTextFieldName) })
1600
1542
  }
1601
1543
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ jsx27("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
1602
1544
  }
@@ -1812,9 +1754,2901 @@ var InputControl = React31.forwardRef(
1812
1754
  );
1813
1755
  InputControl.displayName = "InputControl";
1814
1756
  var InputControl_default = InputControl;
1757
+
1758
+ // src/components/dataForm/DataList.tsx
1759
+ import React34, { useEffect as useEffect6, useState as useState7, useCallback as useCallback2, useReducer } from "react";
1760
+ import { useRouter } from "next/navigation";
1761
+
1762
+ // src/components/dataForm/NoContentView.tsx
1763
+ import React32 from "react";
1764
+ import { jsx as jsx32 } from "react/jsx-runtime";
1765
+ var NoContentView = (props) => {
1766
+ return /* @__PURE__ */ jsx32(React32.Fragment, { children: props.isDataFound === false && props.children });
1767
+ };
1768
+ var NoContentView_default = NoContentView;
1769
+
1770
+ // src/components/dataForm/ContentView.tsx
1771
+ import React33 from "react";
1772
+ import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
1773
+ var ContentView = (props) => {
1774
+ return /* @__PURE__ */ jsxs20(React33.Fragment, { children: [
1775
+ props.isDataFound == null && /* @__PURE__ */ jsx33("div", { className: "", children: /* @__PURE__ */ jsxs20("div", { className: "bg-gray-200 rounded-md p-4 animate-pulse", children: [
1776
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center mb-4", children: [
1777
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
1778
+ /* @__PURE__ */ jsxs20("div", { className: "ml-2", children: [
1779
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
1780
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
1781
+ ] })
1782
+ ] }),
1783
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
1784
+ /* @__PURE__ */ jsxs20("div", { className: "animate-pulse", children: [
1785
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
1786
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
1787
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
1788
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
1789
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
1790
+ ] }),
1791
+ /* @__PURE__ */ jsxs20("div", { className: "animate-pulse", children: [
1792
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
1793
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
1794
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
1795
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
1796
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
1797
+ ] }),
1798
+ /* @__PURE__ */ jsxs20("div", { className: "animate-pulse", children: [
1799
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
1800
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
1801
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
1802
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
1803
+ /* @__PURE__ */ jsx33("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
1804
+ ] })
1805
+ ] })
1806
+ ] }) }),
1807
+ props.isDataFound === true && props.children
1808
+ ] });
1809
+ };
1810
+ var ContentView_default = ContentView;
1811
+
1812
+ // src/components/dataForm/Hyperlink.tsx
1813
+ import Link from "next/link";
1814
+ import { Fragment as Fragment2, jsx as jsx34 } from "react/jsx-runtime";
1815
+ function Hyperlink(props) {
1816
+ let linkClass = props.linkType ? buttonClasses.get(props.linkType) : "";
1817
+ const target = props?.href?.startsWith("http") ? "_blank" : "_self";
1818
+ const additionalProps = {};
1819
+ if (target == "_blank") {
1820
+ additionalProps.rel = "noopener noreferrer";
1821
+ }
1822
+ return /* @__PURE__ */ jsx34(Fragment2, { children: props.href ? /* @__PURE__ */ jsx34(
1823
+ Link,
1824
+ {
1825
+ href: props.href,
1826
+ prefetch: false,
1827
+ className: `${linkClass} ${props.className ?? ""}`,
1828
+ ...additionalProps,
1829
+ target,
1830
+ children: props.children
1831
+ }
1832
+ ) : props.isHeading ? /* @__PURE__ */ jsx34("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ jsx34("span", { className: props.className, children: props.children }) });
1833
+ }
1834
+
1835
+ // src/clients/OdataBuilder.tsx
1836
+ var OdataBuilder = class {
1837
+ constructor(url) {
1838
+ this.baseUrl = url;
1839
+ this.top = Constants.pagesize.toString();
1840
+ this.skip = "0";
1841
+ this.keyword = "";
1842
+ this.filterBy = "";
1843
+ this.orderBy = "";
1844
+ }
1845
+ // parseSearchParams(ReadonlyUrlSearchParams): DataQuery {
1846
+ // this.top = top;
1847
+ // return this;
1848
+ // }
1849
+ setQuery(odata) {
1850
+ if (odata) {
1851
+ for (const key in odata) {
1852
+ if (odata[key] != null && odata[key] != "") {
1853
+ if (key == "$skip") {
1854
+ this.setSkip(odata[key]);
1855
+ }
1856
+ if (key == "$filter") {
1857
+ this.setFilter(odata[key]);
1858
+ }
1859
+ if (key == "$top") {
1860
+ this.setTop(odata[key]);
1861
+ }
1862
+ if (key == "$orderby") {
1863
+ this.setOrderBy(odata[key]);
1864
+ }
1865
+ }
1866
+ }
1867
+ }
1868
+ return this;
1869
+ }
1870
+ // parseKeyValuePairs(inputString: string): { [key: string]: string } {
1871
+ // return inputString.split('$')
1872
+ // .map((pair) => pair.split('='))
1873
+ // .reduce((result: { [key: string]: string }, [key, value]) => {
1874
+ // if (key && value) {
1875
+ // result[key.trim()] = value.trim();
1876
+ // }
1877
+ // return result;
1878
+ // }, {});
1879
+ // }
1880
+ static getOdataQueryString(obj, defaultOrder) {
1881
+ let queryString = "";
1882
+ let skip = (obj && obj["$skip"]) ?? "0";
1883
+ let top = (obj && obj["$top"]) ?? Constants.pagesize.toString();
1884
+ queryString = `$skip=${skip}&$top=${top}&$count=true`;
1885
+ if (obj) {
1886
+ if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
1887
+ queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
1888
+ }
1889
+ if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
1890
+ queryString = queryString + `&$orderby=${encodeURIComponent(obj["$orderby"])}`;
1891
+ } else if (defaultOrder) {
1892
+ queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
1893
+ }
1894
+ } else {
1895
+ if (defaultOrder) {
1896
+ queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
1897
+ }
1898
+ }
1899
+ return queryString;
1900
+ }
1901
+ setTop(top) {
1902
+ this.top = top;
1903
+ return this;
1904
+ }
1905
+ setSkip(skip) {
1906
+ this.skip = skip;
1907
+ return this;
1908
+ }
1909
+ setKeyword(keyword) {
1910
+ this.keyword = keyword;
1911
+ return this;
1912
+ }
1913
+ setFilter(filterBy) {
1914
+ this.filterBy = filterBy;
1915
+ return this;
1916
+ }
1917
+ setOrderBy(orderBy) {
1918
+ this.orderBy = orderBy;
1919
+ return this;
1920
+ }
1921
+ getPageNumber(pageSize) {
1922
+ let pageNumber = 1;
1923
+ if (this.skip && this.top) {
1924
+ const skip = parseInt(this.skip);
1925
+ const top = parseInt(this.top);
1926
+ if (!isNaN(skip) && !isNaN(top)) {
1927
+ pageNumber = skip / pageSize + 1;
1928
+ }
1929
+ }
1930
+ return pageNumber;
1931
+ }
1932
+ getUrl() {
1933
+ let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
1934
+ if (this.filterBy !== null && this.filterBy !== "") {
1935
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1936
+ }
1937
+ if (this.orderBy !== null && this.orderBy !== "") {
1938
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1939
+ }
1940
+ console.log(url);
1941
+ return url;
1942
+ }
1943
+ getNewOrderByUrl(orderBy) {
1944
+ let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
1945
+ if (this.filterBy !== null && this.filterBy !== "") {
1946
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1947
+ }
1948
+ url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
1949
+ return url;
1950
+ }
1951
+ getNewFilterUrl(filterBy) {
1952
+ let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
1953
+ if (filterBy !== null && filterBy !== "") {
1954
+ url = url + `&$filter=${encodeURIComponent(filterBy)}`;
1955
+ }
1956
+ if (this.orderBy !== null && this.orderBy !== "") {
1957
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1958
+ }
1959
+ return url;
1960
+ }
1961
+ getNewPageUrl(page) {
1962
+ let skip = page * Constants.pagesize - Constants.pagesize;
1963
+ let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
1964
+ if (this.filterBy !== null && this.filterBy !== "") {
1965
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1966
+ }
1967
+ if (this.orderBy !== null && this.orderBy !== "") {
1968
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1969
+ }
1970
+ return url;
1971
+ }
1972
+ getNewPageSizeUrl(pageSize) {
1973
+ const currentPage = this.getPageNumber(parseInt(this.top || Constants.pagesize.toString()));
1974
+ const skip = (currentPage - 1) * pageSize;
1975
+ let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
1976
+ if (this.filterBy !== null && this.filterBy !== "") {
1977
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1978
+ }
1979
+ if (this.orderBy !== null && this.orderBy !== "") {
1980
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1981
+ }
1982
+ return url;
1983
+ }
1984
+ getOrderBy() {
1985
+ return this.orderBy;
1986
+ }
1987
+ };
1988
+
1989
+ // src/svg/chevron-updown.tsx
1990
+ import { jsx as jsx35 } from "react/jsx-runtime";
1991
+ var ChevronUpDown = (props) => {
1992
+ return /* @__PURE__ */ jsx35("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx35("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
1993
+ };
1994
+ var chevron_updown_default = ChevronUpDown;
1995
+
1996
+ // src/svg/chevron-down.tsx
1997
+ import { jsx as jsx36 } from "react/jsx-runtime";
1998
+ var ChevronDown = (props) => {
1999
+ return /* @__PURE__ */ jsx36("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx36("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
2000
+ };
2001
+ var chevron_down_default = ChevronDown;
2002
+
2003
+ // src/svg/chevron-up.tsx
2004
+ import { jsx as jsx37 } from "react/jsx-runtime";
2005
+ var ChevronUp = (props) => {
2006
+ return /* @__PURE__ */ jsx37("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx37("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
2007
+ };
2008
+ var chevron_up_default = ChevronUp;
2009
+
2010
+ // src/svg/plus.tsx
2011
+ import { jsx as jsx38 } from "react/jsx-runtime";
2012
+ var Plus = (props) => {
2013
+ return /* @__PURE__ */ jsx38("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx38("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
2014
+ };
2015
+ var plus_default = Plus;
2016
+
2017
+ // src/svg/Icons.tsx
2018
+ var Icons = {
2019
+ chevronUpDown: chevron_updown_default,
2020
+ chevronDown: chevron_down_default,
2021
+ chevronUp: chevron_up_default,
2022
+ plus: plus_default
2023
+ };
2024
+ var Icons_default = Icons;
2025
+
2026
+ // src/svg/Icon.tsx
2027
+ import { jsx as jsx39 } from "react/jsx-runtime";
2028
+ var Icon = ({ name, className, ...props }) => {
2029
+ const IconComponent = Icons_default[name];
2030
+ if (!IconComponent) {
2031
+ console.error(`Icon "${name}" not found.`);
2032
+ return null;
2033
+ }
2034
+ return /* @__PURE__ */ jsx39(IconComponent, { ...props, className });
2035
+ };
2036
+ var Icon_default = Icon;
2037
+
2038
+ // src/FormReducer.tsx
2039
+ var FORM_INPUT_UPDATE = "FORM_INPUT_UPDATE";
2040
+ var FORM_INITIAL_UPDATE = "FORM_INITIAL_UPDATE";
2041
+ function setNestedProperty(obj, path, value) {
2042
+ if (path.includes(".")) {
2043
+ const keys = path.split(".");
2044
+ const lastKey = keys.pop();
2045
+ const newObj = { ...obj };
2046
+ let current = newObj;
2047
+ keys.forEach((key) => {
2048
+ current[key] = { ...current[key] };
2049
+ current = current[key];
2050
+ });
2051
+ current[lastKey] = value;
2052
+ return newObj;
2053
+ }
2054
+ return {
2055
+ ...obj,
2056
+ [path]: value
2057
+ };
2058
+ }
2059
+ function FormReducer(state, action) {
2060
+ switch (action.type) {
2061
+ case FORM_INPUT_UPDATE:
2062
+ if (!action.name) return state;
2063
+ return {
2064
+ inputValues: setNestedProperty(
2065
+ state.inputValues,
2066
+ action.name.toString(),
2067
+ action.value
2068
+ ),
2069
+ lastPropertyChanged: action.name.toString()
2070
+ };
2071
+ case FORM_INITIAL_UPDATE:
2072
+ return {
2073
+ inputValues: { ...action.values },
2074
+ lastPropertyChanged: action.name?.toString() || ""
2075
+ };
2076
+ default:
2077
+ return state;
2078
+ }
2079
+ }
2080
+ var FormReducer_default = FormReducer;
2081
+
2082
+ // src/components/dataForm/DataList.tsx
2083
+ import { Fragment as Fragment3, jsx as jsx40, jsxs as jsxs21 } from "react/jsx-runtime";
2084
+ var DataList = (props) => {
2085
+ console.log(props.dataset, "datasetssssss");
2086
+ const router = useRouter();
2087
+ let builder = new OdataBuilder(props.path);
2088
+ let orderBy = "";
2089
+ let activePageNumber = 0;
2090
+ let pages = 0;
2091
+ console.log(props.addLinkText);
2092
+ const [isDataFound, setIsDataFound] = useState7(null);
2093
+ useEffect6(() => {
2094
+ if (props?.dataset) {
2095
+ if (props?.dataset.result && props.dataset.result.length > 0) {
2096
+ setIsDataFound(true);
2097
+ } else {
2098
+ setIsDataFound(false);
2099
+ }
2100
+ }
2101
+ }, [props.dataset]);
2102
+ function getNestedProperty2(obj, path) {
2103
+ if (path.includes(".")) {
2104
+ return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
2105
+ } else if (Array.isArray(obj[path])) {
2106
+ return obj[path].map((item, index) => /* @__PURE__ */ jsx40("div", { children: item }, index));
2107
+ } else {
2108
+ return obj[path];
2109
+ }
2110
+ }
2111
+ const initialState = {
2112
+ inputValues: {},
2113
+ lastPropertyChanged: ""
2114
+ };
2115
+ const [formState, dispatch] = useReducer(FormReducer_default, initialState);
2116
+ const handleFilterChange = useCallback2(
2117
+ (updatedValues) => {
2118
+ dispatch({
2119
+ type: FORM_INPUT_UPDATE,
2120
+ name: updatedValues.name,
2121
+ value: updatedValues.value
2122
+ });
2123
+ let builder2 = new OdataBuilder(props.path);
2124
+ builder2 = builder2.setQuery(props.query);
2125
+ if (updatedValues.value != "") {
2126
+ const filter = props.filters?.find((x) => x.name == updatedValues.name);
2127
+ if (filter?.dataTypeCode == "number") {
2128
+ router.push(
2129
+ builder2.getNewFilterUrl(
2130
+ updatedValues.name.toString() + " eq " + updatedValues.value
2131
+ )
2132
+ );
2133
+ } else {
2134
+ router.push(
2135
+ builder2.getNewFilterUrl(
2136
+ updatedValues.name.toString() + " eq '" + updatedValues.value + "'"
2137
+ )
2138
+ );
2139
+ }
2140
+ } else {
2141
+ router.push(builder2.getNewFilterUrl(""));
2142
+ }
2143
+ },
2144
+ [dispatch, props, router]
2145
+ );
2146
+ builder = builder.setQuery(props.query);
2147
+ orderBy = builder.getOrderBy();
2148
+ activePageNumber = builder.getPageNumber(Constants.pagesize);
2149
+ let label = "";
2150
+ if (props.dataset && props.dataset.count) {
2151
+ pages = Math.ceil(props.dataset.count / Constants.pagesize);
2152
+ label = `Showing ${(activePageNumber - 1) * Constants.pagesize + 1} - `;
2153
+ if (activePageNumber * Constants.pagesize > props.dataset.count) {
2154
+ label = label + `${props.dataset.count} of ${props.dataset.count} results`;
2155
+ } else {
2156
+ label = label + `${activePageNumber * Constants.pagesize} of ${props.dataset.count} results`;
2157
+ }
2158
+ }
2159
+ const renderPageNumbers = () => {
2160
+ if (pages <= 10) {
2161
+ return Array.from({ length: pages }, (_, index) => index + 1).map(
2162
+ (page) => /* @__PURE__ */ jsx40(React34.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ jsx40(
2163
+ Hyperlink,
2164
+ {
2165
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2166
+ href: builder.getNewPageUrl(page),
2167
+ children: page
2168
+ }
2169
+ ) : /* @__PURE__ */ jsx40("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
2170
+ );
2171
+ } else {
2172
+ const showFirstPages = activePageNumber <= 5;
2173
+ const showLastPages = activePageNumber > pages - 5;
2174
+ if (showFirstPages) {
2175
+ return /* @__PURE__ */ jsxs21(Fragment3, { children: [
2176
+ Array.from({ length: 8 }, (_, index) => index + 1).map((page) => /* @__PURE__ */ jsx40(React34.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ jsx40(
2177
+ Hyperlink,
2178
+ {
2179
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2180
+ href: builder.getNewPageUrl(page),
2181
+ children: page
2182
+ }
2183
+ ) : /* @__PURE__ */ jsx40("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
2184
+ /* @__PURE__ */ jsx40("span", { className: "px-2 py-1", children: "..." }),
2185
+ /* @__PURE__ */ jsx40(
2186
+ Hyperlink,
2187
+ {
2188
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2189
+ href: builder.getNewPageUrl(pages - 1),
2190
+ children: pages - 1
2191
+ }
2192
+ ),
2193
+ /* @__PURE__ */ jsx40(
2194
+ Hyperlink,
2195
+ {
2196
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2197
+ href: builder.getNewPageUrl(pages),
2198
+ children: pages
2199
+ }
2200
+ ),
2201
+ /* @__PURE__ */ jsx40("div", { className: "relative inline-block", children: /* @__PURE__ */ jsxs21(
2202
+ "select",
2203
+ {
2204
+ className: " py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
2205
+ value: activePageNumber > 8 && activePageNumber < pages - 1 ? activePageNumber : "",
2206
+ onChange: (e) => {
2207
+ const page = parseInt(e.target.value);
2208
+ if (page) {
2209
+ router.push(builder.getNewPageUrl(page));
2210
+ }
2211
+ },
2212
+ children: [
2213
+ /* @__PURE__ */ jsx40("option", { className: "", value: "", children: "Jump to" }),
2214
+ Array.from(
2215
+ { length: Math.max(0, pages - 10) },
2216
+ (_, index) => index + 9
2217
+ ).map((page) => /* @__PURE__ */ jsx40("option", { value: page, children: page }, page))
2218
+ ]
2219
+ }
2220
+ ) })
2221
+ ] });
2222
+ } else if (showLastPages) {
2223
+ return /* @__PURE__ */ jsxs21(Fragment3, { children: [
2224
+ /* @__PURE__ */ jsx40(
2225
+ Hyperlink,
2226
+ {
2227
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2228
+ href: builder.getNewPageUrl(1),
2229
+ children: "1"
2230
+ }
2231
+ ),
2232
+ /* @__PURE__ */ jsx40(
2233
+ Hyperlink,
2234
+ {
2235
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2236
+ href: builder.getNewPageUrl(2),
2237
+ children: "2"
2238
+ }
2239
+ ),
2240
+ /* @__PURE__ */ jsx40("span", { className: "px-2 py-1", children: "..." }),
2241
+ Array.from({ length: 8 }, (_, index) => pages - 7 + index).map(
2242
+ (page) => /* @__PURE__ */ jsx40(React34.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ jsx40(
2243
+ Hyperlink,
2244
+ {
2245
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2246
+ href: builder.getNewPageUrl(page),
2247
+ children: page
2248
+ }
2249
+ ) : /* @__PURE__ */ jsx40("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
2250
+ )
2251
+ ] });
2252
+ } else {
2253
+ return /* @__PURE__ */ jsxs21(Fragment3, { children: [
2254
+ /* @__PURE__ */ jsx40(
2255
+ Hyperlink,
2256
+ {
2257
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2258
+ href: builder.getNewPageUrl(1),
2259
+ children: "1"
2260
+ }
2261
+ ),
2262
+ /* @__PURE__ */ jsx40(
2263
+ Hyperlink,
2264
+ {
2265
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2266
+ href: builder.getNewPageUrl(2),
2267
+ children: "2"
2268
+ }
2269
+ ),
2270
+ /* @__PURE__ */ jsx40("span", { className: "px-2 py-1", children: "..." }),
2271
+ Array.from(
2272
+ { length: 5 },
2273
+ (_, index) => activePageNumber - 2 + index
2274
+ ).map((page) => /* @__PURE__ */ jsx40(React34.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ jsx40(
2275
+ Hyperlink,
2276
+ {
2277
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2278
+ href: builder.getNewPageUrl(page),
2279
+ children: page
2280
+ }
2281
+ ) : /* @__PURE__ */ jsx40("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
2282
+ /* @__PURE__ */ jsx40("span", { className: "px-2 py-1", children: "..." }),
2283
+ /* @__PURE__ */ jsx40(
2284
+ Hyperlink,
2285
+ {
2286
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2287
+ href: builder.getNewPageUrl(pages - 1),
2288
+ children: pages - 1
2289
+ }
2290
+ ),
2291
+ /* @__PURE__ */ jsx40(
2292
+ Hyperlink,
2293
+ {
2294
+ className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
2295
+ href: builder.getNewPageUrl(pages),
2296
+ children: pages
2297
+ }
2298
+ ),
2299
+ /* @__PURE__ */ jsx40("div", { className: "relative inline-block", children: /* @__PURE__ */ jsxs21(
2300
+ "select",
2301
+ {
2302
+ className: "px-2 py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
2303
+ value: activePageNumber > 2 && activePageNumber < pages - 1 ? activePageNumber : "",
2304
+ onChange: (e) => {
2305
+ const page = parseInt(e.target.value);
2306
+ if (page) {
2307
+ router.push(builder.getNewPageUrl(page));
2308
+ }
2309
+ },
2310
+ children: [
2311
+ /* @__PURE__ */ jsx40("option", { value: "", children: "Jump to" }),
2312
+ Array.from({ length: pages - 4 }, (_, index) => index + 3).filter((page) => page > 2 && page < pages - 1).map((page) => /* @__PURE__ */ jsx40("option", { value: page, children: page }, page))
2313
+ ]
2314
+ }
2315
+ ) })
2316
+ ] });
2317
+ }
2318
+ }
2319
+ };
2320
+ return /* @__PURE__ */ jsxs21(React34.Fragment, { children: [
2321
+ /* @__PURE__ */ jsxs21(ContentView_default, { isDataFound, children: [
2322
+ (props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ jsxs21(
2323
+ "div",
2324
+ {
2325
+ className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200 sticky top-0`,
2326
+ children: [
2327
+ props.title ? /* @__PURE__ */ jsx40("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ jsx40("h2", { className: "text-lg font-semibold text-black-800", children: props.title }) }) : /* @__PURE__ */ jsx40("div", {}),
2328
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-3", children: [
2329
+ props.filters && props.filters.map((filter) => /* @__PURE__ */ jsx40(
2330
+ InputControl_default,
2331
+ {
2332
+ name: filter.name,
2333
+ controlType: InputControlType_default.select,
2334
+ value: formState.inputValues[filter.name],
2335
+ dataSource: filter.servicePath,
2336
+ dataKeyFieldName: filter.dataKeyFieldName,
2337
+ dataTextFieldName: filter.dataTextFieldName,
2338
+ serviceClient: props.serviceClient,
2339
+ callback: handleFilterChange,
2340
+ attributes: { placeholder: filter.placeholder }
2341
+ },
2342
+ filter.name
2343
+ )),
2344
+ props.addLinkHref && /* @__PURE__ */ jsxs21(
2345
+ Hyperlink,
2346
+ {
2347
+ className: "gap-1",
2348
+ linkType: "Primary" /* Solid */,
2349
+ href: props.addLinkHref,
2350
+ children: [
2351
+ /* @__PURE__ */ jsx40(Icon_default, { name: "plus", className: "w-4 h-4" }),
2352
+ /* @__PURE__ */ jsx40("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
2353
+ ]
2354
+ }
2355
+ )
2356
+ ] })
2357
+ ]
2358
+ }
2359
+ ),
2360
+ /* @__PURE__ */ jsx40("div", { className: "flex-1 overflow-y-auto justify-end bg-white rounded shadow h-[calc(100vh-14rem)]", children: /* @__PURE__ */ jsxs21("table", { className: "w-full divide-y divide-gray-200", children: [
2361
+ /* @__PURE__ */ jsx40("thead", { className: "bg-gray-50 sticky top-0", children: /* @__PURE__ */ jsx40("tr", { children: props?.columns?.map((column) => {
2362
+ let url = builder.getNewOrderByUrl(column.name);
2363
+ let icon = "chevronUpDown";
2364
+ if (orderBy.includes(`${column.name} desc`)) {
2365
+ icon = "chevronDown";
2366
+ url = builder.getNewOrderByUrl(column.name);
2367
+ } else if (orderBy.includes(`${column.name}`)) {
2368
+ icon = "chevronUp";
2369
+ url = builder.getNewOrderByUrl(column.name + " desc");
2370
+ }
2371
+ return /* @__PURE__ */ jsx40(
2372
+ "th",
2373
+ {
2374
+ className: "px-6 py-3 text-left font-medium cursor-pointer bg-neutral-soft " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
2375
+ children: /* @__PURE__ */ jsx40(Hyperlink, { href: url, className: "!text-neutral-contrast ", children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center space-x-1", children: [
2376
+ /* @__PURE__ */ jsx40("span", { className: "text-black", children: column.label }),
2377
+ column.enableSorting && /* @__PURE__ */ jsx40(Icon_default, { className: "w-4 h-4", name: icon })
2378
+ ] }) })
2379
+ },
2380
+ column.name
2381
+ );
2382
+ }) }) }),
2383
+ /* @__PURE__ */ jsx40("tbody", { className: "divide-y divide-gray-200 ", children: props.dataset?.result?.map((dataitem, index) => {
2384
+ let validityClass = "";
2385
+ console.log("dataitem", dataitem);
2386
+ if (props.recordValidityColumnName && getNestedProperty2(dataitem, props.recordValidityColumnName) == false) {
2387
+ validityClass = "bg-alert-200";
2388
+ }
2389
+ return /* @__PURE__ */ jsx40("tr", { className: validityClass, children: props?.columns?.map((column, colindex) => {
2390
+ console.log("column", column);
2391
+ return /* @__PURE__ */ jsx40(React34.Fragment, { children: /* @__PURE__ */ jsx40(
2392
+ "td",
2393
+ {
2394
+ className: "px-6 py-2 whitespace-normal " + (column.controlType == ViewControlTypes_default.moneyView ? "" : ""),
2395
+ children: column.addhref === true ? /* @__PURE__ */ jsx40(
2396
+ Hyperlink,
2397
+ {
2398
+ className: "",
2399
+ href: `https://${dataitem[column.name]}`,
2400
+ children: /* @__PURE__ */ jsx40(
2401
+ ViewControl_default,
2402
+ {
2403
+ controlType: column.controlType,
2404
+ value: getNestedProperty2(
2405
+ dataitem,
2406
+ column.name
2407
+ ),
2408
+ format: column.format,
2409
+ customProps: column.customProps
2410
+ }
2411
+ )
2412
+ }
2413
+ ) : column.showAsLink ? /* @__PURE__ */ jsx40(
2414
+ Hyperlink,
2415
+ {
2416
+ href: props.path + dataitem[props.columns[0].name] + "/" + (dataitem.linkUrlSegment ?? column.linkUrlSegment),
2417
+ children: /* @__PURE__ */ jsx40(
2418
+ ViewControl_default,
2419
+ {
2420
+ controlType: column.controlType,
2421
+ value: getNestedProperty2(dataitem, column.name) || column.emptyValueLabel,
2422
+ format: column.format,
2423
+ customProps: column.customProps
2424
+ }
2425
+ )
2426
+ }
2427
+ ) : /* @__PURE__ */ jsx40(
2428
+ ViewControl_default,
2429
+ {
2430
+ controlType: column.controlType,
2431
+ value: getNestedProperty2(dataitem, column.name),
2432
+ format: column.format,
2433
+ customProps: column.customProps
2434
+ }
2435
+ )
2436
+ }
2437
+ ) }, colindex);
2438
+ }) }, index);
2439
+ }) })
2440
+ ] }) }),
2441
+ /* @__PURE__ */ jsx40("div", { className: "pt-4 border-t border-t-gray-50 sticky bottom-0 h-11 mt-2 ", children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
2442
+ /* @__PURE__ */ jsx40("div", { className: "text-gray-700", children: label }),
2443
+ /* @__PURE__ */ jsxs21("div", { className: "flex space-x-2 items-center", children: [
2444
+ activePageNumber > 1 && /* @__PURE__ */ jsx40(
2445
+ Hyperlink,
2446
+ {
2447
+ className: "px-3 py-1 rounded-l-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
2448
+ href: builder.getNewPageUrl(activePageNumber - 1),
2449
+ children: "Prev"
2450
+ }
2451
+ ),
2452
+ activePageNumber <= 1 && /* @__PURE__ */ jsx40("div", { className: "px-3 py-1 rounded-l-md border border-gray-300 bg-gray-200 text-gray-500 hover:bg-gray-200", children: "Prev" }),
2453
+ renderPageNumbers(),
2454
+ activePageNumber < pages && /* @__PURE__ */ jsx40(
2455
+ Hyperlink,
2456
+ {
2457
+ className: "px-3 py-1 rounded-r-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
2458
+ href: builder.getNewPageUrl(activePageNumber + 1),
2459
+ children: "Next"
2460
+ }
2461
+ ),
2462
+ activePageNumber >= pages && /* @__PURE__ */ jsx40("div", { className: "px-3 py-1 rounded-r-md border border-gray-300 bg-gray-200 text-gray-500", children: "Next" })
2463
+ ] })
2464
+ ] }) })
2465
+ ] }),
2466
+ /* @__PURE__ */ jsxs21(NoContentView_default, { isDataFound, children: [
2467
+ (props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ jsxs21(
2468
+ "div",
2469
+ {
2470
+ className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200`,
2471
+ children: [
2472
+ props.title ? /* @__PURE__ */ jsx40("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ jsx40("h2", { className: "text-lg font-semibold text-black", children: props.title }) }) : /* @__PURE__ */ jsx40("div", {}),
2473
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-3", children: [
2474
+ props.filters && props.filters.map((filter) => /* @__PURE__ */ jsx40(
2475
+ InputControl_default,
2476
+ {
2477
+ name: filter.name,
2478
+ controlType: InputControlType_default.select,
2479
+ value: formState.inputValues[filter.name],
2480
+ dataSource: filter.servicePath,
2481
+ dataKeyFieldName: filter.dataKeyFieldName,
2482
+ dataTextFieldName: filter.dataTextFieldName,
2483
+ serviceClient: props.serviceClient,
2484
+ callback: handleFilterChange,
2485
+ attributes: { placeholder: filter.placeholder }
2486
+ },
2487
+ filter.name
2488
+ )),
2489
+ props.addLinkHref && /* @__PURE__ */ jsxs21(
2490
+ Hyperlink,
2491
+ {
2492
+ className: "gap-1",
2493
+ linkType: "Primary" /* Solid */,
2494
+ href: props.addLinkHref,
2495
+ children: [
2496
+ /* @__PURE__ */ jsx40(Icon_default, { name: "plus", className: "w-4 h-4" }),
2497
+ /* @__PURE__ */ jsx40("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
2498
+ ]
2499
+ }
2500
+ )
2501
+ ] })
2502
+ ]
2503
+ }
2504
+ ),
2505
+ /* @__PURE__ */ jsxs21("div", { className: "flex-grow overflow-y-auto justify-end bg-white rounded shadow h-[75vh]", children: [
2506
+ /* @__PURE__ */ jsx40("div", { children: /* @__PURE__ */ jsx40("table", { className: "w-full divide-y divide-gray-200", children: /* @__PURE__ */ jsx40("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsx40("tr", { children: props?.columns?.map((column) => {
2507
+ let url = builder.getNewOrderByUrl(column.name);
2508
+ let icon = "chevronUpDown";
2509
+ if (orderBy.includes(`${column.name} desc`)) {
2510
+ icon = "chevronDown";
2511
+ url = builder.getNewOrderByUrl(column.name);
2512
+ } else if (orderBy.includes(`${column.name}`)) {
2513
+ icon = "chevronUp";
2514
+ url = builder.getNewOrderByUrl(column.name + " desc");
2515
+ }
2516
+ return /* @__PURE__ */ jsx40(
2517
+ "th",
2518
+ {
2519
+ className: "px-6 py-3 text-left font-medium cursor-pointer bg-neutral-soft " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
2520
+ children: /* @__PURE__ */ jsx40(Hyperlink, { href: url, className: "text-body-950", children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center space-x-1", children: [
2521
+ /* @__PURE__ */ jsx40("span", { children: column.label }),
2522
+ column.enableSorting && /* @__PURE__ */ jsx40(Icon_default, { className: "w-4 h-4", name: icon })
2523
+ ] }) })
2524
+ },
2525
+ column.name
2526
+ );
2527
+ }) }) }) }) }),
2528
+ /* @__PURE__ */ jsx40("div", { className: "w-full text-center bg-transparent pt-5", children: "There are no entries in the table at the moment." })
2529
+ ] })
2530
+ ] })
2531
+ ] });
2532
+ };
2533
+ var DataList_default = DataList;
2534
+
2535
+ // src/components/pageRenderingEngine/PageBodyRenderer.tsx
2536
+ import React50 from "react";
2537
+
2538
+ // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
2539
+ import React36 from "react";
2540
+
2541
+ // src/components/pageRenderingEngine/nodes/TextNode.tsx
2542
+ import { jsx as jsx41 } from "react/jsx-runtime";
2543
+ var TextNode = (props) => {
2544
+ function cssStringToJson(cssString) {
2545
+ const styleObject = {};
2546
+ const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
2547
+ if (matches) {
2548
+ matches.forEach((match) => {
2549
+ const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
2550
+ if (parts && parts.length === 3) {
2551
+ const property = parts[1].trim();
2552
+ const value = parts[2].trim();
2553
+ styleObject[property] = value;
2554
+ }
2555
+ });
2556
+ }
2557
+ return styleObject;
2558
+ }
2559
+ function toCamelCase2(str) {
2560
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2561
+ }
2562
+ function convertKeysToCamelCase2(obj) {
2563
+ if (Array.isArray(obj)) {
2564
+ return obj.map(convertKeysToCamelCase2);
2565
+ } else if (obj !== null && typeof obj === "object") {
2566
+ return Object.fromEntries(
2567
+ Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
2568
+ toCamelCase2(key),
2569
+ convertKeysToCamelCase2(value)
2570
+ ])
2571
+ );
2572
+ }
2573
+ return obj;
2574
+ }
2575
+ function getFormatClass(format) {
2576
+ const classes = [];
2577
+ if (format === 1) classes.push("font-medium");
2578
+ if (format === 2) classes.push("italic");
2579
+ if (format === 3) classes.push("font-medium italic");
2580
+ if (format === 8) classes.push("underline");
2581
+ if (format === 9) classes.push("font-medium underline");
2582
+ if (format === 10) classes.push("italic underline");
2583
+ if (format === 11) classes.push("font-medium italic underline");
2584
+ if (format === 256) classes.push("lowercase");
2585
+ if (format === 512) classes.push("uppercase");
2586
+ if (format === 1024) classes.push("capitalize");
2587
+ return classes.join(" ");
2588
+ }
2589
+ const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
2590
+ function replacePlaceholders(template, dataItem) {
2591
+ {
2592
+ }
2593
+ return template.replace(/{(\w+)}/g, (_, key) => {
2594
+ {
2595
+ }
2596
+ return key in dataItem ? dataItem[key] : `{${key}}`;
2597
+ });
2598
+ }
2599
+ const displayText = props.linkText ? props.linkText : props.node.text;
2600
+ return (
2601
+ // @ts-expect-error custom code
2602
+ /* @__PURE__ */ jsx41("span", { style: { ...styles }, className: getFormatClass(props.node.format), children: props.dataitem && props.linkText ? displayText : props.dataitem ? replacePlaceholders(props.node.text, props.dataitem) : props.node.text })
2603
+ );
2604
+ };
2605
+ var TextNode_default = TextNode;
2606
+
2607
+ // src/components/pageRenderingEngine/nodes/LineBreakNode.tsx
2608
+ import { jsx as jsx42 } from "react/jsx-runtime";
2609
+ var LineBreakNode = () => {
2610
+ return /* @__PURE__ */ jsx42("div", { className: "py-0.5 lg:py-1.5" });
2611
+ };
2612
+ var LineBreakNode_default = LineBreakNode;
2613
+
2614
+ // src/components/pageRenderingEngine/nodes/LinkNode.tsx
2615
+ import React35 from "react";
2616
+ import Link2 from "next/link";
2617
+ import { jsx as jsx43, jsxs as jsxs22 } from "react/jsx-runtime";
2618
+ var LinkNode = (props) => {
2619
+ const NodeTypes2 = {
2620
+ ["text"]: TextNode_default
2621
+ };
2622
+ {
2623
+ }
2624
+ let formatClasses = props.node.cssClass || "";
2625
+ return /* @__PURE__ */ jsxs22(Link2, { className: formatClasses, href: props.node.url, title: props.node.title, children: [
2626
+ props.node.children && props.node.children.map((node, index) => {
2627
+ const SelectedNode = NodeTypes2[node.type];
2628
+ return /* @__PURE__ */ jsx43(React35.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx43(SelectedNode, { node }) }, index);
2629
+ }),
2630
+ props.node.children.length == 0 && /* @__PURE__ */ jsx43("br", {})
2631
+ ] });
2632
+ };
2633
+ var LinkNode_default = LinkNode;
2634
+
2635
+ // src/components/pageRenderingEngine/nodes/SVGIconNode.tsx
2636
+ import { jsx as jsx44 } from "react/jsx-runtime";
2637
+ var SVGIconNode = ({ node }) => {
2638
+ if (!node?.svgCode) return null;
2639
+ return /* @__PURE__ */ jsx44(
2640
+ "span",
2641
+ {
2642
+ style: {
2643
+ display: "inline-flex",
2644
+ width: node.width,
2645
+ height: node.height,
2646
+ color: node.color
2647
+ },
2648
+ dangerouslySetInnerHTML: { __html: node.svgCode }
2649
+ }
2650
+ );
2651
+ };
2652
+ var SVGIconNode_default = SVGIconNode;
2653
+
2654
+ // src/components/pageRenderingEngine/nodes/EquationNode.tsx
2655
+ import katex from "katex";
2656
+ import { jsx as jsx45 } from "react/jsx-runtime";
2657
+ var EquationNode = ({ node }) => {
2658
+ const { equation, inline } = node;
2659
+ let html = "";
2660
+ try {
2661
+ html = katex.renderToString(equation, {
2662
+ displayMode: !inline,
2663
+ throwOnError: false
2664
+ });
2665
+ } catch (error) {
2666
+ html = katex.renderToString(`\\text{Invalid equation}`, {
2667
+ throwOnError: false
2668
+ });
2669
+ }
2670
+ if (inline) {
2671
+ return /* @__PURE__ */ jsx45(
2672
+ "span",
2673
+ {
2674
+ className: "katex-inline",
2675
+ dangerouslySetInnerHTML: { __html: html }
2676
+ }
2677
+ );
2678
+ }
2679
+ return /* @__PURE__ */ jsx45(
2680
+ "div",
2681
+ {
2682
+ className: "katex-block my-3 text-center",
2683
+ dangerouslySetInnerHTML: { __html: html }
2684
+ }
2685
+ );
2686
+ };
2687
+ var EquationNode_default = EquationNode;
2688
+
2689
+ // src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
2690
+ import { jsx as jsx46 } from "react/jsx-runtime";
2691
+ function getNestedProperty(obj, path) {
2692
+ if (!obj || !path) return null;
2693
+ if (path.includes(".")) {
2694
+ return path.split(".").reduce((prev, curr) => {
2695
+ if (prev && typeof prev === "object") {
2696
+ return prev[curr];
2697
+ }
2698
+ return null;
2699
+ }, obj);
2700
+ }
2701
+ const value = obj[path];
2702
+ if (Array.isArray(value)) {
2703
+ return value.map((item, index) => /* @__PURE__ */ jsx46("div", { children: String(item) }, index));
2704
+ }
2705
+ return value;
2706
+ }
2707
+ var DatafieldNode = (props) => {
2708
+ function cssStringToJson(cssString) {
2709
+ const styleObject = {};
2710
+ const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
2711
+ if (matches) {
2712
+ matches.forEach((match) => {
2713
+ const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
2714
+ if (parts && parts.length === 3) {
2715
+ styleObject[parts[1].trim()] = parts[2].trim();
2716
+ }
2717
+ });
2718
+ }
2719
+ return styleObject;
2720
+ }
2721
+ function toCamelCase2(str) {
2722
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2723
+ }
2724
+ function convertKeysToCamelCase2(obj) {
2725
+ return Object.fromEntries(
2726
+ Object.entries(obj).map(([key, value2]) => [
2727
+ toCamelCase2(key),
2728
+ value2
2729
+ ])
2730
+ );
2731
+ }
2732
+ const Formats = [
2733
+ "",
2734
+ "font-medium",
2735
+ "italic",
2736
+ "font-medium italic",
2737
+ "",
2738
+ "",
2739
+ "",
2740
+ "",
2741
+ "underline",
2742
+ "font-medium underline",
2743
+ "italic underline",
2744
+ "italic underline font-medium"
2745
+ ];
2746
+ const styles = convertKeysToCamelCase2(
2747
+ cssStringToJson(props.node.style)
2748
+ );
2749
+ const fieldName = props.node.fieldName ?? "";
2750
+ const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
2751
+ const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && value !== null && Object.keys(value).length === 0;
2752
+ const maxLines = props.node.maxLines;
2753
+ if (maxLines && Number(maxLines) > 0) {
2754
+ Object.assign(styles, {
2755
+ display: "-webkit-box",
2756
+ overflow: "hidden",
2757
+ WebkitBoxOrient: "vertical",
2758
+ WebkitLineClamp: String(maxLines)
2759
+ });
2760
+ }
2761
+ const dataType = props.node.dataType;
2762
+ if (isEmptyValue) return null;
2763
+ if (dataType === "rawContent") {
2764
+ return /* @__PURE__ */ jsx46(
2765
+ PageBodyRenderer_default,
2766
+ {
2767
+ rawBody: String(value ?? `@databound[${fieldName}]`),
2768
+ routeParameters: props.routeParameters,
2769
+ query: props.query,
2770
+ session: props.session,
2771
+ host: props.host,
2772
+ path: props.path,
2773
+ apiBaseUrl: props.apiBaseUrl,
2774
+ breadcrumb: props.breadcrumb,
2775
+ donotApplyContainerClass: true
2776
+ }
2777
+ );
2778
+ }
2779
+ return /* @__PURE__ */ jsx46(
2780
+ "span",
2781
+ {
2782
+ className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
2783
+ style: styles,
2784
+ children: /* @__PURE__ */ jsx46(
2785
+ ViewControl_default,
2786
+ {
2787
+ controlType: dataType,
2788
+ value: value ?? `@databound[${fieldName}]`
2789
+ }
2790
+ )
2791
+ }
2792
+ );
2793
+ };
2794
+ var DatafieldNode_default = DatafieldNode;
2795
+
2796
+ // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
2797
+ import { Fragment as Fragment4, jsx as jsx47, jsxs as jsxs23 } from "react/jsx-runtime";
2798
+ var ParagraphNode = (props) => {
2799
+ const NodeTypes2 = {
2800
+ ["text"]: TextNode_default,
2801
+ ["linebreak"]: LineBreakNode_default,
2802
+ ["link"]: LinkNode_default,
2803
+ ["datafield"]: DatafieldNode_default,
2804
+ ["equation"]: EquationNode_default,
2805
+ ["svg-icon"]: SVGIconNode_default
2806
+ };
2807
+ const FormatClass = {
2808
+ "center": "text-center",
2809
+ "right": "text-right"
2810
+ };
2811
+ {
2812
+ }
2813
+ const formatClasses = FormatClass[props.node.format] || "";
2814
+ const isInlineOnlyParent = props.parentTag === "summary";
2815
+ const hasChildren = props.node.children && props.node.children.length > 0;
2816
+ if (isInlineOnlyParent) {
2817
+ return /* @__PURE__ */ jsx47(Fragment4, { children: hasChildren && props.node.children.map((node, index) => {
2818
+ const SelectedNode = NodeTypes2[node.type];
2819
+ return /* @__PURE__ */ jsx47(React36.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx47(
2820
+ SelectedNode,
2821
+ {
2822
+ node,
2823
+ dataitem: props.dataitem,
2824
+ session: props.session,
2825
+ apiBaseUrl: props.apiBaseUrl,
2826
+ routeParameters: props.routeParameters
2827
+ }
2828
+ ) }, index);
2829
+ }) });
2830
+ }
2831
+ return /* @__PURE__ */ jsxs23("div", { className: " " + formatClasses, children: [
2832
+ hasChildren && props.node.children.map((node, index) => {
2833
+ const SelectedNode = NodeTypes2[node.type];
2834
+ return /* @__PURE__ */ jsx47(React36.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx47(
2835
+ SelectedNode,
2836
+ {
2837
+ node,
2838
+ dataitem: props.dataitem,
2839
+ session: props.session,
2840
+ apiBaseUrl: props.apiBaseUrl,
2841
+ routeParameters: props.routeParameters
2842
+ }
2843
+ ) }, index);
2844
+ }),
2845
+ !hasChildren && /* @__PURE__ */ jsx47("div", { className: "py-1.5 lg:py-2" })
2846
+ ] });
2847
+ };
2848
+ var ParagraphNode_default = ParagraphNode;
2849
+
2850
+ // src/components/pageRenderingEngine/nodes/HeadingNode.tsx
2851
+ import React37 from "react";
2852
+ import { Fragment as Fragment5, jsx as jsx48 } from "react/jsx-runtime";
2853
+ var HeadingNode = (props) => {
2854
+ const NodeTypes2 = {
2855
+ ["text"]: TextNode_default,
2856
+ ["link"]: LinkNode_default,
2857
+ ["svg-icon"]: SVGIconNode_default,
2858
+ ["datafield"]: DatafieldNode_default
2859
+ };
2860
+ const HeadingTag = `${props.node.tag}`;
2861
+ const FormatClass = {
2862
+ "center": "text-center"
2863
+ };
2864
+ {
2865
+ }
2866
+ const formatClasses = FormatClass[props.node.format] || "";
2867
+ return /* @__PURE__ */ jsx48(Fragment5, { children: React37.createElement(
2868
+ HeadingTag,
2869
+ { className: formatClasses },
2870
+ props.node.children && props.node.children.map((childNode, index) => {
2871
+ const SelectedNode = NodeTypes2[childNode.type];
2872
+ return /* @__PURE__ */ jsx48(React37.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx48(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
2873
+ })
2874
+ ) });
2875
+ };
2876
+ var HeadingNode_default = HeadingNode;
2877
+
2878
+ // src/components/pageRenderingEngine/nodes/ListNode.tsx
2879
+ import React39 from "react";
2880
+
2881
+ // src/components/pageRenderingEngine/nodes/ListItemNode.tsx
2882
+ import React38 from "react";
2883
+ import { jsx as jsx49 } from "react/jsx-runtime";
2884
+ var ListItemNode = (props) => {
2885
+ const NodeTypes2 = {
2886
+ text: TextNode_default,
2887
+ linebreak: LineBreakNode_default,
2888
+ link: LinkNode_default,
2889
+ list: ListNode_default
2890
+ };
2891
+ let foundFirstBreak = false;
2892
+ const firstTextChild = props.node.children?.find((c) => c.type === "text");
2893
+ let liStyle = {};
2894
+ if (firstTextChild?.style) {
2895
+ const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
2896
+ if (match) {
2897
+ liStyle.fontSize = match[1].trim();
2898
+ }
2899
+ }
2900
+ return /* @__PURE__ */ jsx49("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
2901
+ const SelectedNode = NodeTypes2[node.type];
2902
+ if (node.type === "linebreak") {
2903
+ if (!foundFirstBreak) {
2904
+ foundFirstBreak = true;
2905
+ return /* @__PURE__ */ jsx49("div", {}, index);
2906
+ } else {
2907
+ return /* @__PURE__ */ jsx49("div", { className: "py-1 lg:py-2" }, index);
2908
+ }
2909
+ } else {
2910
+ foundFirstBreak = false;
2911
+ return /* @__PURE__ */ jsx49(React38.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx49(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
2912
+ }
2913
+ }) });
2914
+ };
2915
+ var ListItemNode_default = ListItemNode;
2916
+
2917
+ // src/components/pageRenderingEngine/nodes/ListNode.tsx
2918
+ import { jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
2919
+ var ListNode = (props) => {
2920
+ const NodeTypes2 = {
2921
+ listitem: ListItemNode_default
2922
+ };
2923
+ return /* @__PURE__ */ jsxs24(React39.Fragment, { children: [
2924
+ props.node.listType == "bullet" && /* @__PURE__ */ jsx50("ul", { children: props.node.children && props.node.children.map((node, index) => {
2925
+ const SelectedNode = NodeTypes2[node.type];
2926
+ return /* @__PURE__ */ jsx50(React39.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx50(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
2927
+ }) }),
2928
+ props.node.listType == "number" && /* @__PURE__ */ jsx50("ol", { children: props.node.children && props.node.children.map((node, index) => {
2929
+ const SelectedNode = NodeTypes2[node.type];
2930
+ return /* @__PURE__ */ jsx50(React39.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx50(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
2931
+ }) })
2932
+ ] });
2933
+ };
2934
+ var ListNode_default = ListNode;
2935
+
2936
+ // src/components/pageRenderingEngine/nodes/QuoteNode.tsx
2937
+ import React40 from "react";
2938
+ import { jsx as jsx51 } from "react/jsx-runtime";
2939
+ var QuoteNode = (props) => {
2940
+ const NodeTypes2 = {
2941
+ ["text"]: TextNode_default,
2942
+ ["linebreak"]: LineBreakNode_default,
2943
+ ["link"]: LinkNode_default
2944
+ };
2945
+ return /* @__PURE__ */ jsx51("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
2946
+ const SelectedNode = NodeTypes2[node.type];
2947
+ return /* @__PURE__ */ jsx51(React40.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx51(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
2948
+ }) });
2949
+ };
2950
+ var QuoteNode_default = QuoteNode;
2951
+
2952
+ // src/components/pageRenderingEngine/nodes/CodeNode.tsx
2953
+ import React41 from "react";
2954
+
2955
+ // src/components/CopyButton.tsx
2956
+ import { useState as useState8, useRef as useRef3, useEffect as useEffect7 } from "react";
2957
+ import { jsx as jsx52, jsxs as jsxs25 } from "react/jsx-runtime";
2958
+ function CopyButton({ text }) {
2959
+ const [copied, setCopied] = useState8(false);
2960
+ const timeoutRef = useRef3(null);
2961
+ useEffect7(() => {
2962
+ return () => {
2963
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
2964
+ };
2965
+ }, []);
2966
+ const handleCopy = async () => {
2967
+ try {
2968
+ await navigator.clipboard.writeText(text);
2969
+ setCopied(true);
2970
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
2971
+ timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
2972
+ } catch (err) {
2973
+ console.error("Failed to copy: ", err);
2974
+ }
2975
+ };
2976
+ return /* @__PURE__ */ jsxs25(
2977
+ "button",
2978
+ {
2979
+ onClick: handleCopy,
2980
+ className: "flex gap-1 items-center hover:text-white transition",
2981
+ children: [
2982
+ /* @__PURE__ */ jsx52(
2983
+ "svg",
2984
+ {
2985
+ width: "16",
2986
+ height: "16",
2987
+ viewBox: "0 0 24 24",
2988
+ className: "w-4 h-4",
2989
+ fill: "currentColor",
2990
+ children: /* @__PURE__ */ jsx52(
2991
+ "path",
2992
+ {
2993
+ fillRule: "evenodd",
2994
+ clipRule: "evenodd",
2995
+ d: "M12 4C10.8954 4 10 4.89543 10 6H14C14 4.89543 13.1046 4 12 4ZM8.53513 4C9.22675 2.8044 10.5194 2 12 2C13.4806 2 14.7733 2.8044 15.4649 4H17C18.6569 4 20 5.34315 20 7V19C20 20.6569 18.6569 22 17 22H7C5.34315 22 4 20.6569 4 19V7C4 5.34315 5.34315 4 7 4H8.53513ZM8 6H7C6.44772 6 6 6.44772 6 7V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V7C18 6.44772 17.5523 6 17 6H16C16 7.10457 15.1046 8 14 8H10C8.89543 8 8 7.10457 8 6Z"
2996
+ }
2997
+ )
2998
+ }
2999
+ ),
3000
+ copied ? "Copied!" : "Copy code"
3001
+ ]
3002
+ }
3003
+ );
3004
+ }
3005
+
3006
+ // src/components/pageRenderingEngine/nodes/CodeNode.tsx
3007
+ import { jsx as jsx53, jsxs as jsxs26 } from "react/jsx-runtime";
3008
+ var CodeNode = (props) => {
3009
+ const NodeTypes2 = {
3010
+ // @ts-expect-error custom code
3011
+ ["text"]: TextNode_default,
3012
+ ["linebreak"]: LineBreakNode_default,
3013
+ // @ts-expect-error custom code
3014
+ ["link"]: LinkNode_default
3015
+ };
3016
+ const textContent = props.node?.children?.map((node) => {
3017
+ if (node.type === "text") return node.text || "";
3018
+ if (node.type === "linebreak") return "\n";
3019
+ if (node.type === "link") return node.text || node.url || "";
3020
+ return "";
3021
+ }).join("") ?? "";
3022
+ return /* @__PURE__ */ jsxs26("div", { className: "code-block", children: [
3023
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center relative text-gray-200 bg-gray-800 px-4 py-2.5 text-xs font-sans justify-between rounded-t-md", children: [
3024
+ /* @__PURE__ */ jsx53("span", { children: "Code Snippet" }),
3025
+ /* @__PURE__ */ jsx53(CopyButton, { text: textContent })
3026
+ ] }),
3027
+ /* @__PURE__ */ jsx53("code", { className: "block bg-gray-900 text-gray-100 p-4 rounded-b-md text-sm whitespace-pre-wrap", children: props.node.children && props.node.children.map((node, index) => {
3028
+ const SelectedNode = NodeTypes2[node.type];
3029
+ return /* @__PURE__ */ jsx53(React41.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx53(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
3030
+ }) })
3031
+ ] });
3032
+ };
3033
+ var CodeNode_default = CodeNode;
3034
+
3035
+ // src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
3036
+ import { jsx as jsx54 } from "react/jsx-runtime";
3037
+ var HorizontalRuleNode = () => {
3038
+ return /* @__PURE__ */ jsx54("hr", {});
3039
+ };
3040
+ var HorizontalRuleNode_default = HorizontalRuleNode;
3041
+
3042
+ // src/components/pageRenderingEngine/nodes/ImageNode.tsx
3043
+ import { Fragment as Fragment6, jsx as jsx55 } from "react/jsx-runtime";
3044
+ var ImageNode = (props) => {
3045
+ const { node, assetBaseUrl = "" } = props;
3046
+ if (!node.imageUrl) return null;
3047
+ let imageUrl;
3048
+ if (node.imageUrl.startsWith("http")) {
3049
+ imageUrl = node.imageUrl;
3050
+ } else {
3051
+ imageUrl = assetBaseUrl ? `${assetBaseUrl}/${node.imageUrl}` : node.imageUrl;
3052
+ }
3053
+ return /* @__PURE__ */ jsx55(Fragment6, { children: node.width ? /* @__PURE__ */ jsx55("div", { style: { width: node.width }, children: /* @__PURE__ */ jsx55(
3054
+ "img",
3055
+ {
3056
+ loading: "lazy",
3057
+ className: "object-cover",
3058
+ src: imageUrl,
3059
+ width: node.intrinsicWidth,
3060
+ height: node.intrinsicHeight,
3061
+ alt: node.title
3062
+ }
3063
+ ) }) : /* @__PURE__ */ jsx55(
3064
+ "img",
3065
+ {
3066
+ loading: "lazy",
3067
+ className: "object-cover",
3068
+ src: imageUrl,
3069
+ width: node.intrinsicWidth,
3070
+ height: node.intrinsicHeight,
3071
+ alt: node.title
3072
+ }
3073
+ ) });
3074
+ };
3075
+ var ImageNode_default = ImageNode;
3076
+
3077
+ // src/components/pageRenderingEngine/nodes/WidgetNode.tsx
3078
+ import React42, { Suspense } from "react";
3079
+ import { Fragment as Fragment7, jsx as jsx56, jsxs as jsxs27 } from "react/jsx-runtime";
3080
+ function resolveWidget(code) {
3081
+ return getWidget(code);
3082
+ }
3083
+ var WidgetNode = (props) => {
3084
+ const getWidgetParameters = () => {
3085
+ const widgetInputParameters = {
3086
+ ...props.routeParameters ?? {}
3087
+ };
3088
+ const rawWidgetParams = props.node.widgetParameters ?? props.node.widgetParams;
3089
+ let widgetParameters = {};
3090
+ const isJSON = (str) => {
3091
+ const s = str.trim();
3092
+ return s.startsWith("{") && s.endsWith("}") || s.startsWith("[") && s.endsWith("]");
3093
+ };
3094
+ if (rawWidgetParams) {
3095
+ if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
3096
+ try {
3097
+ widgetParameters = JSON.parse(rawWidgetParams);
3098
+ } catch {
3099
+ widgetParameters = {};
3100
+ }
3101
+ } else if (typeof rawWidgetParams === "object") {
3102
+ widgetParameters = rawWidgetParams;
3103
+ }
3104
+ }
3105
+ const resolveValue = (val) => {
3106
+ if (typeof val === "string") {
3107
+ const m = /^\{(.+)\}$/.exec(val);
3108
+ if (m) {
3109
+ const actualKey = m[1];
3110
+ return props.routeParameters?.[actualKey] ?? val;
3111
+ }
3112
+ return val;
3113
+ }
3114
+ if (Array.isArray(val)) {
3115
+ return val.map(resolveValue);
3116
+ }
3117
+ if (val && typeof val === "object") {
3118
+ const out = {};
3119
+ for (const k of Object.keys(val)) {
3120
+ out[k] = resolveValue(val[k]);
3121
+ }
3122
+ return out;
3123
+ }
3124
+ return val;
3125
+ };
3126
+ for (const key of Object.keys(widgetParameters)) {
3127
+ const rawVal = widgetParameters[key];
3128
+ if (rawVal === "route") {
3129
+ widgetInputParameters[key] = key === "itemPath" ? props.path : widgetInputParameters[key] ?? null;
3130
+ } else {
3131
+ widgetInputParameters[key] = resolveValue(rawVal);
3132
+ }
3133
+ }
3134
+ widgetInputParameters["widgetTitle"] = props.node.widgetTitle;
3135
+ return widgetInputParameters;
3136
+ };
3137
+ const widgetCode = props.node.widgetCode;
3138
+ const SelectedWidget = resolveWidget(widgetCode);
3139
+ if (!SelectedWidget) {
3140
+ console.warn("Widget not found:", widgetCode);
3141
+ return /* @__PURE__ */ jsxs27(Fragment7, { children: [
3142
+ "Widget not found: ",
3143
+ widgetCode
3144
+ ] });
3145
+ }
3146
+ return /* @__PURE__ */ jsx56(Suspense, { fallback: /* @__PURE__ */ jsx56("div", { className: "container mt-2", children: "..." }), children: React42.createElement(SelectedWidget, {
3147
+ params: getWidgetParameters(),
3148
+ query: props.query,
3149
+ session: props.session,
3150
+ host: props.host,
3151
+ path: props.path,
3152
+ apiBaseUrl: props.apiBaseUrl
3153
+ }) });
3154
+ };
3155
+ var WidgetNode_default = WidgetNode;
3156
+
3157
+ // src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
3158
+ import React43, { useRef as useRef4, useReducer as useReducer2, useCallback as useCallback3, useEffect as useEffect8 } from "react";
3159
+
3160
+ // src/components/pageRenderingEngine/nodes/InputControlNode.tsx
3161
+ import { jsx as jsx57 } from "react/jsx-runtime";
3162
+ var InputControlNode = (props) => {
3163
+ return /* @__PURE__ */ jsx57("div", { children: /* @__PURE__ */ jsx57(
3164
+ InputControl_default,
3165
+ {
3166
+ name: props.node.name,
3167
+ controlType: "lineTextInput",
3168
+ value: props.value,
3169
+ callback: props.callback,
3170
+ attributes: {
3171
+ pattern: props.node.pattern,
3172
+ maxLength: props.node.maxLength,
3173
+ minLength: props.node.minLength,
3174
+ //maxValue:props.node.maxV,
3175
+ //minValue?: number,
3176
+ readOnly: props.node.readOnly,
3177
+ label: "name",
3178
+ //props.node.label,
3179
+ hintText: props.node.hintText,
3180
+ placeholder: props.node.placeholder,
3181
+ required: props.node.required,
3182
+ errorMessage: props.node.errorMessage,
3183
+ helpText: props.node.helpText,
3184
+ autoFocus: props.node.autoFocus
3185
+ }
3186
+ }
3187
+ ) });
3188
+ };
3189
+ var InputControlNode_default = InputControlNode;
3190
+
3191
+ // src/clients/CacheManage.tsx
3192
+ import NodeCache from "node-cache";
3193
+ var CacheManager = class _CacheManager {
3194
+ constructor() {
3195
+ this.maxCacheSize = 1e3;
3196
+ this.cache = new NodeCache({ stdTTL: 0, checkperiod: 300 });
3197
+ }
3198
+ static getInstance() {
3199
+ if (!_CacheManager.instance) {
3200
+ _CacheManager.instance = new _CacheManager();
3201
+ }
3202
+ return _CacheManager.instance;
3203
+ }
3204
+ get(key) {
3205
+ return null;
3206
+ }
3207
+ set(key, data, ttl) {
3208
+ }
3209
+ clear() {
3210
+ this.cache.flushAll();
3211
+ }
3212
+ size() {
3213
+ return this.cache.keys().length;
3214
+ }
3215
+ destroy() {
3216
+ this.cache.close();
3217
+ }
3218
+ };
3219
+
3220
+ // src/clients/ServiceClient.tsx
3221
+ var ServerApiError = class extends Error {
3222
+ constructor(data, status) {
3223
+ super(data.message || "---");
3224
+ this.status = status;
3225
+ this.data = data;
3226
+ this.data.isSuccessful = false;
3227
+ }
3228
+ };
3229
+ var ServiceClient = class {
3230
+ constructor(apiBaseUrl, session) {
3231
+ this.cacheManager = CacheManager.getInstance();
3232
+ this.baseUrl = apiBaseUrl;
3233
+ this.session = session;
3234
+ }
3235
+ buildFullPath(path, params) {
3236
+ let updatedPath = path;
3237
+ if (params) {
3238
+ Object.keys(params).forEach((key) => {
3239
+ updatedPath = updatedPath.replace(
3240
+ `{${key}}`,
3241
+ String(params[key])
3242
+ );
3243
+ });
3244
+ }
3245
+ return this.baseUrl + updatedPath;
3246
+ }
3247
+ getConfig() {
3248
+ const config = { headers: {} };
3249
+ if (this.session) {
3250
+ if (this.session.oAuthToken) {
3251
+ config.headers["Authorization"] = "Bearer " + this.session.oAuthToken;
3252
+ }
3253
+ config.headers["cid"] = this.session.cid || "";
3254
+ config.headers["UserCurrencyCode"] = this.session.userCurrencyCode || "INR";
3255
+ config.headers["MarketCode"] = this.session?.marketCode || "IND";
3256
+ }
3257
+ return config;
3258
+ }
3259
+ handleFetchError(error) {
3260
+ console.log(error);
3261
+ const serverApiError = error;
3262
+ if (serverApiError) {
3263
+ return serverApiError.data;
3264
+ }
3265
+ return {
3266
+ message: "There is some error. Please try after sometime.",
3267
+ isSuccessful: false
3268
+ };
3269
+ }
3270
+ async fetchJsonWithCache(fullPath, config) {
3271
+ const cacheKey = fullPath + "--" + (this.session?.marketCode || "IND");
3272
+ const cachedData = this.cacheManager.get(cacheKey);
3273
+ if (cachedData) {
3274
+ return cachedData;
3275
+ }
3276
+ console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
3277
+ const response = await fetch(fullPath, { headers: config.headers });
3278
+ if (!response.ok) {
3279
+ const apiErrorData = await response.json();
3280
+ throw new ServerApiError(apiErrorData, response.status);
3281
+ }
3282
+ const cacheControl = response.headers.get("Cache-Control");
3283
+ let revalidate = null;
3284
+ if (cacheControl) {
3285
+ const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
3286
+ if (maxAgeMatch && maxAgeMatch[1]) {
3287
+ const maxAge = parseInt(maxAgeMatch[1], 10);
3288
+ revalidate = maxAge * 1e3;
3289
+ }
3290
+ }
3291
+ const data = await response.json();
3292
+ data.isSuccessful = true;
3293
+ if (revalidate !== null && revalidate > 0) {
3294
+ console.log("revalidate............I am caching:" + revalidate);
3295
+ this.cacheManager.set(cacheKey, data, revalidate);
3296
+ }
3297
+ return data;
3298
+ }
3299
+ // private async refreshToken(): Promise<void> {
3300
+ // console.log("*******************calling refresh token***********************");
3301
+ // try {
3302
+ // const response = await fetch(this.baseUrl + "/auth/storefront/login/refreshToken", {
3303
+ // method: 'POST',
3304
+ // headers: {
3305
+ // 'Content-Type': 'application/json'
3306
+ // },
3307
+ // body: JSON.stringify({ refreshToken: this.session.refreshToken })
3308
+ // });
3309
+ // if (!response.ok) {
3310
+ // throw new Error("Failed to refresh token");
3311
+ // }
3312
+ // const responseData = await response.json();
3313
+ // this.session.oAuthToken = responseData.result.accessToken;
3314
+ // if (typeof window === "undefined") {
3315
+ // // Running on the server
3316
+ // } else {
3317
+ // await fetch("/api/login", {
3318
+ // method: "post",
3319
+ // headers: {
3320
+ // "Content-Type": "application/json",
3321
+ // },
3322
+ // body: JSON.stringify({ session: this.session }),
3323
+ // });
3324
+ // }
3325
+ // } catch (error: any) {
3326
+ // throw new Error("Failed to refresh token");
3327
+ // }
3328
+ // }
3329
+ async handleRequest(request) {
3330
+ try {
3331
+ return await request();
3332
+ } catch (error) {
3333
+ throw error;
3334
+ }
3335
+ }
3336
+ async post(path, data) {
3337
+ const request = async () => {
3338
+ const fullPath = this.baseUrl + path;
3339
+ const config = this.getConfig();
3340
+ const response = await fetch(fullPath, {
3341
+ method: "POST",
3342
+ headers: {
3343
+ ...config.headers,
3344
+ "Content-Type": "application/json"
3345
+ },
3346
+ body: JSON.stringify(data)
3347
+ });
3348
+ if (!response.ok) {
3349
+ const apiErrorData = await response.json();
3350
+ throw new ServerApiError(apiErrorData, response.status);
3351
+ }
3352
+ const responseData = await response.json();
3353
+ responseData.isSuccessful = true;
3354
+ return responseData;
3355
+ };
3356
+ try {
3357
+ return await this.handleRequest(request);
3358
+ } catch (error) {
3359
+ return this.handleFetchError(error);
3360
+ }
3361
+ }
3362
+ async getSingle(path, params) {
3363
+ const request = async () => {
3364
+ const sanitizedParams = params ? Object.fromEntries(
3365
+ Object.entries(params).map(([k, v]) => [k, String(v)])
3366
+ ) : void 0;
3367
+ const fullPath = this.buildFullPath(path, sanitizedParams);
3368
+ const config = this.getConfig();
3369
+ return await this.fetchJsonWithCache(fullPath, config);
3370
+ };
3371
+ try {
3372
+ return await this.handleRequest(request);
3373
+ } catch (error) {
3374
+ return this.handleFetchError(error);
3375
+ }
3376
+ }
3377
+ async get(path, params) {
3378
+ const request = async () => {
3379
+ const sanitizedParams = params ? Object.fromEntries(
3380
+ Object.entries(params).map(([k, v]) => [k, String(v)])
3381
+ ) : void 0;
3382
+ const fullPath = this.buildFullPath(path, sanitizedParams);
3383
+ const config = this.getConfig();
3384
+ console.log(fullPath);
3385
+ return await this.fetchJsonWithCache(fullPath, config);
3386
+ };
3387
+ try {
3388
+ return await this.handleRequest(request);
3389
+ } catch (error) {
3390
+ return this.handleFetchError(error);
3391
+ }
3392
+ }
3393
+ };
3394
+ var ServiceClient_default = ServiceClient;
3395
+
3396
+ // src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
3397
+ import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
3398
+ var FormContainerNode = (props) => {
3399
+ const NodeTypes2 = {
3400
+ ["input-control"]: InputControlNode_default
3401
+ };
3402
+ const { node } = props;
3403
+ const formRef = useRef4(null);
3404
+ const initialState = {
3405
+ inputValues: {},
3406
+ lastPropertyChanged: ""
3407
+ };
3408
+ const [formState, dispatch] = useReducer2(FormReducer_default, initialState);
3409
+ const handleInputChange = useCallback3((updatedValues) => {
3410
+ dispatch({ type: FORM_INPUT_UPDATE, name: updatedValues.name, value: updatedValues.value });
3411
+ }, [dispatch]);
3412
+ useEffect8(() => {
3413
+ const fetchInitialData = async () => {
3414
+ const client = new ServiceClient_default(props.apiBaseUrl, props.session);
3415
+ const response = await client.getSingle(props.node.dataFetchApi, props.routeParameters);
3416
+ if (response.isSuccessful) {
3417
+ dispatch({
3418
+ type: FORM_INITIAL_UPDATE,
3419
+ values: response.result,
3420
+ // @ts-expect-error custom code
3421
+ name: "all"
3422
+ });
3423
+ }
3424
+ };
3425
+ fetchInitialData();
3426
+ }, [props.apiBaseUrl, props.node, props.session, props.routeParameters]);
3427
+ return /* @__PURE__ */ jsxs28("form", { className: "group space-y-6 pb-6 overflow-y-auto", noValidate: true, ref: formRef, children: [
3428
+ node.children && node.children.map((node2, index) => {
3429
+ {
3430
+ }
3431
+ const SelectedNode = NodeTypes2[node2.type];
3432
+ return /* @__PURE__ */ jsx58(React43.Fragment, { children: SelectedNode && node2.type == "input-control" && /* @__PURE__ */ jsx58(
3433
+ InputControlNode_default,
3434
+ {
3435
+ value: formState.inputValues[node2.name],
3436
+ callback: handleInputChange,
3437
+ node: node2
3438
+ }
3439
+ ) }, index);
3440
+ }),
3441
+ node.children.length == 0 && /* @__PURE__ */ jsx58("div", { className: "py-0.5 lg:py-1.5" })
3442
+ ] });
3443
+ };
3444
+ var FormContainerNode_default = FormContainerNode;
3445
+
3446
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
3447
+ import React49 from "react";
3448
+
3449
+ // src/components/pageRenderingEngine/nodes/IframeClient.tsx
3450
+ import React45, { useEffect as useEffect9, useRef as useRef5, useState as useState9 } from "react";
3451
+
3452
+ // src/components/IFrameLoaderView.tsx
3453
+ import React44 from "react";
3454
+ import { jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
3455
+ var IFrameLoaderView = (props) => {
3456
+ return /* @__PURE__ */ jsxs29(React44.Fragment, { children: [
3457
+ props.isDataFound == null && /* @__PURE__ */ jsx59("div", { className: "", children: /* @__PURE__ */ jsxs29("div", { className: "mt-4 bg-gray-200 rounded-md p-4 animate-pulse", children: [
3458
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center mb-4", children: [
3459
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
3460
+ /* @__PURE__ */ jsxs29("div", { className: "ml-2", children: [
3461
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
3462
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
3463
+ ] })
3464
+ ] }),
3465
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
3466
+ /* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
3467
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
3468
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
3469
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
3470
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
3471
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
3472
+ ] }),
3473
+ /* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
3474
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
3475
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
3476
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
3477
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
3478
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
3479
+ ] }),
3480
+ /* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
3481
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
3482
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
3483
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
3484
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
3485
+ /* @__PURE__ */ jsx59("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
3486
+ ] })
3487
+ ] })
3488
+ ] }) }),
3489
+ props.children
3490
+ ] });
3491
+ };
3492
+ var IFrameLoaderView_default = IFrameLoaderView;
3493
+
3494
+ // src/components/pageRenderingEngine/nodes/IframeClient.tsx
3495
+ import { jsx as jsx60 } from "react/jsx-runtime";
3496
+ var IframeClient = ({ src }) => {
3497
+ const iframeRef = useRef5(null);
3498
+ const [iframeHeight, setIframeHeight] = useState9("100%");
3499
+ const [isDataFound, setIsDataFound] = useState9(null);
3500
+ useEffect9(() => {
3501
+ const handleReceiveMessage = (event) => {
3502
+ const eventName = event?.data?.eventName;
3503
+ const payload = event?.data?.payload;
3504
+ if (eventName === "SET_HEIGHT" && payload?.height) {
3505
+ let height = 500;
3506
+ if (payload.height > 500) {
3507
+ height = payload.height + 50;
3508
+ }
3509
+ setIframeHeight(`${height}px`);
3510
+ }
3511
+ };
3512
+ window.addEventListener("message", handleReceiveMessage);
3513
+ return () => window.removeEventListener("message", handleReceiveMessage);
3514
+ }, []);
3515
+ useEffect9(() => {
3516
+ const handleResize = () => {
3517
+ if (iframeRef.current) {
3518
+ iframeRef.current.contentWindow?.postMessage({ eventName: "RESIZE" }, "*");
3519
+ }
3520
+ };
3521
+ window.addEventListener("resize", handleResize);
3522
+ return () => window.removeEventListener("resize", handleResize);
3523
+ }, []);
3524
+ const handleIframeLoad = () => {
3525
+ setIsDataFound(true);
3526
+ };
3527
+ return /* @__PURE__ */ jsx60(React45.Fragment, { children: /* @__PURE__ */ jsx60(IFrameLoaderView_default, { isDataFound, children: /* @__PURE__ */ jsx60(
3528
+ "iframe",
3529
+ {
3530
+ ref: iframeRef,
3531
+ src,
3532
+ className: "w-full h-full border-none",
3533
+ scrolling: "no",
3534
+ style: { height: iframeHeight },
3535
+ onLoad: handleIframeLoad
3536
+ }
3537
+ ) }) });
3538
+ };
3539
+ var IframeClient_default = IframeClient;
3540
+
3541
+ // src/components/pageRenderingEngine/nodes/EmbedNode.tsx
3542
+ import { jsx as jsx61 } from "react/jsx-runtime";
3543
+ var EmbedNode = (props) => {
3544
+ let src;
3545
+ if (props.node.provider == "youtube") {
3546
+ src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
3547
+ } else if (props.node.provider == "bunny") {
3548
+ src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
3549
+ } else {
3550
+ src = props.node.embedSrc;
3551
+ }
3552
+ return /* @__PURE__ */ jsx61("div", { className: "aspect-video", children: src && /* @__PURE__ */ jsx61(IframeClient_default, { src }) });
3553
+ };
3554
+ var EmbedNode_default = EmbedNode;
3555
+
3556
+ // src/components/utilities/AssetUtility.tsx
3557
+ var AssetUtility = class {
3558
+ constructor() {
3559
+ }
3560
+ static resolveUrl(apiBaseUrl, url) {
3561
+ if (!url) return void 0;
3562
+ if (url.startsWith("http")) return url;
3563
+ if (!apiBaseUrl) return url;
3564
+ return `${apiBaseUrl}/digitalassets-management/${url}`;
3565
+ }
3566
+ };
3567
+ var AssetUtility_default = AssetUtility;
3568
+
3569
+ // src/components/Slider.tsx
3570
+ import React46, { useState as useState10, useEffect as useEffect10, Children, cloneElement } from "react";
3571
+ import { Fragment as Fragment8, jsx as jsx62, jsxs as jsxs30 } from "react/jsx-runtime";
3572
+ var Slider = ({
3573
+ children,
3574
+ slidesToShow = 4,
3575
+ infinite_scroll = false,
3576
+ autoplay = false,
3577
+ autoplay_speed = 3e3,
3578
+ show_arrows = false,
3579
+ show_dots = false,
3580
+ scaleOnHover = false,
3581
+ className = "",
3582
+ arrowClassName = "bg-black/50 hover:bg-black/80 text-white rounded-full w-10 h-10 flex items-center justify-center",
3583
+ dotActiveClassName = "bg-gray-300",
3584
+ dotInactiveClassName = "bg-gray-600",
3585
+ gap,
3586
+ pillStyle = "cumulative",
3587
+ progressPosition = "bottom"
3588
+ }) => {
3589
+ const [currentSlide, setCurrentSlide] = useState10(0);
3590
+ const [transition, setTransition] = useState10(true);
3591
+ const [slidesToShowState, setSlidesToShowState] = useState10(
3592
+ typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
3593
+ );
3594
+ const [isPlaying, setIsPlaying] = useState10(autoplay);
3595
+ useEffect10(() => {
3596
+ if (typeof slidesToShow === "number") return;
3597
+ const handleResize = () => {
3598
+ if (window.innerWidth >= 1024) {
3599
+ setSlidesToShowState(slidesToShow.large);
3600
+ } else if (window.innerWidth >= 768) {
3601
+ setSlidesToShowState(slidesToShow.medium);
3602
+ } else {
3603
+ setSlidesToShowState(slidesToShow.small);
3604
+ }
3605
+ };
3606
+ handleResize();
3607
+ window.addEventListener("resize", handleResize);
3608
+ return () => window.removeEventListener("resize", handleResize);
3609
+ }, [slidesToShow]);
3610
+ useEffect10(() => {
3611
+ if (!autoplay) return;
3612
+ const timer = setInterval(() => {
3613
+ if (isPlaying) {
3614
+ nextSlide();
3615
+ }
3616
+ }, autoplay_speed);
3617
+ return () => clearInterval(timer);
3618
+ }, [autoplay, autoplay_speed, currentSlide, isPlaying]);
3619
+ const totalSlides = Children.count(children);
3620
+ const maxSlide = totalSlides - slidesToShowState;
3621
+ const nextSlide = () => {
3622
+ if (currentSlide >= maxSlide) {
3623
+ if (infinite_scroll) {
3624
+ setTransition(true);
3625
+ setCurrentSlide(0);
3626
+ }
3627
+ } else {
3628
+ setTransition(true);
3629
+ setCurrentSlide(currentSlide + 1);
3630
+ }
3631
+ };
3632
+ const prevSlide = () => {
3633
+ if (currentSlide <= 0) {
3634
+ if (infinite_scroll) {
3635
+ setTransition(true);
3636
+ setCurrentSlide(maxSlide);
3637
+ }
3638
+ } else {
3639
+ setTransition(true);
3640
+ setCurrentSlide(currentSlide - 1);
3641
+ }
3642
+ };
3643
+ const goToSlide = (index) => {
3644
+ setTransition(true);
3645
+ setCurrentSlide(index);
3646
+ };
3647
+ const handlePillClick = (index) => {
3648
+ goToSlide(index);
3649
+ if (autoplay) {
3650
+ setIsPlaying(true);
3651
+ }
3652
+ };
3653
+ const handleMouseEnter = () => {
3654
+ if (autoplay) {
3655
+ setIsPlaying(false);
3656
+ }
3657
+ };
3658
+ const handleMouseLeave = () => {
3659
+ if (autoplay) {
3660
+ setIsPlaying(true);
3661
+ }
3662
+ };
3663
+ const translateX = -currentSlide * (100 / slidesToShowState);
3664
+ const slides = Children.map(children, (child, index) => {
3665
+ if (!React46.isValidElement(child)) return null;
3666
+ const childProps = child.props;
3667
+ const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
3668
+ return /* @__PURE__ */ jsx62(
3669
+ "div",
3670
+ {
3671
+ className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
3672
+ style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
3673
+ children: cloneElement(child, {
3674
+ className: mergedClassName
3675
+ })
3676
+ },
3677
+ index
3678
+ );
3679
+ });
3680
+ const getProgressPositionClass = () => {
3681
+ switch (progressPosition) {
3682
+ case "top":
3683
+ return "top-4";
3684
+ case "bottom-outside":
3685
+ return "bottom-4 translate-y-full mt-4";
3686
+ case "bottom":
3687
+ default:
3688
+ return "bottom-4";
3689
+ }
3690
+ };
3691
+ return /* @__PURE__ */ jsxs30(
3692
+ "div",
3693
+ {
3694
+ className: `relative w-full overflow-hidden ${className}`,
3695
+ onMouseEnter: handleMouseEnter,
3696
+ onMouseLeave: handleMouseLeave,
3697
+ children: [
3698
+ /* @__PURE__ */ jsx62(
3699
+ "div",
3700
+ {
3701
+ className: "flex h-full",
3702
+ style: {
3703
+ transition: transition ? "transform 0.5s ease" : "none",
3704
+ transform: `translateX(${translateX}%)`
3705
+ },
3706
+ children: slides
3707
+ }
3708
+ ),
3709
+ show_arrows && /* @__PURE__ */ jsxs30(Fragment8, { children: [
3710
+ /* @__PURE__ */ jsx62(
3711
+ ArrowButton,
3712
+ {
3713
+ direction: "left",
3714
+ onClick: prevSlide,
3715
+ visible: infinite_scroll || currentSlide > 0,
3716
+ className: arrowClassName,
3717
+ children: /* @__PURE__ */ jsx62("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx62("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
3718
+ }
3719
+ ),
3720
+ /* @__PURE__ */ jsxs30(
3721
+ ArrowButton,
3722
+ {
3723
+ direction: "right",
3724
+ onClick: nextSlide,
3725
+ visible: infinite_scroll || currentSlide < maxSlide,
3726
+ className: arrowClassName,
3727
+ children: [
3728
+ /* @__PURE__ */ jsx62("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx62("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
3729
+ " "
3730
+ ]
3731
+ }
3732
+ )
3733
+ ] }),
3734
+ show_dots && /* @__PURE__ */ jsx62("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ jsx62(
3735
+ ProgressPill,
3736
+ {
3737
+ active: index === currentSlide,
3738
+ duration: autoplay_speed,
3739
+ index,
3740
+ onClick: () => handlePillClick(index),
3741
+ isPlaying: isPlaying && index === currentSlide && autoplay,
3742
+ style: pillStyle,
3743
+ activeClassName: dotActiveClassName,
3744
+ inactiveClassName: dotInactiveClassName,
3745
+ currentSlide,
3746
+ totalSlides
3747
+ },
3748
+ index
3749
+ )) })
3750
+ ]
3751
+ }
3752
+ );
3753
+ };
3754
+ var ArrowButton = ({
3755
+ direction,
3756
+ onClick,
3757
+ visible,
3758
+ children,
3759
+ className = ""
3760
+ }) => /* @__PURE__ */ jsx62(
3761
+ "button",
3762
+ {
3763
+ className: `
3764
+ absolute top-1/2 -translate-y-1/2 z-10
3765
+ ${direction === "left" ? "left-2.5" : "right-2.5"}
3766
+ ${!visible && "hidden"}
3767
+ ${className}
3768
+ `,
3769
+ onClick,
3770
+ "aria-label": direction === "left" ? "Previous slide" : "Next slide",
3771
+ children
3772
+ }
3773
+ );
3774
+ var ProgressPill = ({
3775
+ active,
3776
+ duration,
3777
+ index,
3778
+ onClick,
3779
+ isPlaying,
3780
+ style = "modern",
3781
+ activeClassName = "",
3782
+ inactiveClassName = "",
3783
+ currentSlide,
3784
+ totalSlides
3785
+ }) => {
3786
+ const [progress, setProgress] = useState10(0);
3787
+ useEffect10(() => {
3788
+ if (active) {
3789
+ setProgress(0);
3790
+ }
3791
+ }, [active, index]);
3792
+ useEffect10(() => {
3793
+ if (!active || !isPlaying) {
3794
+ if (!active) {
3795
+ setProgress(0);
3796
+ }
3797
+ return;
3798
+ }
3799
+ const startTime = Date.now();
3800
+ const interval = setInterval(() => {
3801
+ const elapsed = Date.now() - startTime;
3802
+ const newProgress = elapsed / duration * 100;
3803
+ if (newProgress >= 100) {
3804
+ setProgress(100);
3805
+ clearInterval(interval);
3806
+ } else {
3807
+ setProgress(newProgress);
3808
+ }
3809
+ }, 50);
3810
+ return () => clearInterval(interval);
3811
+ }, [active, isPlaying, duration, index]);
3812
+ const isFilled = index < currentSlide;
3813
+ const isActive = index === currentSlide;
3814
+ const shouldShowProgress = isActive || style === "cumulative" && isFilled;
3815
+ const baseClasses = "cursor-pointer transition-all duration-300 ease-out";
3816
+ const getStyleClasses = () => {
3817
+ switch (style) {
3818
+ case "minimal":
3819
+ return `
3820
+ ${isActive ? "w-8" : "w-2"} h-2 rounded-full
3821
+ ${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
3822
+ hover:scale-110
3823
+ `;
3824
+ case "cumulative":
3825
+ return `
3826
+ w-4 h-1 rounded-full overflow-hidden relative
3827
+ ${isFilled ? activeClassName || "bg-white" : inactiveClassName || "bg-white/30"}
3828
+ `;
3829
+ case "modern":
3830
+ return `
3831
+ w-8 h-1.5 rounded-full overflow-hidden relative
3832
+ ${isActive ? inactiveClassName || "bg-white/30" : inactiveClassName || "bg-white/30"}
3833
+ hover:h-2
3834
+ `;
3835
+ case "default":
3836
+ default:
3837
+ return `
3838
+ w-6 h-1.5 rounded-full
3839
+ ${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
3840
+ hover:w-8
3841
+ `;
3842
+ }
3843
+ };
3844
+ const renderProgressBar = () => {
3845
+ if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
3846
+ const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
3847
+ return /* @__PURE__ */ jsx62(
3848
+ "div",
3849
+ {
3850
+ className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
3851
+ style: { width: `${displayProgress}%` }
3852
+ }
3853
+ );
3854
+ }
3855
+ return null;
3856
+ };
3857
+ const renderCumulativeFill = () => {
3858
+ if (style === "cumulative" && isFilled && !isActive) {
3859
+ return /* @__PURE__ */ jsx62(
3860
+ "div",
3861
+ {
3862
+ className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
3863
+ style: { width: "100%" }
3864
+ }
3865
+ );
3866
+ }
3867
+ return null;
3868
+ };
3869
+ return /* @__PURE__ */ jsxs30(
3870
+ "button",
3871
+ {
3872
+ className: `${baseClasses} ${getStyleClasses()}`,
3873
+ onClick,
3874
+ "aria-label": `Go to slide ${index + 1}`,
3875
+ "aria-current": isActive ? "true" : "false",
3876
+ children: [
3877
+ renderProgressBar(),
3878
+ renderCumulativeFill()
3879
+ ]
3880
+ }
3881
+ );
3882
+ };
3883
+ var Slider_default = Slider;
3884
+
3885
+ // src/components/utilities/AnimationUtility.tsx
3886
+ var AnimationUtility = class {
3887
+ static generateAnimationCSS(config, guid) {
3888
+ const {
3889
+ duration = 700,
3890
+ delay = 0,
3891
+ easing = "ease-out",
3892
+ distance = 30,
3893
+ scaleStart = 1,
3894
+ scaleEnd = 1.2,
3895
+ repeat = 1,
3896
+ intensity = 20,
3897
+ speedPerChar = 100,
3898
+ cursor = true,
3899
+ mode = "enter",
3900
+ direction = "left"
3901
+ // Default direction
3902
+ } = config;
3903
+ let base = "", visible = "", keyframes = "";
3904
+ switch (config.animation) {
3905
+ case "Fade":
3906
+ base = `opacity:0; transition:opacity ${duration}ms ${easing} ${delay}ms;`;
3907
+ visible = `opacity:1;`;
3908
+ break;
3909
+ case "FadeInUp":
3910
+ base = `opacity:0; transform:translateY(${distance}px); transition:all ${duration}ms ${easing} ${delay}ms;`;
3911
+ visible = `opacity:1; transform:translateY(0);`;
3912
+ break;
3913
+ case "Slide":
3914
+ const slideTransform = this.getSlideTransform(direction, distance);
3915
+ base = `opacity:0; transform:${slideTransform.start}; transition:all ${duration}ms ${easing} ${delay}ms; will-change: transform, opacity;`;
3916
+ visible = `opacity:1; transform:${slideTransform.end}; will-change: unset;`;
3917
+ break;
3918
+ case "ZoomIn":
3919
+ if (mode === "enter") {
3920
+ base = `opacity:0; transform:scale(${scaleStart}); transition:all ${duration}ms ${easing} ${delay}ms;`;
3921
+ visible = `opacity:1; transform:scale(${scaleEnd});`;
3922
+ } else {
3923
+ base = `transform:scale(${scaleStart}); transition:transform ${duration / 1e3}s ${easing} ${delay / 1e3}s;`;
3924
+ visible = `transform:scale(${scaleEnd});`;
3925
+ }
3926
+ break;
3927
+ case "Bounce":
3928
+ keyframes = `
3929
+ @keyframes bounce {
3930
+ 0%,20%,50%,80%,100% { transform: translateY(0); }
3931
+ 40% { transform: translateY(-${intensity}px); }
3932
+ 60% { transform: translateY(-${intensity / 2}px); }
3933
+ }
3934
+ `;
3935
+ if (mode === "enter") {
3936
+ base = `opacity:0;`;
3937
+ visible = `opacity:1; animation:bounce ${duration}ms ${easing} ${delay}ms ${repeat};`;
3938
+ } else {
3939
+ base = ``;
3940
+ visible = `animation:bounce ${duration / 1e3}s ${easing} ${delay / 1e3}s ${repeat};`;
3941
+ }
3942
+ break;
3943
+ case "Typewriter":
3944
+ keyframes = `
3945
+ @keyframes typewriter { from { width: 0 } to { width: 100% } }
3946
+ @keyframes blink { 50% { border-color: transparent } }
3947
+ `;
3948
+ base = `
3949
+ overflow:hidden;
3950
+ border-right:${cursor ? "2px solid black" : "none"};
3951
+ white-space:nowrap;
3952
+ width:0;
3953
+ margin:0 auto;
3954
+ `;
3955
+ visible = `
3956
+ animation:typewriter ${speedPerChar * 30}ms steps(30,end) ${delay}ms forwards
3957
+ ${cursor ? ", blink .75s step-end infinite" : ""};
3958
+ `;
3959
+ break;
3960
+ }
3961
+ if (mode === "hover") {
3962
+ return `
3963
+ ${keyframes}
3964
+ ${guid} { ${base} }
3965
+ ${guid}:hover { ${visible} }
3966
+ `;
3967
+ } else {
3968
+ return `
3969
+ ${keyframes}
3970
+ ${guid} { ${base} }
3971
+ ${guid}.visible { ${visible} }
3972
+ `;
3973
+ }
3974
+ }
3975
+ // Helper method to generate slide transforms based on direction
3976
+ static getSlideTransform(direction, distance) {
3977
+ switch (direction) {
3978
+ case "left":
3979
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
3980
+ case "right":
3981
+ return { start: `translateX(-${distance}px)`, end: `translateX(0)` };
3982
+ case "up":
3983
+ return { start: `translateY(${distance}px)`, end: `translateY(0)` };
3984
+ case "down":
3985
+ return { start: `translateY(-${distance}px)`, end: `translateY(0)` };
3986
+ default:
3987
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
3988
+ }
3989
+ }
3990
+ };
3991
+ var AnimationUtility_default = AnimationUtility;
3992
+
3993
+ // src/components/pageRenderingEngine/nodes/EnterAnimationClient.tsx
3994
+ import React47, { useEffect as useEffect11, useRef as useRef6 } from "react";
3995
+ import { Fragment as Fragment9, jsx as jsx63 } from "react/jsx-runtime";
3996
+ function EnterAnimationClient({ hasEnterAnimation, children }) {
3997
+ const ref = useRef6(null);
3998
+ useEffect11(() => {
3999
+ if (!hasEnterAnimation || !ref.current) return;
4000
+ const observer = new IntersectionObserver(
4001
+ (entries) => {
4002
+ entries.forEach((entry) => {
4003
+ if (entry.isIntersecting) {
4004
+ entry.target.classList.add("visible");
4005
+ observer.unobserve(entry.target);
4006
+ }
4007
+ });
4008
+ },
4009
+ { threshold: 0.1 }
4010
+ );
4011
+ observer.observe(ref.current);
4012
+ return () => observer.disconnect();
4013
+ }, [hasEnterAnimation]);
4014
+ return /* @__PURE__ */ jsx63(Fragment9, { children: children && // enforce passing the ref to Wrapper
4015
+ //@ts-ignore
4016
+ React47.cloneElement(children, { ref }) });
4017
+ }
4018
+
4019
+ // src/components/utilities/PathUtility.tsx
4020
+ var PathUtility = class {
4021
+ constructor() {
4022
+ }
4023
+ normalizePath(path) {
4024
+ if (path == null) {
4025
+ return "/";
4026
+ }
4027
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
4028
+ return trimmedPath === "" ? "/" : "/" + trimmedPath + "/";
4029
+ }
4030
+ joinAndNormalizePaths(path1, path2) {
4031
+ path1 = path1.replace(/\/$/, "");
4032
+ path2 = path2.replace(/^\//, "");
4033
+ const joinedPath = `${path1}/${path2}`;
4034
+ const normalizedPath = joinedPath.replace(/\/{2,}/g, "/");
4035
+ return normalizedPath === "" ? "/" : "/" + normalizedPath;
4036
+ }
4037
+ removeLeadingAndTrailingSlashes(path) {
4038
+ if (path == null) {
4039
+ return "/";
4040
+ }
4041
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
4042
+ return trimmedPath;
4043
+ }
4044
+ removeTrailingSlash(path) {
4045
+ if (path == null) {
4046
+ return "/";
4047
+ }
4048
+ const trimmedPath = path.replace(/\/$/, "");
4049
+ return trimmedPath;
4050
+ }
4051
+ joinPaths(path1, path2) {
4052
+ if (!path1.endsWith("/") && !path2.startsWith("/")) {
4053
+ return `${path1}/${path2}`;
4054
+ } else if (path1.endsWith("/") && path2.startsWith("/")) {
4055
+ return `${path1}${path2.substr(1)}`;
4056
+ } else {
4057
+ return `${path1}${path2}`;
4058
+ }
4059
+ }
4060
+ getFirstSegment(path) {
4061
+ if (!path || path === "/") {
4062
+ return "";
4063
+ }
4064
+ const segments = path.split("/").filter(Boolean);
4065
+ return segments.length > 0 ? segments[0] : "";
4066
+ }
4067
+ };
4068
+ var PathUtility_default = new PathUtility();
4069
+
4070
+ // src/components/NoDataFound.tsx
4071
+ import { jsx as jsx64, jsxs as jsxs31 } from "react/jsx-runtime";
4072
+ var NoDataFound = () => {
4073
+ return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center bg-neutral-weak", children: [
4074
+ /* @__PURE__ */ jsx64("div", { className: "mb-5", children: /* @__PURE__ */ jsx64("div", { className: "mx-auto w-20 h-20 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx64(
4075
+ "svg",
4076
+ {
4077
+ className: "w-10 h-10",
4078
+ fill: "none",
4079
+ stroke: "currentColor",
4080
+ viewBox: "0 0 24 24",
4081
+ xmlns: "http://www.w3.org/2000/svg",
4082
+ children: /* @__PURE__ */ jsx64(
4083
+ "path",
4084
+ {
4085
+ strokeLinecap: "round",
4086
+ strokeLinejoin: "round",
4087
+ strokeWidth: "1.5",
4088
+ d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
4089
+ }
4090
+ )
4091
+ }
4092
+ ) }) }),
4093
+ /* @__PURE__ */ jsx64("h3", { className: "text-lg font-medium mb-2", children: "No data available" }),
4094
+ /* @__PURE__ */ jsx64("p", { className: " max-w-sm mb-0", children: "No records found. Data may be empty or not available at the moment." })
4095
+ ] });
4096
+ };
4097
+ var NoDataFound_default = NoDataFound;
4098
+
4099
+ // src/components/Pagination.tsx
4100
+ import { useMemo } from "react";
4101
+ import { jsx as jsx65, jsxs as jsxs32 } from "react/jsx-runtime";
4102
+ var Pagination = (props) => {
4103
+ const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
4104
+ const builder = useMemo(() => {
4105
+ const b = new OdataBuilder(path);
4106
+ if (query) b.setQuery(query);
4107
+ return b;
4108
+ }, [path, query]);
4109
+ const activePageNumber = builder.getPageNumber(Constants.pagesize);
4110
+ const totalItems = dataset?.count || 0;
4111
+ const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
4112
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
4113
+ const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
4114
+ const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
4115
+ const getPaginationRange = () => {
4116
+ const delta = 1;
4117
+ const range = [];
4118
+ if (totalPages <= 7) {
4119
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
4120
+ }
4121
+ range.push(1);
4122
+ let start = Math.max(2, activePageNumber - delta);
4123
+ let end = Math.min(totalPages - 1, activePageNumber + delta);
4124
+ if (activePageNumber - delta <= 2) {
4125
+ end = Math.min(totalPages - 1, 4);
4126
+ }
4127
+ if (activePageNumber + delta >= totalPages - 1) {
4128
+ start = Math.max(2, totalPages - 4);
4129
+ }
4130
+ if (start > 2) {
4131
+ range.push("...");
4132
+ }
4133
+ for (let i = start; i <= end; i++) {
4134
+ range.push(i);
4135
+ }
4136
+ if (end < totalPages - 1) {
4137
+ range.push("...");
4138
+ }
4139
+ if (totalPages > 1) {
4140
+ range.push(totalPages);
4141
+ }
4142
+ return range;
4143
+ };
4144
+ const paginationRange = getPaginationRange();
4145
+ const PageButton = ({ page, children }) => /* @__PURE__ */ jsx65(
4146
+ Hyperlink,
4147
+ {
4148
+ linkType: "Link" /* Link */,
4149
+ className: `
4150
+ min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
4151
+ border text-sm font-medium transition-colors duration-150
4152
+ ${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
4153
+ `,
4154
+ href: builder.getNewPageUrl(page),
4155
+ children
4156
+ }
4157
+ );
4158
+ const NavigationButton = ({ page, disabled, children }) => {
4159
+ if (disabled) {
4160
+ return /* @__PURE__ */ jsx65("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
4161
+ }
4162
+ return /* @__PURE__ */ jsx65(
4163
+ Hyperlink,
4164
+ {
4165
+ className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
4166
+ href: builder.getNewPageUrl(page),
4167
+ children
4168
+ }
4169
+ );
4170
+ };
4171
+ if (totalPages <= 1 && totalItems === 0) return null;
4172
+ return /* @__PURE__ */ jsxs32("div", { className: "py-6 border-t bg-default", children: [
4173
+ /* @__PURE__ */ jsxs32("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
4174
+ /* @__PURE__ */ jsxs32("div", { className: "text-sm", children: [
4175
+ "Showing ",
4176
+ /* @__PURE__ */ jsxs32("span", { className: "font-semibold", children: [
4177
+ startItem,
4178
+ "-",
4179
+ endItem
4180
+ ] }),
4181
+ " ",
4182
+ "out of ",
4183
+ /* @__PURE__ */ jsx65("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
4184
+ " results"
4185
+ ] }),
4186
+ totalPages > 1 && /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-1", children: [
4187
+ /* @__PURE__ */ jsxs32(
4188
+ NavigationButton,
4189
+ {
4190
+ page: activePageNumber - 1,
4191
+ disabled: activePageNumber === 1,
4192
+ children: [
4193
+ /* @__PURE__ */ jsx65("span", { children: /* @__PURE__ */ jsx65(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
4194
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Prev" })
4195
+ ]
4196
+ }
4197
+ ),
4198
+ paginationRange.map((item, index) => {
4199
+ if (item === "...") {
4200
+ return /* @__PURE__ */ jsx65(
4201
+ "span",
4202
+ {
4203
+ className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
4204
+ children: "..."
4205
+ },
4206
+ `ellipsis-${index}`
4207
+ );
4208
+ }
4209
+ const page = item;
4210
+ return /* @__PURE__ */ jsx65(PageButton, { page, children: page }, page);
4211
+ }),
4212
+ /* @__PURE__ */ jsxs32(
4213
+ NavigationButton,
4214
+ {
4215
+ page: activePageNumber + 1,
4216
+ disabled: activePageNumber === totalPages,
4217
+ children: [
4218
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Next" }),
4219
+ /* @__PURE__ */ jsx65("span", { children: /* @__PURE__ */ jsx65(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
4220
+ ]
4221
+ }
4222
+ )
4223
+ ] }),
4224
+ showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-2", children: [
4225
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Go to:" }),
4226
+ /* @__PURE__ */ jsx65("div", { className: "relative", children: /* @__PURE__ */ jsx65(
4227
+ "input",
4228
+ {
4229
+ type: "number",
4230
+ min: "1",
4231
+ max: totalPages,
4232
+ defaultValue: activePageNumber,
4233
+ className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
4234
+ onKeyDown: (e) => {
4235
+ if (e.key === "Enter") {
4236
+ const input = e.target;
4237
+ const page = parseInt(input.value);
4238
+ if (page >= 1 && page <= totalPages && page !== activePageNumber) {
4239
+ window.location.href = builder.getNewPageUrl(page);
4240
+ }
4241
+ }
4242
+ }
4243
+ }
4244
+ ) })
4245
+ ] })
4246
+ ] }),
4247
+ showPageSizeSelector && /* @__PURE__ */ jsx65("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-center space-x-2", children: [
4248
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Show:" }),
4249
+ /* @__PURE__ */ jsx65("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx65(
4250
+ Hyperlink,
4251
+ {
4252
+ className: `
4253
+ px-3 py-1 text-sm rounded border transition-colors duration-150
4254
+ ${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
4255
+ `,
4256
+ href: builder.getNewPageSizeUrl(size),
4257
+ children: size
4258
+ },
4259
+ size
4260
+ )) }),
4261
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "per page" })
4262
+ ] }) })
4263
+ ] });
4264
+ };
4265
+ var Pagination_default = Pagination;
4266
+
4267
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
4268
+ import { jsx as jsx66, jsxs as jsxs33 } from "react/jsx-runtime";
4269
+ function toCamelCase(str) {
4270
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
4271
+ }
4272
+ function convertKeysToCamelCase(obj) {
4273
+ if (!obj || typeof obj !== "object") return obj;
4274
+ if (Array.isArray(obj)) return obj.map(convertKeysToCamelCase);
4275
+ return Object.fromEntries(
4276
+ Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [
4277
+ toCamelCase(key),
4278
+ convertKeysToCamelCase(value)
4279
+ ])
4280
+ );
4281
+ }
4282
+ var getNestedValue = (obj, path) => {
4283
+ if (!obj || !path) return void 0;
4284
+ return path.split(".").reduce((current, key) => {
4285
+ {
4286
+ }
4287
+ return current && current[key] !== void 0 ? current[key] : void 0;
4288
+ }, obj);
4289
+ };
4290
+ {
4291
+ }
4292
+ function generateCompleteBackgroundString(layers, apiBaseUrl) {
4293
+ if (!layers || !Array.isArray(layers)) return "";
4294
+ return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
4295
+ if (layer.type === "image" && typeof layer.value === "object") {
4296
+ const imageValue = layer.value;
4297
+ if (!imageValue.assetUrl) return "";
4298
+ const url = `url('${AssetUtility_default.resolveUrl(
4299
+ apiBaseUrl,
4300
+ imageValue.assetUrl
4301
+ )}')`;
4302
+ const repeat = layer.repeat || "no-repeat";
4303
+ const position = layer.position || "center";
4304
+ const size = layer.size || "auto";
4305
+ const attachment = layer.attachment || "scroll";
4306
+ return `${url} ${position} / ${size} ${repeat} ${attachment}`;
4307
+ }
4308
+ if (layer.type === "gradient" && typeof layer.value === "object") {
4309
+ const gradient = layer.value;
4310
+ if (!gradient.colors || !gradient.direction) return "";
4311
+ const colors = gradient.colors.map(
4312
+ (colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
4313
+ ).join(", ");
4314
+ return `linear-gradient(${gradient.direction}, ${colors})`;
4315
+ }
4316
+ return "";
4317
+ }).filter((bg) => bg.trim() !== "").join(", ");
4318
+ }
4319
+ var generateCssString = (guid, stylesObject, mobileStylesObject) => {
4320
+ {
4321
+ }
4322
+ const gridColumns = stylesObject.gridTemplateColumns ? stylesObject.gridTemplateColumns.match(/\d+/g) : [];
4323
+ const hasGridProperties = gridColumns.length > 0;
4324
+ const largeCols = hasGridProperties ? parseInt(gridColumns[0]) : 4;
4325
+ const tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
4326
+ const mobileColumns = 1;
4327
+ {
4328
+ }
4329
+ const cssRules = Object.entries(stylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
4330
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
4331
+ return `${cssKey}: ${value};`;
4332
+ });
4333
+ let css = `#${guid} {
4334
+ ${cssRules.join(
4335
+ "\n"
4336
+ )}
4337
+ transition: all 0.3s ease-in-out; }`;
4338
+ if (mobileStylesObject) {
4339
+ const mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
4340
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
4341
+ return `${cssKey}: ${value};`;
4342
+ });
4343
+ if (mobileCssRules.length > 0) {
4344
+ css += `
4345
+ @media (max-width: 480px) { #${guid} {
4346
+ ${mobileCssRules.join(
4347
+ "\n"
4348
+ )}
4349
+ } }`;
4350
+ }
4351
+ }
4352
+ if (hasGridProperties) {
4353
+ css += `
4354
+ @media (max-width: 1279px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
4355
+ css += `
4356
+ @media (max-width: 768px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
4357
+ css += `
4358
+ @media (max-width: 480px) { #${guid} { grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr)); } }`;
4359
+ }
4360
+ const output = {
4361
+ css,
4362
+ gridColsLarge: largeCols,
4363
+ gridColsMedium: tabletColumns,
4364
+ gridColsSmall: mobileColumns
4365
+ };
4366
+ return output;
4367
+ };
4368
+ var DivContainer = async (props) => {
4369
+ const NodeTypes2 = {
4370
+ paragraph: ParagraphNode_default,
4371
+ heading: HeadingNode_default,
4372
+ list: ListNode_default,
4373
+ quote: QuoteNode_default,
4374
+ code: CodeNode_default,
4375
+ image: ImageNode_default,
4376
+ horizontalrule: HorizontalRuleNode_default,
4377
+ widget: WidgetNode_default,
4378
+ embed: EmbedNode_default,
4379
+ "div-container": DivContainer,
4380
+ text: TextNode_default,
4381
+ datafield: DatafieldNode_default,
4382
+ "svg-icon": SVGIconNode_default
4383
+ };
4384
+ const styles = props.node.cssProperties;
4385
+ const mobileStyles = props.node.mobileCssProperties;
4386
+ const dataBindingProperties = props.node.dataBinding;
4387
+ const updatedStyles = convertKeysToCamelCase(styles);
4388
+ const background = generateCompleteBackgroundString(props.node.backgroundLayers, props.apiBaseUrl);
4389
+ let containerPaddingClass = "";
4390
+ if (props.node.containerPadding == "small") {
4391
+ containerPaddingClass = "container-small";
4392
+ } else if (props.node.containerPadding == "large") {
4393
+ containerPaddingClass = "container-large";
4394
+ }
4395
+ {
4396
+ }
4397
+ const updatedStyle = { ...updatedStyles };
4398
+ const backgroundStyle = background && background !== "" ? { background } : {};
4399
+ const combinedStyles = {
4400
+ ...backgroundStyle
4401
+ };
4402
+ if (props.node.enableBackgroundClipText) {
4403
+ combinedStyles.WebkitBackgroundClip = "text";
4404
+ combinedStyles.backgroundClip = "text";
4405
+ }
4406
+ const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
4407
+ const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
4408
+ let animationCSS = "";
4409
+ if (enterAnimation?.name) {
4410
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
4411
+ { animation: enterAnimation.name, mode: "enter", ...enterAnimation.properties },
4412
+ `#${guid}`
4413
+ );
4414
+ }
4415
+ if (hoverAnimation?.name) {
4416
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
4417
+ { animation: hoverAnimation.name, mode: "hover", ...hoverAnimation.properties },
4418
+ `#${guid}`
4419
+ );
4420
+ }
4421
+ const shouldHideContainer = () => {
4422
+ if (!props.node.fieldVisibleOnTrue) return false;
4423
+ const fieldValue = getNestedValue(props.dataitem, props.node.fieldVisibleOnTrue);
4424
+ return fieldValue !== void 0 && fieldValue === false;
4425
+ };
4426
+ const isHidden = shouldHideContainer();
4427
+ let odataString = void 0;
4428
+ let endpoint = void 0;
4429
+ let result = null;
4430
+ let response = null;
4431
+ let childCollectionData = null;
4432
+ if (dataBindingProperties) {
4433
+ const serviceClient = new ServiceClient_default(props.apiBaseUrl, props.session);
4434
+ endpoint = dataBindingProperties.dataSource;
4435
+ {
4436
+ }
4437
+ endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
4438
+ return props.routeParameters?.[key] ?? `{${key}}`;
4439
+ });
4440
+ if (dataBindingProperties.applyODataParams) {
4441
+ odataString = OdataBuilder.getOdataQueryString(props.query);
4442
+ if (odataString) {
4443
+ const separator = endpoint.includes("?") ? "&" : "?";
4444
+ endpoint += separator + odataString;
4445
+ }
4446
+ }
4447
+ response = await serviceClient.get(endpoint);
4448
+ result = response?.result;
4449
+ if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
4450
+ return /* @__PURE__ */ jsx66(NoDataFound_default, {});
4451
+ }
4452
+ if (dataBindingProperties.childCollectionName && props.dataitem) {
4453
+ childCollectionData = getNestedValue(props.dataitem, dataBindingProperties.childCollectionName);
4454
+ }
4455
+ }
4456
+ const cssResult = generateCssString(guid, updatedStyle, mobileStyles);
4457
+ function renderNode(node, props2, dataitem, key, href) {
4458
+ {
4459
+ }
4460
+ const SelectedNode = NodeTypes2[node.type];
4461
+ if (!SelectedNode) return null;
4462
+ return /* @__PURE__ */ jsx66(React49.Fragment, { children: /* @__PURE__ */ jsx66(
4463
+ SelectedNode,
4464
+ {
4465
+ node,
4466
+ parentTag: Wrapper,
4467
+ routeParameters: props2.routeParameters,
4468
+ query: props2.query,
4469
+ session: props2.session,
4470
+ host: props2.host,
4471
+ path: props2.path,
4472
+ apiBaseUrl: props2.apiBaseUrl,
4473
+ breadcrumb: props2.breadcrumb,
4474
+ dataitem,
4475
+ href
4476
+ }
4477
+ ) }, key);
4478
+ }
4479
+ function renderChildren(nodes, props2, data, key, href) {
4480
+ if (!nodes) return null;
4481
+ const childNodes = nodes.map((node, index) => {
4482
+ if (node.type === "div-container" && node.dataBinding?.childCollectionName && data) {
4483
+ return renderNode(node, props2, data, index, href);
4484
+ }
4485
+ return renderNode(node, props2, data, index, href);
4486
+ });
4487
+ return childNodes;
4488
+ }
4489
+ function queryObjectToString(query) {
4490
+ if (!query) return "";
4491
+ return Object.entries(query).map(
4492
+ ([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
4493
+ ).join("&");
4494
+ }
4495
+ function resolveHrefTemplate(template, dataItem) {
4496
+ return template.replace(/\{([^}]+)\}/g, (match, key) => {
4497
+ return dataItem[key] !== void 0 ? dataItem[key] : match;
4498
+ });
4499
+ }
4500
+ const dataToRender = (() => {
4501
+ if (childCollectionData && Array.isArray(childCollectionData)) {
4502
+ return childCollectionData;
4503
+ }
4504
+ if (result && props.node.dataBinding?.responseType === "array") {
4505
+ return result;
4506
+ }
4507
+ if (result && props.node.dataBinding?.responseType === "object") {
4508
+ return [result];
4509
+ }
4510
+ return [props.dataitem];
4511
+ })();
4512
+ const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
4513
+ {
4514
+ }
4515
+ let Wrapper;
4516
+ let wrapperProps;
4517
+ switch (true) {
4518
+ case props.node.componentProperties?.type === "slider":
4519
+ Wrapper = Slider_default;
4520
+ const largeCols = props.node.componentProperties?.columns || 4;
4521
+ const slidesToShow = {
4522
+ large: largeCols,
4523
+ medium: Math.ceil(largeCols / 2),
4524
+ small: 1
4525
+ };
4526
+ wrapperProps = { ...props.node.componentProperties, "slidesToShow": slidesToShow };
4527
+ break;
4528
+ case !!(props.node.href || props.href):
4529
+ Wrapper = "a";
4530
+ let href = props.node.href || props.href;
4531
+ if (href?.includes("{")) {
4532
+ href = resolveHrefTemplate(href, props.dataitem);
4533
+ }
4534
+ const currentPath = decodeURIComponent(PathUtility_default.removeTrailingSlash(props.path) + "?" + queryObjectToString(props.query));
4535
+ const resolvedHref = decodeURIComponent(href || "");
4536
+ const isSelected = currentPath === resolvedHref;
4537
+ wrapperProps = { href, "data-isSelected": isSelected, "data-path": currentPath, "data-href": resolvedHref, class: "no-link-color" };
4538
+ break;
4539
+ default: {
4540
+ const replacementTag = props.node.replaceDivTagWith;
4541
+ const allowedTags = ["div", "section", "article", "details", "summary"];
4542
+ if (replacementTag && allowedTags.includes(replacementTag)) {
4543
+ {
4544
+ }
4545
+ Wrapper = replacementTag;
4546
+ } else {
4547
+ Wrapper = "div";
4548
+ }
4549
+ wrapperProps = {};
4550
+ break;
4551
+ }
4552
+ }
4553
+ if (isHidden) {
4554
+ return null;
4555
+ }
4556
+ const classNames = [
4557
+ containerPaddingClass,
4558
+ props.node.autoFormat && "auto-format",
4559
+ props.node.bgClass
4560
+ ].filter(Boolean).join(" ");
4561
+ return /* @__PURE__ */ jsxs33(React49.Fragment, { children: [
4562
+ /* @__PURE__ */ jsx66("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
4563
+ /* @__PURE__ */ jsx66(EnterAnimationClient, { hasEnterAnimation: !!props.node.enterAnimation, children: /* @__PURE__ */ jsx66(React49.Fragment, { children: /* @__PURE__ */ jsx66(
4564
+ Wrapper,
4565
+ {
4566
+ id: guid,
4567
+ style: combinedStyles,
4568
+ className: classNames || void 0,
4569
+ ...wrapperProps,
4570
+ children: dataToRender.map(
4571
+ (item, idx) => item?.links?.view && renderLink ? renderChildren(props.node.children, props, item, idx, props.href ? void 0 : item?.links?.view)?.map(
4572
+ (child, i) => /* @__PURE__ */ jsx66(React49.Fragment, { children: child }, i)
4573
+ ) : renderChildren(props.node.children, props, item, idx)
4574
+ )
4575
+ }
4576
+ ) }) }),
4577
+ dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx66("div", { children: /* @__PURE__ */ jsx66(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
4578
+ ] });
4579
+ };
4580
+ var DivContainer_default = DivContainer;
4581
+
4582
+ // src/components/pageRenderingEngine/PageBodyRenderer.tsx
4583
+ import { jsx as jsx67 } from "react/jsx-runtime";
4584
+ var NodeTypes = {
4585
+ ["paragraph"]: ParagraphNode_default,
4586
+ ["heading"]: HeadingNode_default,
4587
+ ["list"]: ListNode_default,
4588
+ ["quote"]: QuoteNode_default,
4589
+ ["code"]: CodeNode_default,
4590
+ ["image"]: ImageNode_default,
4591
+ ["horizontalrule"]: HorizontalRuleNode_default,
4592
+ ["widget"]: WidgetNode_default,
4593
+ ["form-container"]: FormContainerNode_default,
4594
+ ["div-container"]: DivContainer_default,
4595
+ ["svg-icon"]: SVGIconNode_default,
4596
+ ["embed"]: EmbedNode_default
4597
+ };
4598
+ var PageBodyRenderer = (props) => {
4599
+ let pageBodyTree;
4600
+ if (props.rawBody != void 0 && props.rawBody != null && props.rawBody != "") {
4601
+ try {
4602
+ pageBodyTree = JSON.parse(props.rawBody.toString());
4603
+ } catch (error) {
4604
+ }
4605
+ }
4606
+ let rootNode;
4607
+ if (pageBodyTree && pageBodyTree.root) {
4608
+ rootNode = pageBodyTree.root;
4609
+ }
4610
+ return /* @__PURE__ */ jsx67(React50.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
4611
+ {
4612
+ }
4613
+ const SelectedNode = NodeTypes[node.type];
4614
+ return /* @__PURE__ */ jsx67(React50.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx67(React50.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx67(React50.Fragment, { children: /* @__PURE__ */ jsx67(
4615
+ SelectedNode,
4616
+ {
4617
+ node,
4618
+ firstNode: true,
4619
+ routeParameters: props.routeParameters,
4620
+ query: props.query,
4621
+ session: props.session,
4622
+ host: props.host,
4623
+ path: props.path,
4624
+ apiBaseUrl: props.apiBaseUrl,
4625
+ serviceClient: props.serviceClient,
4626
+ assetBaseUrl: props.assetBaseUrl
4627
+ }
4628
+ ) }) : /* @__PURE__ */ jsx67(React50.Fragment, { children: /* @__PURE__ */ jsx67(
4629
+ SelectedNode,
4630
+ {
4631
+ node,
4632
+ routeParameters: props.routeParameters,
4633
+ query: props.query,
4634
+ session: props.session,
4635
+ host: props.host,
4636
+ path: props.path,
4637
+ apiBaseUrl: props.apiBaseUrl,
4638
+ serviceClient: props.serviceClient,
4639
+ assetBaseUrl: props.assetBaseUrl
4640
+ }
4641
+ ) }) }) }, index);
4642
+ }) });
4643
+ };
4644
+ var PageBodyRenderer_default = PageBodyRenderer;
1815
4645
  export {
4646
+ DataList_default as DataList,
1816
4647
  InputControl_default as InputControl,
1817
4648
  InputControlType_default as InputControlType,
4649
+ PageBodyRenderer_default as PageBodyRenderer,
1818
4650
  ViewControl_default as ViewControl,
1819
- ViewControlTypes_default as ViewControlTypes
4651
+ ViewControlTypes_default as ViewControlTypes,
4652
+ getWidget,
4653
+ registerWidgets
1820
4654
  };