@resulticks/trustsignal-wa-hsm 0.3.0 → 0.4.0

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.
@@ -1,16 +1,16 @@
1
- import { jsx as e, jsxs as r, Fragment as ae } from "react/jsx-runtime";
2
- import Q, { forwardRef as Ce, createElement as fe, useRef as Me, useEffect as ee, useState as I, useMemo as we, useCallback as he, createContext as Ee } from "react";
3
- import { useNavigate as ve, useInRouterContext as ue } from "react-router-dom";
4
- const Le = async (a, n = {}) => {
1
+ import { jsx as e, jsxs as r, Fragment as ne } from "react/jsx-runtime";
2
+ import K, { forwardRef as Le, createElement as be, useRef as Te, useEffect as se, useState as B, useMemo as Ne, useCallback as ge, createContext as Se } from "react";
3
+ import { useNavigate as Ce, useInRouterContext as ye } from "react-router-dom";
4
+ const Ve = async (a, n = {}) => {
5
5
  try {
6
- return await Te(a.apiKey);
6
+ return await je(a.apiKey);
7
7
  } catch (i) {
8
8
  return console.error("API Error:", i), {
9
9
  status: "error",
10
10
  message: i instanceof Error ? i.message : "Failed to fetch templates"
11
11
  };
12
12
  }
13
- }, Te = async (a) => {
13
+ }, je = async (a) => {
14
14
  const n = await fetch(
15
15
  "https://wpapi.trustsignal.io/api/v1/template?page=1&limit=100",
16
16
  {
@@ -54,7 +54,7 @@ const Le = async (a, n = {}) => {
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
56
  */
57
- var Se = {
57
+ var Ue = {
58
58
  xmlns: "http://www.w3.org/2000/svg",
59
59
  width: 24,
60
60
  height: 24,
@@ -71,31 +71,31 @@ var Se = {
71
71
  * This source code is licensed under the ISC license.
72
72
  * See the LICENSE file in the root directory of this source tree.
73
73
  */
74
- const Ve = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(), q = (a, n) => {
75
- const i = Ce(
74
+ const Ae = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(), H = (a, n) => {
75
+ const i = Le(
76
76
  ({
77
77
  color: l = "currentColor",
78
78
  size: d = 24,
79
- strokeWidth: f = 2,
79
+ strokeWidth: p = 2,
80
80
  absoluteStrokeWidth: m,
81
- className: N = "",
82
- children: w,
83
- ...h
84
- }, g) => fe(
81
+ className: C = "",
82
+ children: g,
83
+ ...f
84
+ }, y) => be(
85
85
  "svg",
86
86
  {
87
- ref: g,
88
- ...Se,
87
+ ref: y,
88
+ ...Ue,
89
89
  width: d,
90
90
  height: d,
91
91
  stroke: l,
92
- strokeWidth: m ? Number(f) * 24 / Number(d) : f,
93
- className: ["lucide", `lucide-${Ve(a)}`, N].join(" "),
94
- ...h
92
+ strokeWidth: m ? Number(p) * 24 / Number(d) : p,
93
+ className: ["lucide", `lucide-${Ae(a)}`, C].join(" "),
94
+ ...f
95
95
  },
96
96
  [
97
- ...n.map(([S, V]) => fe(S, V)),
98
- ...Array.isArray(w) ? w : [w]
97
+ ...n.map(([j, U]) => be(j, U)),
98
+ ...Array.isArray(g) ? g : [g]
99
99
  ]
100
100
  )
101
101
  );
@@ -107,7 +107,7 @@ const Ve = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(),
107
107
  * This source code is licensed under the ISC license.
108
108
  * See the LICENSE file in the root directory of this source tree.
109
109
  */
110
- const ie = q("AlertCircle", [
110
+ const ce = H("AlertCircle", [
111
111
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
112
112
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
113
113
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
@@ -118,7 +118,7 @@ const ie = q("AlertCircle", [
118
118
  * This source code is licensed under the ISC license.
119
119
  * See the LICENSE file in the root directory of this source tree.
120
120
  */
121
- const je = q("ArrowRight", [
121
+ const Re = H("ArrowRight", [
122
122
  ["path", { d: "M5 12h14", key: "1ays0h" }],
123
123
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
124
124
  ]);
@@ -128,7 +128,7 @@ const je = q("ArrowRight", [
128
128
  * This source code is licensed under the ISC license.
129
129
  * See the LICENSE file in the root directory of this source tree.
130
130
  */
131
- const Ue = q("ExternalLink", [
131
+ const Be = H("ExternalLink", [
132
132
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
133
133
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
134
134
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
@@ -139,7 +139,7 @@ const Ue = q("ExternalLink", [
139
139
  * This source code is licensed under the ISC license.
140
140
  * See the LICENSE file in the root directory of this source tree.
141
141
  */
142
- const Ae = q("FileText", [
142
+ const Ie = H("FileText", [
143
143
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
144
144
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
145
145
  ["path", { d: "M10 9H8", key: "b1mrlr" }],
@@ -152,7 +152,7 @@ const Ae = q("FileText", [
152
152
  * This source code is licensed under the ISC license.
153
153
  * See the LICENSE file in the root directory of this source tree.
154
154
  */
155
- const Re = q("FileVideo", [
155
+ const ze = H("FileVideo", [
156
156
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
157
157
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
158
158
  ["path", { d: "m10 11 5 3-5 3v-6Z", key: "7ntvm4" }]
@@ -163,7 +163,7 @@ const Re = q("FileVideo", [
163
163
  * This source code is licensed under the ISC license.
164
164
  * See the LICENSE file in the root directory of this source tree.
165
165
  */
166
- const Ie = q("Link", [
166
+ const Oe = H("Link", [
167
167
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
168
168
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
169
169
  ]);
@@ -173,7 +173,7 @@ const Ie = q("Link", [
173
173
  * This source code is licensed under the ISC license.
174
174
  * See the LICENSE file in the root directory of this source tree.
175
175
  */
176
- const re = q("MessageCircle", [
176
+ const le = H("MessageCircle", [
177
177
  ["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
178
178
  ]);
179
179
  /**
@@ -182,7 +182,7 @@ const re = q("MessageCircle", [
182
182
  * This source code is licensed under the ISC license.
183
183
  * See the LICENSE file in the root directory of this source tree.
184
184
  */
185
- const ke = q("Phone", [
185
+ const Me = H("Phone", [
186
186
  [
187
187
  "path",
188
188
  {
@@ -197,7 +197,7 @@ const ke = q("Phone", [
197
197
  * This source code is licensed under the ISC license.
198
198
  * See the LICENSE file in the root directory of this source tree.
199
199
  */
200
- const te = q("Plus", [
200
+ const de = H("Plus", [
201
201
  ["path", { d: "M5 12h14", key: "1ays0h" }],
202
202
  ["path", { d: "M12 5v14", key: "s699le" }]
203
203
  ]);
@@ -207,7 +207,7 @@ const te = q("Plus", [
207
207
  * This source code is licensed under the ISC license.
208
208
  * See the LICENSE file in the root directory of this source tree.
209
209
  */
210
- const Be = q("Reply", [
210
+ const Pe = H("Reply", [
211
211
  ["polyline", { points: "9 17 4 12 9 7", key: "hvgpf2" }],
212
212
  ["path", { d: "M20 18v-2a4 4 0 0 0-4-4H4", key: "5vmcpk" }]
213
213
  ]);
@@ -217,7 +217,7 @@ const Be = q("Reply", [
217
217
  * This source code is licensed under the ISC license.
218
218
  * See the LICENSE file in the root directory of this source tree.
219
219
  */
220
- const me = q("Smile", [
220
+ const xe = H("Smile", [
221
221
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
222
222
  ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
223
223
  ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
@@ -229,7 +229,7 @@ const me = q("Smile", [
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
231
  */
232
- const ze = q("Upload", [
232
+ const _e = H("Upload", [
233
233
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
234
234
  ["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
235
235
  ["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
@@ -240,7 +240,7 @@ const ze = q("Upload", [
240
240
  * This source code is licensed under the ISC license.
241
241
  * See the LICENSE file in the root directory of this source tree.
242
242
  */
243
- const Pe = q("Workflow", [
243
+ const Fe = H("Workflow", [
244
244
  ["rect", { width: "8", height: "8", x: "3", y: "3", rx: "2", key: "by2w9f" }],
245
245
  ["path", { d: "M7 11v4a2 2 0 0 0 2 2h4", key: "xkn7yn" }],
246
246
  ["rect", { width: "8", height: "8", x: "13", y: "13", rx: "2", key: "1cgmvn" }]
@@ -251,18 +251,18 @@ const Pe = q("Workflow", [
251
251
  * This source code is licensed under the ISC license.
252
252
  * See the LICENSE file in the root directory of this source tree.
253
253
  */
254
- const J = q("X", [
254
+ const ee = H("X", [
255
255
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
256
256
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
257
257
  ]);
258
- function ce({ isOpen: a, onClose: n, title: i, children: l }) {
259
- const d = Me(null);
260
- return ee(() => {
261
- const f = (m) => {
258
+ function pe({ isOpen: a, onClose: n, title: i, children: l }) {
259
+ const d = Te(null);
260
+ return se(() => {
261
+ const p = (m) => {
262
262
  d.current && !d.current.contains(m.target) && n();
263
263
  };
264
- return a && document.addEventListener("mousedown", f), () => {
265
- document.removeEventListener("mousedown", f);
264
+ return a && document.addEventListener("mousedown", p), () => {
265
+ document.removeEventListener("mousedown", p);
266
266
  };
267
267
  }, [a, n]), a ? /* @__PURE__ */ e("div", { className: "rsp-fixed rsp-inset-0 rsp-bg-black rsp-bg-opacity-50 rsp-flex rsp-items-center rsp-justify-center rsp-p-4 rsp-z-50", children: /* @__PURE__ */ r("div", { ref: d, className: "rsp-bg-white rsp-rounded-lg rsp-shadow-xl rsp-w-full rsp-max-w-[600px] rsp-animate-modal-appear", style: { backgroundColor: "#f5f7fc" }, children: [
268
268
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-px-6 rsp-py-4 rsp-border-b", children: [
@@ -272,58 +272,58 @@ function ce({ isOpen: a, onClose: n, title: i, children: l }) {
272
272
  {
273
273
  onClick: n,
274
274
  className: "rsp-p-1 hover:rsp-bg-gray-100 rsp-rounded-full",
275
- children: /* @__PURE__ */ e(J, { className: "rsp-w-5 rsp-h-5 rsp-text-gray-500" })
275
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-5 rsp-h-5 rsp-text-gray-500" })
276
276
  }
277
277
  )
278
278
  ] }),
279
279
  /* @__PURE__ */ e("div", { className: "rsp-px-6 rsp-py-4 rsp-overflow-y-auto rsp-max-h-[70vh] rsp-break-words rsp-whitespace-pre-wrap", children: l })
280
280
  ] }) }) : null;
281
281
  }
282
- function ha() {
283
- const a = ve(), [n, i] = I([]), [l, d] = I(!0), [f, m] = I(null), [N, w] = I(() => {
284
- const p = localStorage.getItem("account");
285
- return p ? JSON.parse(p) : {
282
+ function ga() {
283
+ const a = Ce(), [n, i] = B([]), [l, d] = B(!0), [p, m] = B(null), [C, g] = B(() => {
284
+ const c = localStorage.getItem("account");
285
+ return c ? JSON.parse(c) : {
286
286
  apiKey: ""
287
287
  };
288
- }), [h, g] = I(""), [S, V] = I("all"), [M, v] = I("all"), [x, b] = I("all"), [t, u] = I(1), k = 20, [E, U] = I({ isOpen: !1 });
289
- ee(() => {
288
+ }), [f, y] = B(""), [j, U] = B("all"), [k, N] = B("all"), [o, u] = B("all"), [t, h] = B(1), v = 20, [V, R] = B({ isOpen: !1 });
289
+ se(() => {
290
290
  (async () => {
291
291
  try {
292
- if (m(null), d(!0), i([]), !N.apiKey) {
292
+ if (m(null), d(!0), i([]), !C.apiKey) {
293
293
  m("Please enter your TrustSignal API key"), d(!1);
294
294
  return;
295
295
  }
296
- const L = await Le(N, {
296
+ const M = await Ve(C, {
297
297
  limit: 1e3
298
298
  });
299
- if (L.status === "error")
300
- throw new Error(L.message);
301
- i(L.data);
302
- } catch (L) {
303
- m(L instanceof Error ? L.message : "Failed to fetch templates"), i([]);
299
+ if (M.status === "error")
300
+ throw new Error(M.message);
301
+ i(M.data);
302
+ } catch (M) {
303
+ m(M instanceof Error ? M.message : "Failed to fetch templates"), i([]);
304
304
  } finally {
305
305
  d(!1);
306
306
  }
307
307
  })();
308
- }, [N]);
309
- const B = (p) => {
310
- const { name: L, value: A } = p.target, T = {
311
- ...N,
312
- [L]: A
308
+ }, [C]);
309
+ const I = (c) => {
310
+ const { name: M, value: A } = c.target, O = {
311
+ ...C,
312
+ [M]: A
313
313
  };
314
- w(T), localStorage.setItem("account", JSON.stringify(T));
315
- }, s = (p, L) => {
316
- U({
314
+ g(O), localStorage.setItem("account", JSON.stringify(O));
315
+ }, x = (c, M) => {
316
+ R({
317
317
  isOpen: !0,
318
- url: p,
319
- templateName: L
318
+ url: c,
319
+ templateName: M
320
320
  });
321
- }, c = () => {
322
- U({ isOpen: !1 });
323
- }, o = n.filter((p) => {
324
- const L = h.trim(), A = L.toLowerCase(), T = L === "" || p.id.toString().includes(L) || p.name.toLowerCase().includes(A), Y = S === "all" || p.status.toLowerCase() === S.toLowerCase(), z = M === "all" || p.category.toLowerCase() === M.toLowerCase(), G = x === "all" || p.language.toLowerCase().startsWith(x.toLowerCase());
325
- return T && Y && z && G;
326
- }), y = Math.ceil(o.length / k), C = (t - 1) * k, j = C + k, R = o.slice(C, j);
321
+ }, w = () => {
322
+ R({ isOpen: !1 });
323
+ }, L = n.filter((c) => {
324
+ const M = f.trim(), A = M.toLowerCase(), O = M === "" || c.id.toString().includes(M) || c.name.toLowerCase().includes(A), $ = j === "all" || c.status.toLowerCase() === j.toLowerCase(), X = k === "all" || c.category.toLowerCase() === k.toLowerCase(), S = o === "all" || c.language.toLowerCase().startsWith(o.toLowerCase());
325
+ return O && $ && X && S;
326
+ }), s = Math.ceil(L.length / v), b = (t - 1) * v, E = b + v, T = L.slice(b, E);
327
327
  return l ? /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-min-h-screen", children: /* @__PURE__ */ e("div", { className: "rsp-text-lg rsp-text-gray-600", children: "Loading templates..." }) }) : /* @__PURE__ */ r("div", { className: "rsp-container rsp-mx-auto rsp-px-4 rsp-py-8 rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm", children: [
328
328
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mb-6", children: [
329
329
  /* @__PURE__ */ e("h1", { className: "rsp-text-2xl rsp-font-bold", children: "Whatsapp HSM Templates" }),
@@ -332,7 +332,7 @@ function ha() {
332
332
  {
333
333
  onClick: () => a("/create"),
334
334
  className: "rsp-bg-blue-600 rsp-text-white rsp-p-1 rsp-rounded-full hover:rsp-bg-blue-700 rsp-flex rsp-items-center rsp-gap-2",
335
- children: /* @__PURE__ */ e(te, { className: "rsp-w-6 rsp-h-6" })
335
+ children: /* @__PURE__ */ e(de, { className: "rsp-w-6 rsp-h-6" })
336
336
  }
337
337
  )
338
338
  ] }),
@@ -344,8 +344,8 @@ function ha() {
344
344
  {
345
345
  type: "password",
346
346
  name: "apiKey",
347
- value: N.apiKey,
348
- onChange: B,
347
+ value: C.apiKey,
348
+ onChange: I,
349
349
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
350
350
  placeholder: "Enter your TrustSignal API key"
351
351
  }
@@ -353,17 +353,17 @@ function ha() {
353
353
  /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500" })
354
354
  ] })
355
355
  ] }) }),
356
- f && /* @__PURE__ */ e("div", { className: "rsp-bg-red-50 rsp-border-l-4 rsp-border-red-500 rsp-p-4 rsp-mb-6", children: /* @__PURE__ */ r("div", { className: "rsp-flex", children: [
357
- /* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e(ie, { className: "rsp-h-5 rsp-w-5 rsp-text-red-400" }) }),
358
- /* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-red-700", children: f }) })
356
+ p && /* @__PURE__ */ e("div", { className: "rsp-bg-red-50 rsp-border-l-4 rsp-border-red-500 rsp-p-4 rsp-mb-6", children: /* @__PURE__ */ r("div", { className: "rsp-flex", children: [
357
+ /* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e(ce, { className: "rsp-h-5 rsp-w-5 rsp-text-red-400" }) }),
358
+ /* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-red-700", children: p }) })
359
359
  ] }) }),
360
360
  /* @__PURE__ */ e("div", { className: "rsp-mb-6", children: /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
361
361
  "input",
362
362
  {
363
363
  type: "text",
364
364
  placeholder: "Search by name or ID...",
365
- value: h,
366
- onChange: (p) => g(p.target.value),
365
+ value: f,
366
+ onChange: (c) => y(c.target.value),
367
367
  className: "rsp-w-full rsp-px-0 rsp-py-3 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent"
368
368
  }
369
369
  ) }) }),
@@ -376,10 +376,10 @@ function ha() {
376
376
  /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
377
377
  "select",
378
378
  {
379
- value: M,
380
- onChange: (p) => v(p.target.value),
379
+ value: k,
380
+ onChange: (c) => N(c.target.value),
381
381
  className: "rsp-cursor-pointer rsp-ml-2 rsp-bg-transparent rsp-text-white rsp-border-0 rsp-text-sm focus:rsp-outline-none ",
382
- onClick: (p) => p.stopPropagation(),
382
+ onClick: (c) => c.stopPropagation(),
383
383
  children: [
384
384
  /* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
385
385
  /* @__PURE__ */ e("option", { value: "utility", className: "rsp-text-gray-900", children: "Utility" }),
@@ -395,10 +395,10 @@ function ha() {
395
395
  /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
396
396
  "select",
397
397
  {
398
- value: S,
399
- onChange: (p) => V(p.target.value),
398
+ value: j,
399
+ onChange: (c) => U(c.target.value),
400
400
  className: "rsp-cursor-pointer rsp-ml-2 rsp-bg-transparent rsp-text-white rsp-border-0 rsp-text-sm focus:rsp-outline-none",
401
- onClick: (p) => p.stopPropagation(),
401
+ onClick: (c) => c.stopPropagation(),
402
402
  children: [
403
403
  /* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
404
404
  /* @__PURE__ */ e("option", { value: "pending", className: "rsp-text-gray-900", children: "Pending" }),
@@ -412,26 +412,26 @@ function ha() {
412
412
  /* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Updated" }),
413
413
  /* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Media" })
414
414
  ] }) }),
415
- /* @__PURE__ */ e("tbody", { children: R.length > 0 ? R.map((p, L) => {
415
+ /* @__PURE__ */ e("tbody", { children: T.length > 0 ? T.map((c, M) => {
416
416
  var A;
417
417
  return /* @__PURE__ */ r(
418
418
  "tr",
419
419
  {
420
- className: `rsp-border-b rsp-border-gray-200 ${L % 2 === 0 ? "rsp-bg-white" : "rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,
420
+ className: `rsp-border-b rsp-border-gray-200 ${M % 2 === 0 ? "rsp-bg-white" : "rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,
421
421
  children: [
422
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900", children: p.id }),
423
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium", children: p.name }),
424
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize", children: p.category }),
425
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: p.language }),
426
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: p.type }),
422
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900", children: c.id }),
423
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium", children: c.name }),
424
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize", children: c.category }),
425
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.language }),
426
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.type }),
427
427
  /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4", children: /* @__PURE__ */ e("span", { className: `rsp-inline-flex rsp-px-3 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium
428
- ${p.status.toLowerCase() === "approved" ? "rsp-bg-green-100 rsp-text-green-800" : p.status.toLowerCase() === "rejected" ? "rsp-bg-red-100 rsp-text-red-800" : "rsp-bg-yellow-100 rsp-text-yellow-800"}`, children: p.status }) }),
429
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: p.creation_time ? new Date(p.creation_time).toLocaleDateString() : "N/A" }),
430
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: p.updation_time ? new Date(p.updation_time).toLocaleDateString() : "N/A" }),
431
- /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: (A = p.medialist) != null && A.header ? /* @__PURE__ */ r(
428
+ ${c.status.toLowerCase() === "approved" ? "rsp-bg-green-100 rsp-text-green-800" : c.status.toLowerCase() === "rejected" ? "rsp-bg-red-100 rsp-text-red-800" : "rsp-bg-yellow-100 rsp-text-yellow-800"}`, children: c.status }) }),
429
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.creation_time ? new Date(c.creation_time).toLocaleDateString() : "N/A" }),
430
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.updation_time ? new Date(c.updation_time).toLocaleDateString() : "N/A" }),
431
+ /* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: (A = c.medialist) != null && A.header ? /* @__PURE__ */ r(
432
432
  "button",
433
433
  {
434
- onClick: () => s(p.medialist.header, p.name),
434
+ onClick: () => x(c.medialist.header, c.name),
435
435
  className: "rsp-inline-flex rsp-items-center rsp-px-3 rsp-py-1 rsp-rounded rsp-text-xs rsp-font-medium rsp-bg-blue-100 rsp-text-blue-800 hover:rsp-bg-blue-200 rsp-transition-colors",
436
436
  children: [
437
437
  /* @__PURE__ */ r("svg", { className: "rsp-w-3 rsp-h-3 rsp-mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
@@ -444,25 +444,25 @@ function ha() {
444
444
  ) : /* @__PURE__ */ e("span", { className: "rsp-inline-flex rsp-px-2 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium rsp-bg-gray-100 rsp-text-gray-800", children: "No Media" }) })
445
445
  ]
446
446
  },
447
- p.id
447
+ c.id
448
448
  );
449
449
  }) : /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "rsp-px-6 rsp-py-8 rsp-text-center rsp-text-gray-500", children: "No templates found" }) }) })
450
450
  ] }) }) }),
451
- R.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mt-6 rsp-px-6 rsp-py-4 rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
451
+ T.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mt-6 rsp-px-6 rsp-py-4 rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
452
452
  /* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-700", children: [
453
453
  "Showing ",
454
- /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: C + 1 }),
454
+ /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: b + 1 }),
455
455
  " to ",
456
- /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(j, o.length) }),
456
+ /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(E, L.length) }),
457
457
  " of ",
458
- /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: o.length }),
458
+ /* @__PURE__ */ e("span", { className: "rsp-font-medium", children: L.length }),
459
459
  " results"
460
460
  ] }),
461
461
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-2", children: [
462
462
  /* @__PURE__ */ e(
463
463
  "button",
464
464
  {
465
- onClick: () => u((p) => Math.max(p - 1, 1)),
465
+ onClick: () => h((c) => Math.max(c - 1, 1)),
466
466
  disabled: t === 1,
467
467
  className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",
468
468
  children: "Previous"
@@ -472,13 +472,13 @@ function ha() {
472
472
  "Page ",
473
473
  t,
474
474
  " of ",
475
- y
475
+ s
476
476
  ] }),
477
477
  /* @__PURE__ */ e(
478
478
  "button",
479
479
  {
480
- onClick: () => u((p) => Math.min(p + 1, y)),
481
- disabled: t === y,
480
+ onClick: () => h((c) => Math.min(c + 1, s)),
481
+ disabled: t === s,
482
482
  className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",
483
483
  children: "Next"
484
484
  }
@@ -486,30 +486,30 @@ function ha() {
486
486
  ] })
487
487
  ] }),
488
488
  /* @__PURE__ */ e(
489
- ce,
489
+ pe,
490
490
  {
491
- isOpen: E.isOpen,
492
- onClose: c,
493
- title: `Media - ${E.templateName || "Template"}`,
491
+ isOpen: V.isOpen,
492
+ onClose: w,
493
+ title: `Media - ${V.templateName || "Template"}`,
494
494
  children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
495
- E.url && /* @__PURE__ */ r("div", { className: "rsp-text-center", children: [
495
+ V.url && /* @__PURE__ */ r("div", { className: "rsp-text-center", children: [
496
496
  /* @__PURE__ */ r("div", { className: "rsp-relative rsp-bg-gray-50 rsp-rounded-lg rsp-p-4 rsp-min-h-[200px] rsp-flex rsp-items-center rsp-justify-center", children: [
497
497
  /* @__PURE__ */ e(
498
498
  "img",
499
499
  {
500
- src: E.url,
500
+ src: V.url,
501
501
  alt: "Template media",
502
502
  className: "rsp-max-w-full rsp-max-h-[400px] rsp-mx-auto rsp-rounded-lg rsp-shadow-md rsp-object-contain",
503
- onLoad: (p) => {
503
+ onLoad: (c) => {
504
504
  var A;
505
- const L = (A = p.currentTarget.parentElement) == null ? void 0 : A.querySelector(".loading-placeholder");
506
- L && (L.style.display = "none");
505
+ const M = (A = c.currentTarget.parentElement) == null ? void 0 : A.querySelector(".loading-placeholder");
506
+ M && (M.style.display = "none");
507
507
  },
508
- onError: (p) => {
508
+ onError: (c) => {
509
509
  var A;
510
- p.currentTarget.style.display = "none";
511
- const L = (A = p.currentTarget.parentElement) == null ? void 0 : A.querySelector(".error-placeholder");
512
- L && (L.style.display = "block");
510
+ c.currentTarget.style.display = "none";
511
+ const M = (A = c.currentTarget.parentElement) == null ? void 0 : A.querySelector(".error-placeholder");
512
+ M && (M.style.display = "block");
513
513
  }
514
514
  }
515
515
  ),
@@ -521,13 +521,13 @@ function ha() {
521
521
  ] }),
522
522
  /* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg", children: [
523
523
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-mb-1", children: "Media URL:" }),
524
- /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono", children: E.url })
524
+ /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono", children: V.url })
525
525
  ] })
526
526
  ] }),
527
527
  /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-end rsp-pt-4", children: /* @__PURE__ */ r(
528
528
  "a",
529
529
  {
530
- href: E.url,
530
+ href: V.url,
531
531
  target: "_blank",
532
532
  rel: "noopener noreferrer",
533
533
  className: "rsp-inline-flex rsp-items-center rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-text-sm rsp-font-medium rsp-rounded-md hover:rsp-bg-blue-700 rsp-transition-colors",
@@ -542,64 +542,64 @@ function ha() {
542
542
  )
543
543
  ] });
544
544
  }
545
- const Oe = async (a, n) => {
546
- var i, l, d, f, m, N, w;
545
+ const De = async (a, n) => {
546
+ var i, l, d, p, m, C, g;
547
547
  try {
548
548
  console.log("Creating template with data:", n);
549
- const h = n.language, g = n.headerType === "MEDIA" && n.mediaType === "DOCUMENT", S = n.type === "CAROUSEL";
550
- let V = "";
551
- g ? V = _e(n, h) : S ? V = Fe(n, h) : V = qe(n, h), console.log("Raw JSON string being sent:", V);
552
- const M = {
549
+ const f = n.language, y = n.headerType === "MEDIA" && n.mediaType === "DOCUMENT", j = n.type === "CAROUSEL";
550
+ let U = "";
551
+ y ? U = qe(n, f) : j ? U = He(n, f) : U = Ge(n, f), console.log("Raw JSON string being sent:", U);
552
+ const k = {
553
553
  method: "POST",
554
554
  headers: {
555
555
  "Content-Type": "application/json"
556
556
  },
557
- body: V,
557
+ body: U,
558
558
  redirect: "follow"
559
559
  };
560
560
  console.log(
561
561
  "Making request to:",
562
562
  `https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`
563
- ), console.log("Request options:", M);
564
- const v = await fetch(
563
+ ), console.log("Request options:", k);
564
+ const N = await fetch(
565
565
  `https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`,
566
- M
566
+ k
567
567
  );
568
- console.log("Response status:", v.status), console.log(
568
+ console.log("Response status:", N.status), console.log(
569
569
  "Response headers:",
570
- Object.fromEntries(v.headers.entries())
570
+ Object.fromEntries(N.headers.entries())
571
571
  );
572
- const x = await v.text();
573
- console.log("Raw response:", x);
574
- const b = JSON.parse(x);
575
- if (console.log("Parsed response:", b), !b.success)
576
- throw new Error(b.message || "Template creation failed");
572
+ const o = await N.text();
573
+ console.log("Raw response:", o);
574
+ const u = JSON.parse(o);
575
+ if (console.log("Parsed response:", u), !u.success)
576
+ throw new Error(u.message || "Template creation failed");
577
577
  return {
578
578
  status: "success",
579
579
  message: "Template created successfully",
580
580
  data: {
581
- template: b.template,
581
+ template: u.template,
582
582
  details: [
583
583
  {
584
- template_name: ((i = b.template) == null ? void 0 : i.name) || n.name,
585
- template_id: ((l = b.template) == null ? void 0 : l.id) || "unknown",
586
- meta_tid: (d = b.template) == null ? void 0 : d.meta_tid,
587
- status: (f = b.template) == null ? void 0 : f.status,
588
- quality: (m = b.template) == null ? void 0 : m.quality,
589
- temp_route: (N = b.template) == null ? void 0 : N.temp_route,
590
- temptype: (w = b.template) == null ? void 0 : w.temptype
584
+ template_name: ((i = u.template) == null ? void 0 : i.name) || n.name,
585
+ template_id: ((l = u.template) == null ? void 0 : l.id) || "unknown",
586
+ meta_tid: (d = u.template) == null ? void 0 : d.meta_tid,
587
+ status: (p = u.template) == null ? void 0 : p.status,
588
+ quality: (m = u.template) == null ? void 0 : m.quality,
589
+ temp_route: (C = u.template) == null ? void 0 : C.temp_route,
590
+ temptype: (g = u.template) == null ? void 0 : g.temptype
591
591
  }
592
592
  ]
593
593
  }
594
594
  };
595
- } catch (h) {
596
- return console.error("TrustSignal API Error:", h), {
595
+ } catch (f) {
596
+ return console.error("TrustSignal API Error:", f), {
597
597
  status: "error",
598
- message: h instanceof Error ? h.message : "Failed to create template"
598
+ message: f instanceof Error ? f.message : "Failed to create template"
599
599
  };
600
600
  }
601
- }, _e = (a, n) => {
602
- var f, m;
601
+ }, qe = (a, n) => {
602
+ var p, m;
603
603
  const i = {
604
604
  name: a.name,
605
605
  lang: n,
@@ -613,14 +613,14 @@ const Oe = async (a, n) => {
613
613
  type: "HEADER",
614
614
  format: "DOCUMENT"
615
615
  }));
616
- const l = X(a.body), d = {
616
+ const l = J(a.body), d = {
617
617
  type: "BODY",
618
618
  text: a.body
619
619
  };
620
- if (l.length > 0 && ((f = a.sampleContent) != null && f.bodyVariables)) {
621
- const N = de(a, l);
620
+ if (l.length > 0 && ((p = a.sampleContent) != null && p.bodyVariables)) {
621
+ const C = oe(a, l);
622
622
  d.example = {
623
- body_text: [N]
623
+ body_text: [C]
624
624
  // This creates the required nested array
625
625
  };
626
626
  }
@@ -628,34 +628,34 @@ const Oe = async (a, n) => {
628
628
  type: "FOOTER",
629
629
  text: a.footer
630
630
  }), a.buttons && a.buttons.length > 0) {
631
- const N = a.buttons.map((w) => {
632
- var g;
633
- const h = {
634
- type: w.type === "CALL" ? "PHONE_NUMBER" : w.type,
635
- text: w.text
631
+ const C = a.buttons.map((g) => {
632
+ var y;
633
+ const f = {
634
+ type: g.type === "CALL" ? "PHONE_NUMBER" : g.type,
635
+ text: g.text
636
636
  };
637
- if (w.type === "URL" && w.value && (h.url = w.value, w.urlType === "dynamic" && w.value.includes("{{"))) {
638
- const S = X(w.value);
639
- if (S.length > 0 && ((g = a.sampleContent) != null && g.buttonVariables)) {
640
- const V = S.map(
641
- ({ number: M }) => {
642
- var v, x;
643
- return ((x = (v = a.sampleContent) == null ? void 0 : v.buttonVariables) == null ? void 0 : x[M]) || `sample${M}`;
637
+ if (g.type === "URL" && g.value && (f.url = g.value, g.urlType === "dynamic" && g.value.includes("{{"))) {
638
+ const j = J(g.value);
639
+ if (j.length > 0 && ((y = a.sampleContent) != null && y.buttonVariables)) {
640
+ const U = j.map(
641
+ ({ number: k }) => {
642
+ var N, o;
643
+ return ((o = (N = a.sampleContent) == null ? void 0 : N.buttonVariables) == null ? void 0 : o[k]) || `sample${k}`;
644
644
  }
645
645
  );
646
- h.example = V;
646
+ f.example = U;
647
647
  }
648
648
  }
649
- return (w.type === "CALL" || w.type === "PHONE_NUMBER") && w.value && (h.phone_number = w.value.startsWith("+") ? w.value : `+${w.value}`), h;
649
+ return (g.type === "CALL" || g.type === "PHONE_NUMBER") && g.value && (f.phone_number = g.value.startsWith("+") ? g.value : `+${g.value}`), f;
650
650
  });
651
651
  i.components.push({
652
652
  type: "BUTTONS",
653
- buttons: N
653
+ buttons: C
654
654
  });
655
655
  }
656
656
  return JSON.stringify(i);
657
- }, Fe = (a, n) => {
658
- var m, N, w;
657
+ }, He = (a, n) => {
658
+ var m, C, g;
659
659
  const i = {
660
660
  name: a.name,
661
661
  lang: n,
@@ -663,69 +663,69 @@ const Oe = async (a, n) => {
663
663
  shortlink: a.enableClickTracking ? "1" : "0",
664
664
  components: []
665
665
  };
666
- (m = a.carousel) != null && m.cards.length && (i.media = {}, a.carousel.cards.forEach((h, g) => {
667
- h.mediaUrl && (i.media[`card${g}header`] = h.mediaUrl);
666
+ (m = a.carousel) != null && m.cards.length && (i.media = {}, a.carousel.cards.forEach((f, y) => {
667
+ f.mediaUrl && (i.media[`card${y}header`] = f.mediaUrl);
668
668
  }));
669
- const l = [], d = X(a.body), f = {
669
+ const l = [], d = J(a.body), p = {
670
670
  type: "BODY",
671
671
  text: a.body,
672
- ...d.length > 0 && ((N = a.sampleContent) == null ? void 0 : N.bodyVariables) && {
672
+ ...d.length > 0 && ((C = a.sampleContent) == null ? void 0 : C.bodyVariables) && {
673
673
  example: {
674
- body_text: [de(a, d)]
674
+ body_text: [oe(a, d)]
675
675
  }
676
676
  }
677
677
  };
678
- if (l.push(f), (w = a.carousel) != null && w.cards.length) {
679
- const h = {
678
+ if (l.push(p), (g = a.carousel) != null && g.cards.length) {
679
+ const f = {
680
680
  type: "CAROUSEL",
681
- cards: a.carousel.cards.map((g, S) => {
682
- var V;
681
+ cards: a.carousel.cards.map((y, j) => {
682
+ var U;
683
683
  return {
684
684
  components: [
685
685
  {
686
686
  type: "HEADER",
687
- format: ((V = a.carousel) == null ? void 0 : V.type) || "IMAGE"
687
+ format: ((U = a.carousel) == null ? void 0 : U.type) || "IMAGE"
688
688
  },
689
689
  {
690
690
  type: "BODY",
691
- text: g.body,
692
- ...X(g.body).length > 0 && {
691
+ text: y.body,
692
+ ...J(y.body).length > 0 && {
693
693
  example: {
694
- body_text: [De(g)]
694
+ body_text: [$e(y)]
695
695
  }
696
696
  }
697
697
  },
698
- ...g.buttons.length > 0 ? [{
698
+ ...y.buttons.length > 0 ? [{
699
699
  type: "BUTTONS",
700
- buttons: g.buttons.map((M) => {
701
- var x;
702
- const v = {
703
- type: M.type === "CALL" ? "PHONE_NUMBER" : M.type,
704
- text: M.text
700
+ buttons: y.buttons.map((k) => {
701
+ var o;
702
+ const N = {
703
+ type: k.type === "CALL" ? "PHONE_NUMBER" : k.type,
704
+ text: k.text
705
705
  };
706
- if (M.type === "URL" && M.value && (v.url = M.value, M.urlType === "dynamic" && M.value.includes("{{"))) {
707
- const b = X(M.value);
708
- if (b.length > 0) {
709
- const t = ((x = g == null ? void 0 : g.sampleContent) == null ? void 0 : x.buttonVariables) || {}, u = b.map(({ number: k }) => t[k] || `sample${k}`);
710
- v.example = u;
706
+ if (k.type === "URL" && k.value && (N.url = k.value, k.urlType === "dynamic" && k.value.includes("{{"))) {
707
+ const u = J(k.value);
708
+ if (u.length > 0) {
709
+ const t = ((o = y == null ? void 0 : y.sampleContent) == null ? void 0 : o.buttonVariables) || {}, h = u.map(({ number: v }) => t[v] || `sample${v}`);
710
+ N.example = h;
711
711
  }
712
712
  }
713
- return (M.type === "CALL" || M.type === "PHONE_NUMBER") && M.value && (v.phone_number = M.value), console.log("Carousel card button data:", v), v;
713
+ return (k.type === "CALL" || k.type === "PHONE_NUMBER") && k.value && (N.phone_number = k.value), console.log("Carousel card button data:", N), N;
714
714
  })
715
715
  }] : []
716
716
  ]
717
717
  };
718
718
  })
719
719
  };
720
- l.push(h);
720
+ l.push(f);
721
721
  }
722
722
  return i.components = l, JSON.stringify(i);
723
- }, De = (a) => {
723
+ }, $e = (a) => {
724
724
  var l;
725
- const n = X(a.body || ""), i = ((l = a == null ? void 0 : a.sampleContent) == null ? void 0 : l.bodyVariables) || {};
725
+ const n = J(a.body || ""), i = ((l = a == null ? void 0 : a.sampleContent) == null ? void 0 : l.bodyVariables) || {};
726
726
  return n.map(({ number: d }) => i[d] || `Sample ${d}`);
727
- }, qe = (a, n) => {
728
- var m, N;
727
+ }, Ge = (a, n) => {
728
+ var m, C;
729
729
  const i = {
730
730
  name: a.name,
731
731
  lang: n,
@@ -739,91 +739,91 @@ const Oe = async (a, n) => {
739
739
  const l = [];
740
740
  if (a.type !== "CAROUSEL") {
741
741
  if (a.headerType === "TEXT" && a.headerText) {
742
- const w = X(a.headerText), h = {
742
+ const g = J(a.headerText), f = {
743
743
  type: "HEADER",
744
744
  format: "TEXT",
745
745
  text: a.headerText,
746
- ...w.length > 0 && ((m = a.sampleContent) == null ? void 0 : m.headerVariables) && {
746
+ ...g.length > 0 && ((m = a.sampleContent) == null ? void 0 : m.headerVariables) && {
747
747
  example: {
748
- header_text: He(a, w)
748
+ header_text: We(a, g)
749
749
  }
750
750
  }
751
751
  };
752
- l.push(h);
752
+ l.push(f);
753
753
  } else if (a.headerType === "MEDIA") {
754
- const w = {
754
+ const g = {
755
755
  type: "HEADER",
756
756
  format: a.mediaType || "IMAGE"
757
757
  };
758
- l.push(w);
758
+ l.push(g);
759
759
  }
760
760
  }
761
- const d = X(a.body), f = {
761
+ const d = J(a.body), p = {
762
762
  type: "BODY",
763
763
  text: a.body,
764
- ...d.length > 0 && ((N = a.sampleContent) == null ? void 0 : N.bodyVariables) && {
764
+ ...d.length > 0 && ((C = a.sampleContent) == null ? void 0 : C.bodyVariables) && {
765
765
  example: {
766
- body_text: [de(a, d)]
766
+ body_text: [oe(a, d)]
767
767
  }
768
768
  }
769
769
  };
770
- if (l.push(f), a.footer && a.type !== "CAROUSEL" && l.push({
770
+ if (l.push(p), a.footer && a.type !== "CAROUSEL" && l.push({
771
771
  type: "FOOTER",
772
772
  text: a.footer
773
773
  }), a.buttons.length > 0) {
774
- const w = a.buttons.map((h) => {
775
- var S;
776
- const g = {
777
- type: h.type === "CALL" ? "PHONE_NUMBER" : h.type,
778
- text: h.text
774
+ const g = a.buttons.map((f) => {
775
+ var j;
776
+ const y = {
777
+ type: f.type === "CALL" ? "PHONE_NUMBER" : f.type,
778
+ text: f.text
779
779
  };
780
- if (h.type === "URL" && h.value && (g.url = h.value, h.urlType === "dynamic" && h.value.includes("{{"))) {
781
- const V = X(h.value);
782
- if (V.length > 0 && ((S = a.sampleContent) != null && S.buttonVariables)) {
783
- const M = V.map(
784
- ({ number: v }) => {
785
- var x, b;
786
- return ((b = (x = a.sampleContent) == null ? void 0 : x.buttonVariables) == null ? void 0 : b[v]) || `sample${v}`;
780
+ if (f.type === "URL" && f.value && (y.url = f.value, f.urlType === "dynamic" && f.value.includes("{{"))) {
781
+ const U = J(f.value);
782
+ if (U.length > 0 && ((j = a.sampleContent) != null && j.buttonVariables)) {
783
+ const k = U.map(
784
+ ({ number: N }) => {
785
+ var o, u;
786
+ return ((u = (o = a.sampleContent) == null ? void 0 : o.buttonVariables) == null ? void 0 : u[N]) || `sample${N}`;
787
787
  }
788
788
  );
789
- g.example = M;
789
+ y.example = k;
790
790
  }
791
791
  }
792
- return (h.type === "CALL" || h.type === "PHONE_NUMBER") && h.value && (g.phone_number = h.value), g;
792
+ return (f.type === "CALL" || f.type === "PHONE_NUMBER") && f.value && (y.phone_number = f.value), y;
793
793
  });
794
794
  l.push({
795
795
  type: "BUTTONS",
796
- buttons: w
796
+ buttons: g
797
797
  });
798
798
  }
799
799
  return i.components = l, JSON.stringify(i);
800
- }, X = (a) => (a.match(/\{\{(\d+)\}\}/g) || []).map((i) => ({
800
+ }, J = (a) => (a.match(/\{\{(\d+)\}\}/g) || []).map((i) => ({
801
801
  variable: i.replace(/[{}]/g, ""),
802
802
  number: i.replace(/[{}]/g, "")
803
- })), He = (a, n) => n.map(
803
+ })), We = (a, n) => n.map(
804
804
  ({ number: i }) => {
805
805
  var l, d;
806
806
  return ((d = (l = a.sampleContent) == null ? void 0 : l.headerVariables) == null ? void 0 : d[i]) || `Sample ${i}`;
807
807
  }
808
- ), de = (a, n) => n.map(
808
+ ), oe = (a, n) => n.map(
809
809
  ({ number: i }) => {
810
810
  var l, d;
811
811
  return ((d = (l = a.sampleContent) == null ? void 0 : l.bodyVariables) == null ? void 0 : d[i]) || `Sample ${i}`;
812
812
  }
813
- ), $e = async (a, n) => {
813
+ ), Ke = async (a, n) => {
814
814
  try {
815
815
  if (!n.name || !n.body)
816
816
  throw new Error("Missing required template fields: name and body are required");
817
817
  if (!a.apiKey)
818
818
  throw new Error("Missing TrustSignal API key");
819
- return await Oe(a.apiKey, n);
819
+ return await De(a.apiKey, n);
820
820
  } catch (i) {
821
821
  return console.error("API Error:", i), {
822
822
  status: "error",
823
823
  message: i instanceof Error ? i.message : "An unexpected error occurred while creating the template"
824
824
  };
825
825
  }
826
- }, Ge = [
826
+ }, Qe = [
827
827
  { value: "af", label: "Afrikaans" },
828
828
  { value: "sq", label: "Albanian" },
829
829
  { value: "ar", label: "Arabic" },
@@ -888,118 +888,118 @@ const Oe = async (a, n) => {
888
888
  { value: "ur", label: "Urdu" },
889
889
  { value: "uz", label: "Uzbek" },
890
890
  { value: "vi", label: "Vietnamese" }
891
- ], We = [
891
+ ], Ye = [
892
892
  { value: "NONE", label: "None" },
893
893
  { value: "TEXT", label: "Text" },
894
894
  { value: "MEDIA", label: "Media" }
895
- ], Ke = [
895
+ ], Xe = [
896
896
  { value: "IMAGE", label: "Image" },
897
897
  { value: "VIDEO", label: "Video" },
898
898
  { value: "DOCUMENT", label: "Document" }
899
- ], Qe = 5 * 1024 * 1024, Ye = 16 * 1024 * 1024, Xe = 100 * 1024 * 1024, se = ["jpg", "jpeg", "png"], ne = ["mp4", "3gpp"], le = ["pdf", "docx", "xlsx", "pptx", "txt"];
900
- function Je({ template: a, setTemplate: n, onFileUpload: i }) {
901
- var U, B;
902
- const [l, d] = Q.useState(null), [f, m] = Q.useState(!1), [N, w] = Q.useState(null), [h, g] = Q.useState(null), S = () => {
903
- const c = (a.headerText || "").match(/{{\d+}}/g);
904
- if (!c) return 0;
905
- const o = c.map((y) => {
906
- const C = y.match(/{{(\d+)}}/);
907
- return C ? parseInt(C[1], 10) : 0;
899
+ ], Je = 5 * 1024 * 1024, Ze = 16 * 1024 * 1024, ea = 100 * 1024 * 1024, ie = ["jpg", "jpeg", "png"], te = ["mp4", "3gpp"], me = ["pdf", "docx", "xlsx", "pptx", "txt"];
900
+ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
901
+ var R, I;
902
+ const [l, d] = K.useState(null), [p, m] = K.useState(!1), [C, g] = K.useState(null), [f, y] = K.useState(null), j = () => {
903
+ const w = (a.headerText || "").match(/{{\d+}}/g);
904
+ if (!w) return 0;
905
+ const L = w.map((s) => {
906
+ const b = s.match(/{{(\d+)}}/);
907
+ return b ? parseInt(b[1], 10) : 0;
908
908
  });
909
- return o.length > 0 ? Math.max(...o) : 0;
910
- }, V = () => {
911
- const o = `{{${S() + 1}}}`;
912
- if (N && a.headerText.length + o.length <= 60) {
913
- const y = N.selectionStart || a.headerText.length, C = a.headerText.substring(0, y), j = a.headerText.substring(y), R = C + o + j;
914
- n({ ...a, headerText: R }), setTimeout(() => {
915
- if (N) {
916
- const p = y + o.length;
917
- N.setSelectionRange(p, p), N.focus();
909
+ return L.length > 0 ? Math.max(...L) : 0;
910
+ }, U = () => {
911
+ const L = `{{${j() + 1}}}`;
912
+ if (C && a.headerText.length + L.length <= 60) {
913
+ const s = C.selectionStart || a.headerText.length, b = a.headerText.substring(0, s), E = a.headerText.substring(s), T = b + L + E;
914
+ n({ ...a, headerText: T }), setTimeout(() => {
915
+ if (C) {
916
+ const c = s + L.length;
917
+ C.setSelectionRange(c, c), C.focus();
918
918
  }
919
919
  }, 0);
920
920
  }
921
- }, M = (s) => {
922
- n((c) => ({
923
- ...c,
924
- headerType: s,
925
- headerText: s === "TEXT" ? c.headerText : "",
926
- mediaType: s === "MEDIA" ? c.mediaType || "IMAGE" : void 0,
927
- mediaUrl: s === "MEDIA" ? c.mediaUrl : void 0
928
- })), s !== "MEDIA" && (d(null), g(null));
929
- }, v = (s) => {
930
- var c;
931
- return ((c = s.split("?")[0].split(".").pop()) == null ? void 0 : c.toLowerCase()) || "";
932
- }, x = (s, c) => {
933
- const o = v(s.name);
934
- switch (c) {
921
+ }, k = (x) => {
922
+ n((w) => ({
923
+ ...w,
924
+ headerType: x,
925
+ headerText: x === "TEXT" ? w.headerText : "",
926
+ mediaType: x === "MEDIA" ? w.mediaType || "IMAGE" : void 0,
927
+ mediaUrl: x === "MEDIA" ? w.mediaUrl : void 0
928
+ })), x !== "MEDIA" && (d(null), y(null));
929
+ }, N = (x) => {
930
+ var w;
931
+ return ((w = x.split("?")[0].split(".").pop()) == null ? void 0 : w.toLowerCase()) || "";
932
+ }, o = (x, w) => {
933
+ const L = N(x.name);
934
+ switch (w) {
935
935
  case "IMAGE":
936
- if (!se.includes(o)) return "Invalid format. Only JPG, JPEG, PNG are allowed.";
937
- if (s.size > Qe) return "File is too large. Max size is 5 MB.";
936
+ if (!ie.includes(L)) return "Invalid format. Only JPG, JPEG, PNG are allowed.";
937
+ if (x.size > Je) return "File is too large. Max size is 5 MB.";
938
938
  break;
939
939
  case "VIDEO":
940
- if (!ne.includes(o)) return "Invalid format. Only MP4, 3GPP are allowed.";
941
- if (s.size > Ye) return "File is too large. Max size is 16 MB.";
940
+ if (!te.includes(L)) return "Invalid format. Only MP4, 3GPP are allowed.";
941
+ if (x.size > Ze) return "File is too large. Max size is 16 MB.";
942
942
  break;
943
943
  case "DOCUMENT":
944
- if (!le.includes(o)) return "Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";
945
- if (s.size > Xe) return "File is too large. Max size is 100 MB.";
944
+ if (!me.includes(L)) return "Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";
945
+ if (x.size > ea) return "File is too large. Max size is 100 MB.";
946
946
  break;
947
947
  default:
948
948
  return "Invalid media type.";
949
949
  }
950
950
  return null;
951
- }, b = (s, c) => {
952
- if (!s) return null;
953
- const o = v(s);
954
- switch (c) {
951
+ }, u = (x, w) => {
952
+ if (!x) return null;
953
+ const L = N(x);
954
+ switch (w) {
955
955
  case "IMAGE":
956
- if (!se.includes(o)) return "URL does not point to a valid image (JPG, JPEG, PNG).";
956
+ if (!ie.includes(L)) return "URL does not point to a valid image (JPG, JPEG, PNG).";
957
957
  break;
958
958
  case "VIDEO":
959
- if (!ne.includes(o)) return "URL does not point to a valid video (MP4, 3GPP).";
959
+ if (!te.includes(L)) return "URL does not point to a valid video (MP4, 3GPP).";
960
960
  break;
961
961
  case "DOCUMENT":
962
- if (!le.includes(o)) return "URL does not point to a valid document.";
962
+ if (!me.includes(L)) return "URL does not point to a valid document.";
963
963
  break;
964
964
  }
965
965
  return null;
966
966
  }, t = () => {
967
- d(null), n({ ...a, mediaUrl: "" }), g(null);
968
- }, u = async (s) => {
969
- var y;
970
- const c = (y = s.target.files) == null ? void 0 : y[0];
971
- if (!c || !a.mediaType) return;
972
- g(null);
973
- const o = x(c, a.mediaType);
974
- if (o) {
975
- g(o);
967
+ d(null), n({ ...a, mediaUrl: "" }), y(null);
968
+ }, h = async (x) => {
969
+ var s;
970
+ const w = (s = x.target.files) == null ? void 0 : s[0];
971
+ if (!w || !a.mediaType) return;
972
+ y(null);
973
+ const L = o(w, a.mediaType);
974
+ if (L) {
975
+ y(L);
976
976
  return;
977
977
  }
978
- m(!0), d(c);
978
+ m(!0), d(w);
979
979
  try {
980
- const C = await i(c);
981
- n({ ...a, mediaUrl: C });
982
- } catch (C) {
983
- console.error("File upload failed:", C), t();
984
- const j = C instanceof Error ? C.message : "File upload failed. Please try again.";
985
- g(j);
980
+ const b = await i(w);
981
+ n({ ...a, mediaUrl: b });
982
+ } catch (b) {
983
+ console.error("File upload failed:", b), t();
984
+ const E = b instanceof Error ? b.message : "File upload failed. Please try again.";
985
+ y(E);
986
986
  } finally {
987
987
  m(!1);
988
988
  }
989
- }, k = (s) => {
990
- const c = s.target.value;
991
- if (d(null), n({ ...a, mediaUrl: c }), a.mediaType) {
992
- const o = b(c, a.mediaType);
993
- g(o);
989
+ }, v = (x) => {
990
+ const w = x.target.value;
991
+ if (d(null), n({ ...a, mediaUrl: w }), a.mediaType) {
992
+ const L = u(w, a.mediaType);
993
+ y(L);
994
994
  }
995
- }, E = () => {
995
+ }, V = () => {
996
996
  switch (a.mediaType) {
997
997
  case "IMAGE":
998
- return se.map((s) => `.${s}`).join(",");
998
+ return ie.map((x) => `.${x}`).join(",");
999
999
  case "VIDEO":
1000
- return ne.map((s) => `.${s}`).join(",");
1000
+ return te.map((x) => `.${x}`).join(",");
1001
1001
  case "DOCUMENT":
1002
- return le.map((s) => `.${s}`).join(",");
1002
+ return me.map((x) => `.${x}`).join(",");
1003
1003
  default:
1004
1004
  return "*/*";
1005
1005
  }
@@ -1012,9 +1012,9 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1012
1012
  "select",
1013
1013
  {
1014
1014
  value: a.headerType,
1015
- onChange: (s) => M(s.target.value),
1015
+ onChange: (x) => k(x.target.value),
1016
1016
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
1017
- children: We.map((s) => /* @__PURE__ */ e("option", { value: s.value, children: s.label }, s.value))
1017
+ children: Ye.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
1018
1018
  }
1019
1019
  ),
1020
1020
  /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }),
@@ -1026,10 +1026,10 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1026
1026
  /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
1027
1027
  "input",
1028
1028
  {
1029
- ref: w,
1029
+ ref: g,
1030
1030
  type: "text",
1031
1031
  value: a.headerText,
1032
- onChange: (s) => n({ ...a, headerText: s.target.value }),
1032
+ onChange: (x) => n({ ...a, headerText: x.target.value }),
1033
1033
  maxLength: 60,
1034
1034
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
1035
1035
  placeholder: "Add a 60 character title to your message"
@@ -1039,7 +1039,7 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1039
1039
  /* @__PURE__ */ e(
1040
1040
  "button",
1041
1041
  {
1042
- onClick: V,
1042
+ onClick: U,
1043
1043
  className: "rsp-px-2 rsp-py-1 rsp-text-xs hover:rsp-bg-gray-100 rsp-rounded rsp-text-gray-500 rsp-flex rsp-items-center rsp-gap-1",
1044
1044
  title: "Add variable to header",
1045
1045
  children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
@@ -1051,30 +1051,30 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1051
1051
  ] })
1052
1052
  ] }),
1053
1053
  (() => {
1054
- const s = [...new Set((a.headerText.match(/\{\{(\d+)\}\}/g) || []).map((c) => c.replace(/[{}]/g, "")))];
1055
- return s.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
1054
+ const x = [...new Set((a.headerText.match(/\{\{(\d+)\}\}/g) || []).map((w) => w.replace(/[{}]/g, "")))];
1055
+ return x.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
1056
1056
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
1057
- /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: s.map((c) => {
1058
- var o, y;
1057
+ /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: x.map((w) => {
1058
+ var L, s;
1059
1059
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
1060
1060
  /* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
1061
- `{{${c}}}`,
1061
+ `{{${w}}}`,
1062
1062
  ":"
1063
1063
  ] }),
1064
1064
  /* @__PURE__ */ e(
1065
1065
  "input",
1066
1066
  {
1067
1067
  type: "text",
1068
- value: ((y = (o = a.sampleContent) == null ? void 0 : o.headerVariables) == null ? void 0 : y[c]) || "",
1069
- onChange: (C) => {
1070
- var R, p, L;
1071
- const j = {
1068
+ value: ((s = (L = a.sampleContent) == null ? void 0 : L.headerVariables) == null ? void 0 : s[w]) || "",
1069
+ onChange: (b) => {
1070
+ var T, c, M;
1071
+ const E = {
1072
1072
  ...a.sampleContent,
1073
- headerVariables: { ...(R = a.sampleContent) == null ? void 0 : R.headerVariables, [c]: C.target.value },
1074
- bodyVariables: ((p = a.sampleContent) == null ? void 0 : p.bodyVariables) || {},
1075
- buttonVariables: ((L = a.sampleContent) == null ? void 0 : L.buttonVariables) || {}
1073
+ headerVariables: { ...(T = a.sampleContent) == null ? void 0 : T.headerVariables, [w]: b.target.value },
1074
+ bodyVariables: ((c = a.sampleContent) == null ? void 0 : c.bodyVariables) || {},
1075
+ buttonVariables: ((M = a.sampleContent) == null ? void 0 : M.buttonVariables) || {}
1076
1076
  };
1077
- n({ ...a, sampleContent: j });
1077
+ n({ ...a, sampleContent: E });
1078
1078
  },
1079
1079
  className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
1080
1080
  placeholder: "Sample"
@@ -1085,15 +1085,15 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1085
1085
  {
1086
1086
  type: "button",
1087
1087
  onClick: () => {
1088
- var p, L, A;
1089
- const C = new RegExp(`\\{\\{${c}\\}\\}`, "g"), j = (a.headerText || "").replace(C, ""), R = Object.fromEntries(Object.entries(((p = a.sampleContent) == null ? void 0 : p.headerVariables) || {}).filter(([T]) => T !== c));
1088
+ var c, M, A;
1089
+ const b = new RegExp(`\\{\\{${w}\\}\\}`, "g"), E = (a.headerText || "").replace(b, ""), T = Object.fromEntries(Object.entries(((c = a.sampleContent) == null ? void 0 : c.headerVariables) || {}).filter(([O]) => O !== w));
1090
1090
  n({
1091
1091
  ...a,
1092
- headerText: j,
1092
+ headerText: E,
1093
1093
  sampleContent: {
1094
1094
  ...a.sampleContent,
1095
- headerVariables: R,
1096
- bodyVariables: ((L = a.sampleContent) == null ? void 0 : L.bodyVariables) || {},
1095
+ headerVariables: T,
1096
+ bodyVariables: ((M = a.sampleContent) == null ? void 0 : M.bodyVariables) || {},
1097
1097
  buttonVariables: ((A = a.sampleContent) == null ? void 0 : A.buttonVariables) || {}
1098
1098
  }
1099
1099
  });
@@ -1103,7 +1103,7 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1103
1103
  children: "×"
1104
1104
  }
1105
1105
  )
1106
- ] }, `header-sample-${c}`);
1106
+ ] }, `header-sample-${w}`);
1107
1107
  }) })
1108
1108
  ] });
1109
1109
  })()
@@ -1116,15 +1116,15 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1116
1116
  "select",
1117
1117
  {
1118
1118
  value: a.mediaType || "IMAGE",
1119
- onChange: (s) => {
1120
- n((c) => ({
1121
- ...c,
1122
- mediaType: s.target.value,
1119
+ onChange: (x) => {
1120
+ n((w) => ({
1121
+ ...w,
1122
+ mediaType: x.target.value,
1123
1123
  mediaUrl: ""
1124
- })), d(null), g(null);
1124
+ })), d(null), y(null);
1125
1125
  },
1126
1126
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
1127
- children: Ke.map((s) => /* @__PURE__ */ e("option", { value: s.value, children: s.label }, s.value))
1127
+ children: Xe.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
1128
1128
  }
1129
1129
  ),
1130
1130
  /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) })
@@ -1140,32 +1140,32 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1140
1140
  src: a.mediaUrl,
1141
1141
  alt: "Preview",
1142
1142
  className: "rsp-w-12 rsp-h-12 rsp-object-cover rsp-rounded",
1143
- onError: (s) => {
1144
- s.currentTarget.style.display = "none", h || g("Could not load image preview from URL.");
1143
+ onError: (x) => {
1144
+ x.currentTarget.style.display = "none", f || y("Could not load image preview from URL.");
1145
1145
  },
1146
1146
  onLoad: () => {
1147
- h != null && h.includes("Could not load") && g(null);
1147
+ f != null && f.includes("Could not load") && y(null);
1148
1148
  }
1149
1149
  }
1150
1150
  ),
1151
- a.mediaType === "VIDEO" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(Re, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
1152
- a.mediaType === "DOCUMENT" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(Ae, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
1151
+ a.mediaType === "VIDEO" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(ze, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
1152
+ a.mediaType === "DOCUMENT" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(Ie, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
1153
1153
  /* @__PURE__ */ r("div", { className: "overflow-hidden", children: [
1154
1154
  /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate", children: l ? l.name : a.mediaUrl }),
1155
1155
  l && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500", children: `${(l.size / 1024 / 1024).toFixed(2)} MB` })
1156
1156
  ] })
1157
1157
  ] }),
1158
- /* @__PURE__ */ e("button", { onClick: t, className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0", children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4" }) })
1158
+ /* @__PURE__ */ e("button", { onClick: t, className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0", children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" }) })
1159
1159
  ] }) : /* @__PURE__ */ r("div", { children: [
1160
- /* @__PURE__ */ e("input", { type: "file", accept: E(), onChange: u, className: "rsp-hidden", id: "media-upload", disabled: f }),
1160
+ /* @__PURE__ */ e("input", { type: "file", accept: V(), onChange: h, className: "rsp-hidden", id: "media-upload", disabled: p }),
1161
1161
  /* @__PURE__ */ r(
1162
1162
  "label",
1163
1163
  {
1164
1164
  htmlFor: "media-upload",
1165
- className: `rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${f ? "rsp-opacity-50 rsp-cursor-not-allowed" : ""}`,
1165
+ className: `rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${p ? "rsp-opacity-50 rsp-cursor-not-allowed" : ""}`,
1166
1166
  children: [
1167
- /* @__PURE__ */ e(ze, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2" }),
1168
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: f ? "Uploading..." : `Upload ${((U = a.mediaType) == null ? void 0 : U.toLowerCase()) || "file"}` }),
1167
+ /* @__PURE__ */ e(_e, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2" }),
1168
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: p ? "Uploading..." : `Upload ${((R = a.mediaType) == null ? void 0 : R.toLowerCase()) || "file"}` }),
1169
1169
  /* @__PURE__ */ r("span", { className: "rsp-text-xs rsp-text-gray-400 rsp-mt-1", children: [
1170
1170
  a.mediaType === "IMAGE" && "JPG, PNG up to 5MB",
1171
1171
  a.mediaType === "VIDEO" && "MP4, 3GPP up to 16MB",
@@ -1175,9 +1175,9 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1175
1175
  }
1176
1176
  )
1177
1177
  ] }),
1178
- h && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600", children: [
1179
- /* @__PURE__ */ e(ie, { className: "rsp-w-4 rsp-h-4" }),
1180
- /* @__PURE__ */ e("span", { children: h })
1178
+ f && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600", children: [
1179
+ /* @__PURE__ */ e(ce, { className: "rsp-w-4 rsp-h-4" }),
1180
+ /* @__PURE__ */ e("span", { children: f })
1181
1181
  ] }),
1182
1182
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center", children: [
1183
1183
  /* @__PURE__ */ e("div", { className: "rsp-flex-1 rsp-border-t rsp-border-gray-300" }),
@@ -1189,16 +1189,16 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
1189
1189
  {
1190
1190
  type: "url",
1191
1191
  value: a.mediaUrl || "",
1192
- onChange: k,
1192
+ onChange: v,
1193
1193
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
1194
- placeholder: `Enter ${(B = a.mediaType) == null ? void 0 : B.toLowerCase()} URL`
1194
+ placeholder: `Enter ${(I = a.mediaType) == null ? void 0 : I.toLowerCase()} URL`
1195
1195
  }
1196
1196
  ) })
1197
1197
  ] })
1198
1198
  ] })
1199
1199
  ] });
1200
1200
  }
1201
- const be = [
1201
+ const we = [
1202
1202
  { name: "grinning-face", hexadecimal: "&#x1f600;" },
1203
1203
  { name: "grinning-face-with-smiling-eyes", hexadecimal: "&#x1f601;" },
1204
1204
  { name: "face-with-tears-of-joy", hexadecimal: "&#x1f602;" },
@@ -2997,56 +2997,56 @@ const be = [
2997
2997
  { name: "south-africa", hexadecimal: "&#x1f1ff;&#x1f1e6;" },
2998
2998
  { name: "zambia", hexadecimal: "&#x1f1ff;&#x1f1f2;" },
2999
2999
  { name: "zimbabwe", hexadecimal: "&#x1f1ff;&#x1f1fc;" }
3000
- ], Ze = ({
3000
+ ], ra = ({
3001
3001
  emojis: a,
3002
3002
  onSelect: n,
3003
3003
  onClose: i
3004
3004
  }) => {
3005
- const [l, d] = I({ start: 0, end: 80 }), f = 8, m = 40, N = 400, w = he((V) => {
3006
- const M = V.currentTarget.scrollTop, v = Math.floor(M / m), x = Math.min(
3007
- v + Math.ceil(N / m) + 2,
3008
- Math.ceil(a.length / f)
3005
+ const [l, d] = B({ start: 0, end: 80 }), p = 8, m = 40, C = 400, g = ge((U) => {
3006
+ const k = U.currentTarget.scrollTop, N = Math.floor(k / m), o = Math.min(
3007
+ N + Math.ceil(C / m) + 2,
3008
+ Math.ceil(a.length / p)
3009
3009
  );
3010
3010
  d({
3011
- start: v * f,
3012
- end: x * f
3011
+ start: N * p,
3012
+ end: o * p
3013
3013
  });
3014
- }, [a.length, m, N, f]), h = he((V) => {
3015
- const M = V.match(/&#x([0-9A-Fa-f]+);/g);
3016
- if (!M) return "";
3017
- const v = M.map((x) => {
3018
- const b = x.replace(/&#x|;/g, "");
3019
- return parseInt(b, 16);
3014
+ }, [a.length, m, C, p]), f = ge((U) => {
3015
+ const k = U.match(/&#x([0-9A-Fa-f]+);/g);
3016
+ if (!k) return "";
3017
+ const N = k.map((o) => {
3018
+ const u = o.replace(/&#x|;/g, "");
3019
+ return parseInt(u, 16);
3020
3020
  });
3021
- return String.fromCodePoint(...v);
3022
- }, []), g = Math.ceil(a.length / f) * m, S = a.slice(l.start, l.end);
3021
+ return String.fromCodePoint(...N);
3022
+ }, []), y = Math.ceil(a.length / p) * m, j = a.slice(l.start, l.end);
3023
3023
  return /* @__PURE__ */ e(
3024
3024
  "div",
3025
3025
  {
3026
3026
  className: "rsp-h-[400px] rsp-overflow-y-auto rsp-relative",
3027
- onScroll: w,
3028
- children: /* @__PURE__ */ e("div", { style: { height: g }, className: "rsp-relative", children: /* @__PURE__ */ e(
3027
+ onScroll: g,
3028
+ children: /* @__PURE__ */ e("div", { style: { height: y }, className: "rsp-relative", children: /* @__PURE__ */ e(
3029
3029
  "div",
3030
3030
  {
3031
3031
  className: "rsp-absolute rsp-w-full rsp-grid rsp-grid-cols-8 rsp-gap-1",
3032
3032
  style: {
3033
- top: Math.floor(l.start / f) * m,
3033
+ top: Math.floor(l.start / p) * m,
3034
3034
  transform: "translateY(0px)"
3035
3035
  },
3036
- children: S.map((V, M) => {
3037
- const v = l.start + M;
3036
+ children: j.map((U, k) => {
3037
+ const N = l.start + k;
3038
3038
  return /* @__PURE__ */ e(
3039
3039
  "button",
3040
3040
  {
3041
3041
  onClick: () => {
3042
- n(h(V.hexadecimal));
3042
+ n(f(U.hexadecimal));
3043
3043
  },
3044
3044
  className: "rsp-w-10 rsp-h-10 rsp-flex rsp-items-center rsp-justify-center rsp-text-xl hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",
3045
- title: V.name,
3045
+ title: U.name,
3046
3046
  style: { height: m },
3047
- children: h(V.hexadecimal)
3047
+ children: f(U.hexadecimal)
3048
3048
  },
3049
- v
3049
+ N
3050
3050
  );
3051
3051
  })
3052
3052
  }
@@ -3054,13 +3054,13 @@ const be = [
3054
3054
  }
3055
3055
  );
3056
3056
  };
3057
- function xe({ isOpen: a, onClose: n, onSelect: i }) {
3058
- const [l, d] = I(""), f = we(() => l ? be.filter(
3057
+ function fe({ isOpen: a, onClose: n, onSelect: i }) {
3058
+ const [l, d] = B(""), p = Ne(() => l ? we.filter(
3059
3059
  (m) => m.name.toLowerCase().includes(l.toLowerCase())
3060
- ) : be, [l]);
3061
- return Q.useEffect(() => {
3060
+ ) : we, [l]);
3061
+ return K.useEffect(() => {
3062
3062
  a || d("");
3063
- }, [a]), /* @__PURE__ */ e(ce, { isOpen: a, onClose: n, title: "Select Emoji", children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
3063
+ }, [a]), /* @__PURE__ */ e(pe, { isOpen: a, onClose: n, title: "Select Emoji", children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
3064
3064
  /* @__PURE__ */ r("div", { className: "rsp-relative", children: [
3065
3065
  /* @__PURE__ */ e(
3066
3066
  "input",
@@ -3093,74 +3093,74 @@ function xe({ isOpen: a, onClose: n, onSelect: i }) {
3093
3093
  m
3094
3094
  )) }),
3095
3095
  /* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-500", children: [
3096
- f.length,
3096
+ p.length,
3097
3097
  " emojis found"
3098
3098
  ] }),
3099
3099
  /* @__PURE__ */ e(
3100
- Ze,
3100
+ ra,
3101
3101
  {
3102
- emojis: f,
3102
+ emojis: p,
3103
3103
  onSelect: i,
3104
3104
  onClose: n
3105
3105
  }
3106
3106
  )
3107
3107
  ] }) });
3108
3108
  }
3109
- function ea({ template: a, setTemplate: n }) {
3110
- const [i, l] = I(!1), [d, f] = I(null), [m, N] = I(null), [w, h] = I(null), g = () => {
3111
- const x = (a.body || "").match(/{{\d+}}/g);
3112
- if (!x) return 0;
3113
- const b = x.map((t) => {
3114
- const u = t.match(/{{(\d+)}}/);
3115
- return u ? parseInt(u[1], 10) : 0;
3109
+ function sa({ template: a, setTemplate: n }) {
3110
+ const [i, l] = B(!1), [d, p] = B(null), [m, C] = B(null), [g, f] = B(null), y = () => {
3111
+ const o = (a.body || "").match(/{{\d+}}/g);
3112
+ if (!o) return 0;
3113
+ const u = o.map((t) => {
3114
+ const h = t.match(/{{(\d+)}}/);
3115
+ return h ? parseInt(h[1], 10) : 0;
3116
3116
  });
3117
- return b.length > 0 ? Math.max(...b) : 0;
3118
- }, S = () => {
3119
- const b = `{{${g() + 1}}}`;
3120
- if (m && a.body.length + b.length <= 1024) {
3121
- const t = m.selectionStart || a.body.length, u = a.body.substring(0, t), k = a.body.substring(t), E = u + b + k;
3117
+ return u.length > 0 ? Math.max(...u) : 0;
3118
+ }, j = () => {
3119
+ const u = `{{${y() + 1}}}`;
3120
+ if (m && a.body.length + u.length <= 1024) {
3121
+ const t = m.selectionStart || a.body.length, h = a.body.substring(0, t), v = a.body.substring(t), V = h + u + v;
3122
3122
  n({
3123
3123
  ...a,
3124
- body: E
3124
+ body: V
3125
3125
  }), setTimeout(() => {
3126
3126
  if (m) {
3127
- const U = t + b.length;
3128
- m.setSelectionRange(U, U), m.focus();
3127
+ const R = t + u.length;
3128
+ m.setSelectionRange(R, R), m.focus();
3129
3129
  }
3130
3130
  }, 0);
3131
3131
  }
3132
- }, V = () => {
3133
- f("body"), l(!0), setTimeout(() => {
3132
+ }, U = () => {
3133
+ p("body"), l(!0), setTimeout(() => {
3134
3134
  m && m.focus();
3135
3135
  }, 0);
3136
- }, M = (v) => {
3136
+ }, k = (N) => {
3137
3137
  if (d === "body") {
3138
3138
  if (!m) return;
3139
- const x = m.selectionStart || a.body.length, b = 1024, t = a.body;
3140
- if (t.length + v.length <= b) {
3141
- const u = t.substring(0, x), k = t.substring(x), E = u + v + k;
3139
+ const o = m.selectionStart || a.body.length, u = 1024, t = a.body;
3140
+ if (t.length + N.length <= u) {
3141
+ const h = t.substring(0, o), v = t.substring(o), V = h + N + v;
3142
3142
  n({
3143
3143
  ...a,
3144
- body: E
3144
+ body: V
3145
3145
  }), setTimeout(() => {
3146
3146
  if (m) {
3147
- const U = x + v.length;
3148
- m.setSelectionRange(U, U), m.focus();
3147
+ const R = o + N.length;
3148
+ m.setSelectionRange(R, R), m.focus();
3149
3149
  }
3150
3150
  }, 0);
3151
3151
  }
3152
3152
  } else if (d === "footer") {
3153
- if (!w) return;
3154
- const x = w.selectionStart || a.footer.length, b = 60, t = a.footer;
3155
- if (t.length + v.length <= b) {
3156
- const u = t.substring(0, x), k = t.substring(x), E = u + v + k;
3153
+ if (!g) return;
3154
+ const o = g.selectionStart || a.footer.length, u = 60, t = a.footer;
3155
+ if (t.length + N.length <= u) {
3156
+ const h = t.substring(0, o), v = t.substring(o), V = h + N + v;
3157
3157
  n({
3158
3158
  ...a,
3159
- footer: E
3159
+ footer: V
3160
3160
  }), setTimeout(() => {
3161
- if (w) {
3162
- const U = x + v.length;
3163
- w.setSelectionRange(U, U), w.focus();
3161
+ if (g) {
3162
+ const R = o + N.length;
3163
+ g.setSelectionRange(R, R), g.focus();
3164
3164
  }
3165
3165
  }, 0);
3166
3166
  }
@@ -3172,14 +3172,14 @@ function ea({ template: a, setTemplate: n }) {
3172
3172
  /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
3173
3173
  "textarea",
3174
3174
  {
3175
- ref: N,
3175
+ ref: C,
3176
3176
  value: a.body,
3177
- onChange: (v) => n({ ...a, body: v.target.value }),
3177
+ onChange: (N) => n({ ...a, body: N.target.value }),
3178
3178
  maxLength: 1024,
3179
3179
  rows: 6,
3180
3180
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none rsp-shadow-sm",
3181
3181
  placeholder: "Enter the text for your message",
3182
- onFocus: () => f("body")
3182
+ onFocus: () => p("body")
3183
3183
  }
3184
3184
  ) }),
3185
3185
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mt-2", children: [
@@ -3187,7 +3187,7 @@ function ea({ template: a, setTemplate: n }) {
3187
3187
  /* @__PURE__ */ e(
3188
3188
  "button",
3189
3189
  {
3190
- onClick: S,
3190
+ onClick: j,
3191
3191
  className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
3192
3192
  title: "Add Variable",
3193
3193
  children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
@@ -3196,10 +3196,10 @@ function ea({ template: a, setTemplate: n }) {
3196
3196
  /* @__PURE__ */ e(
3197
3197
  "button",
3198
3198
  {
3199
- onClick: V,
3199
+ onClick: U,
3200
3200
  className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
3201
3201
  title: "Add emoji",
3202
- children: /* @__PURE__ */ e(me, { className: "rsp-w-4 rsp-h-4" })
3202
+ children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
3203
3203
  }
3204
3204
  )
3205
3205
  ] }),
@@ -3209,15 +3209,15 @@ function ea({ template: a, setTemplate: n }) {
3209
3209
  ] }) })
3210
3210
  ] }),
3211
3211
  (() => {
3212
- const v = a.body.match(/\{\{(\d+)\}\}/g) || [], x = [...new Set(v.map((b) => b.replace(/[{}]/g, "")))];
3213
- return x.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
3212
+ const N = a.body.match(/\{\{(\d+)\}\}/g) || [], o = [...new Set(N.map((u) => u.replace(/[{}]/g, "")))];
3213
+ return o.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
3214
3214
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
3215
- /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: x.map((b) => {
3216
- var t, u;
3215
+ /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: o.map((u) => {
3216
+ var t, h;
3217
3217
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
3218
3218
  /* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
3219
3219
  "{{",
3220
- b,
3220
+ u,
3221
3221
  "}}",
3222
3222
  ":"
3223
3223
  ] }),
@@ -3225,21 +3225,21 @@ function ea({ template: a, setTemplate: n }) {
3225
3225
  "input",
3226
3226
  {
3227
3227
  type: "text",
3228
- value: ((u = (t = a.sampleContent) == null ? void 0 : t.bodyVariables) == null ? void 0 : u[b]) || "",
3229
- onChange: (k) => {
3230
- var U, B, s;
3231
- const E = {
3228
+ value: ((h = (t = a.sampleContent) == null ? void 0 : t.bodyVariables) == null ? void 0 : h[u]) || "",
3229
+ onChange: (v) => {
3230
+ var R, I, x;
3231
+ const V = {
3232
3232
  ...a.sampleContent,
3233
3233
  bodyVariables: {
3234
- ...(U = a.sampleContent) == null ? void 0 : U.bodyVariables,
3235
- [b]: k.target.value
3234
+ ...(R = a.sampleContent) == null ? void 0 : R.bodyVariables,
3235
+ [u]: v.target.value
3236
3236
  },
3237
- headerVariables: ((B = a.sampleContent) == null ? void 0 : B.headerVariables) || {},
3238
- buttonVariables: ((s = a.sampleContent) == null ? void 0 : s.buttonVariables) || {}
3237
+ headerVariables: ((I = a.sampleContent) == null ? void 0 : I.headerVariables) || {},
3238
+ buttonVariables: ((x = a.sampleContent) == null ? void 0 : x.buttonVariables) || {}
3239
3239
  };
3240
3240
  n({
3241
3241
  ...a,
3242
- sampleContent: E
3242
+ sampleContent: V
3243
3243
  });
3244
3244
  },
3245
3245
  className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
@@ -3251,16 +3251,16 @@ function ea({ template: a, setTemplate: n }) {
3251
3251
  {
3252
3252
  type: "button",
3253
3253
  onClick: () => {
3254
- var B, s, c;
3255
- const k = new RegExp(`\\{\\{${b}\\}\\}`, "g"), E = (a.body || "").replace(k, ""), U = Object.fromEntries(Object.entries(((B = a.sampleContent) == null ? void 0 : B.bodyVariables) || {}).filter(([o]) => o !== b));
3254
+ var I, x, w;
3255
+ const v = new RegExp(`\\{\\{${u}\\}\\}`, "g"), V = (a.body || "").replace(v, ""), R = Object.fromEntries(Object.entries(((I = a.sampleContent) == null ? void 0 : I.bodyVariables) || {}).filter(([L]) => L !== u));
3256
3256
  n({
3257
3257
  ...a,
3258
- body: E,
3258
+ body: V,
3259
3259
  sampleContent: {
3260
3260
  ...a.sampleContent,
3261
- bodyVariables: U,
3262
- headerVariables: ((s = a.sampleContent) == null ? void 0 : s.headerVariables) || {},
3263
- buttonVariables: ((c = a.sampleContent) == null ? void 0 : c.buttonVariables) || {}
3261
+ bodyVariables: R,
3262
+ headerVariables: ((x = a.sampleContent) == null ? void 0 : x.headerVariables) || {},
3263
+ buttonVariables: ((w = a.sampleContent) == null ? void 0 : w.buttonVariables) || {}
3264
3264
  }
3265
3265
  });
3266
3266
  },
@@ -3269,7 +3269,7 @@ function ea({ template: a, setTemplate: n }) {
3269
3269
  children: "×"
3270
3270
  }
3271
3271
  )
3272
- ] }, `body-sample-${b}`);
3272
+ ] }, `body-sample-${u}`);
3273
3273
  }) })
3274
3274
  ] });
3275
3275
  })()
@@ -3279,14 +3279,14 @@ function ea({ template: a, setTemplate: n }) {
3279
3279
  /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
3280
3280
  "input",
3281
3281
  {
3282
- ref: h,
3282
+ ref: f,
3283
3283
  type: "text",
3284
3284
  value: a.footer,
3285
- onChange: (v) => n({ ...a, footer: v.target.value }),
3285
+ onChange: (N) => n({ ...a, footer: N.target.value }),
3286
3286
  maxLength: 60,
3287
3287
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
3288
3288
  placeholder: "Footer Text",
3289
- onFocus: () => f("footer")
3289
+ onFocus: () => p("footer")
3290
3290
  }
3291
3291
  ) }),
3292
3292
  /* @__PURE__ */ r("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: [
@@ -3295,31 +3295,31 @@ function ea({ template: a, setTemplate: n }) {
3295
3295
  ] })
3296
3296
  ] }),
3297
3297
  /* @__PURE__ */ e(
3298
- xe,
3298
+ fe,
3299
3299
  {
3300
3300
  isOpen: i,
3301
3301
  onClose: () => l(!1),
3302
- onSelect: M
3302
+ onSelect: k
3303
3303
  }
3304
3304
  )
3305
3305
  ] });
3306
3306
  }
3307
- function aa({ template: a, setTemplate: n }) {
3308
- var b;
3309
- const [i, l] = I(null), [d, f] = I(!1), [m, N] = I({
3307
+ function na({ template: a, setTemplate: n }) {
3308
+ var u;
3309
+ const [i, l] = B(null), [d, p] = B(!1), [m, C] = B({
3310
3310
  text: "",
3311
3311
  value: "",
3312
3312
  urlType: "static"
3313
- }), h = {
3313
+ }), f = {
3314
3314
  quickReply: a.buttons.filter((t) => t.type === "QUICK_REPLY").length,
3315
3315
  url: a.buttons.filter((t) => t.type === "URL").length,
3316
3316
  call: a.buttons.filter((t) => t.type === "CALL").length,
3317
3317
  flow: a.buttons.filter((t) => t.type === "FLOW").length
3318
- }, g = () => {
3319
- N({ text: "", value: "", urlType: "static" }), l(null), f(!1);
3320
- }, S = (t) => {
3318
+ }, y = () => {
3319
+ C({ text: "", value: "", urlType: "static" }), l(null), p(!1);
3320
+ }, j = (t) => {
3321
3321
  if (!m.text.trim()) return;
3322
- const u = {
3322
+ const h = {
3323
3323
  id: Math.random().toString(36).substr(2, 9),
3324
3324
  type: t,
3325
3325
  text: m.text,
@@ -3328,60 +3328,60 @@ function aa({ template: a, setTemplate: n }) {
3328
3328
  };
3329
3329
  n({
3330
3330
  ...a,
3331
- buttons: [...a.buttons, u]
3332
- }), g();
3333
- }, V = (t) => {
3331
+ buttons: [...a.buttons, h]
3332
+ }), y();
3333
+ }, U = (t) => {
3334
3334
  n({
3335
3335
  ...a,
3336
- buttons: a.buttons.filter((u) => u.id !== t)
3336
+ buttons: a.buttons.filter((h) => h.id !== t)
3337
3337
  });
3338
- }, M = (t, u, k) => {
3339
- var U;
3340
- const E = u === "text" ? 25 : u === "value" && ((U = a.buttons.find((B) => B.id === t)) == null ? void 0 : U.type) === "URL" ? 2e3 : 20;
3338
+ }, k = (t, h, v) => {
3339
+ var R;
3340
+ const V = h === "text" ? 25 : h === "value" && ((R = a.buttons.find((I) => I.id === t)) == null ? void 0 : R.type) === "URL" ? 2e3 : 20;
3341
3341
  n({
3342
3342
  ...a,
3343
3343
  buttons: a.buttons.map(
3344
- (B) => B.id === t ? { ...B, [u]: k.slice(0, E) } : B
3344
+ (I) => I.id === t ? { ...I, [h]: v.slice(0, V) } : I
3345
3345
  )
3346
3346
  });
3347
- }, v = () => {
3348
- const u = [
3349
- ...a.buttons.filter((E) => E.type === "URL" && E.urlType === "dynamic").map((E) => E.value || ""),
3347
+ }, N = () => {
3348
+ const h = [
3349
+ ...a.buttons.filter((V) => V.type === "URL" && V.urlType === "dynamic").map((V) => V.value || ""),
3350
3350
  m.value
3351
3351
  // Include current form input
3352
3352
  ].join(" ").match(/{{\d+}}/g);
3353
- if (!u) return 0;
3354
- const k = u.map((E) => {
3355
- const U = E.match(/{{(\d+)}}/);
3356
- return U ? parseInt(U[1], 10) : 0;
3353
+ if (!h) return 0;
3354
+ const v = h.map((V) => {
3355
+ const R = V.match(/{{(\d+)}}/);
3356
+ return R ? parseInt(R[1], 10) : 0;
3357
3357
  });
3358
- return k.length > 0 ? Math.max(...k) : 0;
3359
- }, x = [
3358
+ return v.length > 0 ? Math.max(...v) : 0;
3359
+ }, o = [
3360
3360
  {
3361
3361
  type: "QUICK_REPLY",
3362
- icon: re,
3362
+ icon: le,
3363
3363
  label: "Quick Reply",
3364
3364
  description: "Add quick response options",
3365
3365
  limit: 10,
3366
- current: h.quickReply,
3366
+ current: f.quickReply,
3367
3367
  color: "blue"
3368
3368
  },
3369
3369
  {
3370
3370
  type: "URL",
3371
- icon: Ue,
3371
+ icon: Be,
3372
3372
  label: "Web URL",
3373
3373
  description: "Link to websites or pages",
3374
3374
  limit: 2,
3375
- current: h.url,
3375
+ current: f.url,
3376
3376
  color: "green"
3377
3377
  },
3378
3378
  {
3379
3379
  type: "CALL",
3380
- icon: ke,
3380
+ icon: Me,
3381
3381
  label: "Call Button",
3382
3382
  description: "Add phone number to call",
3383
3383
  limit: 1,
3384
- current: h.call,
3384
+ current: f.call,
3385
3385
  color: "purple"
3386
3386
  }
3387
3387
  // {
@@ -3406,17 +3406,17 @@ function aa({ template: a, setTemplate: n }) {
3406
3406
  /* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e("svg", { className: "rsp-h-5 rsp-w-5 rsp-text-blue-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ e("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }) }),
3407
3407
  /* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-blue-700", children: "We recommend adding the marketing opt-out button. This can help reduce blocks from customers and increase your quality rating." }) })
3408
3408
  ] }) }),
3409
- !i && /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4", children: x.map((t) => {
3410
- const u = t.icon, k = t.current >= t.limit;
3409
+ !i && /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4", children: o.map((t) => {
3410
+ const h = t.icon, v = t.current >= t.limit;
3411
3411
  return /* @__PURE__ */ e(
3412
3412
  "button",
3413
3413
  {
3414
- onClick: () => !k && l(t.type),
3415
- disabled: k,
3416
- className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${k ? "rsp-border-gray-200 rsp-bg-gray-50 rsp-text-gray-400 rsp-cursor-not-allowed rsp-opacity-60" : "rsp-cursor-pointer rsp-transform rsp-shadow-sm hover:rsp-shadow-md"}`,
3414
+ onClick: () => !v && l(t.type),
3415
+ disabled: v,
3416
+ className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${v ? "rsp-border-gray-200 rsp-bg-gray-50 rsp-text-gray-400 rsp-cursor-not-allowed rsp-opacity-60" : "rsp-cursor-pointer rsp-transform rsp-shadow-sm hover:rsp-shadow-md"}`,
3417
3417
  children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-start rsp-justify-between", children: [
3418
3418
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
3419
- /* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${k ? "rsp-bg-gray-200" : "rsp-bg-white rsp-shadow-sm"}`, children: /* @__PURE__ */ e(u, { className: "rsp-w-5 rsp-h-5" }) }),
3419
+ /* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${v ? "rsp-bg-gray-200" : "rsp-bg-white rsp-shadow-sm"}`, children: /* @__PURE__ */ e(h, { className: "rsp-w-5 rsp-h-5" }) }),
3420
3420
  /* @__PURE__ */ r("div", { children: [
3421
3421
  /* @__PURE__ */ e("h4", { className: "rsp-font-semibold rsp-text-sm", children: t.label }),
3422
3422
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-opacity-80 rsp-mt-1", children: t.description })
@@ -3428,7 +3428,7 @@ function aa({ template: a, setTemplate: n }) {
3428
3428
  "/",
3429
3429
  t.limit
3430
3430
  ] }),
3431
- !k && /* @__PURE__ */ e(te, { className: "rsp-w-4 rsp-h-4" })
3431
+ !v && /* @__PURE__ */ e(de, { className: "rsp-w-4 rsp-h-4" })
3432
3432
  ] })
3433
3433
  ] })
3434
3434
  },
@@ -3439,14 +3439,14 @@ function aa({ template: a, setTemplate: n }) {
3439
3439
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-4", children: [
3440
3440
  /* @__PURE__ */ r("h4", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: [
3441
3441
  "Add ",
3442
- (b = x.find((t) => t.type === i)) == null ? void 0 : b.label
3442
+ (u = o.find((t) => t.type === i)) == null ? void 0 : u.label
3443
3443
  ] }),
3444
3444
  /* @__PURE__ */ e(
3445
3445
  "button",
3446
3446
  {
3447
- onClick: g,
3447
+ onClick: y,
3448
3448
  className: "rsp-p-2 rsp-text-gray-400 hover:rsp-text-gray-600 hover:rsp-bg-white rsp-rounded-lg rsp-transition-colors",
3449
- children: /* @__PURE__ */ e(J, { className: "rsp-w-5 rsp-h-5" })
3449
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-5 rsp-h-5" })
3450
3450
  }
3451
3451
  )
3452
3452
  ] }),
@@ -3459,7 +3459,7 @@ function aa({ template: a, setTemplate: n }) {
3459
3459
  {
3460
3460
  type: "text",
3461
3461
  value: m.text,
3462
- onChange: (t) => N({ ...m, text: t.target.value.slice(0, 25) }),
3462
+ onChange: (t) => C({ ...m, text: t.target.value.slice(0, 25) }),
3463
3463
  className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-bg-white rsp-text-sm focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-transparent rsp-shadow-sm",
3464
3464
  placeholder: "Enter button text (max 25 characters)",
3465
3465
  maxLength: 25
@@ -3481,7 +3481,7 @@ function aa({ template: a, setTemplate: n }) {
3481
3481
  {
3482
3482
  type: "radio",
3483
3483
  checked: m.urlType === "static",
3484
- onChange: () => N({ ...m, urlType: "static" }),
3484
+ onChange: () => C({ ...m, urlType: "static" }),
3485
3485
  className: "rsp-mr-2 rsp-text-blue-600"
3486
3486
  }
3487
3487
  ),
@@ -3493,7 +3493,7 @@ function aa({ template: a, setTemplate: n }) {
3493
3493
  {
3494
3494
  type: "radio",
3495
3495
  checked: m.urlType === "dynamic",
3496
- onChange: () => N({ ...m, urlType: "dynamic" }),
3496
+ onChange: () => C({ ...m, urlType: "dynamic" }),
3497
3497
  className: "rsp-mr-2 rsp-text-blue-600"
3498
3498
  }
3499
3499
  ),
@@ -3517,8 +3517,8 @@ function aa({ template: a, setTemplate: n }) {
3517
3517
  type: i === "CALL" ? "tel" : i === "URL" ? "url" : "text",
3518
3518
  value: m.value,
3519
3519
  onChange: (t) => {
3520
- const u = i === "URL" ? 2e3 : 20;
3521
- N({ ...m, value: t.target.value.slice(0, u) });
3520
+ const h = i === "URL" ? 2e3 : 20;
3521
+ C({ ...m, value: t.target.value.slice(0, h) });
3522
3522
  },
3523
3523
  className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-bg-white rsp-text-sm focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-transparent rsp-shadow-sm",
3524
3524
  placeholder: i === "URL" ? m.urlType === "dynamic" ? "https://example.com/order/{{1}}?user={{2}}" : "https://example.com" : i === "CALL" ? "+1234567890" : "Flow ID",
@@ -3538,8 +3538,8 @@ function aa({ template: a, setTemplate: n }) {
3538
3538
  type: "button",
3539
3539
  onClick: () => {
3540
3540
  if ((m.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
3541
- const k = v() + 1, E = m.value + `{{${k}}}`;
3542
- N({ ...m, value: E }), f(!0);
3541
+ const v = N() + 1, V = m.value + `{{${v}}}`;
3542
+ C({ ...m, value: V }), p(!0);
3543
3543
  },
3544
3544
  disabled: (m.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3,
3545
3545
  className: "rsp-px-2 rsp-py-2 rsp-text-xs rsp-bg-gray-300 hover:rsp-bg-gray-200 rsp-rounded rsp-text-gray-700 disabled:rsp-bg-gray-200 disabled:rsp-text-gray-500",
@@ -3551,37 +3551,37 @@ function aa({ template: a, setTemplate: n }) {
3551
3551
  /* @__PURE__ */ e("h4", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-3", children: "Sample Values for URL Variables" }),
3552
3552
  /* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: (() => {
3553
3553
  const t = m.value.match(/\{\{(\d+)\}\}/g) || [];
3554
- return [...new Set(t.map((k) => k.replace(/[{}]/g, "")))].map((k) => {
3555
- var E, U;
3554
+ return [...new Set(t.map((v) => v.replace(/[{}]/g, "")))].map((v) => {
3555
+ var V, R;
3556
3556
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
3557
3557
  /* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-text-gray-600 rsp-whitespace-nowrap", children: [
3558
3558
  "Variable {{",
3559
- k,
3559
+ v,
3560
3560
  "}}"
3561
3561
  ] }),
3562
3562
  /* @__PURE__ */ e(
3563
3563
  "input",
3564
3564
  {
3565
3565
  type: "text",
3566
- value: ((U = (E = a.sampleContent) == null ? void 0 : E.buttonVariables) == null ? void 0 : U[k]) || "",
3567
- onChange: (B) => {
3568
- var c, o, y;
3569
- const s = {
3566
+ value: ((R = (V = a.sampleContent) == null ? void 0 : V.buttonVariables) == null ? void 0 : R[v]) || "",
3567
+ onChange: (I) => {
3568
+ var w, L, s;
3569
+ const x = {
3570
3570
  ...a.sampleContent,
3571
- headerVariables: ((c = a.sampleContent) == null ? void 0 : c.headerVariables) || {},
3572
- bodyVariables: ((o = a.sampleContent) == null ? void 0 : o.bodyVariables) || {},
3571
+ headerVariables: ((w = a.sampleContent) == null ? void 0 : w.headerVariables) || {},
3572
+ bodyVariables: ((L = a.sampleContent) == null ? void 0 : L.bodyVariables) || {},
3573
3573
  buttonVariables: {
3574
- ...(y = a.sampleContent) == null ? void 0 : y.buttonVariables,
3575
- [k]: B.target.value
3574
+ ...(s = a.sampleContent) == null ? void 0 : s.buttonVariables,
3575
+ [v]: I.target.value
3576
3576
  }
3577
3577
  };
3578
3578
  n({
3579
3579
  ...a,
3580
- sampleContent: s
3580
+ sampleContent: x
3581
3581
  });
3582
3582
  },
3583
3583
  className: "rsp-flex-1 rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500",
3584
- placeholder: `Sample value (e.g., ${k === "1" ? "order123" : "user456"})`
3584
+ placeholder: `Sample value (e.g., ${v === "1" ? "order123" : "user456"})`
3585
3585
  }
3586
3586
  ),
3587
3587
  /* @__PURE__ */ e(
@@ -3589,17 +3589,17 @@ function aa({ template: a, setTemplate: n }) {
3589
3589
  {
3590
3590
  type: "button",
3591
3591
  onClick: () => {
3592
- var o, y, C;
3593
- const B = new RegExp(`\\{\\{${k}\\}\\}`, "g"), s = (m.value || "").replace(B, "");
3594
- N({ ...m, value: s });
3595
- const c = Object.fromEntries(Object.entries(((o = a.sampleContent) == null ? void 0 : o.buttonVariables) || {}).filter(([j]) => j !== k));
3592
+ var L, s, b;
3593
+ const I = new RegExp(`\\{\\{${v}\\}\\}`, "g"), x = (m.value || "").replace(I, "");
3594
+ C({ ...m, value: x });
3595
+ const w = Object.fromEntries(Object.entries(((L = a.sampleContent) == null ? void 0 : L.buttonVariables) || {}).filter(([E]) => E !== v));
3596
3596
  n({
3597
3597
  ...a,
3598
3598
  sampleContent: {
3599
3599
  ...a.sampleContent,
3600
- headerVariables: ((y = a.sampleContent) == null ? void 0 : y.headerVariables) || {},
3601
- bodyVariables: ((C = a.sampleContent) == null ? void 0 : C.bodyVariables) || {},
3602
- buttonVariables: c
3600
+ headerVariables: ((s = a.sampleContent) == null ? void 0 : s.headerVariables) || {},
3601
+ bodyVariables: ((b = a.sampleContent) == null ? void 0 : b.bodyVariables) || {},
3602
+ buttonVariables: w
3603
3603
  }
3604
3604
  });
3605
3605
  },
@@ -3608,16 +3608,16 @@ function aa({ template: a, setTemplate: n }) {
3608
3608
  children: "×"
3609
3609
  }
3610
3610
  )
3611
- ] }, `sample-${k}`);
3611
+ ] }, `sample-${v}`);
3612
3612
  });
3613
3613
  })() }),
3614
3614
  /* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-white rsp-rounded-lg rsp-border", children: [
3615
3615
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-700 rsp-mb-1", children: "Preview URL:" }),
3616
3616
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-font-mono rsp-break-all", children: m.value.replace(
3617
3617
  /\{\{(\d+)\}\}/g,
3618
- (t, u) => {
3619
- var k, E;
3620
- return ((E = (k = a.sampleContent) == null ? void 0 : k.buttonVariables) == null ? void 0 : E[u]) || `[${t}]`;
3618
+ (t, h) => {
3619
+ var v, V;
3620
+ return ((V = (v = a.sampleContent) == null ? void 0 : v.buttonVariables) == null ? void 0 : V[h]) || `[${t}]`;
3621
3621
  }
3622
3622
  ) })
3623
3623
  ] }),
@@ -3625,7 +3625,7 @@ function aa({ template: a, setTemplate: n }) {
3625
3625
  "button",
3626
3626
  {
3627
3627
  type: "button",
3628
- onClick: () => f(!1),
3628
+ onClick: () => p(!1),
3629
3629
  className: "rsp-px-3 rsp-py-1 rsp-text-xs rsp-text-gray-500 hover:rsp-text-gray-700",
3630
3630
  children: "Close"
3631
3631
  }
@@ -3637,7 +3637,7 @@ function aa({ template: a, setTemplate: n }) {
3637
3637
  /* @__PURE__ */ e(
3638
3638
  "button",
3639
3639
  {
3640
- onClick: () => S(i),
3640
+ onClick: () => j(i),
3641
3641
  disabled: !m.text.trim() || i !== "QUICK_REPLY" && !m.value.trim(),
3642
3642
  className: "rsp-flex-1 rsp-bg-blue-600 rsp-text-white rsp-py-3 rsp-px-4 rsp-rounded-lg rsp-font-medium rsp-text-sm rsp-transition-colors hover:rsp-bg-blue-700 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-shadow-sm",
3643
3643
  children: "Add Button"
@@ -3646,7 +3646,7 @@ function aa({ template: a, setTemplate: n }) {
3646
3646
  /* @__PURE__ */ e(
3647
3647
  "button",
3648
3648
  {
3649
- onClick: g,
3649
+ onClick: y,
3650
3650
  className: "rsp-px-4 rsp-py-3 rsp-text-gray-600 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-font-medium rsp-text-sm rsp-transition-colors hover:rsp-bg-gray-50 rsp-shadow-sm",
3651
3651
  children: "Cancel"
3652
3652
  }
@@ -3657,18 +3657,18 @@ function aa({ template: a, setTemplate: n }) {
3657
3657
  a.buttons.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
3658
3658
  /* @__PURE__ */ e("h4", { className: "rsp-text-md rsp-font-semibold rsp-text-gray-900", children: "Added Buttons" }),
3659
3659
  /* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: a.buttons.map((t) => {
3660
- const u = x.find((E) => E.type === t.type), k = (u == null ? void 0 : u.icon) || re;
3660
+ const h = o.find((V) => V.type === t.type), v = (h == null ? void 0 : h.icon) || le;
3661
3661
  return /* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-border rsp-border-gray-200 rsp-rounded-lg rsp-p-4 rsp-shadow-sm", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-start rsp-gap-3", children: [
3662
- /* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(k, { className: "rsp-w-4 rsp-h-4 rsp-text-gray-600" }) }),
3662
+ /* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(v, { className: "rsp-w-4 rsp-h-4 rsp-text-gray-600" }) }),
3663
3663
  /* @__PURE__ */ r("div", { className: "rsp-flex-1 rsp-space-y-3", children: [
3664
3664
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between", children: [
3665
3665
  /* @__PURE__ */ e("span", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-500 rsp-uppercase rsp-tracking-wider", children: t.type.replace("_", " ") }),
3666
3666
  /* @__PURE__ */ e(
3667
3667
  "button",
3668
3668
  {
3669
- onClick: () => V(t.id),
3669
+ onClick: () => U(t.id),
3670
3670
  className: "rsp-p-1 rsp-text-red-400 hover:rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
3671
- children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4" })
3671
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
3672
3672
  }
3673
3673
  )
3674
3674
  ] }),
@@ -3681,7 +3681,7 @@ function aa({ template: a, setTemplate: n }) {
3681
3681
  {
3682
3682
  type: "text",
3683
3683
  value: t.text,
3684
- onChange: (E) => M(t.id, "text", E.target.value),
3684
+ onChange: (V) => k(t.id, "text", V.target.value),
3685
3685
  maxLength: 25,
3686
3686
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500"
3687
3687
  }
@@ -3700,7 +3700,7 @@ function aa({ template: a, setTemplate: n }) {
3700
3700
  {
3701
3701
  type: t.type === "CALL" ? "tel" : t.type === "URL" ? "url" : "text",
3702
3702
  value: t.value || "",
3703
- onChange: (E) => M(t.id, "value", E.target.value),
3703
+ onChange: (V) => k(t.id, "value", V.target.value),
3704
3704
  maxLength: t.type === "URL" ? 2e3 : 20,
3705
3705
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500"
3706
3706
  }
@@ -3718,14 +3718,14 @@ function aa({ template: a, setTemplate: n }) {
3718
3718
  }) })
3719
3719
  ] }),
3720
3720
  a.buttons.length === 0 && !i && /* @__PURE__ */ r("div", { className: "rsp-text-center rsp-py-12 rsp-bg-gray-50 rsp-rounded-xl rsp-border-2 rsp-border-dashed rsp-border-gray-300", children: [
3721
- /* @__PURE__ */ e("div", { className: "rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm", children: /* @__PURE__ */ e(re, { className: "rsp-w-8 rsp-h-8 rsp-text-gray-400" }) }),
3721
+ /* @__PURE__ */ e("div", { className: "rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm", children: /* @__PURE__ */ e(le, { className: "rsp-w-8 rsp-h-8 rsp-text-gray-400" }) }),
3722
3722
  /* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-medium rsp-text-gray-900 rsp-mb-2", children: "No buttons added yet" }),
3723
3723
  /* @__PURE__ */ e("p", { className: "rsp-text-gray-500 rsp-text-sm rsp-mb-4", children: "Add interactive buttons to make your message more engaging" }),
3724
3724
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-400", children: "Choose from Quick Reply, Web URL, Call, or Flow buttons above" })
3725
3725
  ] })
3726
3726
  ] });
3727
3727
  }
3728
- const ra = async (a) => {
3728
+ const la = async (a) => {
3729
3729
  try {
3730
3730
  if (!a)
3731
3731
  throw new Error("No file provided");
@@ -3741,16 +3741,16 @@ const ra = async (a) => {
3741
3741
  console.log("Upload response status:", l.status), console.log("Upload response headers:", Object.fromEntries(l.headers.entries()));
3742
3742
  const d = await l.text();
3743
3743
  console.log("Raw upload response:", d);
3744
- let f;
3744
+ let p;
3745
3745
  try {
3746
- f = JSON.parse(d);
3746
+ p = JSON.parse(d);
3747
3747
  } catch (m) {
3748
3748
  throw console.error("Failed to parse upload response:", m), new Error("Invalid response from upload server");
3749
3749
  }
3750
- if (console.log("Parsed upload response:", f), console.log("Upload status:", f.status), console.log("Upload message:", f.message), console.log("Upload data:", f.data), !f.status)
3751
- throw new Error(f.message || "Upload failed");
3752
- if (f.data && Array.isArray(f.data) && f.data.length > 0) {
3753
- const m = f.data[0];
3750
+ if (console.log("Parsed upload response:", p), console.log("Upload status:", p.status), console.log("Upload message:", p.message), console.log("Upload data:", p.data), !p.status)
3751
+ throw new Error(p.message || "Upload failed");
3752
+ if (p.data && Array.isArray(p.data) && p.data.length > 0) {
3753
+ const m = p.data[0];
3754
3754
  if (m.url)
3755
3755
  return console.log("File uploaded successfully:", {
3756
3756
  url: m.url,
@@ -3764,7 +3764,7 @@ const ra = async (a) => {
3764
3764
  } catch (n) {
3765
3765
  throw console.error("File upload error:", n), n instanceof Error ? n : new Error("Unknown error occurred during file upload");
3766
3766
  }
3767
- }, sa = (a, n) => {
3767
+ }, ia = (a, n) => {
3768
3768
  const l = a.name.toLowerCase().split(".").pop();
3769
3769
  switch (n) {
3770
3770
  case "IMAGE":
@@ -3776,7 +3776,7 @@ const ra = async (a) => {
3776
3776
  default:
3777
3777
  return !1;
3778
3778
  }
3779
- }, na = (a) => {
3779
+ }, ta = (a) => {
3780
3780
  switch (a) {
3781
3781
  case "IMAGE":
3782
3782
  return 5 * 1024 * 1024;
@@ -3788,116 +3788,119 @@ const ra = async (a) => {
3788
3788
  return 10 * 1024 * 1024;
3789
3789
  }
3790
3790
  };
3791
- function la({ template: a, setTemplate: n, onFileUpload: i }) {
3792
- var u, k, E, U, B;
3793
- const [l, d] = Q.useState(!1), [f, m] = Q.useState(null), N = Q.useRef({}), w = () => {
3794
- var c;
3791
+ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
3792
+ var R, I, x, w, L;
3793
+ const [l, d] = K.useState({}), [, p] = K.useState({}), [m, C] = K.useState(!1), [g, f] = K.useState(null), y = K.useRef({}), j = () => {
3794
+ var b;
3795
3795
  const s = {
3796
3796
  id: Math.random().toString(36).substr(2, 9),
3797
3797
  headerType: "MEDIA",
3798
- mediaType: ((c = a.carousel) == null ? void 0 : c.type) === "VIDEO" ? "VIDEO" : "IMAGE",
3798
+ mediaType: ((b = a.carousel) == null ? void 0 : b.type) === "VIDEO" ? "VIDEO" : "IMAGE",
3799
3799
  body: "",
3800
3800
  buttons: []
3801
3801
  };
3802
- n((o) => {
3803
- var y, C;
3802
+ n((E) => {
3803
+ var T, c;
3804
3804
  return {
3805
- ...o,
3805
+ ...E,
3806
3806
  carousel: {
3807
- type: ((y = a.carousel) == null ? void 0 : y.type) || "IMAGE",
3808
- cards: [...((C = a.carousel) == null ? void 0 : C.cards) || [], s]
3807
+ type: ((T = a.carousel) == null ? void 0 : T.type) || "IMAGE",
3808
+ cards: [...((c = a.carousel) == null ? void 0 : c.cards) || [], s]
3809
3809
  }
3810
3810
  };
3811
3811
  });
3812
- }, h = (s) => {
3813
- n((c) => ({
3814
- ...c,
3812
+ }, U = (s) => {
3813
+ n((b) => ({
3814
+ ...b,
3815
3815
  carousel: {
3816
- ...c.carousel,
3817
- cards: c.carousel.cards.filter((o) => o.id !== s)
3816
+ ...b.carousel,
3817
+ cards: b.carousel.cards.filter((E) => E.id !== s)
3818
3818
  }
3819
3819
  }));
3820
- }, g = (s, c, o) => {
3821
- n((y) => ({
3822
- ...y,
3820
+ }, k = (s, b, E) => {
3821
+ n((T) => ({
3822
+ ...T,
3823
3823
  carousel: {
3824
- ...y.carousel,
3825
- cards: y.carousel.cards.map(
3826
- (C) => C.id === s ? { ...C, [c]: o } : C
3824
+ ...T.carousel,
3825
+ cards: T.carousel.cards.map(
3826
+ (c) => c.id === s ? { ...c, [b]: E } : c
3827
3827
  )
3828
3828
  }
3829
3829
  }));
3830
- }, S = (s, c) => {
3831
- var L;
3832
- const o = (L = a.carousel) == null ? void 0 : L.cards.find((A) => A.id === s);
3833
- if (!o) return;
3834
- const j = `{{${M(s) + 1}}}`, p = o[c] + j;
3835
- g(s, c, p);
3836
- }, V = (s) => {
3837
- var p;
3838
- if (!f) return;
3839
- const c = N.current[f], o = (p = a.carousel) == null ? void 0 : p.cards.find((L) => L.id === f);
3840
- if (!o) return;
3841
- const y = c && typeof c.selectionStart == "number" ? c.selectionStart : o.body.length, C = o.body.substring(0, y), j = o.body.substring(y), R = C + s + j;
3842
- g(f, "body", R), setTimeout(() => {
3843
- const L = N.current[f];
3844
- if (L) {
3845
- const A = y + s.length;
3846
- L.setSelectionRange(A, A), L.focus();
3830
+ }, N = (s, b) => {
3831
+ var $;
3832
+ const E = ($ = a.carousel) == null ? void 0 : $.cards.find((X) => X.id === s);
3833
+ if (!E) return;
3834
+ const M = `{{${u(s) + 1}}}`, O = E[b] + M;
3835
+ k(s, b, O);
3836
+ }, o = (s) => {
3837
+ var O;
3838
+ if (!g) return;
3839
+ const b = y.current[g], E = (O = a.carousel) == null ? void 0 : O.cards.find(($) => $.id === g);
3840
+ if (!E) return;
3841
+ const T = b && typeof b.selectionStart == "number" ? b.selectionStart : E.body.length, c = E.body.substring(0, T), M = E.body.substring(T), A = c + s + M;
3842
+ k(g, "body", A), setTimeout(() => {
3843
+ const $ = y.current[g];
3844
+ if ($) {
3845
+ const X = T + s.length;
3846
+ $.setSelectionRange(X, X), $.focus();
3847
3847
  }
3848
- }, 0), d(!1);
3849
- }, M = (s) => {
3850
- var j;
3851
- const c = (j = a.carousel) == null ? void 0 : j.cards.find((R) => R.id === s);
3852
- if (!c) return 0;
3853
- const y = (c.body || "").match(/\{\{(\d+)\}\}/g);
3854
- if (!y) return 0;
3855
- const C = y.map((R) => {
3856
- const p = R.match(/{{(\d+)}}/);
3857
- return p ? parseInt(p[1], 10) : 0;
3848
+ }, 0), C(!1);
3849
+ }, u = (s) => {
3850
+ var M;
3851
+ const b = (M = a.carousel) == null ? void 0 : M.cards.find((A) => A.id === s);
3852
+ if (!b) return 0;
3853
+ const T = (b.body || "").match(/\{\{(\d+)\}\}/g);
3854
+ if (!T) return 0;
3855
+ const c = T.map((A) => {
3856
+ const O = A.match(/{{(\d+)}}/);
3857
+ return O ? parseInt(O[1], 10) : 0;
3858
3858
  });
3859
- return C.length > 0 ? Math.max(...C) : 0;
3860
- }, v = (s, c) => {
3861
- var C;
3862
- const o = (C = a.carousel) == null ? void 0 : C.cards.find((j) => j.id === s);
3863
- if (!o || o.buttons.length >= 2) return;
3864
- const y = {
3859
+ return c.length > 0 ? Math.max(...c) : 0;
3860
+ }, t = (s, b) => {
3861
+ var c;
3862
+ const E = (c = a.carousel) == null ? void 0 : c.cards.find((M) => M.id === s);
3863
+ if (!E || E.buttons.length >= 2) return;
3864
+ const T = {
3865
3865
  id: Math.random().toString(36).substr(2, 9),
3866
- type: c,
3866
+ type: b,
3867
3867
  text: "",
3868
3868
  value: "",
3869
3869
  urlType: "static"
3870
3870
  };
3871
- g(s, "buttons", [...o.buttons, y]);
3872
- }, x = (s, c, o, y) => {
3873
- var R;
3874
- const C = (R = a.carousel) == null ? void 0 : R.cards.find((p) => p.id === s);
3875
- if (!C) return;
3876
- const j = C.buttons.map(
3877
- (p) => p.id === c ? { ...p, [o]: y } : p
3871
+ k(s, "buttons", [...E.buttons, T]);
3872
+ }, h = (s, b, E, T) => {
3873
+ var A;
3874
+ const c = (A = a.carousel) == null ? void 0 : A.cards.find((O) => O.id === s);
3875
+ if (!c) return;
3876
+ const M = c.buttons.map(
3877
+ (O) => O.id === b ? { ...O, [E]: T } : O
3878
3878
  );
3879
- g(s, "buttons", j);
3880
- }, b = (s, c) => {
3881
- var C;
3882
- const o = (C = a.carousel) == null ? void 0 : C.cards.find((j) => j.id === s);
3883
- if (!o) return;
3884
- const y = o.buttons.filter((j) => j.id !== c);
3885
- g(s, "buttons", y);
3886
- }, t = async (s, c) => {
3887
- var o;
3879
+ k(s, "buttons", M);
3880
+ }, v = (s, b) => {
3881
+ var c;
3882
+ const E = (c = a.carousel) == null ? void 0 : c.cards.find((M) => M.id === s);
3883
+ if (!E) return;
3884
+ const T = E.buttons.filter((M) => M.id !== b);
3885
+ k(s, "buttons", T);
3886
+ }, V = async (s, b) => {
3887
+ var E;
3888
3888
  try {
3889
- const y = ((o = a.carousel) == null ? void 0 : o.type) === "VIDEO" ? "VIDEO" : "IMAGE";
3890
- if (!sa(c, y))
3891
- throw new Error(`Invalid file type. Expected ${y.toLowerCase()} file.`);
3892
- const C = na(y);
3893
- if (c.size > C) {
3894
- const R = C / 1048576;
3895
- throw new Error(`File size too large. Maximum allowed size is ${R}MB.`);
3889
+ d((A) => ({ ...A, [s]: !0 })), p((A) => ({ ...A, [s]: !1 }));
3890
+ const T = ((E = a.carousel) == null ? void 0 : E.type) === "VIDEO" ? "VIDEO" : "IMAGE";
3891
+ if (!ia(b, T))
3892
+ throw new Error(`Invalid file type. Expected ${T.toLowerCase()} file.`);
3893
+ const c = ta(T);
3894
+ if (b.size > c) {
3895
+ const A = c / 1048576;
3896
+ throw new Error(`File size too large. Maximum allowed size is ${A}MB.`);
3896
3897
  }
3897
- const j = await i(c);
3898
- g(s, "mediaUrl", j);
3899
- } catch (y) {
3900
- console.error("File upload failed:", y), alert(y instanceof Error ? y.message : "File upload failed");
3898
+ const M = await i(b);
3899
+ k(s, "mediaUrl", M);
3900
+ } catch (T) {
3901
+ console.error("File upload failed:", T), alert(T instanceof Error ? T.message : "File upload failed");
3902
+ } finally {
3903
+ d((T) => ({ ...T, [s]: !1 }));
3901
3904
  }
3902
3905
  };
3903
3906
  return /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
@@ -3906,17 +3909,17 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
3906
3909
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-4", children: [
3907
3910
  /* @__PURE__ */ r("span", { className: "rsp-text-sm rsp-text-gray-500", children: [
3908
3911
  "Total Cards: ",
3909
- ((u = a.carousel) == null ? void 0 : u.cards.length) || 0,
3912
+ ((R = a.carousel) == null ? void 0 : R.cards.length) || 0,
3910
3913
  "/10"
3911
3914
  ] }),
3912
3915
  /* @__PURE__ */ r(
3913
3916
  "button",
3914
3917
  {
3915
- onClick: w,
3916
- disabled: (((k = a.carousel) == null ? void 0 : k.cards.length) || 0) >= 10,
3918
+ onClick: j,
3919
+ disabled: (((I = a.carousel) == null ? void 0 : I.cards.length) || 0) >= 10,
3917
3920
  className: "rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-rounded-md hover:rsp-bg-blue-700 disabled:rsp-bg-gray-400 disabled:rsp-cursor-not-allowed rsp-text-sm rsp-font-medium",
3918
3921
  children: [
3919
- /* @__PURE__ */ e(te, { className: "rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2" }),
3922
+ /* @__PURE__ */ e(de, { className: "rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2" }),
3920
3923
  "Add Card"
3921
3924
  ]
3922
3925
  }
@@ -3933,14 +3936,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
3933
3936
  type: "radio",
3934
3937
  name: "carouselType",
3935
3938
  value: "IMAGE",
3936
- checked: ((E = a.carousel) == null ? void 0 : E.type) === "IMAGE",
3937
- onChange: (s) => n((c) => {
3938
- var o;
3939
+ checked: ((x = a.carousel) == null ? void 0 : x.type) === "IMAGE",
3940
+ onChange: (s) => n((b) => {
3941
+ var E;
3939
3942
  return {
3940
- ...c,
3943
+ ...b,
3941
3944
  carousel: {
3942
3945
  type: s.target.value,
3943
- cards: ((o = c.carousel) == null ? void 0 : o.cards) || []
3946
+ cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
3944
3947
  }
3945
3948
  };
3946
3949
  }),
@@ -3956,14 +3959,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
3956
3959
  type: "radio",
3957
3960
  name: "carouselType",
3958
3961
  value: "VIDEO",
3959
- checked: ((U = a.carousel) == null ? void 0 : U.type) === "VIDEO",
3960
- onChange: (s) => n((c) => {
3961
- var o;
3962
+ checked: ((w = a.carousel) == null ? void 0 : w.type) === "VIDEO",
3963
+ onChange: (s) => n((b) => {
3964
+ var E;
3962
3965
  return {
3963
- ...c,
3966
+ ...b,
3964
3967
  carousel: {
3965
3968
  type: s.target.value,
3966
- cards: ((o = c.carousel) == null ? void 0 : o.cards) || []
3969
+ cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
3967
3970
  }
3968
3971
  };
3969
3972
  }),
@@ -3974,90 +3977,105 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
3974
3977
  ] })
3975
3978
  ] })
3976
3979
  ] }),
3977
- /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (B = a.carousel) == null ? void 0 : B.cards.map((s, c) => {
3978
- var o, y, C, j, R, p, L, A;
3980
+ /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (L = a.carousel) == null ? void 0 : L.cards.map((s, b) => {
3981
+ var E, T, c, M, A, O, $, X;
3979
3982
  return /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-rounded-xl rsp-border-2 rsp-border-gray-200 rsp-overflow-hidden rsp-shadow-lg rsp-transition-all hover:rsp-shadow-xl hover:rsp-border-blue-300", children: [
3980
3983
  /* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-r rsp-from-blue-50 rsp-to-blue-100 rsp-px-5 rsp-py-3 rsp-flex rsp-items-center rsp-justify-between rsp-border-b rsp-border-gray-200", children: [
3981
3984
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
3982
- /* @__PURE__ */ e("div", { className: "rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md", children: c + 1 }),
3985
+ /* @__PURE__ */ e("div", { className: "rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md", children: b + 1 }),
3983
3986
  /* @__PURE__ */ r("h4", { className: "rsp-text-base rsp-font-semibold rsp-text-gray-800", children: [
3984
3987
  "Card ",
3985
- c + 1
3988
+ b + 1
3986
3989
  ] })
3987
3990
  ] }),
3988
3991
  /* @__PURE__ */ e(
3989
3992
  "button",
3990
3993
  {
3991
- onClick: () => h(s.id),
3994
+ onClick: () => U(s.id),
3992
3995
  className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-white hover:rsp-bg-red-500 rsp-rounded-full rsp-transition-colors",
3993
3996
  title: "Remove Card",
3994
- children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4" })
3997
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
3995
3998
  }
3996
3999
  )
3997
4000
  ] }),
3998
4001
  /* @__PURE__ */ e("div", { className: "rsp-p-6", children: /* @__PURE__ */ r("div", { className: "rsp-grid rsp-grid-cols-1 lg:rsp-grid-cols-2 rsp-gap-6", children: [
3999
4002
  /* @__PURE__ */ r("div", { children: [
4000
4003
  /* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2", children: [
4001
- /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((o = a.carousel) == null ? void 0 : o.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
4002
- ((y = a.carousel) == null ? void 0 : y.type) === "VIDEO" ? "Video" : "Image",
4004
+ /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((E = a.carousel) == null ? void 0 : E.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
4005
+ ((T = a.carousel) == null ? void 0 : T.type) === "VIDEO" ? "Video" : "Image",
4003
4006
  " Upload"
4004
4007
  ] }),
4005
- /* @__PURE__ */ e("div", { className: "rsp-border-2 rsp-border-dashed rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-text-center rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-transition-all hover:rsp-border-blue-400 hover:rsp-from-blue-100", children: s.mediaUrl ? /* @__PURE__ */ r("div", { className: "rsp-relative rsp-group", children: [
4006
- ((C = a.carousel) == null ? void 0 : C.type) === "IMAGE" ? /* @__PURE__ */ e(
4007
- "img",
4008
- {
4009
- src: s.mediaUrl,
4010
- alt: `Card ${c + 1}`,
4011
- className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md"
4012
- }
4013
- ) : /* @__PURE__ */ e(
4014
- "video",
4015
- {
4016
- src: s.mediaUrl,
4017
- className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
4018
- controls: !0
4019
- }
4020
- ),
4021
- /* @__PURE__ */ e(
4022
- "button",
4023
- {
4024
- onClick: () => g(s.id, "mediaUrl", ""),
4025
- className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-2 rsp-bg-red-500 rsp-text-white rsp-rounded-full hover:rsp-bg-red-600 rsp-shadow-lg rsp-opacity-0 group-hover:rsp-opacity-100 rsp-transition-opacity",
4026
- title: "Remove media",
4027
- children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4" })
4028
- }
4029
- ),
4030
- /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-2 rsp-left-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-xs rsp-px-2 rsp-py-1 rsp-rounded rsp-backdrop-blur-sm", children: ((j = a.carousel) == null ? void 0 : j.type) === "VIDEO" ? "📹 Video" : "🖼️ Image" })
4031
- ] }) : /* @__PURE__ */ r("div", { children: [
4032
- /* @__PURE__ */ e("div", { className: "rsp-w-20 rsp-h-20 rsp-mx-auto rsp-mb-4 rsp-bg-gradient-to-br rsp-from-blue-100 rsp-to-blue-200 rsp-rounded-xl rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md", children: /* @__PURE__ */ e("svg", { className: "rsp-w-10 rsp-h-10 rsp-text-blue-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((R = a.carousel) == null ? void 0 : R.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }),
4033
- /* @__PURE__ */ e(
4034
- "input",
4035
- {
4036
- type: "file",
4037
- accept: ((p = a.carousel) == null ? void 0 : p.type) === "VIDEO" ? "video/*" : "image/*",
4038
- onChange: (T) => {
4039
- var z;
4040
- const Y = (z = T.target.files) == null ? void 0 : z[0];
4041
- Y && t(s.id, Y);
4042
- },
4043
- className: "rsp-hidden",
4044
- id: `file-upload-${s.id}`
4045
- }
4046
- ),
4047
- /* @__PURE__ */ r(
4048
- "label",
4049
- {
4050
- htmlFor: `file-upload-${s.id}`,
4051
- className: "rsp-inline-flex rsp-items-center rsp-gap-2 rsp-px-5 rsp-py-2.5 rsp-border rsp-border-blue-300 rsp-rounded-lg rsp-shadow-sm rsp-text-sm rsp-font-semibold rsp-text-blue-600 rsp-bg-white hover:rsp-bg-blue-50 rsp-cursor-pointer rsp-transition-colors",
4052
- children: [
4053
- /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" }) }),
4054
- "Upload ",
4055
- ((L = a.carousel) == null ? void 0 : L.type) === "VIDEO" ? "Video" : "Image"
4056
- ]
4057
- }
4058
- ),
4059
- /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2", children: ((A = a.carousel) == null ? void 0 : A.type) === "VIDEO" ? "📹 MP4, MOV, AVI (Max 16MB)" : "🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)" })
4060
- ] }) })
4008
+ /* @__PURE__ */ r("div", { className: "rsp-border-2 rsp-border-dashed rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-text-center rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-transition-all hover:rsp-border-blue-400 hover:rsp-from-blue-100 rsp-relative", children: [
4009
+ s.mediaUrl ? /* @__PURE__ */ r("div", { className: "rsp-relative rsp-group", children: [
4010
+ ((c = a.carousel) == null ? void 0 : c.type) === "IMAGE" ? /* @__PURE__ */ e(
4011
+ "img",
4012
+ {
4013
+ src: s.mediaUrl,
4014
+ alt: `Card ${b + 1}`,
4015
+ className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
4016
+ onLoad: () => p((S) => ({ ...S, [s.id]: !0 })),
4017
+ onError: () => p((S) => ({ ...S, [s.id]: !1 }))
4018
+ }
4019
+ ) : /* @__PURE__ */ e(
4020
+ "video",
4021
+ {
4022
+ src: s.mediaUrl,
4023
+ className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
4024
+ controls: !0,
4025
+ onLoadedData: () => p((S) => ({ ...S, [s.id]: !0 })),
4026
+ onError: () => p((S) => ({ ...S, [s.id]: !1 }))
4027
+ }
4028
+ ),
4029
+ /* @__PURE__ */ e(
4030
+ "button",
4031
+ {
4032
+ onClick: () => k(s.id, "mediaUrl", ""),
4033
+ className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-2 rsp-bg-red-500 rsp-text-white rsp-rounded-full hover:rsp-bg-red-600 rsp-shadow-lg rsp-opacity-0 group-hover:rsp-opacity-100 rsp-transition-opacity",
4034
+ title: "Remove media",
4035
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
4036
+ }
4037
+ ),
4038
+ /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-2 rsp-left-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-xs rsp-px-2 rsp-py-1 rsp-rounded rsp-backdrop-blur-sm", children: ((M = a.carousel) == null ? void 0 : M.type) === "VIDEO" ? "📹 Video" : "🖼️ Image" })
4039
+ ] }) : /* @__PURE__ */ r("div", { children: [
4040
+ /* @__PURE__ */ e("div", { className: "rsp-w-20 rsp-h-20 rsp-mx-auto rsp-mb-4 rsp-bg-gradient-to-br rsp-from-blue-100 rsp-to-blue-200 rsp-rounded-xl rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md", children: /* @__PURE__ */ e("svg", { className: "rsp-w-10 rsp-h-10 rsp-text-blue-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((A = a.carousel) == null ? void 0 : A.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }),
4041
+ /* @__PURE__ */ e(
4042
+ "input",
4043
+ {
4044
+ type: "file",
4045
+ accept: ((O = a.carousel) == null ? void 0 : O.type) === "VIDEO" ? "video/*" : "image/*",
4046
+ onChange: (S) => {
4047
+ var z;
4048
+ const ae = (z = S.target.files) == null ? void 0 : z[0];
4049
+ ae && !l[s.id] && V(s.id, ae);
4050
+ },
4051
+ className: "rsp-hidden",
4052
+ id: `file-upload-${s.id}`,
4053
+ disabled: !!l[s.id]
4054
+ }
4055
+ ),
4056
+ /* @__PURE__ */ r(
4057
+ "label",
4058
+ {
4059
+ htmlFor: `file-upload-${s.id}`,
4060
+ className: `rsp-inline-flex rsp-items-center rsp-gap-2 rsp-px-5 rsp-py-2.5 rsp-border rsp-border-blue-300 rsp-rounded-lg rsp-shadow-sm rsp-text-sm rsp-font-semibold rsp-text-blue-600 rsp-bg-white rsp-transition-colors ${l[s.id] ? "rsp-opacity-50 rsp-cursor-not-allowed" : "hover:rsp-bg-blue-50 rsp-cursor-pointer"}`,
4061
+ "aria-disabled": !!l[s.id],
4062
+ children: [
4063
+ /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" }) }),
4064
+ "Upload ",
4065
+ (($ = a.carousel) == null ? void 0 : $.type) === "VIDEO" ? "Video" : "Image"
4066
+ ]
4067
+ }
4068
+ ),
4069
+ /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2", children: ((X = a.carousel) == null ? void 0 : X.type) === "VIDEO" ? "📹 MP4, MOV, AVI (Max 16MB)" : "🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)" })
4070
+ ] }),
4071
+ l[s.id] && /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-30 rsp-flex rsp-items-center rsp-justify-center", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-bg-white rsp-px-3 rsp-py-2 rsp-rounded-md rsp-shadow", children: [
4072
+ /* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4 rsp-animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: [
4073
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeOpacity: "0.25", strokeWidth: "4" }),
4074
+ /* @__PURE__ */ e("path", { d: "M22 12a10 10 0 00-10-10", strokeWidth: "4" })
4075
+ ] }),
4076
+ /* @__PURE__ */ e("span", { className: "rsp-text-xs rsp-text-gray-700", children: "Uploading..." })
4077
+ ] }) })
4078
+ ] })
4061
4079
  ] }),
4062
4080
  /* @__PURE__ */ r("div", { className: "rsp-space-y-5", children: [
4063
4081
  /* @__PURE__ */ r("div", { children: [
@@ -4069,11 +4087,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4069
4087
  /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
4070
4088
  "textarea",
4071
4089
  {
4072
- ref: (T) => {
4073
- N.current[s.id] = T;
4090
+ ref: (S) => {
4091
+ y.current[s.id] = S;
4074
4092
  },
4075
4093
  value: s.body,
4076
- onChange: (T) => g(s.id, "body", T.target.value),
4094
+ onChange: (S) => k(s.id, "body", S.target.value),
4077
4095
  maxLength: 160,
4078
4096
  rows: 4,
4079
4097
  className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-400 rsp-bg-white rsp-resize-none rsp-shadow-sm rsp-transition-colors",
@@ -4085,7 +4103,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4085
4103
  /* @__PURE__ */ e(
4086
4104
  "button",
4087
4105
  {
4088
- onClick: () => S(s.id, "body"),
4106
+ onClick: () => N(s.id, "body"),
4089
4107
  className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
4090
4108
  title: "Add Variable",
4091
4109
  children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
@@ -4095,11 +4113,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4095
4113
  "button",
4096
4114
  {
4097
4115
  onClick: () => {
4098
- m(s.id), d(!0);
4116
+ f(s.id), C(!0);
4099
4117
  },
4100
4118
  className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
4101
4119
  title: "Add Emoji",
4102
- children: /* @__PURE__ */ e(me, { className: "rsp-w-4 rsp-h-4" })
4120
+ children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
4103
4121
  }
4104
4122
  )
4105
4123
  ] }),
@@ -4109,11 +4127,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4109
4127
  ] })
4110
4128
  ] }),
4111
4129
  (() => {
4112
- const T = s.body.match(/\{\{(\d+)\}\}/g) || [], Y = [...new Set(T.map((z) => z.replace(/[{}]/g, "")))];
4113
- return Y.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3 rsp-p-3 rsp-bg-blue-50 rsp-rounded-lg rsp-border rsp-border-blue-200", children: [
4130
+ const S = s.body.match(/\{\{(\d+)\}\}/g) || [], ae = [...new Set(S.map((z) => z.replace(/[{}]/g, "")))];
4131
+ return ae.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3 rsp-p-3 rsp-bg-blue-50 rsp-rounded-lg rsp-border rsp-border-blue-200", children: [
4114
4132
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-semibold rsp-text-blue-800 rsp-mb-2", children: "Sample Values for This Card" }),
4115
- /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children: Y.map((z) => {
4116
- var G, O;
4133
+ /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children: ae.map((z) => {
4134
+ var Z, _;
4117
4135
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
4118
4136
  /* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-700 rsp-font-medium rsp-whitespace-nowrap", children: [
4119
4137
  "{{",
@@ -4125,24 +4143,24 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4125
4143
  "input",
4126
4144
  {
4127
4145
  type: "text",
4128
- value: ((O = (G = s.sampleContent) == null ? void 0 : G.bodyVariables) == null ? void 0 : O[z]) || "",
4129
- onChange: (W) => {
4130
- const $ = W.target.value;
4131
- n((_) => ({
4132
- ..._,
4146
+ value: ((_ = (Z = s.sampleContent) == null ? void 0 : Z.bodyVariables) == null ? void 0 : _[z]) || "",
4147
+ onChange: (Q) => {
4148
+ const W = Q.target.value;
4149
+ n((F) => ({
4150
+ ...F,
4133
4151
  carousel: {
4134
- ..._.carousel,
4135
- cards: _.carousel.cards.map((P) => {
4136
- var F, D, K;
4152
+ ...F.carousel,
4153
+ cards: F.carousel.cards.map((P) => {
4154
+ var D, q, Y;
4137
4155
  return P.id !== s.id ? P : {
4138
4156
  ...P,
4139
4157
  sampleContent: {
4140
- headerVariables: ((F = P.sampleContent) == null ? void 0 : F.headerVariables) || {},
4158
+ headerVariables: ((D = P.sampleContent) == null ? void 0 : D.headerVariables) || {},
4141
4159
  bodyVariables: {
4142
- ...((D = P.sampleContent) == null ? void 0 : D.bodyVariables) || {},
4143
- [z]: $
4160
+ ...((q = P.sampleContent) == null ? void 0 : q.bodyVariables) || {},
4161
+ [z]: W
4144
4162
  },
4145
- buttonVariables: ((K = P.sampleContent) == null ? void 0 : K.buttonVariables) || {}
4163
+ buttonVariables: ((Y = P.sampleContent) == null ? void 0 : Y.buttonVariables) || {}
4146
4164
  }
4147
4165
  };
4148
4166
  })
@@ -4158,22 +4176,22 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4158
4176
  {
4159
4177
  type: "button",
4160
4178
  onClick: () => {
4161
- const W = new RegExp(`\\{\\{${z}\\}\\}`, "g"), $ = (s.body || "").replace(W, "");
4162
- n((_) => ({
4163
- ..._,
4179
+ const Q = new RegExp(`\\{\\{${z}\\}\\}`, "g"), W = (s.body || "").replace(Q, "");
4180
+ n((F) => ({
4181
+ ...F,
4164
4182
  carousel: {
4165
- ..._.carousel,
4166
- cards: _.carousel.cards.map((P) => {
4167
- var F, D, K;
4183
+ ...F.carousel,
4184
+ cards: F.carousel.cards.map((P) => {
4185
+ var D, q, Y;
4168
4186
  if (P.id !== s.id) return P;
4169
- const H = Object.fromEntries(Object.entries(((F = P.sampleContent) == null ? void 0 : F.bodyVariables) || {}).filter(([Z]) => Z !== z));
4187
+ const G = Object.fromEntries(Object.entries(((D = P.sampleContent) == null ? void 0 : D.bodyVariables) || {}).filter(([re]) => re !== z));
4170
4188
  return {
4171
4189
  ...P,
4172
- body: $,
4190
+ body: W,
4173
4191
  sampleContent: {
4174
- headerVariables: ((D = P.sampleContent) == null ? void 0 : D.headerVariables) || {},
4175
- bodyVariables: H,
4176
- buttonVariables: ((K = P.sampleContent) == null ? void 0 : K.buttonVariables) || {}
4192
+ headerVariables: ((q = P.sampleContent) == null ? void 0 : q.headerVariables) || {},
4193
+ bodyVariables: G,
4194
+ buttonVariables: ((Y = P.sampleContent) == null ? void 0 : Y.buttonVariables) || {}
4177
4195
  }
4178
4196
  };
4179
4197
  })
@@ -4204,7 +4222,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4204
4222
  /* @__PURE__ */ r(
4205
4223
  "button",
4206
4224
  {
4207
- onClick: () => v(s.id, "QUICK_REPLY"),
4225
+ onClick: () => t(s.id, "QUICK_REPLY"),
4208
4226
  className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
4209
4227
  children: [
4210
4228
  /* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
@@ -4215,7 +4233,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4215
4233
  /* @__PURE__ */ r(
4216
4234
  "button",
4217
4235
  {
4218
- onClick: () => v(s.id, "URL"),
4236
+ onClick: () => t(s.id, "URL"),
4219
4237
  className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
4220
4238
  children: [
4221
4239
  /* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }),
@@ -4226,7 +4244,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4226
4244
  /* @__PURE__ */ r(
4227
4245
  "button",
4228
4246
  {
4229
- onClick: () => v(s.id, "PHONE_NUMBER"),
4247
+ onClick: () => t(s.id, "PHONE_NUMBER"),
4230
4248
  className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
4231
4249
  children: [
4232
4250
  /* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }),
@@ -4241,19 +4259,19 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4241
4259
  /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4242
4260
  "Configured Buttons"
4243
4261
  ] }),
4244
- s.buttons.map((T, Y) => /* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-shadow-sm", children: [
4262
+ s.buttons.map((S, ae) => /* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-shadow-sm", children: [
4245
4263
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-3", children: [
4246
4264
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
4247
- /* @__PURE__ */ e("div", { className: "rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold", children: Y + 1 }),
4248
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children: T.type === "QUICK_REPLY" ? "Quick Reply" : T.type === "URL" ? "Website" : "Phone" })
4265
+ /* @__PURE__ */ e("div", { className: "rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold", children: ae + 1 }),
4266
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children: S.type === "QUICK_REPLY" ? "Quick Reply" : S.type === "URL" ? "Website" : "Phone" })
4249
4267
  ] }),
4250
4268
  /* @__PURE__ */ e(
4251
4269
  "button",
4252
4270
  {
4253
- onClick: () => b(s.id, T.id),
4271
+ onClick: () => v(s.id, S.id),
4254
4272
  className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
4255
4273
  title: "Remove button",
4256
- children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4" })
4274
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
4257
4275
  }
4258
4276
  )
4259
4277
  ] }),
@@ -4264,15 +4282,15 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4264
4282
  "input",
4265
4283
  {
4266
4284
  type: "text",
4267
- value: T.text,
4268
- onChange: (z) => x(s.id, T.id, "text", z.target.value),
4269
- placeholder: `Enter Button Text (Max ${T.type === "QUICK_REPLY" ? "25" : "20"} characters)`,
4270
- maxLength: T.type === "QUICK_REPLY" ? 25 : 20,
4285
+ value: S.text,
4286
+ onChange: (z) => h(s.id, S.id, "text", z.target.value),
4287
+ placeholder: `Enter Button Text (Max ${S.type === "QUICK_REPLY" ? "25" : "20"} characters)`,
4288
+ maxLength: S.type === "QUICK_REPLY" ? 25 : 20,
4271
4289
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
4272
4290
  }
4273
4291
  )
4274
4292
  ] }),
4275
- T.type === "URL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-3", children: [
4293
+ S.type === "URL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-3", children: [
4276
4294
  /* @__PURE__ */ r("div", { children: [
4277
4295
  /* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "URL Type" }),
4278
4296
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-4", children: [
@@ -4281,8 +4299,8 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4281
4299
  "input",
4282
4300
  {
4283
4301
  type: "radio",
4284
- checked: T.urlType !== "dynamic",
4285
- onChange: () => x(s.id, T.id, "urlType", "static"),
4302
+ checked: S.urlType !== "dynamic",
4303
+ onChange: () => h(s.id, S.id, "urlType", "static"),
4286
4304
  className: "rsp-mr-2 rsp-text-blue-600"
4287
4305
  }
4288
4306
  ),
@@ -4293,8 +4311,8 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4293
4311
  "input",
4294
4312
  {
4295
4313
  type: "radio",
4296
- checked: T.urlType === "dynamic",
4297
- onChange: () => x(s.id, T.id, "urlType", "dynamic"),
4314
+ checked: S.urlType === "dynamic",
4315
+ onChange: () => h(s.id, S.id, "urlType", "dynamic"),
4298
4316
  className: "rsp-mr-2 rsp-text-blue-600"
4299
4317
  }
4300
4318
  ),
@@ -4308,14 +4326,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4308
4326
  "input",
4309
4327
  {
4310
4328
  type: "text",
4311
- value: T.value || "",
4312
- onChange: (z) => x(s.id, T.id, "value", z.target.value),
4313
- placeholder: T.urlType === "dynamic" ? "https://example.com/order/{{1}}" : "https://example.com",
4329
+ value: S.value || "",
4330
+ onChange: (z) => h(s.id, S.id, "value", z.target.value),
4331
+ placeholder: S.urlType === "dynamic" ? "https://example.com/order/{{1}}" : "https://example.com",
4314
4332
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
4315
4333
  }
4316
4334
  )
4317
4335
  ] }),
4318
- T.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-space-y-2", children: [
4336
+ S.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-space-y-2", children: [
4319
4337
  /* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-blue-50 rsp-rounded rsp-border rsp-border-blue-200", children: /* @__PURE__ */ r("p", { className: "rsp-text-xs rsp-text-blue-700", children: [
4320
4338
  /* @__PURE__ */ e("strong", { children: "Tip:" }),
4321
4339
  " Use ",
@@ -4334,71 +4352,71 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4334
4352
  {
4335
4353
  type: "button",
4336
4354
  onClick: () => {
4337
- if (((T.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
4338
- const O = ((T.value || "").match(/\{\{(\d+)\}\}/g) || []).map((P) => {
4339
- const H = P.match(/{{(\d+)}}/);
4340
- return H ? parseInt(H[1], 10) : 0;
4341
- }), $ = (O.length > 0 ? Math.max(...O) : 0) + 1, _ = (T.value || "") + `{{${$}}}`;
4342
- x(s.id, T.id, "value", _);
4355
+ if (((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
4356
+ const _ = ((S.value || "").match(/\{\{(\d+)\}\}/g) || []).map((P) => {
4357
+ const G = P.match(/{{(\d+)}}/);
4358
+ return G ? parseInt(G[1], 10) : 0;
4359
+ }), W = (_.length > 0 ? Math.max(..._) : 0) + 1, F = (S.value || "") + `{{${W}}}`;
4360
+ h(s.id, S.id, "value", F);
4343
4361
  },
4344
- disabled: ((T.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3,
4362
+ disabled: ((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3,
4345
4363
  className: "rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-blue-500 hover:rsp-bg-blue-600 rsp-text-white rsp-rounded disabled:rsp-bg-gray-300 disabled:rsp-cursor-not-allowed rsp-transition-colors",
4346
4364
  children: "+ Add Variable"
4347
4365
  }
4348
4366
  ),
4349
- ((T.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3 && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: "Maximum 3 variables allowed" })
4367
+ ((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3 && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: "Maximum 3 variables allowed" })
4350
4368
  ] }),
4351
4369
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
4352
4370
  "button",
4353
4371
  {
4354
4372
  type: "button",
4355
4373
  onClick: () => {
4356
- const z = T.value || "", G = /\{\{\d+\}\}/g;
4357
- let O = -1, W = "", $;
4358
- for (; ($ = G.exec(z)) !== null; )
4359
- O = $.index, W = $[0];
4360
- if (O === -1) return;
4361
- const _ = O, P = _ + W.length, H = z.slice(0, _) + z.slice(P);
4362
- x(s.id, T.id, "value", H);
4374
+ const z = S.value || "", Z = /\{\{\d+\}\}/g;
4375
+ let _ = -1, Q = "", W;
4376
+ for (; (W = Z.exec(z)) !== null; )
4377
+ _ = W.index, Q = W[0];
4378
+ if (_ === -1) return;
4379
+ const F = _, P = F + Q.length, G = z.slice(0, F) + z.slice(P);
4380
+ h(s.id, S.id, "value", G);
4363
4381
  },
4364
4382
  className: "rsp-mt-2 rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-red-500 hover:rsp-bg-red-600 rsp-text-white rsp-rounded rsp-transition-colors",
4365
4383
  children: "Remove Last"
4366
4384
  }
4367
4385
  ) }),
4368
4386
  (() => {
4369
- const z = (T.value || "").match(/\{\{(\d+)\}\}/g) || [], G = [...new Set(z.map((O) => O.replace(/[{}]/g, "")))];
4370
- return G.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200", children: [
4387
+ const z = (S.value || "").match(/\{\{(\d+)\}\}/g) || [], Z = [...new Set(z.map((_) => _.replace(/[{}]/g, "")))];
4388
+ return Z.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200", children: [
4371
4389
  /* @__PURE__ */ e("h4", { className: "rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2", children: "Sample Values for URL Variables" }),
4372
- /* @__PURE__ */ e("div", { className: "rsp-space-y-2", children: G.map((O) => {
4373
- var W, $;
4390
+ /* @__PURE__ */ e("div", { className: "rsp-space-y-2", children: Z.map((_) => {
4391
+ var Q, W;
4374
4392
  return /* @__PURE__ */ r("div", { className: "rsp-space-y-1", children: [
4375
4393
  /* @__PURE__ */ r("label", { className: "rsp-block rsp-text-xs rsp-text-gray-600 rsp-mb-1", children: [
4376
4394
  "Variable ",
4377
4395
  "{{",
4378
- O,
4396
+ _,
4379
4397
  "}}"
4380
4398
  ] }),
4381
4399
  /* @__PURE__ */ e(
4382
4400
  "input",
4383
4401
  {
4384
4402
  type: "text",
4385
- value: (($ = (W = s.sampleContent) == null ? void 0 : W.buttonVariables) == null ? void 0 : $[O]) || "",
4386
- onChange: (_) => {
4387
- const P = _.target.value;
4388
- n((H) => ({
4389
- ...H,
4403
+ value: ((W = (Q = s.sampleContent) == null ? void 0 : Q.buttonVariables) == null ? void 0 : W[_]) || "",
4404
+ onChange: (F) => {
4405
+ const P = F.target.value;
4406
+ n((G) => ({
4407
+ ...G,
4390
4408
  carousel: {
4391
- ...H.carousel,
4392
- cards: H.carousel.cards.map((F) => {
4393
- var D, K, Z;
4394
- return F.id !== s.id ? F : {
4395
- ...F,
4409
+ ...G.carousel,
4410
+ cards: G.carousel.cards.map((D) => {
4411
+ var q, Y, re;
4412
+ return D.id !== s.id ? D : {
4413
+ ...D,
4396
4414
  sampleContent: {
4397
- headerVariables: ((D = F.sampleContent) == null ? void 0 : D.headerVariables) || {},
4398
- bodyVariables: ((K = F.sampleContent) == null ? void 0 : K.bodyVariables) || {},
4415
+ headerVariables: ((q = D.sampleContent) == null ? void 0 : q.headerVariables) || {},
4416
+ bodyVariables: ((Y = D.sampleContent) == null ? void 0 : Y.bodyVariables) || {},
4399
4417
  buttonVariables: {
4400
- ...((Z = F.sampleContent) == null ? void 0 : Z.buttonVariables) || {},
4401
- [O]: P
4418
+ ...((re = D.sampleContent) == null ? void 0 : re.buttonVariables) || {},
4419
+ [_]: P
4402
4420
  }
4403
4421
  }
4404
4422
  };
@@ -4407,7 +4425,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4407
4425
  }));
4408
4426
  },
4409
4427
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-bg-white",
4410
- placeholder: `Sample value (e.g., ${O === "1" ? "order123" : "user456"})`
4428
+ placeholder: `Sample value (e.g., ${_ === "1" ? "order123" : "user456"})`
4411
4429
  }
4412
4430
  ),
4413
4431
  /* @__PURE__ */ e(
@@ -4415,21 +4433,21 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4415
4433
  {
4416
4434
  type: "button",
4417
4435
  onClick: () => {
4418
- const _ = T.value || "", P = new RegExp(`\\{\\{${O}\\}\\}`, "g"), H = _.replace(P, "");
4419
- x(s.id, T.id, "value", H), n((F) => ({
4420
- ...F,
4436
+ const F = S.value || "", P = new RegExp(`\\{\\{${_}\\}\\}`, "g"), G = F.replace(P, "");
4437
+ h(s.id, S.id, "value", G), n((D) => ({
4438
+ ...D,
4421
4439
  carousel: {
4422
- ...F.carousel,
4423
- cards: F.carousel.cards.map((D) => {
4424
- var Z, pe, oe;
4425
- if (D.id !== s.id) return D;
4426
- const K = Object.fromEntries(Object.entries(((Z = D.sampleContent) == null ? void 0 : Z.buttonVariables) || {}).filter(([Ne]) => Ne !== O));
4440
+ ...D.carousel,
4441
+ cards: D.carousel.cards.map((q) => {
4442
+ var re, he, ue;
4443
+ if (q.id !== s.id) return q;
4444
+ const Y = Object.fromEntries(Object.entries(((re = q.sampleContent) == null ? void 0 : re.buttonVariables) || {}).filter(([Ee]) => Ee !== _));
4427
4445
  return {
4428
- ...D,
4446
+ ...q,
4429
4447
  sampleContent: {
4430
- headerVariables: ((pe = D.sampleContent) == null ? void 0 : pe.headerVariables) || {},
4431
- bodyVariables: ((oe = D.sampleContent) == null ? void 0 : oe.bodyVariables) || {},
4432
- buttonVariables: K
4448
+ headerVariables: ((he = q.sampleContent) == null ? void 0 : he.headerVariables) || {},
4449
+ bodyVariables: ((ue = q.sampleContent) == null ? void 0 : ue.bodyVariables) || {},
4450
+ buttonVariables: Y
4433
4451
  }
4434
4452
  };
4435
4453
  })
@@ -4441,27 +4459,27 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4441
4459
  children: "×"
4442
4460
  }
4443
4461
  )
4444
- ] }, `button-${T.id}-sample-${O}`);
4462
+ ] }, `button-${S.id}-sample-${_}`);
4445
4463
  }) })
4446
4464
  ] });
4447
4465
  })()
4448
4466
  ] })
4449
4467
  ] }),
4450
- T.type === "PHONE_NUMBER" && /* @__PURE__ */ r("div", { children: [
4468
+ S.type === "PHONE_NUMBER" && /* @__PURE__ */ r("div", { children: [
4451
4469
  /* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1", children: "Phone Number" }),
4452
4470
  /* @__PURE__ */ e(
4453
4471
  "input",
4454
4472
  {
4455
4473
  type: "text",
4456
- value: T.value || "",
4457
- onChange: (z) => x(s.id, T.id, "value", z.target.value),
4474
+ value: S.value || "",
4475
+ onChange: (z) => h(s.id, S.id, "value", z.target.value),
4458
4476
  placeholder: "+1234567890",
4459
4477
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
4460
4478
  }
4461
4479
  )
4462
4480
  ] })
4463
4481
  ] })
4464
- ] }, T.id))
4482
+ ] }, S.id))
4465
4483
  ] })
4466
4484
  ] })
4467
4485
  ] }) })
@@ -4482,43 +4500,43 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
4482
4500
  ] })
4483
4501
  ] }) }),
4484
4502
  /* @__PURE__ */ e(
4485
- xe,
4503
+ fe,
4486
4504
  {
4487
- isOpen: l,
4488
- onClose: () => d(!1),
4489
- onSelect: V
4505
+ isOpen: m,
4506
+ onClose: () => C(!1),
4507
+ onSelect: o
4490
4508
  }
4491
4509
  )
4492
4510
  ] });
4493
4511
  }
4494
- const ge = async (a) => {
4512
+ const ve = async (a) => {
4495
4513
  try {
4496
4514
  console.log(`Starting file upload: ${a.name}`);
4497
- const n = await ra(a);
4515
+ const n = await la(a);
4498
4516
  return console.log(`File uploaded successfully: ${n}`), n;
4499
4517
  } catch (n) {
4500
4518
  throw console.error("Upload failed in parent:", n), n;
4501
4519
  }
4502
- }, ia = (a) => {
4520
+ }, ca = (a) => {
4503
4521
  const i = (a.body || "").match(/\{\{(\d+)\}\}/g);
4504
4522
  if (!i) return 0;
4505
4523
  const l = i.map((d) => {
4506
- const f = d.match(/{{(\d+)}}/);
4507
- return f ? parseInt(f[1], 10) : 0;
4524
+ const p = d.match(/{{(\d+)}}/);
4525
+ return p ? parseInt(p[1], 10) : 0;
4508
4526
  });
4509
4527
  return l.length > 0 ? Math.max(...l) : 0;
4510
4528
  };
4511
- function ta({ template: a, setTemplate: n }) {
4512
- const [i, l] = Q.useState(!1), d = Q.useRef(null), f = () => {
4529
+ function da({ template: a, setTemplate: n }) {
4530
+ const [i, l] = K.useState(!1), d = K.useRef(null), p = () => {
4513
4531
  l(!0), setTimeout(() => {
4514
4532
  d.current && d.current.focus();
4515
4533
  }, 0);
4516
- }, m = (N) => {
4517
- const w = d.current, h = a.body, g = w && typeof w.selectionStart == "number" ? w.selectionStart : h.length, S = h.substring(0, g), V = h.substring(g), M = S + N + V;
4518
- n({ ...a, body: M }), setTimeout(() => {
4534
+ }, m = (C) => {
4535
+ const g = d.current, f = a.body, y = g && typeof g.selectionStart == "number" ? g.selectionStart : f.length, j = f.substring(0, y), U = f.substring(y), k = j + C + U;
4536
+ n({ ...a, body: k }), setTimeout(() => {
4519
4537
  if (d.current) {
4520
- const v = g + N.length;
4521
- d.current.setSelectionRange(v, v), d.current.focus();
4538
+ const N = y + C.length;
4539
+ d.current.setSelectionRange(N, N), d.current.focus();
4522
4540
  }
4523
4541
  }, 0), l(!1);
4524
4542
  };
@@ -4526,8 +4544,8 @@ function ta({ template: a, setTemplate: n }) {
4526
4544
  a.type !== "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
4527
4545
  /* @__PURE__ */ e("h2", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Message Content" }),
4528
4546
  /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
4529
- /* @__PURE__ */ e(Je, { template: a, setTemplate: n, onFileUpload: ge }),
4530
- /* @__PURE__ */ e(ea, { template: a, setTemplate: n })
4547
+ /* @__PURE__ */ e(aa, { template: a, setTemplate: n, onFileUpload: ve }),
4548
+ /* @__PURE__ */ e(sa, { template: a, setTemplate: n })
4531
4549
  ] })
4532
4550
  ] }),
4533
4551
  a.type === "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
@@ -4542,7 +4560,7 @@ function ta({ template: a, setTemplate: n }) {
4542
4560
  {
4543
4561
  ref: d,
4544
4562
  value: a.body,
4545
- onChange: (N) => n({ ...a, body: N.target.value }),
4563
+ onChange: (C) => n({ ...a, body: C.target.value }),
4546
4564
  maxLength: 1024,
4547
4565
  rows: 4,
4548
4566
  className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none",
@@ -4555,8 +4573,8 @@ function ta({ template: a, setTemplate: n }) {
4555
4573
  "button",
4556
4574
  {
4557
4575
  onClick: () => {
4558
- const h = `{{${ia(a) + 1}}}`;
4559
- n({ ...a, body: a.body + h });
4576
+ const f = `{{${ca(a) + 1}}}`;
4577
+ n({ ...a, body: a.body + f });
4560
4578
  },
4561
4579
  className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
4562
4580
  title: "Add Variable",
@@ -4566,10 +4584,10 @@ function ta({ template: a, setTemplate: n }) {
4566
4584
  /* @__PURE__ */ e(
4567
4585
  "button",
4568
4586
  {
4569
- onClick: f,
4587
+ onClick: p,
4570
4588
  className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
4571
4589
  title: "Add emoji",
4572
- children: /* @__PURE__ */ e(me, { className: "rsp-w-4 rsp-h-4" })
4590
+ children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
4573
4591
  }
4574
4592
  )
4575
4593
  ] }),
@@ -4579,15 +4597,15 @@ function ta({ template: a, setTemplate: n }) {
4579
4597
  ] })
4580
4598
  ] }),
4581
4599
  (() => {
4582
- const N = a.body.match(/\{\{(\d+)\}\}/g) || [], w = [...new Set(N.map((h) => h.replace(/[{}]/g, "")))];
4583
- return w.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
4600
+ const C = a.body.match(/\{\{(\d+)\}\}/g) || [], g = [...new Set(C.map((f) => f.replace(/[{}]/g, "")))];
4601
+ return g.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
4584
4602
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
4585
- /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: w.map((h) => {
4586
- var g, S;
4603
+ /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: g.map((f) => {
4604
+ var y, j;
4587
4605
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
4588
4606
  /* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
4589
4607
  "{{",
4590
- h,
4608
+ f,
4591
4609
  "}}",
4592
4610
  ":"
4593
4611
  ] }),
@@ -4595,19 +4613,19 @@ function ta({ template: a, setTemplate: n }) {
4595
4613
  "input",
4596
4614
  {
4597
4615
  type: "text",
4598
- value: ((S = (g = a.sampleContent) == null ? void 0 : g.bodyVariables) == null ? void 0 : S[h]) || "",
4599
- onChange: (V) => {
4600
- var v, x, b;
4601
- const M = {
4616
+ value: ((j = (y = a.sampleContent) == null ? void 0 : y.bodyVariables) == null ? void 0 : j[f]) || "",
4617
+ onChange: (U) => {
4618
+ var N, o, u;
4619
+ const k = {
4602
4620
  ...a.sampleContent,
4603
- headerVariables: ((v = a.sampleContent) == null ? void 0 : v.headerVariables) || {},
4621
+ headerVariables: ((N = a.sampleContent) == null ? void 0 : N.headerVariables) || {},
4604
4622
  bodyVariables: {
4605
- ...(x = a.sampleContent) == null ? void 0 : x.bodyVariables,
4606
- [h]: V.target.value
4623
+ ...(o = a.sampleContent) == null ? void 0 : o.bodyVariables,
4624
+ [f]: U.target.value
4607
4625
  },
4608
- buttonVariables: ((b = a.sampleContent) == null ? void 0 : b.buttonVariables) || {}
4626
+ buttonVariables: ((u = a.sampleContent) == null ? void 0 : u.buttonVariables) || {}
4609
4627
  };
4610
- n({ ...a, sampleContent: M });
4628
+ n({ ...a, sampleContent: k });
4611
4629
  },
4612
4630
  className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
4613
4631
  placeholder: "Sample"
@@ -4618,15 +4636,15 @@ function ta({ template: a, setTemplate: n }) {
4618
4636
  {
4619
4637
  type: "button",
4620
4638
  onClick: () => {
4621
- var x, b, t;
4622
- const V = new RegExp(`\\{\\{${h}\\}\\}`, "g"), M = (a.body || "").replace(V, ""), v = Object.fromEntries(Object.entries(((x = a.sampleContent) == null ? void 0 : x.bodyVariables) || {}).filter(([u]) => u !== h));
4639
+ var o, u, t;
4640
+ const U = new RegExp(`\\{\\{${f}\\}\\}`, "g"), k = (a.body || "").replace(U, ""), N = Object.fromEntries(Object.entries(((o = a.sampleContent) == null ? void 0 : o.bodyVariables) || {}).filter(([h]) => h !== f));
4623
4641
  n({
4624
4642
  ...a,
4625
- body: M,
4643
+ body: k,
4626
4644
  sampleContent: {
4627
4645
  ...a.sampleContent,
4628
- bodyVariables: v,
4629
- headerVariables: ((b = a.sampleContent) == null ? void 0 : b.headerVariables) || {},
4646
+ bodyVariables: N,
4647
+ headerVariables: ((u = a.sampleContent) == null ? void 0 : u.headerVariables) || {},
4630
4648
  buttonVariables: ((t = a.sampleContent) == null ? void 0 : t.buttonVariables) || {}
4631
4649
  }
4632
4650
  });
@@ -4636,29 +4654,29 @@ function ta({ template: a, setTemplate: n }) {
4636
4654
  children: "×"
4637
4655
  }
4638
4656
  )
4639
- ] }, `global-body-sample-${h}`);
4657
+ ] }, `global-body-sample-${f}`);
4640
4658
  }) })
4641
4659
  ] });
4642
4660
  })()
4643
4661
  ] }) })
4644
4662
  ] }),
4645
4663
  a.type === "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
4646
- la,
4664
+ ma,
4647
4665
  {
4648
4666
  template: a,
4649
4667
  setTemplate: n,
4650
- onFileUpload: ge
4668
+ onFileUpload: ve
4651
4669
  }
4652
4670
  ) }),
4653
4671
  a.type !== "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
4654
- aa,
4672
+ na,
4655
4673
  {
4656
4674
  template: a,
4657
4675
  setTemplate: n
4658
4676
  }
4659
4677
  ) }),
4660
4678
  /* @__PURE__ */ e(
4661
- xe,
4679
+ fe,
4662
4680
  {
4663
4681
  isOpen: i,
4664
4682
  onClose: () => l(!1),
@@ -4667,21 +4685,21 @@ function ta({ template: a, setTemplate: n }) {
4667
4685
  )
4668
4686
  ] });
4669
4687
  }
4670
- function ma({ type: a }) {
4688
+ function xa({ type: a }) {
4671
4689
  switch (a) {
4672
4690
  case "QUICK_REPLY":
4673
- return /* @__PURE__ */ e(Be, { className: "w-4 h-4" });
4691
+ return /* @__PURE__ */ e(Pe, { className: "w-4 h-4" });
4674
4692
  case "URL":
4675
- return /* @__PURE__ */ e(Ie, { className: "w-4 h-4" });
4693
+ return /* @__PURE__ */ e(Oe, { className: "w-4 h-4" });
4676
4694
  case "CALL":
4677
- return /* @__PURE__ */ e(ke, { className: "w-4 h-4" });
4695
+ return /* @__PURE__ */ e(Me, { className: "w-4 h-4" });
4678
4696
  case "FLOW":
4679
- return /* @__PURE__ */ e(Pe, { className: "w-4 h-4" });
4697
+ return /* @__PURE__ */ e(Fe, { className: "w-4 h-4" });
4680
4698
  default:
4681
4699
  return null;
4682
4700
  }
4683
4701
  }
4684
- function ca({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
4702
+ function pa({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
4685
4703
  const l = [...a];
4686
4704
  n && l.push({
4687
4705
  id: "flow-button",
@@ -4690,18 +4708,18 @@ function ca({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
4690
4708
  });
4691
4709
  const d = l.slice(0, 2);
4692
4710
  return /* @__PURE__ */ r("div", { className: "rsp-divide-y rsp-divide-gray-200", children: [
4693
- d.map((f) => /* @__PURE__ */ r(
4711
+ d.map((p) => /* @__PURE__ */ r(
4694
4712
  "button",
4695
4713
  {
4696
4714
  className: "rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-gap-3 rsp-px-4 rsp-transition-colors",
4697
4715
  style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
4698
4716
  children: [
4699
- /* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(ma, { type: f.type }) }),
4700
- /* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children: f.text }),
4701
- f.id === "flow-button" && /* @__PURE__ */ e(je, { className: "rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto" })
4717
+ /* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(xa, { type: p.type }) }),
4718
+ /* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children: p.text }),
4719
+ p.id === "flow-button" && /* @__PURE__ */ e(Re, { className: "rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto" })
4702
4720
  ]
4703
4721
  },
4704
- f.id
4722
+ p.id
4705
4723
  )),
4706
4724
  l.length > 2 && /* @__PURE__ */ r(
4707
4725
  "button",
@@ -4717,25 +4735,25 @@ function ca({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
4717
4735
  )
4718
4736
  ] });
4719
4737
  }
4720
- function da({ template: a }) {
4721
- var S, V, M, v;
4722
- const [n, i] = I(!1), [l, d] = I(0), f = (S = a.carousel) != null && S.cards ? a.carousel.cards.length : 0;
4723
- ee(() => {
4724
- a.type === "CAROUSEL" && f > 0 ? l >= f && d(0) : d(0);
4725
- }, [f, a.type]);
4726
- const m = (x) => x ? x.replace(/\{\{(\d+)\}\}/g, (b, t) => {
4727
- var u, k;
4728
- return ((k = (u = a.sampleContent) == null ? void 0 : u.headerVariables) == null ? void 0 : k[t]) || `[Variable ${t}]`;
4729
- }) : "", N = (x) => x ? x.replace(/\{\{(\d+)\}\}/g, (b, t) => {
4730
- var u, k;
4731
- return ((k = (u = a.sampleContent) == null ? void 0 : u.bodyVariables) == null ? void 0 : k[t]) || `[Variable ${t}]`;
4732
- }) : "", w = (x) => {
4733
- var u;
4734
- const b = (x == null ? void 0 : x.body) ?? "";
4735
- if (!b) return "";
4736
- const t = ((u = x == null ? void 0 : x.sampleContent) == null ? void 0 : u.bodyVariables) ?? {};
4737
- return b.replace(/\{\{(\d+)\}\}/g, (k, E) => t[E] || `[Variable ${E}]`);
4738
- }, h = a.headerType !== "NONE" || a.body || a.footer || a.buttons.length > 0 || a.type === "CAROUSEL" && ((V = a.carousel) == null ? void 0 : V.cards.length), g = a.headerText || a.body || a.footer;
4738
+ function oa({ template: a }) {
4739
+ var j, U, k, N;
4740
+ const [n, i] = B(!1), [l, d] = B(0), p = (j = a.carousel) != null && j.cards ? a.carousel.cards.length : 0;
4741
+ se(() => {
4742
+ a.type === "CAROUSEL" && p > 0 ? l >= p && d(0) : d(0);
4743
+ }, [p, a.type]);
4744
+ const m = (o) => o ? o.replace(/\{\{(\d+)\}\}/g, (u, t) => {
4745
+ var h, v;
4746
+ return ((v = (h = a.sampleContent) == null ? void 0 : h.headerVariables) == null ? void 0 : v[t]) || `[Variable ${t}]`;
4747
+ }) : "", C = (o) => o ? o.replace(/\{\{(\d+)\}\}/g, (u, t) => {
4748
+ var h, v;
4749
+ return ((v = (h = a.sampleContent) == null ? void 0 : h.bodyVariables) == null ? void 0 : v[t]) || `[Variable ${t}]`;
4750
+ }) : "", g = (o) => {
4751
+ var h;
4752
+ const u = (o == null ? void 0 : o.body) ?? "";
4753
+ if (!u) return "";
4754
+ const t = ((h = o == null ? void 0 : o.sampleContent) == null ? void 0 : h.bodyVariables) ?? {};
4755
+ return u.replace(/\{\{(\d+)\}\}/g, (v, V) => t[V] || `[Variable ${V}]`);
4756
+ }, f = a.headerType !== "NONE" || a.body || a.footer || a.buttons.length > 0 || a.type === "CAROUSEL" && ((U = a.carousel) == null ? void 0 : U.cards.length), y = a.headerText || a.body || a.footer;
4739
4757
  return /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
4740
4758
  /* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-b rsp-border-gray-200", children: [
4741
4759
  /* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Preview" }),
@@ -4782,7 +4800,7 @@ function da({ template: a }) {
4782
4800
  ] }),
4783
4801
  /* @__PURE__ */ r("div", { className: "rsp-absolute rsp-top-[105px] rsp-left-0 rsp-right-0 rsp-bottom-[60px] rsp-bg-gradient-to-b rsp-from-[#E8E2DB] rsp-via-[#E5DDD5] rsp-to-[#DDD5CC] rsp-overflow-y-auto", children: [
4784
4802
  /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-opacity-[0.03]", style: { backgroundImage: `url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.08'%3E%3Cpath d='M40 40c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm0-32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm32 32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")` } }),
4785
- /* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children: h ? /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-items-start", children: [
4803
+ /* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children: f ? /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-items-start", children: [
4786
4804
  a.headerType === "MEDIA" && a.mediaUrl && /* @__PURE__ */ r("div", { className: "rsp-max-w-[220px] rsp-w-auto rsp-rounded-xl rsp-overflow-hidden rsp-shadow-md rsp-mb-1.5 rsp-animate-slide-up rsp-border rsp-border-gray-200", children: [
4787
4805
  a.mediaType === "IMAGE" && /* @__PURE__ */ e(
4788
4806
  "img",
@@ -4790,8 +4808,8 @@ function da({ template: a }) {
4790
4808
  src: a.mediaUrl,
4791
4809
  alt: "Header media",
4792
4810
  className: "rsp-w-full rsp-max-h-[150px] rsp-object-cover rsp-block",
4793
- onError: (x) => {
4794
- x.currentTarget.style.display = "none";
4811
+ onError: (o) => {
4812
+ o.currentTarget.style.display = "none";
4795
4813
  }
4796
4814
  }
4797
4815
  ),
@@ -4807,38 +4825,38 @@ function da({ template: a }) {
4807
4825
  ] })
4808
4826
  ] }) })
4809
4827
  ] }),
4810
- g && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-max-w-[220px] rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-relative rsp-border rsp-border-gray-100 rsp-animate-slide-up", children: [
4828
+ y && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-max-w-[220px] rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-relative rsp-border rsp-border-gray-100 rsp-animate-slide-up", children: [
4811
4829
  a.headerType === "TEXT" && a.headerText && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pt-3 rsp-pb-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[15px] rsp-font-semibold rsp-text-[#111b21] rsp-leading-[1.3] rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: m(a.headerText) }) }),
4812
- a.body && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: N(a.body) }) }),
4830
+ a.body && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: C(a.body) }) }),
4813
4831
  a.footer && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pb-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[12px] rsp-text-[#667781] rsp-pt-2 rsp-border-t rsp-border-gray-100 rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: a.footer }) }),
4814
4832
  /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pb-2 rsp-text-right", children: /* @__PURE__ */ r("div", { className: "rsp-text-[11px] rsp-text-[#667781] rsp-flex rsp-items-center rsp-justify-end rsp-gap-1 rsp-opacity-80", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: [
4815
4833
  "9:41 AM",
4816
4834
  /* @__PURE__ */ e("svg", { className: "rsp-w-3 rsp-h-3 rsp-text-[#53bdeb]", viewBox: "0 0 16 15", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M15.01 3.316l-.478-.372a.365.365 0 0 0-.51.063L8.666 9.879a.32.32 0 0 1-.484.033l-.358-.325a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l1.32 1.266c.143.14.361.125.484-.033l6.272-8.048a.366.366 0 0 0-.064-.512zm-4.1 0l-.478-.372a.365.365 0 0 0-.51.063L4.566 9.879a.32.32 0 0 1-.484.033L1.891 7.769a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l3.61 3.463c.143.14.361.125.484-.033l6.272-8.048a.365.365 0 0 0-.064-.512z" }) })
4817
4835
  ] }) })
4818
4836
  ] }) }),
4819
- a.type === "CAROUSEL" && (((v = (M = a.carousel) == null ? void 0 : M.cards) == null ? void 0 : v.length) || 0) > 0 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ e("div", { className: "rsp-w-[220px] rsp-animate-slide-up", children: /* @__PURE__ */ e("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-border rsp-border-gray-100 rsp-relative rsp-min-h-[280px] rsp-flex rsp-flex-col", children: /* @__PURE__ */ r("div", { className: "rsp-relative rsp-flex-1 rsp-flex rsp-flex-col", children: [
4837
+ a.type === "CAROUSEL" && (((N = (k = a.carousel) == null ? void 0 : k.cards) == null ? void 0 : N.length) || 0) > 0 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ e("div", { className: "rsp-w-[220px] rsp-animate-slide-up", children: /* @__PURE__ */ e("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-border rsp-border-gray-100 rsp-relative rsp-min-h-[280px] rsp-flex rsp-flex-col", children: /* @__PURE__ */ r("div", { className: "rsp-relative rsp-flex-1 rsp-flex rsp-flex-col", children: [
4820
4838
  (() => {
4821
- var b, t;
4822
- const x = a.carousel && a.carousel.cards.length > 0 ? a.carousel.cards[l] || a.carousel.cards[0] : void 0;
4839
+ var u, t;
4840
+ const o = a.carousel && a.carousel.cards.length > 0 ? a.carousel.cards[l] || a.carousel.cards[0] : void 0;
4823
4841
  return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-h-full", children: [
4824
- /* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children: x && x.mediaUrl ? /* @__PURE__ */ r(ae, { children: [
4825
- ((b = a.carousel) == null ? void 0 : b.type) === "IMAGE" ? /* @__PURE__ */ e(
4842
+ /* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children: o && o.mediaUrl ? /* @__PURE__ */ r(ne, { children: [
4843
+ ((u = a.carousel) == null ? void 0 : u.type) === "IMAGE" ? /* @__PURE__ */ e(
4826
4844
  "img",
4827
4845
  {
4828
- src: x.mediaUrl,
4846
+ src: o.mediaUrl,
4829
4847
  alt: "Carousel card",
4830
4848
  className: "rsp-w-full rsp-h-full rsp-object-cover",
4831
- onError: (u) => {
4832
- u.currentTarget.style.display = "none";
4849
+ onError: (h) => {
4850
+ h.currentTarget.style.display = "none";
4833
4851
  }
4834
4852
  }
4835
4853
  ) : /* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-full rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center", children: /* @__PURE__ */ e("div", { className: "rsp-w-10 rsp-h-10 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg", children: /* @__PURE__ */ e("div", { className: "rsp-w-0 rsp-h-0 rsp-border-l-[6px] rsp-border-l-white rsp-border-t-[5px] rsp-border-t-transparent rsp-border-b-[5px] rsp-border-b-transparent rsp-ml-1" }) }) }),
4836
- a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(ae, { children: [
4854
+ a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(ne, { children: [
4837
4855
  /* @__PURE__ */ e(
4838
4856
  "button",
4839
4857
  {
4840
4858
  onClick: () => d(
4841
- (u) => u > 0 ? u - 1 : a.carousel.cards.length - 1
4859
+ (h) => h > 0 ? h - 1 : a.carousel.cards.length - 1
4842
4860
  ),
4843
4861
  className: "rsp-absolute rsp-left-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",
4844
4862
  children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
@@ -4848,7 +4866,7 @@ function da({ template: a }) {
4848
4866
  "button",
4849
4867
  {
4850
4868
  onClick: () => d(
4851
- (u) => u < a.carousel.cards.length - 1 ? u + 1 : 0
4869
+ (h) => h < a.carousel.cards.length - 1 ? h + 1 : 0
4852
4870
  ),
4853
4871
  className: "rsp-absolute rsp-right-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",
4854
4872
  children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
@@ -4864,33 +4882,33 @@ function da({ template: a }) {
4864
4882
  /* @__PURE__ */ e("svg", { className: "rsp-w-12 rsp-h-12 rsp-mx-auto rsp-text-gray-400 rsp-mb-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((t = a.carousel) == null ? void 0 : t.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
4865
4883
  /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: "No media" })
4866
4884
  ] }) }) }),
4867
- /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start", children: /* @__PURE__ */ e("p", { className: "rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: x ? w(x) : "Card body text..." }) }),
4868
- /* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children: x && x.buttons.length > 0 ? /* @__PURE__ */ e(ae, { children: x.buttons.map((u, k) => /* @__PURE__ */ e(
4885
+ /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start", children: /* @__PURE__ */ e("p", { className: "rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: o ? g(o) : "Card body text..." }) }),
4886
+ /* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children: o && o.buttons.length > 0 ? /* @__PURE__ */ e(ne, { children: o.buttons.map((h, v) => /* @__PURE__ */ e(
4869
4887
  "div",
4870
4888
  {
4871
- className: `rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${k < x.buttons.length - 1 ? "rsp-border-b rsp-border-gray-100" : ""}`,
4889
+ className: `rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${v < o.buttons.length - 1 ? "rsp-border-b rsp-border-gray-100" : ""}`,
4872
4890
  style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
4873
4891
  children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-2", children: [
4874
- u.type === "URL" && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }),
4875
- (u.type === "CALL" || u.type === "PHONE_NUMBER") && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }),
4876
- /* @__PURE__ */ e("span", { className: "rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center", children: u.text })
4892
+ h.type === "URL" && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }),
4893
+ (h.type === "CALL" || h.type === "PHONE_NUMBER") && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }),
4894
+ /* @__PURE__ */ e("span", { className: "rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center", children: h.text })
4877
4895
  ] })
4878
4896
  },
4879
- u.id
4897
+ h.id
4880
4898
  )) }) : /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-text-center rsp-text-xs rsp-text-gray-400", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: "No buttons" }) })
4881
4899
  ] });
4882
4900
  })(),
4883
- a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100", children: a.carousel && a.carousel.cards.map((x, b) => /* @__PURE__ */ e(
4901
+ a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100", children: a.carousel && a.carousel.cards.map((o, u) => /* @__PURE__ */ e(
4884
4902
  "button",
4885
4903
  {
4886
- onClick: () => d(b),
4887
- className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${b === l ? "rsp-bg-[#128C7E] rsp-w-6" : "rsp-bg-gray-300 hover:rsp-bg-gray-400"}`
4904
+ onClick: () => d(u),
4905
+ className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${u === l ? "rsp-bg-[#128C7E] rsp-w-6" : "rsp-bg-gray-300 hover:rsp-bg-gray-400"}`
4888
4906
  },
4889
- b
4907
+ u
4890
4908
  )) })
4891
4909
  ] }) }) }) }),
4892
4910
  a.buttons.length > 0 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start", children: /* @__PURE__ */ e("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-max-w-[220px] rsp-w-full rsp-border rsp-border-gray-100 rsp-animate-slide-up", children: /* @__PURE__ */ e(
4893
- ca,
4911
+ pa,
4894
4912
  {
4895
4913
  buttons: a.buttons,
4896
4914
  onShowAllOptions: () => i(!0)
@@ -4913,14 +4931,14 @@ function da({ template: a }) {
4913
4931
  className: "rsp-w-full rsp-bg-[#F0F2F5] rsp-rounded-t-2xl rsp-shadow-lg rsp-animate-slide-up",
4914
4932
  children: [
4915
4933
  /* @__PURE__ */ e("div", { className: "rsp-p-4 rsp-border-b rsp-border-gray-300", children: /* @__PURE__ */ e("h4", { className: "rsp-font-bold rsp-text-center rsp-text-gray-800 rsp-text-md", children: a.body || "Options" }) }),
4916
- /* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((x, b) => /* @__PURE__ */ e(
4934
+ /* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((o, u) => /* @__PURE__ */ e(
4917
4935
  "div",
4918
4936
  {
4919
- className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${b < a.buttons.length - 1 ? "rsp-border-b rsp-border-gray-300" : ""}`,
4937
+ className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${u < a.buttons.length - 1 ? "rsp-border-b rsp-border-gray-300" : ""}`,
4920
4938
  style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
4921
- children: x.text
4939
+ children: o.text
4922
4940
  },
4923
- x.id
4941
+ o.id
4924
4942
  )) }),
4925
4943
  /* @__PURE__ */ e(
4926
4944
  "div",
@@ -4939,7 +4957,7 @@ function da({ template: a }) {
4939
4957
  ] }) }) })
4940
4958
  ] });
4941
4959
  }
4942
- const ye = {
4960
+ const ke = {
4943
4961
  name: "",
4944
4962
  category: "MARKETING",
4945
4963
  type: "BASIC",
@@ -4951,76 +4969,76 @@ const ye = {
4951
4969
  footer: "",
4952
4970
  buttons: []
4953
4971
  };
4954
- function ua({ onCancel: a }) {
4955
- var E, U, B;
4956
- const i = (typeof ue == "function" ? ue() : !1) ? ve() : void 0, [l, d] = I(ye), [f, m] = I(!0), [N, w] = I(!1), [h, g] = I(null), [S, V] = I({
4972
+ function ya({ onCancel: a }) {
4973
+ var V, R, I;
4974
+ const i = (typeof ye == "function" ? ye() : !1) ? Ce() : void 0, [l, d] = B(ke), [p, m] = B(!0), [C, g] = B(!1), [f, y] = B(null), [j, U] = B({
4957
4975
  isOpen: !1
4958
- }), [M, v] = I({
4976
+ }), [k, N] = B({
4959
4977
  isOpen: !1
4960
- }), x = () => {
4978
+ }), o = () => {
4961
4979
  if (!l.name || !l.body) return !1;
4962
- const s = b(l.body), c = b(l.headerText), o = t(), y = c.every(
4963
- (R) => {
4964
- var p, L, A;
4965
- return !!((A = (L = (p = l.sampleContent) == null ? void 0 : p.headerVariables) == null ? void 0 : L[R]) != null && A.trim());
4980
+ const x = u(l.body), w = u(l.headerText), L = t(), s = w.every(
4981
+ (T) => {
4982
+ var c, M, A;
4983
+ return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.headerVariables) == null ? void 0 : M[T]) != null && A.trim());
4966
4984
  }
4967
- ), C = s.every(
4968
- (R) => {
4969
- var p, L, A;
4970
- return !!((A = (L = (p = l.sampleContent) == null ? void 0 : p.bodyVariables) == null ? void 0 : L[R]) != null && A.trim());
4985
+ ), b = x.every(
4986
+ (T) => {
4987
+ var c, M, A;
4988
+ return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.bodyVariables) == null ? void 0 : M[T]) != null && A.trim());
4971
4989
  }
4972
- ), j = o.every(
4973
- (R) => {
4974
- var p, L, A;
4975
- return !!((A = (L = (p = l.sampleContent) == null ? void 0 : p.buttonVariables) == null ? void 0 : L[R]) != null && A.trim());
4990
+ ), E = L.every(
4991
+ (T) => {
4992
+ var c, M, A;
4993
+ return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.buttonVariables) == null ? void 0 : M[T]) != null && A.trim());
4976
4994
  }
4977
4995
  );
4978
- return y && C && j;
4979
- }, b = (s) => {
4980
- if (!s) return [];
4981
- const c = s.match(/\{\{(\d+)\}\}/g) || [];
4982
- return [...new Set(c.map((o) => o.replace(/[{}]/g, "")))];
4996
+ return s && b && E;
4997
+ }, u = (x) => {
4998
+ if (!x) return [];
4999
+ const w = x.match(/\{\{(\d+)\}\}/g) || [];
5000
+ return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
4983
5001
  }, t = () => {
4984
- const s = l.buttons.find(
4985
- (o) => o.type === "URL" && o.urlType === "dynamic"
5002
+ const x = l.buttons.find(
5003
+ (L) => L.type === "URL" && L.urlType === "dynamic"
4986
5004
  );
4987
- if (!(s != null && s.value)) return [];
4988
- const c = s.value.match(/\{\{(\d+)\}\}/g) || [];
4989
- return [...new Set(c.map((o) => o.replace(/[{}]/g, "")))];
5005
+ if (!(x != null && x.value)) return [];
5006
+ const w = x.value.match(/\{\{(\d+)\}\}/g) || [];
5007
+ return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
4990
5008
  };
4991
- ee(() => {
4992
- if (h) {
4993
- const s = setTimeout(() => {
4994
- g(null);
5009
+ se(() => {
5010
+ if (f) {
5011
+ const x = setTimeout(() => {
5012
+ y(null);
4995
5013
  }, 5e3);
4996
- return () => clearTimeout(s);
5014
+ return () => clearTimeout(x);
4997
5015
  }
4998
- }, [h]);
4999
- const u = async () => {
5000
- var s, c, o;
5016
+ }, [f]);
5017
+ const h = async () => {
5018
+ var x, w, L;
5001
5019
  try {
5002
- if (w(!0), g(null), !l.name || !l.body)
5020
+ if (g(!0), y(null), !l.name || !l.body)
5003
5021
  throw new Error("Template name and body are required");
5004
- const y = localStorage.getItem("account"), C = y ? JSON.parse(y) : { apiKey: "" };
5005
- if (!C.apiKey)
5022
+ const s = localStorage.getItem("account"), b = s ? JSON.parse(s) : { apiKey: "" };
5023
+ if (!b.apiKey)
5006
5024
  throw new Error("Please set your API key in the dashboard first");
5007
- const j = await $e(C, l);
5008
- if (j.status === "error")
5009
- throw new Error(j.message);
5010
- V({
5025
+ const E = await Ke(b, l);
5026
+ if (E.status === "error")
5027
+ throw new Error(E.message);
5028
+ U({
5011
5029
  isOpen: !0,
5012
- templateName: (s = j.data) == null ? void 0 : s.details[0].template_name,
5013
- templateId: (c = j.data) == null ? void 0 : c.details[0].template_id,
5030
+ templateName: (x = E.data) == null ? void 0 : x.details[0].template_name,
5031
+ templateId: (w = E.data) == null ? void 0 : w.details[0].template_id,
5014
5032
  // @ts-ignore
5015
- template: (o = j.data) == null ? void 0 : o.template
5016
- }), d(ye);
5017
- } catch (y) {
5018
- g(y instanceof Error ? y.message : "An error occurred while creating the template");
5033
+ template: (L = E.data) == null ? void 0 : L.template
5034
+ }), d(ke);
5035
+ } catch (s) {
5036
+ y(s instanceof Error ? s.message : "An error occurred while creating the template");
5019
5037
  } finally {
5020
- w(!1);
5038
+ g(!1);
5021
5039
  }
5022
- }, k = () => {
5023
- V({ isOpen: !1 }), a ? a() : i ? i("/") : window.history.length > 1 && window.history.back();
5040
+ }, v = () => {
5041
+ U({ isOpen: !1 }), a ? a() : i ? i("/") : window.history.length > 1 && window.history.back();
5024
5042
  };
5025
5043
  return /* @__PURE__ */ r("div", { className: "rsp-min-h-screen rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm", children: [
5026
5044
  /* @__PURE__ */ r("div", { className: "rsp-max-w-[1200px] rsp-mx-auto rsp-px-6 rsp-h-full", children: [
@@ -5040,22 +5058,22 @@ function ua({ onCancel: a }) {
5040
5058
  /* @__PURE__ */ r(
5041
5059
  "button",
5042
5060
  {
5043
- onClick: () => m(!f),
5061
+ onClick: () => m(!p),
5044
5062
  className: `rsp-flex rsp-items-center rsp-gap-2 rsp-px-4 rsp-py-2 rsp-rounded-md rsp-text-sm rsp-font-medium rsp-transition-colors
5045
- ${f ? "rsp-bg-blue-100 rsp-text-blue-700 rsp-border rsp-border-blue-200" : "rsp-bg-gray-100 rsp-text-gray-700 rsp-border rsp-border-gray-200"}`,
5063
+ ${p ? "rsp-bg-blue-100 rsp-text-blue-700 rsp-border rsp-border-blue-200" : "rsp-bg-gray-100 rsp-text-gray-700 rsp-border rsp-border-gray-200"}`,
5046
5064
  children: [
5047
5065
  /* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
5048
5066
  /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
5049
5067
  /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" })
5050
5068
  ] }),
5051
- f ? "Hide Preview" : "Show Preview"
5069
+ p ? "Hide Preview" : "Show Preview"
5052
5070
  ]
5053
5071
  }
5054
5072
  )
5055
5073
  ] })
5056
5074
  ] }) }),
5057
- /* @__PURE__ */ r("div", { className: `rsp-py-8 ${f ? "rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8" : ""}`, children: [
5058
- /* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${f ? "" : "rsp-max-w-4xl rsp-mx-auto"}`, children: [
5075
+ /* @__PURE__ */ r("div", { className: `rsp-py-8 ${p ? "rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8" : ""}`, children: [
5076
+ /* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${p ? "" : "rsp-max-w-4xl rsp-mx-auto"}`, children: [
5059
5077
  /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-space-y-6", children: [
5060
5078
  /* @__PURE__ */ r("div", { children: [
5061
5079
  /* @__PURE__ */ r("label", { className: "rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2", children: [
@@ -5068,7 +5086,7 @@ function ua({ onCancel: a }) {
5068
5086
  {
5069
5087
  type: "text",
5070
5088
  value: l.name,
5071
- onChange: (s) => d({ ...l, name: s.target.value.replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "").replace(/_+/g, "_") }),
5089
+ onChange: (x) => d({ ...l, name: x.target.value.replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "").replace(/_+/g, "_") }),
5072
5090
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
5073
5091
  placeholder: "Template name cannot Have capital letters and space"
5074
5092
  }
@@ -5085,7 +5103,7 @@ function ua({ onCancel: a }) {
5085
5103
  "select",
5086
5104
  {
5087
5105
  value: l.category,
5088
- onChange: (s) => d({ ...l, category: s.target.value }),
5106
+ onChange: (x) => d({ ...l, category: x.target.value }),
5089
5107
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
5090
5108
  children: [
5091
5109
  /* @__PURE__ */ e("option", { value: "MARKETING", children: "Marketing" }),
@@ -5105,9 +5123,9 @@ function ua({ onCancel: a }) {
5105
5123
  "select",
5106
5124
  {
5107
5125
  value: l.language,
5108
- onChange: (s) => d({ ...l, language: s.target.value }),
5126
+ onChange: (x) => d({ ...l, language: x.target.value }),
5109
5127
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
5110
- children: Ge.map((s) => /* @__PURE__ */ e("option", { value: s.value, children: s.label }, s.value))
5128
+ children: Qe.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
5111
5129
  }
5112
5130
  ),
5113
5131
  /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }),
@@ -5123,11 +5141,11 @@ function ua({ onCancel: a }) {
5123
5141
  "select",
5124
5142
  {
5125
5143
  value: l.type,
5126
- onChange: (s) => {
5127
- const c = s.target.value;
5128
- c === "CAROUSEL" && !l.carousel ? d({
5144
+ onChange: (x) => {
5145
+ const w = x.target.value;
5146
+ w === "CAROUSEL" && !l.carousel ? d({
5129
5147
  ...l,
5130
- type: c,
5148
+ type: w,
5131
5149
  carousel: {
5132
5150
  type: "IMAGE",
5133
5151
  cards: [{
@@ -5139,7 +5157,7 @@ function ua({ onCancel: a }) {
5139
5157
  buttons: []
5140
5158
  }]
5141
5159
  }
5142
- }) : d({ ...l, type: c });
5160
+ }) : d({ ...l, type: w });
5143
5161
  },
5144
5162
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
5145
5163
  children: [
@@ -5159,7 +5177,7 @@ function ua({ onCancel: a }) {
5159
5177
  "select",
5160
5178
  {
5161
5179
  value: l.enableClickTracking.toString(),
5162
- onChange: (s) => d({ ...l, enableClickTracking: s.target.value === "true" }),
5180
+ onChange: (x) => d({ ...l, enableClickTracking: x.target.value === "true" }),
5163
5181
  className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
5164
5182
  children: [
5165
5183
  /* @__PURE__ */ e("option", { value: "false", children: "False" }),
@@ -5172,70 +5190,70 @@ function ua({ onCancel: a }) {
5172
5190
  ] })
5173
5191
  ] })
5174
5192
  ] }),
5175
- /* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(ta, { template: l, setTemplate: d }) }),
5193
+ /* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(da, { template: l, setTemplate: d }) }),
5176
5194
  /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-pt-6 rsp-border-t rsp-border-gray-200", children: [
5177
- h && /* @__PURE__ */ r("div", { className: "rsp-mb-4 rsp-flex rsp-items-start rsp-gap-3 rsp-p-4 rsp-rounded-lg rsp-bg-red-50 rsp-border-l-4 rsp-border-l-red-500 rsp-relative rsp-animate-fade-in", children: [
5178
- /* @__PURE__ */ e(ie, { className: "rsp-w-5 rsp-h-5 rsp-text-red-500 rsp-flex-shrink-0 rsp-mt-0.5" }),
5195
+ f && /* @__PURE__ */ r("div", { className: "rsp-mb-4 rsp-flex rsp-items-start rsp-gap-3 rsp-p-4 rsp-rounded-lg rsp-bg-red-50 rsp-border-l-4 rsp-border-l-red-500 rsp-relative rsp-animate-fade-in", children: [
5196
+ /* @__PURE__ */ e(ce, { className: "rsp-w-5 rsp-h-5 rsp-text-red-500 rsp-flex-shrink-0 rsp-mt-0.5" }),
5179
5197
  /* @__PURE__ */ r("div", { children: [
5180
5198
  /* @__PURE__ */ e("h3", { className: "rsp-text-sm rsp-font-medium rsp-text-red-800", children: "Error" }),
5181
- /* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children: h })
5199
+ /* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children: f })
5182
5200
  ] }),
5183
5201
  /* @__PURE__ */ e(
5184
5202
  "button",
5185
5203
  {
5186
- onClick: () => g(null),
5204
+ onClick: () => y(null),
5187
5205
  className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-1 hover:rsp-bg-red-100 rsp-rounded-full",
5188
- children: /* @__PURE__ */ e(J, { className: "rsp-w-4 rsp-h-4 rsp-text-red-500" })
5206
+ children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4 rsp-text-red-500" })
5189
5207
  }
5190
5208
  )
5191
5209
  ] }),
5192
5210
  /* @__PURE__ */ e("div", { className: "rsp-flex rsp-gap-4", children: /* @__PURE__ */ e(
5193
5211
  "button",
5194
5212
  {
5195
- onClick: u,
5196
- disabled: N || !x(),
5213
+ onClick: h,
5214
+ disabled: C || !o(),
5197
5215
  className: `rsp-flex-1 rsp-py-3 rsp-px-6 rsp-rounded-md rsp-transition-colors rsp-text-white rsp-font-medium rsp-text-sm
5198
- ${N || !x() ? "rsp-bg-blue-600 rsp-cursor-not-allowed" : "rsp-bg-blue-600 hover:rsp-bg-blue-700 active:rsp-bg-blue-800"}`,
5199
- children: N ? "Submitting for Approval..." : "Submit for Approval"
5216
+ ${C || !o() ? "rsp-bg-blue-600 rsp-cursor-not-allowed" : "rsp-bg-blue-600 hover:rsp-bg-blue-700 active:rsp-bg-blue-800"}`,
5217
+ children: C ? "Submitting for Approval..." : "Submit for Approval"
5200
5218
  }
5201
5219
  ) })
5202
5220
  ] })
5203
5221
  ] }),
5204
- f && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "rsp-sticky rsp-top-4", children: /* @__PURE__ */ e(da, { template: l }) }) })
5222
+ p && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "rsp-sticky rsp-top-4", children: /* @__PURE__ */ e(oa, { template: l }) }) })
5205
5223
  ] })
5206
5224
  ] }),
5207
5225
  /* @__PURE__ */ e(
5208
- ce,
5226
+ pe,
5209
5227
  {
5210
- isOpen: S.isOpen,
5211
- onClose: k,
5228
+ isOpen: j.isOpen,
5229
+ onClose: v,
5212
5230
  title: "Success",
5213
5231
  children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
5214
5232
  /* @__PURE__ */ e("div", { className: "rsp-text-center", children: /* @__PURE__ */ e("p", { className: "rsp-text-green-600 rsp-font-medium rsp-mb-4", children: "Template created successfully!" }) }),
5215
- S.templateId && /* @__PURE__ */ r("div", { className: "rsp-bg-gray-50 rsp-p-4 rsp-rounded-lg rsp-space-y-2", children: [
5233
+ j.templateId && /* @__PURE__ */ r("div", { className: "rsp-bg-gray-50 rsp-p-4 rsp-rounded-lg rsp-space-y-2", children: [
5216
5234
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5217
5235
  /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template Name:" }),
5218
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children: S.templateName })
5236
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children: j.templateName })
5219
5237
  ] }),
5220
5238
  /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5221
5239
  /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template ID:" }),
5222
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: S.templateId })
5240
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: j.templateId })
5223
5241
  ] }),
5224
- ((E = S.template) == null ? void 0 : E.meta_tid) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5242
+ ((V = j.template) == null ? void 0 : V.meta_tid) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5225
5243
  /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Meta TID:" }),
5226
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: S.template.meta_tid })
5244
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: j.template.meta_tid })
5227
5245
  ] }),
5228
- ((U = S.template) == null ? void 0 : U.status) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5246
+ ((R = j.template) == null ? void 0 : R.status) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5229
5247
  /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Status:" }),
5230
5248
  /* @__PURE__ */ e("span", { className: `rsp-text-sm rsp-font-medium rsp-capitalize ${// @ts-ignore
5231
- S.template.status === "pending" ? "rsp-text-yellow-600" : (
5249
+ j.template.status === "pending" ? "rsp-text-yellow-600" : (
5232
5250
  // @ts-ignore
5233
- S.template.status === "approved" ? "rsp-text-green-600" : "rsp-text-red-600"
5234
- )}`, children: S.template.status })
5251
+ j.template.status === "approved" ? "rsp-text-green-600" : "rsp-text-red-600"
5252
+ )}`, children: j.template.status })
5235
5253
  ] }),
5236
- ((B = S.template) == null ? void 0 : B.quality) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5254
+ ((I = j.template) == null ? void 0 : I.quality) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
5237
5255
  /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Quality:" }),
5238
- /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children: S.template.quality })
5256
+ /* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children: j.template.quality })
5239
5257
  ] })
5240
5258
  ] })
5241
5259
  ] })
@@ -5243,18 +5261,18 @@ function ua({ onCancel: a }) {
5243
5261
  )
5244
5262
  ] });
5245
5263
  }
5246
- const xa = Ee({});
5247
- function ba({ apiKey: a, children: n }) {
5248
- const i = we(() => ({ apiKey: a }), [a]);
5264
+ const fa = Se({});
5265
+ function wa({ apiKey: a, children: n }) {
5266
+ const i = Ne(() => ({ apiKey: a }), [a]);
5249
5267
  if (a)
5250
5268
  try {
5251
5269
  localStorage.setItem("account", JSON.stringify({ apiKey: a }));
5252
5270
  } catch {
5253
5271
  }
5254
- return /* @__PURE__ */ e(xa.Provider, { value: i, children: n });
5272
+ return /* @__PURE__ */ e(fa.Provider, { value: i, children: n });
5255
5273
  }
5256
5274
  export {
5257
- ua as CreateTemplate,
5258
- ha as Dashboard,
5259
- ba as TrustSignalProvider
5275
+ ya as CreateTemplate,
5276
+ ga as Dashboard,
5277
+ wa as TrustSignalProvider
5260
5278
  };